Mercurial > hg > orthanc-stone
annotate Framework/Scene2D/TextureBaseSceneLayer.h @ 1310:9bea7e15b519 broker
- first pass at changes to cope with the refactoring of the loading system
- global loader-related data accessible through ILoadersContext::ILock
- many changes in legacy loaders (CT, RTSTRUCT, DOSE) + loader cache
- NOT FINISHED! there are shared_from_this calls in ctors! this will crash!
author | Benjamin Golinvaux <bgo@osimis.io> |
---|---|
date | Mon, 09 Mar 2020 14:53:22 +0100 |
parents | 8a0a62189f46 |
children | 30deba7bc8e2 |
rev | line source |
---|---|
590 | 1 /** |
2 * Stone of Orthanc | |
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics | |
4 * Department, University Hospital of Liege, Belgium | |
1270
2d8ab34c8c91
upgrade to year 2020
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
590
diff
changeset
|
5 * Copyright (C) 2017-2020 Osimis S.A., Belgium |
590 | 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 | |
1298
8a0a62189f46
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1270
diff
changeset
|
27 #include <Core/Compatibility.h> |
590 | 28 #include <Core/Images/ImageAccessor.h> |
29 | |
30 namespace OrthancStone | |
31 { | |
32 class TextureBaseSceneLayer : public ISceneLayer | |
33 { | |
34 private: | |
1298
8a0a62189f46
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1270
diff
changeset
|
35 std::unique_ptr<Orthanc::ImageAccessor> texture_; |
590 | 36 double originX_; |
37 double originY_; | |
38 double pixelSpacingX_; | |
39 double pixelSpacingY_; | |
40 double angle_; | |
41 bool isLinearInterpolation_; | |
42 uint64_t revision_; | |
43 | |
44 protected: | |
45 void SetTexture(Orthanc::ImageAccessor* texture); | |
46 | |
47 void IncrementRevision() | |
48 { | |
49 revision_++; | |
50 } | |
51 | |
52 void CopyParameters(const TextureBaseSceneLayer& other); | |
53 | |
54 public: | |
55 TextureBaseSceneLayer(); | |
56 | |
57 // Center of the top-left pixel | |
58 void SetOrigin(double x, | |
59 double y); | |
60 | |
61 void SetPixelSpacing(double sx, | |
62 double sy); | |
63 | |
64 // In radians | |
65 void SetAngle(double angle); | |
66 | |
67 void SetLinearInterpolation(bool isLinearInterpolation); | |
68 | |
69 double GetOriginX() const | |
70 { | |
71 return originX_; | |
72 } | |
73 | |
74 double GetOriginY() const | |
75 { | |
76 return originY_; | |
77 } | |
78 | |
79 double GetPixelSpacingX() const | |
80 { | |
81 return pixelSpacingX_; | |
82 } | |
83 | |
84 double GetPixelSpacingY() const | |
85 { | |
86 return pixelSpacingY_; | |
87 } | |
88 | |
89 double GetAngle() const | |
90 { | |
91 return angle_; | |
92 } | |
93 | |
94 bool IsLinearInterpolation() const | |
95 { | |
96 return isLinearInterpolation_; | |
97 } | |
98 | |
99 bool HasTexture() const | |
100 { | |
101 return (texture_.get() != NULL); | |
102 } | |
103 | |
104 const Orthanc::ImageAccessor& GetTexture() const; | |
105 | |
106 AffineTransform2D GetTransform() const; | |
107 | |
108 virtual bool GetBoundingBox(Extent2D& target) const; | |
109 | |
110 virtual uint64_t GetRevision() const | |
111 { | |
112 return revision_; | |
113 } | |
114 }; | |
115 } |