# HG changeset patch # User Sebastien Jodogne # Date 1603987993 -3600 # Node ID b7630b1a025343fc8ead9c396307812dea0c392f # Parent 5f5c549499ff91e506069300f012123dfb40e944 ISceneLayer::GetBoundingBox() returns void diff -r 5f5c549499ff -r b7630b1a0253 OrthancStone/Sources/Scene2D/ISceneLayer.h --- 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; }; diff -r 5f5c549499ff -r b7630b1a0253 OrthancStone/Sources/Scene2D/InfoPanelSceneLayer.h --- 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 diff -r 5f5c549499ff -r b7630b1a0253 OrthancStone/Sources/Scene2D/MacroSceneLayer.cpp --- 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; } } diff -r 5f5c549499ff -r b7630b1a0253 OrthancStone/Sources/Scene2D/MacroSceneLayer.h --- 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 { diff -r 5f5c549499ff -r b7630b1a0253 OrthancStone/Sources/Scene2D/NullLayer.h --- 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 diff -r 5f5c549499ff -r b7630b1a0253 OrthancStone/Sources/Scene2D/PolylineSceneLayer.cpp --- 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; } } diff -r 5f5c549499ff -r b7630b1a0253 OrthancStone/Sources/Scene2D/PolylineSceneLayer.h --- 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; }; } diff -r 5f5c549499ff -r b7630b1a0253 OrthancStone/Sources/Scene2D/Scene2D.cpp --- 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); } } diff -r 5f5c549499ff -r b7630b1a0253 OrthancStone/Sources/Scene2D/TextSceneLayer.h --- 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 diff -r 5f5c549499ff -r b7630b1a0253 OrthancStone/Sources/Scene2D/TextureBaseSceneLayer.cpp --- 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(texture_->GetHeight()); t.Apply(x, y); target.AddPoint(x, y); - - return true; } } } diff -r 5f5c549499ff -r b7630b1a0253 OrthancStone/Sources/Scene2D/TextureBaseSceneLayer.h --- 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 { diff -r 5f5c549499ff -r b7630b1a0253 OrthancStone/Sources/Toolbox/DicomStructureSet.cpp --- 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) { diff -r 5f5c549499ff -r b7630b1a0253 OrthancStone/Sources/Toolbox/Extent2D.cpp --- 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; diff -r 5f5c549499ff -r b7630b1a0253 OrthancStone/Sources/Toolbox/Extent2D.h --- 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); diff -r 5f5c549499ff -r b7630b1a0253 OrthancStone/Sources/Volumes/OrientedVolumeBoundingBox.cpp --- 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 points; if (HasIntersection(points, plane)) diff -r 5f5c549499ff -r b7630b1a0253 OrthancStone/Sources/Volumes/VolumeReslicer.cpp --- 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); }