diff Framework/Radiography/RadiographyLayer.cpp @ 620:fd9b9d993fc7 am-dev

added flip to RadiographyLayer
author Alain Mazy <alain@mazy.be>
date Tue, 07 May 2019 11:15:57 +0200
parents 77e0eb83ff63
children 8d66efecd91c
line wrap: on
line diff
--- a/Framework/Radiography/RadiographyLayer.cpp	Mon Apr 29 12:01:55 2019 +0200
+++ b/Framework/Radiography/RadiographyLayer.cpp	Tue May 07 11:15:57 2019 +0200
@@ -34,6 +34,8 @@
 
   RadiographyLayer::Geometry::Geometry() :
     hasCrop_(false),
+    verticalFlip_(false),
+    horizontalFlip_(false),
     panX_(0),
     panY_(0),
     angle_(0),
@@ -57,7 +59,7 @@
 
   void RadiographyLayer::UpdateTransform()
   {
-    transform_ = AffineTransform2D::CreateScaling(geometry_.GetPixelSpacingX(), geometry_.GetPixelSpacingY());
+    transform_ = AffineTransform2D::CreateScaling(geometry_.GetScalingX(), geometry_.GetScalingY());
 
     double centerX, centerY;
     GetCenter(centerX, centerY);
@@ -204,6 +206,21 @@
     EmitMessage(RadiographyLayer::LayerEditedMessage(*this));
   }
 
+  void RadiographyLayer::SetVerticalFlip(bool flip)
+  {
+    geometry_.SetVerticalFlip(flip);
+    UpdateTransform();
+
+    EmitMessage(RadiographyLayer::LayerEditedMessage(*this));
+  }
+
+  void RadiographyLayer::SetHorizontalFlip(bool flip)
+  {
+    geometry_.SetHorizontalFlip(flip);
+    UpdateTransform();
+
+    EmitMessage(RadiographyLayer::LayerEditedMessage(*this));
+  }
 
   void RadiographyLayer::SetSize(unsigned int width,
                                  unsigned int height)