changeset 1610:b7630b1a0253

ISceneLayer::GetBoundingBox() returns void
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 29 Oct 2020 17:13:13 +0100
parents 5f5c549499ff
children 787db80a5a1b
files OrthancStone/Sources/Scene2D/ISceneLayer.h OrthancStone/Sources/Scene2D/InfoPanelSceneLayer.h OrthancStone/Sources/Scene2D/MacroSceneLayer.cpp OrthancStone/Sources/Scene2D/MacroSceneLayer.h OrthancStone/Sources/Scene2D/NullLayer.h OrthancStone/Sources/Scene2D/PolylineSceneLayer.cpp OrthancStone/Sources/Scene2D/PolylineSceneLayer.h OrthancStone/Sources/Scene2D/Scene2D.cpp OrthancStone/Sources/Scene2D/TextSceneLayer.h OrthancStone/Sources/Scene2D/TextureBaseSceneLayer.cpp OrthancStone/Sources/Scene2D/TextureBaseSceneLayer.h OrthancStone/Sources/Toolbox/DicomStructureSet.cpp OrthancStone/Sources/Toolbox/Extent2D.cpp OrthancStone/Sources/Toolbox/Extent2D.h OrthancStone/Sources/Volumes/OrientedVolumeBoundingBox.cpp OrthancStone/Sources/Volumes/VolumeReslicer.cpp
diffstat 16 files changed, 33 insertions(+), 46 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancStone/Sources/Scene2D/ISceneLayer.h	Thu Oct 29 17:01:29 2020 +0100
+++ b/OrthancStone/Sources/Scene2D/ISceneLayer.h	Thu Oct 29 17:13:13 2020 +0100
@@ -52,7 +52,7 @@
 
     virtual Type GetType() const = 0;
 
-    virtual bool GetBoundingBox(Extent2D& target) const = 0;
+    virtual void GetBoundingBox(Extent2D& target) const = 0;
 
     virtual uint64_t GetRevision() const = 0;
   };
--- a/OrthancStone/Sources/Scene2D/InfoPanelSceneLayer.h	Thu Oct 29 17:01:29 2020 +0100
+++ b/OrthancStone/Sources/Scene2D/InfoPanelSceneLayer.h	Thu Oct 29 17:13:13 2020 +0100
@@ -85,9 +85,9 @@
       return Type_InfoPanel;
     }
 
-    virtual bool GetBoundingBox(Extent2D& target) const ORTHANC_OVERRIDE
+    virtual void GetBoundingBox(Extent2D& target) const ORTHANC_OVERRIDE
     {
-      return false;
+      target.Clear();
     }
 
     virtual uint64_t GetRevision() const ORTHANC_OVERRIDE
--- a/OrthancStone/Sources/Scene2D/MacroSceneLayer.cpp	Thu Oct 29 17:01:29 2020 +0100
+++ b/OrthancStone/Sources/Scene2D/MacroSceneLayer.cpp	Thu Oct 29 17:13:13 2020 +0100
@@ -69,21 +69,17 @@
   }
   
 
-  bool MacroSceneLayer::GetBoundingBox(Extent2D& target) const
+  void MacroSceneLayer::GetBoundingBox(Extent2D& target) const
   {
-    target.Reset();
+    target.Clear();
 
     for (size_t i = 0; i < layers_.size(); i++)
     {
       assert(layers_[i] != NULL);
 
       Extent2D subextent;
-      if (layers_[i]->GetBoundingBox(subextent))
-      {
-        target.Union(subextent);
-      }
+      layers_[i]->GetBoundingBox(subextent);
+      target.Union(subextent);
     }
-
-    return true;
   }
 }
--- a/OrthancStone/Sources/Scene2D/MacroSceneLayer.h	Thu Oct 29 17:01:29 2020 +0100
+++ b/OrthancStone/Sources/Scene2D/MacroSceneLayer.h	Thu Oct 29 17:13:13 2020 +0100
@@ -79,7 +79,7 @@
       return Type_Macro;
     }
 
