diff Framework/Radiography/RadiographyLayer.h @ 476:a95090305dd4 am-touch-events

Introduced ControlPoint instead of Corner in the trackers and layers + drawing mask from the ControlPoints
author am@osimis.io
date Wed, 13 Feb 2019 12:04:02 +0100
parents 3c28542229a3
children 2f6ecb5037ea
line wrap: on
line diff
--- a/Framework/Radiography/RadiographyLayer.h	Tue Feb 12 12:22:13 2019 +0100
+++ b/Framework/Radiography/RadiographyLayer.h	Wed Feb 13 12:04:02 2019 +0100
@@ -27,6 +27,25 @@
 
 namespace OrthancStone
 {
+  struct ControlPoint
+  {
+    double x;
+    double y;
+    size_t index;
+
+    ControlPoint(double x, double y, size_t index)
+      : x(x),
+        y(y),
+        index(index)
+    {}
+
+    ControlPoint()
+      : x(0),
+        y(0),
+        index(std::numeric_limits<size_t>::max())
+    {}
+  };
+
   class RadiographyLayer : public boost::noncopyable
   {
     friend class RadiographyScene;
@@ -144,39 +163,39 @@
 
 
   protected:
-    const AffineTransform2D& GetTransform() const
+    virtual const AffineTransform2D& GetTransform() const
     {
       return transform_;
     }
 
+    virtual const AffineTransform2D& GetTransformInverse() const
+    {
+      return transformInverse_;
+    }
+
     void SetPreferredPhotomotricDisplayMode(PhotometricDisplayMode  prefferedPhotometricDisplayMode)
     {
       prefferedPhotometricDisplayMode_ = prefferedPhotometricDisplayMode;
     }
 
+    virtual void GetControlPointInternal(ControlPoint& controlPoint,
+                                         size_t index) const;
+
   private:
     void UpdateTransform();
-      
+
     void AddToExtent(Extent2D& extent,
                      double x,
                      double y) const;
 
-    void GetCornerInternal(double& x,
-                           double& y,
-                           Corner corner,
-                           unsigned int cropX,
-                           unsigned int cropY,
-                           unsigned int cropWidth,
-                           unsigned int cropHeight) const;
-
     void SetIndex(size_t index)
     {
       index_ = index;
     }
-      
+
     bool Contains(double x,
                   double y) const;
-      
+
     void DrawBorders(CairoContext& context,
                      double zoom);
 
@@ -232,12 +251,12 @@
     unsigned int GetWidth() const
     {
       return width_;
-    }        
+    }
 
     unsigned int GetHeight() const
     {
       return height_;
-    }       
+    }
 
     Extent2D GetExtent() const;
 
@@ -252,15 +271,16 @@
     void GetCenter(double& centerX,
                    double& centerY) const;
 
-    void GetCorner(double& x /* out */,
-                   double& y /* out */,
-                   Corner corner) const;
-      
-    bool LookupCorner(Corner& corner /* out */,
-                      double x,
-                      double y,
-                      double zoom,
-                      double viewportDistance) const;
+    void GetControlPoint(ControlPoint& controlPoint,
+                         size_t index) const;
+
+    virtual size_t GetControlPointCount() const;
+
+    bool LookupControlPoint(ControlPoint& controlPoint /* out */,
+                            double x,
+                            double y,
+                            double zoom,
+                            double viewportDistance) const;
 
     virtual bool GetDefaultWindowing(float& center,
                                      float& width) const = 0;