comparison Framework/Scene2D/TextureBaseSceneLayer.h @ 590:5430bcffba57

FloatTextureSceneLayer
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 26 Apr 2019 11:33:57 +0200
parents
children 2d8ab34c8c91
comparison
equal deleted inserted replaced
589:3080ec4ec6b9 590:5430bcffba57
1 /**
2 * Stone of Orthanc
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
4 * Department, University Hospital of Liege, Belgium
5 * Copyright (C) 2017-2019 Osimis S.A., Belgium
6 *
7 * This program is free software: you can redistribute it and/or
8 * modify it under the terms of the GNU Affero General Public License
9 * as published by the Free Software Foundation, either version 3 of
10 * the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Affero General Public License for more details.
16 *
17 * You should have received a copy of the GNU Affero General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 **/
20
21
22 #pragma once
23
24 #include "ISceneLayer.h"
25 #include "../Toolbox/AffineTransform2D.h"
26
27 #include <Core/Images/ImageAccessor.h>
28
29 namespace OrthancStone
30 {
31 class TextureBaseSceneLayer : public ISceneLayer
32 {
33 private:
34 std::auto_ptr<Orthanc::ImageAccessor> texture_;
35 double originX_;
36 double originY_;
37 double pixelSpacingX_;
38 double pixelSpacingY_;
39 double angle_;
40 bool isLinearInterpolation_;
41 uint64_t revision_;
42
43 protected:
44 void SetTexture(Orthanc::ImageAccessor* texture);
45
46 void IncrementRevision()
47 {
48 revision_++;
49 }
50
51 void CopyParameters(const TextureBaseSceneLayer& other);
52
53 public:
54 TextureBaseSceneLayer();
55
56 // Center of the top-left pixel
57 void SetOrigin(double x,
58 double y);
59
60 void SetPixelSpacing(double sx,
61 double sy);
62
63 // In radians
64 void SetAngle(double angle);
65
66 void SetLinearInterpolation(bool isLinearInterpolation);
67
68 double GetOriginX() const
69 {
70 return originX_;
71 }
72
73 double GetOriginY() const
74 {
75 return originY_;
76 }
77
78 double GetPixelSpacingX() const
79 {
80 return pixelSpacingX_;
81 }
82
83 double GetPixelSpacingY() const
84 {
85 return pixelSpacingY_;
86 }
87
88 double GetAngle() const
89 {
90 return angle_;
91 }
92
93 bool IsLinearInterpolation() const
94 {
95 return isLinearInterpolation_;
96 }
97
98 bool HasTexture() const
99 {
100 return (texture_.get() != NULL);
101 }
102
103 const Orthanc::ImageAccessor& GetTexture() const;
104
105 AffineTransform2D GetTransform() const;
106
107 virtual bool GetBoundingBox(Extent2D& target) const;
108
109 virtual uint64_t GetRevision() const
110 {
111 return revision_;
112 }
113 };
114 }