-    virtual bool GetBoundingBox(Extent2D& target) const ORTHANC_OVERRIDE;
+    virtual void GetBoundingBox(Extent2D& target) const ORTHANC_OVERRIDE;
 
     virtual uint64_t GetRevision() const ORTHANC_OVERRIDE
     {
--- a/OrthancStone/Sources/Scene2D/NullLayer.h	Thu Oct 29 17:01:29 2020 +0100
+++ b/OrthancStone/Sources/Scene2D/NullLayer.h	Thu Oct 29 17:13:13 2020 +0100
@@ -37,7 +37,9 @@
   class NullLayer : public ISceneLayer
   {
   public:
-    NullLayer() {}
+    NullLayer()
+    {
+    }
 
     virtual ISceneLayer* Clone() const ORTHANC_OVERRIDE
     {
@@ -49,10 +51,9 @@
       return Type_NullLayer;
     }
 
-    virtual bool GetBoundingBox(Extent2D& target) const ORTHANC_OVERRIDE
+    virtual void GetBoundingBox(Extent2D& target) const ORTHANC_OVERRIDE
     {
-      target = Extent2D();
-      return false; 
+      target.Clear();
     }
 
     virtual uint64_t GetRevision() const ORTHANC_OVERRIDE
--- a/OrthancStone/Sources/Scene2D/PolylineSceneLayer.cpp	Thu Oct 29 17:01:29 2020 +0100
+++ b/OrthancStone/Sources/Scene2D/PolylineSceneLayer.cpp	Thu Oct 29 17:13:13 2020 +0100
@@ -93,9 +93,9 @@
   }
 
   
-  bool PolylineSceneLayer::GetBoundingBox(Extent2D& target) const
+  void PolylineSceneLayer::GetBoundingBox(Extent2D& target) const
   {
-    target.Reset();
+    target.Clear();
 
     for (size_t i = 0; i < items_.size(); i++)
     {
@@ -105,7 +105,5 @@
         target.AddPoint(p.GetX(), p.GetY());
       }
     }
-
-    return true;
   }
 }
--- a/OrthancStone/Sources/Scene2D/PolylineSceneLayer.h	Thu Oct 29 17:01:29 2020 +0100
+++ b/OrthancStone/Sources/Scene2D/PolylineSceneLayer.h	Thu Oct 29 17:13:13 2020 +0100
@@ -119,6 +119,6 @@
       return Type_Polyline;
     }
 
-    virtual bool GetBoundingBox(Extent2D& target) const ORTHANC_OVERRIDE;
+    virtual void GetBoundingBox(Extent2D& target) const ORTHANC_OVERRIDE;
   };
 }
--- a/OrthancStone/Sources/Scene2D/Scene2D.cpp	Thu Oct 29 17:01:29 2020 +0100
+++ b/OrthancStone/Sources/Scene2D/Scene2D.cpp	Thu Oct 29 17:13:13 2020 +0100
@@ -223,9 +223,9 @@
     canvasToScene_ = inverse;
   }
 
-  void Scene2D::GetBoundingBox(Extent2D &target) const
+  void Scene2D::GetBoundingBox(Extent2D& target) const
   {
-    target.Reset();
+    target.Clear();
 
     for (Content::const_iterator it = content_.begin();
          it != content_.end(); ++it)
@@ -233,10 +233,8 @@
       assert(it->second != NULL);
 
       Extent2D tmp;
-      if (it->second->GetLayer().GetBoundingBox(tmp))
-      {
-        target.Union(tmp);
-      }
+      it->second->GetLayer().GetBoundingBox(tmp);
+      target.Union(tmp);
     }
   }
 
--- a/OrthancStone/Sources/Scene2D/TextSceneLayer.h	Thu Oct 29 17:01:29 2020 +0100
+++ b/OrthancStone/Sources/Scene2D/TextSceneLayer.h	Thu Oct 29 17:13:13 2020 +0100
@@ -92,9 +92,9 @@
       return Type_Text;
     }
 
-    virtual bool GetBoundingBox(Extent2D& target) const ORTHANC_OVERRIDE
+    virtual void GetBoundingBox(Extent2D& target) const ORTHANC_OVERRIDE
     {
-      return false;
+      target.Clear();
     }
 
     virtual uint64_t GetRevision() const ORTHANC_OVERRIDE
--- a/OrthancStone/Sources/Scene2D/TextureBaseSceneLayer.cpp	Thu Oct 29 17:01:29 2020 +0100
+++ b/OrthancStone/Sources/Scene2D/TextureBaseSceneLayer.cpp	Thu Oct 29 17:13:13 2020 +0100
@@ -160,18 +160,14 @@
   }
 
   
