diff Framework/Radiography/RadiographyScene.h @ 410:6decc0ba9da5

rename RadiographyScene::Layer as RadiographyLayer
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 12 Nov 2018 15:52:03 +0100
parents 99c9b3238008
children aee3d7941c9b
line wrap: on
line diff
--- a/Framework/Radiography/RadiographyScene.h	Mon Nov 12 15:38:11 2018 +0100
+++ b/Framework/Radiography/RadiographyScene.h	Mon Nov 12 15:52:03 2018 +0100
@@ -21,10 +21,8 @@
 
 #pragma once
 
-#include "../Toolbox/AffineTransform2D.h"
-#include "../Toolbox/Extent2D.h"
+#include "RadiographyLayer.h"
 #include "../Toolbox/OrthancApiClient.h"
-#include "../Viewport/CairoContext.h"
 
 
 namespace OrthancStone
@@ -37,193 +35,12 @@
     typedef OriginMessage<MessageType_Widget_GeometryChanged, RadiographyScene> GeometryChangedMessage;
     typedef OriginMessage<MessageType_Widget_ContentChanged, RadiographyScene> ContentChangedMessage;
 
-    enum Corner
-    {
-      Corner_TopLeft,
-      Corner_TopRight,
-      Corner_BottomLeft,
-      Corner_BottomRight
-    };
-
-
-    class Layer : public boost::noncopyable
-    {
-      friend class RadiographyScene;
-      
-    private:
-      size_t             index_;
-      bool               hasSize_;
-      unsigned int       width_;
-      unsigned int       height_;
-      bool               hasCrop_;
-      unsigned int       cropX_;
-      unsigned int       cropY_;
-      unsigned int       cropWidth_;
-      unsigned int       cropHeight_;
-      AffineTransform2D  transform_;
-      AffineTransform2D  transformInverse_;
-      double             pixelSpacingX_;
-      double             pixelSpacingY_;
-      double             panX_;
-      double             panY_;
-      double             angle_;
-      bool               resizeable_;
-
-
-    protected:
-      const AffineTransform2D& GetTransform() const
-      {
-        return transform_;
-      }
-
-
-    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);
-
-    public:
-      Layer();
-
-      virtual ~Layer()
-      {
-      }
-
-      size_t GetIndex() const
-      {
-        return index_;
-      }
-
-      void ResetCrop()
-      {
-        hasCrop_ = false;
-      }
-
-      void SetCrop(unsigned int x,
-                   unsigned int y,
-                   unsigned int width,
-                   unsigned int height);
-
-      void GetCrop(unsigned int& x,
-                   unsigned int& y,
-                   unsigned int& width,
-                   unsigned int& height) const;
-
-      void SetAngle(double angle);
-
-      double GetAngle() const
-      {
-        return angle_;
-      }
-
-      void SetSize(unsigned int width,
-                   unsigned int height);
-
-      unsigned int GetWidth() const
-      {
-        return width_;
-      }        
-
-      unsigned int GetHeight() const
-      {
-        return height_;
-      }       
-
-      Extent2D GetExtent() const;
-
-      bool GetPixel(unsigned int& imageX,
-                    unsigned int& imageY,
-                    double sceneX,
-                    double sceneY) const;
-
-      void SetPan(double x,
-                  double y);
-
-      void SetPixelSpacing(double x,
-                           double y);
-
-      double GetPixelSpacingX() const
-      {
-        return pixelSpacingX_;
-      }   
-
-      double GetPixelSpacingY() const
-      {
-        return pixelSpacingY_;
-      }   
-
-      double GetPanX() const
-      {
-        return panX_;
-      }
-
-      double GetPanY() const
-      {
-        return panY_;
-      }
-
-      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;
-
-      bool IsResizeable() const
-      {
-        return resizeable_;
-      }
-
-      void SetResizeable(bool resizeable)
-      {
-        resizeable_ = resizeable;
-      }
-
-      virtual bool GetDefaultWindowing(float& center,
-                                       float& width) const = 0;
-
-      virtual void Render(Orthanc::ImageAccessor& buffer,
-                          const AffineTransform2D& viewTransform,
-                          ImageInterpolation interpolation) const = 0;
-
-      virtual bool GetRange(float& minValue,
-                            float& maxValue) const = 0;
-    }; 
-
-
     class LayerAccessor : public boost::noncopyable
     {
     private:
       RadiographyScene&  scene_;
       size_t             index_;
-      Layer*             layer_;
+      RadiographyLayer*  layer_;
 
     public:
       LayerAccessor(RadiographyScene& scene,
@@ -247,7 +64,7 @@
 
       size_t GetIndex() const;
 
-      Layer& GetLayer() const;
+      RadiographyLayer& GetLayer() const;
     };
 
 
@@ -255,7 +72,7 @@
     class AlphaLayer;    
     class DicomLayer;
 
-    typedef std::map<size_t, Layer*>  Layers;
+    typedef std::map<size_t, RadiographyLayer*>  Layers;
         
     OrthancApiClient&  orthanc_;
     size_t             countLayers_;
@@ -264,7 +81,7 @@
     float              windowingWidth_;
     Layers             layers_;
 
-    Layer& RegisterLayer(Layer* layer);
+    RadiographyLayer& RegisterLayer(RadiographyLayer* layer);
 
     void OnTagsReceived(const OrthancApiClient::BinaryResponseReadyMessage& message);
 
@@ -287,15 +104,15 @@
     void SetWindowing(float center,
                       float width);
 
-    Layer& LoadText(const Orthanc::Font& font,
-                    const std::string& utf8);
+    RadiographyLayer& LoadText(const Orthanc::Font& font,
+                               const std::string& utf8);
     
-    Layer& LoadTestBlock(unsigned int width,
-                         unsigned int height);
+    RadiographyLayer& LoadTestBlock(unsigned int width,
+                                    unsigned int height);
     
-    Layer& LoadDicomFrame(const std::string& instance,
-                          unsigned int frame,
-                          bool httpCompression);
+    RadiographyLayer& LoadDicomFrame(const std::string& instance,
+                                     unsigned int frame,
+                                     bool httpCompression);
 
     Extent2D GetSceneExtent() const;