Mercurial > hg > orthanc-stone
diff OrthancStone/Sources/Scene2D/TextureBaseSceneLayer.cpp @ 1787:6e8105942146
safeguard in TextureBaseSceneLayer
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Sat, 15 May 2021 11:47:55 +0200 |
parents | fca942f4b4a7 |
children | 3889ae96d2e9 |
line wrap: on
line diff
--- a/OrthancStone/Sources/Scene2D/TextureBaseSceneLayer.cpp Sat May 15 11:41:58 2021 +0200 +++ b/OrthancStone/Sources/Scene2D/TextureBaseSceneLayer.cpp Sat May 15 11:47:55 2021 +0200 @@ -27,6 +27,16 @@ namespace OrthancStone { + void TextureBaseSceneLayer::CheckNoManualTransform() const + { + if (transform_.get() != NULL) + { + throw Orthanc::OrthancException(Orthanc::ErrorCode_BadSequenceOfCalls, + "A transform has been manually set, first call ClearTransform()"); + } + } + + void TextureBaseSceneLayer::SetTexture(Orthanc::ImageAccessor* texture) { if (texture == NULL) @@ -81,6 +91,8 @@ void TextureBaseSceneLayer::SetOrigin(double x, double y) { + CheckNoManualTransform(); + originX_ = x; originY_ = y; IncrementRevision(); @@ -90,6 +102,8 @@ void TextureBaseSceneLayer::SetPixelSpacing(double sx, double sy) { + CheckNoManualTransform(); + if (sx <= 0 || sy <= 0) { @@ -106,6 +120,8 @@ void TextureBaseSceneLayer::SetAngle(double angle) { + CheckNoManualTransform(); + angle_ = angle; IncrementRevision(); } @@ -120,6 +136,8 @@ void TextureBaseSceneLayer::SetFlipX(bool flip) { + CheckNoManualTransform(); + flipX_ = flip; IncrementRevision(); } @@ -127,6 +145,8 @@ void TextureBaseSceneLayer::SetFlipY(bool flip) { + CheckNoManualTransform(); + flipY_ = flip; IncrementRevision(); }