-  bool TextureBaseSceneLayer::GetBoundingBox(Extent2D& target) const
+  void TextureBaseSceneLayer::GetBoundingBox(Extent2D& target) const
   {
-    if (texture_.get() == NULL)
-    {
-      return false;
-    }
-    else
+    target.Clear();
+    
+    if (texture_.get() != NULL)
     {
       const AffineTransform2D t = GetTransform();
 
-      target.Reset();
-    
       double x, y;
 
       x = 0;
@@ -193,8 +189,6 @@
       y = static_cast<double>(texture_->GetHeight());
       t.Apply(x, y);
       target.AddPoint(x, y);    
-
-      return true;
     }
   }
 }
--- a/OrthancStone/Sources/Scene2D/TextureBaseSceneLayer.h	Thu Oct 29 17:01:29 2020 +0100
+++ b/OrthancStone/Sources/Scene2D/TextureBaseSceneLayer.h	Thu Oct 29 17:13:13 2020 +0100
@@ -122,7 +122,7 @@
 
     AffineTransform2D GetTransform() const;
     
-    virtual bool GetBoundingBox(Extent2D& target) const ORTHANC_OVERRIDE;
+    virtual void GetBoundingBox(Extent2D& target) const ORTHANC_OVERRIDE;
 
     virtual uint64_t GetRevision() const ORTHANC_OVERRIDE
     {
--- a/OrthancStone/Sources/Toolbox/DicomStructureSet.cpp	Thu Oct 29 17:01:29 2020 +0100
+++ b/OrthancStone/Sources/Toolbox/DicomStructureSet.cpp	Thu Oct 29 17:13:13 2020 +0100
@@ -258,7 +258,7 @@
         projectionAlongNormal_ = GeometryToolbox::ProjectAlongNormal(geometry.GetOrigin(), geometry.GetNormal());
         sliceThickness_ = it->second.thickness_;
 
-        extent_.Reset();
+        extent_.Clear();
         
         for (Points::const_iterator it2 = points_.begin(); it2 != points_.end(); ++it2)
         {
--- a/OrthancStone/Sources/Toolbox/Extent2D.cpp	Thu Oct 29 17:01:29 2020 +0100
+++ b/OrthancStone/Sources/Toolbox/Extent2D.cpp	Thu Oct 29 17:13:13 2020 +0100
@@ -50,7 +50,7 @@
   }
 
 
-  void Extent2D::Reset()
+  void Extent2D::Clear()
   {
     empty_ = true;
     x1_ = 0;
--- a/OrthancStone/Sources/Toolbox/Extent2D.h	Thu Oct 29 17:01:29 2020 +0100
+++ b/OrthancStone/Sources/Toolbox/Extent2D.h	Thu Oct 29 17:13:13 2020 +0100
@@ -36,7 +36,7 @@
   public:
     Extent2D()
     {
-      Reset();
+      Clear();
     }
 
     Extent2D(double x1,
@@ -44,7 +44,7 @@
              double x2,
              double y2);
 
-    void Reset();
+    void Clear();
 
     void AddPoint(double x,
                   double y);
--- a/OrthancStone/Sources/Volumes/OrientedVolumeBoundingBox.cpp	Thu Oct 29 17:01:29 2020 +0100
+++ b/OrthancStone/Sources/Volumes/OrientedVolumeBoundingBox.cpp	Thu Oct 29 17:13:13 2020 +0100
@@ -247,7 +247,7 @@
   bool OrientedVolumeBoundingBox::ComputeExtent(Extent2D& extent,
                                                 const CoordinateSystem3D& plane) const
   {
-    extent.Reset();
+    extent.Clear();
     
     std::vector<Vector> points;
     if (HasIntersection(points, plane))
--- a/OrthancStone/Sources/Volumes/VolumeReslicer.cpp	Thu Oct 29 17:01:29 2020 +0100
+++ b/OrthancStone/Sources/Volumes/VolumeReslicer.cpp	Thu Oct 29 17:13:13 2020 +0100
@@ -535,7 +535,7 @@
   void VolumeReslicer::Reset()
   {
     success_ = false;
-    extent_.Reset();
+    extent_.Clear();
     slice_.reset(NULL);
   }