comparison OrthancStone/Sources/Scene2D/TextureBaseSceneLayer.cpp @ 1768:226718777702

fix DicomVolumeImageMPRSlicer::Slice::CreateSceneLayer() for opposite normals
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 11 May 2021 17:18:39 +0200
parents 9ac2a65d4172
children a217140dd41a
comparison
equal deleted inserted replaced
1767:e7b4479dea6f 1768:226718777702
49 pixelSpacingY_ = other.pixelSpacingY_; 49 pixelSpacingY_ = other.pixelSpacingY_;
50 angle_ = other.angle_; 50 angle_ = other.angle_;
51 isLinearInterpolation_ = other.isLinearInterpolation_; 51 isLinearInterpolation_ = other.isLinearInterpolation_;
52 flipX_ = other.flipX_; 52 flipX_ = other.flipX_;
53 flipY_ = other.flipY_; 53 flipY_ = other.flipY_;
54
55 if (other.transform_.get() != NULL)
56 {
57 transform_.reset(new AffineTransform2D(*other.transform_));
58 }
54 } 59 }
55 60
56 61
57 TextureBaseSceneLayer::TextureBaseSceneLayer() : 62 TextureBaseSceneLayer::TextureBaseSceneLayer() :
58 originX_(0), 63 originX_(0),
139 return *texture_; 144 return *texture_;
140 } 145 }
141 } 146 }
142 147
143 148
149 void TextureBaseSceneLayer::SetTransform(const AffineTransform2D& transform)
150 {
151 transform_.reset(new AffineTransform2D(transform));
152 IncrementRevision();
153 }
154
155
156 void TextureBaseSceneLayer::ClearTransform()
157 {
158 transform_.reset(NULL);
159 IncrementRevision();
160 }
161
162
144 AffineTransform2D TextureBaseSceneLayer::GetTransform() const 163 AffineTransform2D TextureBaseSceneLayer::GetTransform() const
145 { 164 {
146 unsigned int width = 0; 165 if (transform_.get() == NULL)
147 unsigned int height = 0; 166 {
148 167 unsigned int width = 0;
149 if (texture_.get() != NULL) 168 unsigned int height = 0;
150 { 169
151 width = texture_->GetWidth(); 170 if (texture_.get() != NULL)
152 height = texture_->GetHeight(); 171 {
153 } 172 width = texture_->GetWidth();
154 173 height = texture_->GetHeight();
155 return AffineTransform2D::Combine( 174 }
156 AffineTransform2D::CreateOffset(originX_, originY_), 175
157 AffineTransform2D::CreateRotation(angle_), 176 return AffineTransform2D::Combine(
158 AffineTransform2D::CreateScaling(pixelSpacingX_, pixelSpacingY_), 177 AffineTransform2D::CreateOffset(originX_, originY_),
159 AffineTransform2D::CreateOffset(-0.5, -0.5), 178 AffineTransform2D::CreateRotation(angle_),
160 AffineTransform2D::CreateFlip(flipX_, flipY_, width, height)); 179 AffineTransform2D::CreateScaling(pixelSpacingX_, pixelSpacingY_),
180 AffineTransform2D::CreateOffset(-0.5, -0.5),
181 AffineTransform2D::CreateFlip(flipX_, flipY_, width, height));
182 }
183 else
184 {
185 return *transform_;
186 }
161 } 187 }
162 188
163 189
164 void TextureBaseSceneLayer::GetBoundingBox(Extent2D& target) const 190 void TextureBaseSceneLayer::GetBoundingBox(Extent2D& target) const
165 { 191 {