Mercurial > hg > orthanc-stone
diff 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 |
line wrap: on
line diff
--- a/OrthancStone/Sources/Scene2D/TextureBaseSceneLayer.cpp Tue May 11 11:42:08 2021 +0200 +++ b/OrthancStone/Sources/Scene2D/TextureBaseSceneLayer.cpp Tue May 11 17:18:39 2021 +0200 @@ -51,6 +51,11 @@ isLinearInterpolation_ = other.isLinearInterpolation_; flipX_ = other.flipX_; flipY_ = other.flipY_; + + if (other.transform_.get() != NULL) + { + transform_.reset(new AffineTransform2D(*other.transform_)); + } } @@ -141,23 +146,44 @@ } + void TextureBaseSceneLayer::SetTransform(const AffineTransform2D& transform) + { + transform_.reset(new AffineTransform2D(transform)); + IncrementRevision(); + } + + + void TextureBaseSceneLayer::ClearTransform() + { + transform_.reset(NULL); + IncrementRevision(); + } + + AffineTransform2D TextureBaseSceneLayer::GetTransform() const { - unsigned int width = 0; - unsigned int height = 0; + if (transform_.get() == NULL) + { + unsigned int width = 0; + unsigned int height = 0; - if (texture_.get() != NULL) - { - width = texture_->GetWidth(); - height = texture_->GetHeight(); + if (texture_.get() != NULL) + { + width = texture_->GetWidth(); + height = texture_->GetHeight(); + } + + return AffineTransform2D::Combine( + AffineTransform2D::CreateOffset(originX_, originY_), + AffineTransform2D::CreateRotation(angle_), + AffineTransform2D::CreateScaling(pixelSpacingX_, pixelSpacingY_), + AffineTransform2D::CreateOffset(-0.5, -0.5), + AffineTransform2D::CreateFlip(flipX_, flipY_, width, height)); } - - return AffineTransform2D::Combine( - AffineTransform2D::CreateOffset(originX_, originY_), - AffineTransform2D::CreateRotation(angle_), - AffineTransform2D::CreateScaling(pixelSpacingX_, pixelSpacingY_), - AffineTransform2D::CreateOffset(-0.5, -0.5), - AffineTransform2D::CreateFlip(flipX_, flipY_, width, height)); + else + { + return *transform_; + } }