annotate OrthancStone/Sources/Scene2D/TextureBaseSceneLayer.h @ 1512:244ad1e4e76a

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