Mercurial > hg > orthanc-stone
changeset 821:5c7b08bf84af
merge
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 29 May 2019 13:42:34 +0200 |
parents | 270c31978df1 (current diff) e42b491f1fb2 (diff) |
children | 76e8224bc300 28f99af358fa |
files | Framework/Scene2DViewport/PointerTypes.h |
diffstat | 39 files changed, 210 insertions(+), 247 deletions(-) [+] |
line wrap: on
line diff
--- a/Framework/Scene2D/Internals/FixedPointAligner.cpp Wed May 29 13:40:07 2019 +0200 +++ b/Framework/Scene2D/Internals/FixedPointAligner.cpp Wed May 29 13:42:34 2019 +0200 @@ -25,19 +25,19 @@ { namespace Internals { - FixedPointAligner::FixedPointAligner(ViewportControllerWPtr controllerW, + FixedPointAligner::FixedPointAligner(boost::weak_ptr<ViewportController> controllerW, const ScenePoint2D& p) : controllerW_(controllerW) , canvas_(p) { - ViewportControllerPtr controller = controllerW_.lock(); + boost::shared_ptr<ViewportController> controller = controllerW_.lock(); pivot_ = canvas_.Apply(controller->GetCanvasToSceneTransform()); } void FixedPointAligner::Apply() { - ViewportControllerPtr controller = controllerW_.lock(); + boost::shared_ptr<ViewportController> controller = controllerW_.lock(); ScenePoint2D p = canvas_.Apply(controller->GetCanvasToSceneTransform()); controller->SetSceneToCanvasTransform(
--- a/Framework/Scene2D/Internals/FixedPointAligner.h Wed May 29 13:40:07 2019 +0200 +++ b/Framework/Scene2D/Internals/FixedPointAligner.h Wed May 29 13:42:34 2019 +0200 @@ -20,7 +20,7 @@ #pragma once -#include "../../Scene2DViewport/PointerTypes.h" +#include "../../Scene2DViewport/PredeclaredTypes.h" #include "../../Scene2D/ScenePoint2D.h" namespace OrthancStone @@ -32,12 +32,12 @@ class FixedPointAligner : public boost::noncopyable { private: - ViewportControllerWPtr controllerW_; + boost::weak_ptr<ViewportController> controllerW_; ScenePoint2D pivot_; ScenePoint2D canvas_; public: - FixedPointAligner(ViewportControllerWPtr controllerW, + FixedPointAligner(boost::weak_ptr<ViewportController> controllerW, const ScenePoint2D& p); void Apply();
--- a/Framework/Scene2D/PanSceneTracker.cpp Wed May 29 13:40:07 2019 +0200 +++ b/Framework/Scene2D/PanSceneTracker.cpp Wed May 29 13:42:34 2019 +0200 @@ -24,7 +24,7 @@ namespace OrthancStone { - PanSceneTracker::PanSceneTracker(ViewportControllerWPtr controllerW, + PanSceneTracker::PanSceneTracker(boost::weak_ptr<ViewportController> controllerW, const PointerEvent& event) : OneGesturePointerTracker(controllerW) , originalSceneToCanvas_(GetController()->GetSceneToCanvasTransform())
--- a/Framework/Scene2D/PanSceneTracker.h Wed May 29 13:40:07 2019 +0200 +++ b/Framework/Scene2D/PanSceneTracker.h Wed May 29 13:42:34 2019 +0200 @@ -28,14 +28,14 @@ class PanSceneTracker : public OneGesturePointerTracker { public: - PanSceneTracker(ViewportControllerWPtr controllerW, + PanSceneTracker(boost::weak_ptr<ViewportController> controllerW, const PointerEvent& event); virtual void PointerMove(const PointerEvent& event) ORTHANC_OVERRIDE; virtual void Cancel() ORTHANC_OVERRIDE; private: - ViewportControllerWPtr controllerW_; + boost::weak_ptr<ViewportController> controllerW_; ScenePoint2D pivot_; AffineTransform2D originalSceneToCanvas_; AffineTransform2D originalCanvasToScene_;
--- a/Framework/Scene2D/RotateSceneTracker.cpp Wed May 29 13:40:07 2019 +0200 +++ b/Framework/Scene2D/RotateSceneTracker.cpp Wed May 29 13:42:34 2019 +0200 @@ -23,7 +23,7 @@ namespace OrthancStone { - RotateSceneTracker::RotateSceneTracker(ViewportControllerWPtr controllerW, + RotateSceneTracker::RotateSceneTracker(boost::weak_ptr<ViewportController> controllerW, const PointerEvent& event) : OneGesturePointerTracker(controllerW) , click_(event.GetMainPosition())
--- a/Framework/Scene2D/RotateSceneTracker.h Wed May 29 13:40:07 2019 +0200 +++ b/Framework/Scene2D/RotateSceneTracker.h Wed May 29 13:42:34 2019 +0200 @@ -29,7 +29,7 @@ class RotateSceneTracker : public OneGesturePointerTracker { public: - RotateSceneTracker(ViewportControllerWPtr controllerW, + RotateSceneTracker(boost::weak_ptr<ViewportController> controllerW, const PointerEvent& event); virtual void PointerMove(const PointerEvent& event) ORTHANC_OVERRIDE;
--- a/Framework/Scene2D/ZoomSceneTracker.cpp Wed May 29 13:40:07 2019 +0200 +++ b/Framework/Scene2D/ZoomSceneTracker.cpp Wed May 29 13:42:34 2019 +0200 @@ -22,9 +22,12 @@ #include "ZoomSceneTracker.h" #include "../Scene2DViewport/ViewportController.h" +using boost::weak_ptr; +using boost::shared_ptr; + namespace OrthancStone { - ZoomSceneTracker::ZoomSceneTracker(ViewportControllerWPtr controllerW, + ZoomSceneTracker::ZoomSceneTracker(weak_ptr<ViewportController> controllerW, const PointerEvent& event, unsigned int canvasHeight) : OneGesturePointerTracker(controllerW)
--- a/Framework/Scene2D/ZoomSceneTracker.h Wed May 29 13:40:07 2019 +0200 +++ b/Framework/Scene2D/ZoomSceneTracker.h Wed May 29 13:42:34 2019 +0200 @@ -30,7 +30,7 @@ class ZoomSceneTracker : public OneGesturePointerTracker { public: - ZoomSceneTracker(ViewportControllerWPtr controllerW, + ZoomSceneTracker(boost::weak_ptr<ViewportController> controllerW, const PointerEvent& event, unsigned int canvasHeight);
--- a/Framework/Scene2DViewport/AngleMeasureTool.cpp Wed May 29 13:40:07 2019 +0200 +++ b/Framework/Scene2DViewport/AngleMeasureTool.cpp Wed May 29 13:42:34 2019 +0200 @@ -40,7 +40,7 @@ // the params in the LayerHolder ctor specify the number of polyline and text // layers AngleMeasureTool::AngleMeasureTool( - MessageBroker& broker, ViewportControllerWPtr controllerW) + MessageBroker& broker, boost::weak_ptr<ViewportController> controllerW) : MeasureTool(broker, controllerW) , layerHolder_(boost::make_shared<LayerHolder>(controllerW,1,5)) { @@ -91,7 +91,7 @@ { if (IsSceneAlive()) { - ViewportControllerPtr controller = GetController(); + boost::shared_ptr<ViewportController> controller = GetController(); if (IsEnabled()) { layerHolder_->CreateLayersIfNeeded();
--- a/Framework/Scene2DViewport/AngleMeasureTool.h Wed May 29 13:40:07 2019 +0200 +++ b/Framework/Scene2DViewport/AngleMeasureTool.h Wed May 29 13:42:34 2019 +0200 @@ -39,7 +39,7 @@ class AngleMeasureTool : public MeasureTool { public: - AngleMeasureTool(MessageBroker& broker, ViewportControllerWPtr controllerW); + AngleMeasureTool(MessageBroker& broker, boost::weak_ptr<ViewportController> controllerW); ~AngleMeasureTool(); @@ -58,7 +58,7 @@ ScenePoint2D side1End_; ScenePoint2D side2End_; ScenePoint2D center_; - LayerHolderPtr layerHolder_; + boost::shared_ptr<LayerHolder> layerHolder_; }; }
--- a/Framework/Scene2DViewport/CreateAngleMeasureTracker.cpp Wed May 29 13:40:07 2019 +0200 +++ b/Framework/Scene2DViewport/CreateAngleMeasureTracker.cpp Wed May 29 13:42:34 2019 +0200 @@ -25,7 +25,7 @@ { CreateAngleMeasureTracker::CreateAngleMeasureTracker( MessageBroker& broker, - ViewportControllerWPtr controllerW, + boost::weak_ptr<ViewportController> controllerW, const PointerEvent& e) : CreateMeasureTracker(controllerW) , state_(CreatingSide1) @@ -117,7 +117,7 @@ } } - CreateAngleMeasureCommandPtr CreateAngleMeasureTracker::GetCommand() + boost::shared_ptr<CreateAngleMeasureCommand> CreateAngleMeasureTracker::GetCommand() { return boost::dynamic_pointer_cast<CreateAngleMeasureCommand>(command_); }
--- a/Framework/Scene2DViewport/CreateAngleMeasureTracker.h Wed May 29 13:40:07 2019 +0200 +++ b/Framework/Scene2DViewport/CreateAngleMeasureTracker.h Wed May 29 13:42:34 2019 +0200 @@ -39,7 +39,7 @@ */ CreateAngleMeasureTracker( MessageBroker& broker, - ViewportControllerWPtr controllerW, + boost::weak_ptr<ViewportController> controllerW, const PointerEvent& e); ~CreateAngleMeasureTracker(); @@ -49,7 +49,7 @@ virtual void PointerDown(const PointerEvent& e) ORTHANC_OVERRIDE; private: - CreateAngleMeasureCommandPtr GetCommand(); + boost::shared_ptr<CreateAngleMeasureCommand> GetCommand(); enum State {
--- a/Framework/Scene2DViewport/CreateLineMeasureTracker.cpp Wed May 29 13:40:07 2019 +0200 +++ b/Framework/Scene2DViewport/CreateLineMeasureTracker.cpp Wed May 29 13:42:34 2019 +0200 @@ -25,7 +25,7 @@ { CreateLineMeasureTracker::CreateLineMeasureTracker( MessageBroker& broker, - ViewportControllerWPtr controllerW, + boost::weak_ptr<ViewportController> controllerW, const PointerEvent& e) : CreateMeasureTracker(controllerW) { @@ -80,7 +80,7 @@ "are ignored when the line measure creation tracker is active"; } - CreateLineMeasureCommandPtr CreateLineMeasureTracker::GetCommand() + boost::shared_ptr<CreateLineMeasureCommand> CreateLineMeasureTracker::GetCommand() { return boost::dynamic_pointer_cast<CreateLineMeasureCommand>(command_); }
--- a/Framework/Scene2DViewport/CreateLineMeasureTracker.h Wed May 29 13:40:07 2019 +0200 +++ b/Framework/Scene2DViewport/CreateLineMeasureTracker.h Wed May 29 13:42:34 2019 +0200 @@ -36,7 +36,7 @@ */ CreateLineMeasureTracker( MessageBroker& broker, - ViewportControllerWPtr controllerW, + boost::weak_ptr<ViewportController> controllerW, const PointerEvent& e); ~CreateLineMeasureTracker(); @@ -46,6 +46,6 @@ virtual void PointerDown(const PointerEvent& e) ORTHANC_OVERRIDE; private: - CreateLineMeasureCommandPtr GetCommand(); + boost::shared_ptr<CreateLineMeasureCommand> GetCommand(); }; }
--- a/Framework/Scene2DViewport/CreateSimpleTrackerAdapter.cpp Wed May 29 13:40:07 2019 +0200 +++ b/Framework/Scene2DViewport/CreateSimpleTrackerAdapter.cpp Wed May 29 13:42:34 2019 +0200 @@ -30,7 +30,7 @@ class SimpleTrackerAdapter : public IFlexiblePointerTracker { public: - SimpleTrackerAdapter(PointerTrackerPtr wrappedTracker) + SimpleTrackerAdapter(boost::shared_ptr<IPointerTracker> wrappedTracker) : wrappedTracker_(wrappedTracker) , active_(true) { @@ -66,14 +66,14 @@ } private: - PointerTrackerPtr wrappedTracker_; + boost::shared_ptr<IPointerTracker> wrappedTracker_; bool active_; }; } - FlexiblePointerTrackerPtr CreateSimpleTrackerAdapter(PointerTrackerPtr t) + boost::shared_ptr<IFlexiblePointerTracker> CreateSimpleTrackerAdapter(boost::shared_ptr<IPointerTracker> t) { - return FlexiblePointerTrackerPtr(new SimpleTrackerAdapter(t)); + return boost::shared_ptr<IFlexiblePointerTracker>(new SimpleTrackerAdapter(t)); } #endif }
--- a/Framework/Scene2DViewport/IFlexiblePointerTracker.h Wed May 29 13:40:07 2019 +0200 +++ b/Framework/Scene2DViewport/IFlexiblePointerTracker.h Wed May 29 13:42:34 2019 +0200 @@ -21,10 +21,11 @@ #pragma once -#include "PointerTypes.h" +#include "PredeclaredTypes.h" #include "../Scene2D/PointerEvent.h" + namespace OrthancStone { /** @@ -82,6 +83,6 @@ This factory adopts the supplied simple tracker and creates a flexible tracker wrapper around it. */ - FlexiblePointerTrackerPtr CreateSimpleTrackerAdapter(PointerTrackerPtr); + boost::shared_ptr<IFlexiblePointerTracker> CreateSimpleTrackerAdapter(boost::shared_ptr<IPointerTracker>); }
--- a/Framework/Scene2DViewport/LayerHolder.cpp Wed May 29 13:40:07 2019 +0200 +++ b/Framework/Scene2DViewport/LayerHolder.cpp Wed May 29 13:42:34 2019 +0200 @@ -25,12 +25,10 @@ #include "../Scene2DViewport/ViewportController.h" #include "../StoneException.h" -using namespace Orthanc; - namespace OrthancStone { LayerHolder::LayerHolder( - ViewportControllerWPtr controllerW, + boost::weak_ptr<ViewportController> controllerW, int polylineLayerCount, int textLayerCount) : textLayerCount_(textLayerCount) @@ -74,9 +72,9 @@ return (baseLayerIndex_ != -1); } - OrthancStone::Scene2DPtr LayerHolder::GetScene() + boost::shared_ptr<Scene2D> LayerHolder::GetScene() { - ViewportControllerPtr controller = controllerW_.lock(); + boost::shared_ptr<ViewportController> controller = controllerW_.lock(); ORTHANC_ASSERT(controller.get() != 0, "Zombie attack!"); return controller->GetScene(); } @@ -93,6 +91,7 @@ PolylineSceneLayer* LayerHolder::GetPolylineLayer(int index /*= 0*/) { + using namespace Orthanc; ORTHANC_ASSERT(baseLayerIndex_ != -1); ORTHANC_ASSERT(GetScene()->HasLayer(GetPolylineLayerIndex(index))); ISceneLayer* layer = @@ -107,6 +106,7 @@ TextSceneLayer* LayerHolder::GetTextLayer(int index /*= 0*/) { + using namespace Orthanc; ORTHANC_ASSERT(baseLayerIndex_ != -1); ORTHANC_ASSERT(GetScene()->HasLayer(GetTextLayerIndex(index))); ISceneLayer* layer = @@ -121,6 +121,7 @@ int LayerHolder::GetPolylineLayerIndex(int index /*= 0*/) { + using namespace Orthanc; ORTHANC_ASSERT(index < polylineLayerCount_); return baseLayerIndex_ + index; } @@ -128,6 +129,7 @@ int LayerHolder::GetTextLayerIndex(int index /*= 0*/) { + using namespace Orthanc; ORTHANC_ASSERT(index < textLayerCount_); // the text layers are placed right after the polyline layers
--- a/Framework/Scene2DViewport/LayerHolder.h Wed May 29 13:40:07 2019 +0200 +++ b/Framework/Scene2DViewport/LayerHolder.h Wed May 29 13:42:34 2019 +0200 @@ -20,8 +20,11 @@ #pragma once -#include "PointerTypes.h" +#include "PredeclaredTypes.h" + #include "boost/noncopyable.hpp" +#include "boost/weak_ptr.hpp" +#include "boost/shared_ptr.hpp" namespace OrthancStone { @@ -40,7 +43,7 @@ performed at this time */ LayerHolder( - ViewportControllerWPtr controllerW, + boost::weak_ptr<ViewportController> controllerW, int polylineLayerCount, int textLayerCount); /** @@ -86,14 +89,12 @@ private: int GetPolylineLayerIndex(int index = 0); int GetTextLayerIndex(int index = 0); - Scene2DPtr GetScene(); + boost::shared_ptr<Scene2D> GetScene(); int textLayerCount_; int polylineLayerCount_; - ViewportControllerWPtr controllerW_; + boost::weak_ptr<ViewportController> controllerW_; int baseLayerIndex_; }; - - typedef boost::shared_ptr<LayerHolder> LayerHolderPtr; }
--- a/Framework/Scene2DViewport/LineMeasureTool.cpp Wed May 29 13:40:07 2019 +0200 +++ b/Framework/Scene2DViewport/LineMeasureTool.cpp Wed May 29 13:42:34 2019 +0200 @@ -30,7 +30,7 @@ { LineMeasureTool::LineMeasureTool( - MessageBroker& broker, ViewportControllerWPtr controllerW) + MessageBroker& broker, boost::weak_ptr<ViewportController> controllerW) : MeasureTool(broker, controllerW) , layerHolder_(boost::make_shared<LayerHolder>(controllerW, 1, 5)) {
--- a/Framework/Scene2DViewport/LineMeasureTool.h Wed May 29 13:40:07 2019 +0200 +++ b/Framework/Scene2DViewport/LineMeasureTool.h Wed May 29 13:42:34 2019 +0200 @@ -37,7 +37,7 @@ class LineMeasureTool : public MeasureTool { public: - LineMeasureTool(MessageBroker& broker, ViewportControllerWPtr controllerW); + LineMeasureTool(MessageBroker& broker, boost::weak_ptr<ViewportController> controllerW); ~LineMeasureTool(); @@ -55,7 +55,7 @@ private: ScenePoint2D start_; ScenePoint2D end_; - LayerHolderPtr layerHolder_; + boost::shared_ptr<LayerHolder> layerHolder_; int baseLayerIndex_; };
--- a/Framework/Scene2DViewport/MeasureCommands.cpp Wed May 29 13:40:07 2019 +0200 +++ b/Framework/Scene2DViewport/MeasureCommands.cpp Wed May 29 13:42:34 2019 +0200 @@ -38,7 +38,7 @@ GetController()->AddMeasureTool(GetMeasureTool()); } - CreateMeasureCommand::CreateMeasureCommand(ViewportControllerWPtr controllerW) + CreateMeasureCommand::CreateMeasureCommand(boost::weak_ptr<ViewportController> controllerW) : TrackerCommand(controllerW) { @@ -52,7 +52,7 @@ CreateLineMeasureCommand::CreateLineMeasureCommand( MessageBroker& broker, - ViewportControllerWPtr controllerW, + boost::weak_ptr<ViewportController> controllerW, ScenePoint2D point) : CreateMeasureCommand(controllerW) , measureTool_( @@ -69,7 +69,7 @@ CreateAngleMeasureCommand::CreateAngleMeasureCommand( MessageBroker& broker, - ViewportControllerWPtr controllerW, + boost::weak_ptr<ViewportController> controllerW, ScenePoint2D point) : CreateMeasureCommand(controllerW) , measureTool_( @@ -93,9 +93,9 @@ measureTool_->SetSide2End(scenePos); } - ViewportControllerPtr TrackerCommand::GetController() + boost::shared_ptr<ViewportController> TrackerCommand::GetController() { - ViewportControllerPtr controller = controllerW_.lock(); + boost::shared_ptr<ViewportController> controller = controllerW_.lock(); assert(controller); // accessing dead object? return controller; }
--- a/Framework/Scene2DViewport/MeasureCommands.h Wed May 29 13:40:07 2019 +0200 +++ b/Framework/Scene2DViewport/MeasureCommands.h Wed May 29 13:42:34 2019 +0200 @@ -22,7 +22,7 @@ #include "../Scene2D/Scene2D.h" // to be moved into Stone -#include "PointerTypes.h" +#include "PredeclaredTypes.h" #include "MeasureTool.h" #include "LineMeasureTool.h" #include "AngleMeasureTool.h" @@ -35,7 +35,7 @@ class TrackerCommand : public boost::noncopyable { public: - TrackerCommand(ViewportControllerWPtr controllerW) + TrackerCommand(boost::weak_ptr<ViewportController> controllerW) : controllerW_(controllerW) { @@ -44,20 +44,20 @@ virtual void Redo() = 0; protected: - ViewportControllerPtr GetController(); - ViewportControllerWPtr controllerW_; + boost::shared_ptr<ViewportController> GetController(); + boost::weak_ptr<ViewportController> controllerW_; }; class CreateMeasureCommand : public TrackerCommand { public: - CreateMeasureCommand(ViewportControllerWPtr controllerW); + CreateMeasureCommand(boost::weak_ptr<ViewportController> controllerW); ~CreateMeasureCommand(); virtual void Undo() ORTHANC_OVERRIDE; virtual void Redo() ORTHANC_OVERRIDE; private: /** Must be implemented by the subclasses that create the actual tool */ - virtual MeasureToolPtr GetMeasureTool() = 0; + virtual boost::shared_ptr<MeasureTool> GetMeasureTool() = 0; }; class CreateLineMeasureCommand : public CreateMeasureCommand @@ -65,18 +65,18 @@ public: CreateLineMeasureCommand( MessageBroker& broker, - ViewportControllerWPtr controllerW, + boost::weak_ptr<ViewportController> controllerW, ScenePoint2D point); // the starting position is set in the ctor void SetEnd(ScenePoint2D scenePos); private: - virtual MeasureToolPtr GetMeasureTool() ORTHANC_OVERRIDE + virtual boost::shared_ptr<MeasureTool> GetMeasureTool() ORTHANC_OVERRIDE { return measureTool_; } - LineMeasureToolPtr measureTool_; + boost::shared_ptr<LineMeasureTool> measureTool_; }; @@ -86,7 +86,7 @@ /** Ctor sets end of side 1*/ CreateAngleMeasureCommand( MessageBroker& broker, - ViewportControllerWPtr controllerW, + boost::weak_ptr<ViewportController> controllerW, ScenePoint2D point); /** This method sets center*/ @@ -96,11 +96,11 @@ void SetSide2End(ScenePoint2D scenePos); private: - virtual MeasureToolPtr GetMeasureTool() ORTHANC_OVERRIDE + virtual boost::shared_ptr<MeasureTool> GetMeasureTool() ORTHANC_OVERRIDE { return measureTool_; } - AngleMeasureToolPtr measureTool_; + boost::shared_ptr<AngleMeasureTool> measureTool_; }; }
--- a/Framework/Scene2DViewport/MeasureTool.cpp Wed May 29 13:40:07 2019 +0200 +++ b/Framework/Scene2DViewport/MeasureTool.cpp Wed May 29 13:42:34 2019 +0200 @@ -51,24 +51,24 @@ } - ViewportControllerConstPtr MeasureTool::GetController() const + boost::shared_ptr<const ViewportController> MeasureTool::GetController() const { - ViewportControllerConstPtr controller = controllerW_.lock(); + boost::shared_ptr<const ViewportController> controller = controllerW_.lock(); if (!controller) throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError, "Using dead ViewportController object!"); return controller; } - ViewportControllerPtr MeasureTool::GetController() + boost::shared_ptr<ViewportController> MeasureTool::GetController() { #if 1 return boost::const_pointer_cast<ViewportController> (const_cast<const MeasureTool*>(this)->GetController()); - //return boost::const_<ViewportControllerPtr> + //return boost::const_<boost::shared_ptr<ViewportController>> // (const_cast<const MeasureTool*>(this)->GetController()); #else - ViewportControllerPtr controller = controllerW_.lock(); + boost::shared_ptr<ViewportController> controller = controllerW_.lock(); if (!controller) throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError, "Using dead ViewportController object!"); @@ -76,18 +76,18 @@ #endif } - Scene2DPtr MeasureTool::GetScene() + boost::shared_ptr<Scene2D> MeasureTool::GetScene() { return GetController()->GetScene(); } - Scene2DConstPtr MeasureTool::GetScene() const + boost::shared_ptr<const Scene2D> MeasureTool::GetScene() const { return GetController()->GetScene(); } MeasureTool::MeasureTool(MessageBroker& broker, - ViewportControllerWPtr controllerW) + boost::weak_ptr<ViewportController> controllerW) : IObserver(broker) , controllerW_(controllerW) , enabled_(true) @@ -100,7 +100,7 @@ bool MeasureTool::IsSceneAlive() const { - ViewportControllerPtr controller = controllerW_.lock(); + boost::shared_ptr<ViewportController> controller = controllerW_.lock(); return (controller.get() != NULL); }
--- a/Framework/Scene2DViewport/MeasureTool.h Wed May 29 13:40:07 2019 +0200 +++ b/Framework/Scene2DViewport/MeasureTool.h Wed May 29 13:42:34 2019 +0200 @@ -24,7 +24,7 @@ #include "../Scene2D/Scene2D.h" #include "../Scene2D/ScenePoint2D.h" #include "../Scene2D/TextSceneLayer.h" -#include "../Scene2DViewport/PointerTypes.h" +#include "../Scene2DViewport/PredeclaredTypes.h" #include "../Scene2DViewport/ViewportController.h" #include <boost/shared_ptr.hpp> @@ -72,7 +72,7 @@ */ virtual bool HitTest(ScenePoint2D p) const = 0; protected: - MeasureTool(MessageBroker& broker, ViewportControllerWPtr controllerW); + MeasureTool(MessageBroker& broker, boost::weak_ptr<ViewportController> controllerW); /** The measuring tool may exist in a standalone fashion, without any available @@ -88,11 +88,11 @@ */ virtual void RefreshScene() = 0; - ViewportControllerConstPtr GetController() const; - ViewportControllerPtr GetController(); + boost::shared_ptr<const ViewportController> GetController() const; + boost::shared_ptr<ViewportController> GetController(); - Scene2DConstPtr GetScene() const; - Scene2DPtr GetScene(); + boost::shared_ptr<const Scene2D> GetScene() const; + boost::shared_ptr<Scene2D> GetScene(); /** enabled_ is not accessible by subclasses because there is a state machine @@ -101,7 +101,7 @@ bool IsEnabled() const; private: - ViewportControllerWPtr controllerW_; + boost::weak_ptr<ViewportController> controllerW_; bool enabled_; }; }
--- a/Framework/Scene2DViewport/MeasureToolsToolbox.cpp Wed May 29 13:40:07 2019 +0200 +++ b/Framework/Scene2DViewport/MeasureToolsToolbox.cpp Wed May 29 13:42:34 2019 +0200 @@ -19,7 +19,7 @@ **/ #include "MeasureToolsToolbox.h" -#include "PointerTypes.h" +#include "PredeclaredTypes.h" #include "LayerHolder.h" #include "ViewportController.h" @@ -60,7 +60,7 @@ } void AddSquare(PolylineSceneLayer::Chain& chain, - Scene2DConstPtr scene, + boost::shared_ptr<const Scene2D> scene, const ScenePoint2D& centerS, const double& sideLengthS) { @@ -288,7 +288,7 @@ for the actual text */ void SetTextLayerOutlineProperties( - Scene2DPtr scene, LayerHolderPtr layerHolder, + boost::shared_ptr<Scene2D> scene, boost::shared_ptr<LayerHolder> layerHolder, const char* text, ScenePoint2D p) { double xoffsets[5] = { 2, 0, -2, 0, 0 };
--- a/Framework/Scene2DViewport/MeasureToolsToolbox.h Wed May 29 13:40:07 2019 +0200 +++ b/Framework/Scene2DViewport/MeasureToolsToolbox.h Wed May 29 13:42:34 2019 +0200 @@ -18,7 +18,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. **/ -#include "PointerTypes.h" +#include "PredeclaredTypes.h" #include "../Scene2D/PolylineSceneLayer.h" #include "../Scene2D/Scene2D.h" @@ -31,7 +31,7 @@ square sides are parallel to the canvas boundaries. */ void AddSquare(PolylineSceneLayer::Chain& chain, - Scene2DConstPtr scene, + boost::shared_ptr<const Scene2D> scene, const ScenePoint2D& centerS, const double& sideLengthS); @@ -180,6 +180,6 @@ from layerIndex, up to (and not including) layerIndex+5. */ void SetTextLayerOutlineProperties( - Scene2DPtr scene, LayerHolderPtr layerHolder, + boost::shared_ptr<Scene2D> scene, boost::shared_ptr<LayerHolder> layerHolder, const char* text, ScenePoint2D p); }
--- a/Framework/Scene2DViewport/MeasureTrackers.cpp Wed May 29 13:40:07 2019 +0200 +++ b/Framework/Scene2DViewport/MeasureTrackers.cpp Wed May 29 13:42:34 2019 +0200 @@ -24,7 +24,7 @@ namespace OrthancStone { - CreateMeasureTracker::CreateMeasureTracker(ViewportControllerWPtr controllerW) + CreateMeasureTracker::CreateMeasureTracker(boost::weak_ptr<ViewportController> controllerW) : controllerW_(controllerW) , alive_(true) , commitResult_(true) @@ -54,7 +54,7 @@ command_->Undo(); } - OrthancStone::Scene2DPtr CreateMeasureTracker::GetScene() + boost::shared_ptr<Scene2D> CreateMeasureTracker::GetScene() { return controllerW_.lock()->GetScene(); }
--- a/Framework/Scene2DViewport/MeasureTrackers.h Wed May 29 13:40:07 2019 +0200 +++ b/Framework/Scene2DViewport/MeasureTrackers.h Wed May 29 13:42:34 2019 +0200 @@ -37,15 +37,15 @@ virtual void Cancel() ORTHANC_OVERRIDE; virtual bool IsAlive() const ORTHANC_OVERRIDE; protected: - CreateMeasureTracker(ViewportControllerWPtr controllerW); + CreateMeasureTracker(boost::weak_ptr<ViewportController> controllerW); ~CreateMeasureTracker(); protected: - CreateMeasureCommandPtr command_; - ViewportControllerWPtr controllerW_; + boost::shared_ptr<CreateMeasureCommand> command_; + boost::weak_ptr<ViewportController> controllerW_; bool alive_; - Scene2DPtr GetScene(); + boost::shared_ptr<Scene2D> GetScene(); private: bool commitResult_;
--- a/Framework/Scene2DViewport/OneGesturePointerTracker.cpp Wed May 29 13:40:07 2019 +0200 +++ b/Framework/Scene2DViewport/OneGesturePointerTracker.cpp Wed May 29 13:42:34 2019 +0200 @@ -28,7 +28,7 @@ namespace OrthancStone { OneGesturePointerTracker::OneGesturePointerTracker( - ViewportControllerWPtr controllerW) + boost::weak_ptr<ViewportController> controllerW) : controllerW_(controllerW) , alive_(true) , currentTouchCount_(1) @@ -62,7 +62,7 @@ return alive_; } - ViewportControllerPtr OneGesturePointerTracker::GetController() + boost::shared_ptr<ViewportController> OneGesturePointerTracker::GetController() { return controllerW_.lock(); }
--- a/Framework/Scene2DViewport/OneGesturePointerTracker.h Wed May 29 13:40:07 2019 +0200 +++ b/Framework/Scene2DViewport/OneGesturePointerTracker.h Wed May 29 13:42:34 2019 +0200 @@ -39,16 +39,16 @@ class OneGesturePointerTracker : public IFlexiblePointerTracker { public: - OneGesturePointerTracker(ViewportControllerWPtr controllerW); + OneGesturePointerTracker(boost::weak_ptr<ViewportController> controllerW); virtual void PointerUp(const PointerEvent& event) ORTHANC_OVERRIDE; virtual void PointerDown(const PointerEvent& event) ORTHANC_OVERRIDE; virtual bool IsAlive() const ORTHANC_OVERRIDE; protected: - ViewportControllerPtr GetController(); + boost::shared_ptr<ViewportController> GetController(); private: - ViewportControllerWPtr controllerW_; + boost::weak_ptr<ViewportController> controllerW_; bool alive_; int currentTouchCount_; };
--- a/Framework/Scene2DViewport/PointerTypes.h Wed May 29 13:40:07 2019 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,83 +0,0 @@ -/** - * Stone of Orthanc - * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics - * Department, University Hospital of Liege, Belgium - * Copyright (C) 2017-2018 Osimis S.A., Belgium - * - * This program is free software: you can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License - * as published by the Free Software Foundation, either version 3 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - **/ - -#pragma once - -#include <boost/shared_ptr.hpp> -#include <boost/weak_ptr.hpp> - -#include <vector> - -namespace OrthancStone -{ - class Scene2D; - typedef boost::shared_ptr<Scene2D> Scene2DPtr; - typedef boost::shared_ptr<const Scene2D> Scene2DConstPtr; - - typedef boost::weak_ptr<Scene2D> Scene2DWPtr; - - class MeasureTool; - typedef boost::shared_ptr<MeasureTool> - MeasureToolPtr; - typedef boost::weak_ptr<MeasureTool> - MeasureToolWPtr; - - class LineMeasureTool; - typedef boost::shared_ptr<LineMeasureTool> - LineMeasureToolPtr; - - class AngleMeasureTool; - typedef boost::shared_ptr<AngleMeasureTool> - AngleMeasureToolPtr; - - class IPointerTracker; - typedef boost::shared_ptr<IPointerTracker> - PointerTrackerPtr; - - class IFlexiblePointerTracker; - typedef boost::shared_ptr<IFlexiblePointerTracker> - FlexiblePointerTrackerPtr; - - typedef boost::shared_ptr<LineMeasureTool> - LineMeasureToolPtr; - - class CreateMeasureCommand; - typedef boost::shared_ptr<CreateMeasureCommand> - CreateMeasureCommandPtr; - - class CreateLineMeasureCommand; - typedef boost::shared_ptr<CreateLineMeasureCommand> - CreateLineMeasureCommandPtr; - - class CreateAngleMeasureCommand; - typedef boost::shared_ptr<CreateAngleMeasureCommand> - CreateAngleMeasureCommandPtr; - - class TrackerCommand; - typedef boost::shared_ptr<TrackerCommand> TrackerCommandPtr; - - class ViewportController; - typedef boost::shared_ptr<ViewportController> ViewportControllerPtr; - typedef boost::shared_ptr<const ViewportController> ViewportControllerConstPtr; - typedef boost::weak_ptr<ViewportController> ViewportControllerWPtr; - - class LayerHolder; - typedef boost::shared_ptr<LayerHolder> LayerHolderPtr; -}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Framework/Scene2DViewport/PredeclaredTypes.h Wed May 29 13:42:34 2019 +0200 @@ -0,0 +1,41 @@ +/** + * Stone of Orthanc + * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics + * Department, University Hospital of Liege, Belgium + * Copyright (C) 2017-2018 Osimis S.A., Belgium + * + * This program is free software: you can redistribute it and/or + * modify it under the terms of the GNU Affero General Public License + * as published by the Free Software Foundation, either version 3 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + **/ + +#pragma once + +#include <boost/shared_ptr.hpp> +#include <boost/weak_ptr.hpp> + +namespace OrthancStone + +{ + class Scene2D; + class MeasureTool; + class LineMeasureTool; + class AngleMeasureTool; + class IPointerTracker; + class IFlexiblePointerTracker; + class CreateMeasureCommand; + class CreateLineMeasureCommand; + class CreateAngleMeasureCommand; + class TrackerCommand; + class ViewportController; + class LayerHolder; +}
--- a/Framework/Scene2DViewport/ViewportController.cpp Wed May 29 13:40:07 2019 +0200 +++ b/Framework/Scene2DViewport/ViewportController.cpp Wed May 29 13:42:34 2019 +0200 @@ -35,12 +35,12 @@ scene_ = boost::make_shared<Scene2D>(); } - Scene2DConstPtr ViewportController::GetScene() const + boost::shared_ptr<const Scene2D> ViewportController::GetScene() const { return scene_; } - Scene2DPtr ViewportController::GetScene() + boost::shared_ptr<Scene2D> ViewportController::GetScene() { return scene_; } @@ -50,10 +50,10 @@ throw StoneException(ErrorCode_NotImplemented); } - std::vector<MeasureToolPtr> ViewportController::HitTestMeasureTools( + std::vector<boost::shared_ptr<MeasureTool>> ViewportController::HitTestMeasureTools( ScenePoint2D p) { - std::vector<MeasureToolPtr> ret; + std::vector<boost::shared_ptr<MeasureTool>> ret; for (size_t i = 0; i < measureTools_.size(); ++i) { @@ -91,7 +91,7 @@ BroadcastMessage(SceneTransformChanged(*this)); } - void ViewportController::PushCommand(TrackerCommandPtr command) + void ViewportController::PushCommand(boost::shared_ptr<TrackerCommand> command) { commandStack_.erase( commandStack_.begin() + numAppliedCommands_, @@ -127,14 +127,14 @@ return numAppliedCommands_ < commandStack_.size(); } - void ViewportController::AddMeasureTool(MeasureToolPtr measureTool) + void ViewportController::AddMeasureTool(boost::shared_ptr<MeasureTool> measureTool) { ORTHANC_ASSERT(std::find(measureTools_.begin(), measureTools_.end(), measureTool) == measureTools_.end(), "Duplicate measure tool"); measureTools_.push_back(measureTool); } - void ViewportController::RemoveMeasureTool(MeasureToolPtr measureTool) + void ViewportController::RemoveMeasureTool(boost::shared_ptr<MeasureTool> measureTool) { ORTHANC_ASSERT(std::find(measureTools_.begin(), measureTools_.end(), measureTool) != measureTools_.end(), "Measure tool not found");
--- a/Framework/Scene2DViewport/ViewportController.h Wed May 29 13:40:07 2019 +0200 +++ b/Framework/Scene2DViewport/ViewportController.h Wed May 29 13:42:34 2019 +0200 @@ -20,7 +20,7 @@ #pragma once -#include "PointerTypes.h" +#include "PredeclaredTypes.h" #include "../Scene2D/Scene2D.h" #include "../Scene2D/PointerEvent.h" @@ -73,8 +73,8 @@ ViewportController(MessageBroker& broker); - Scene2DConstPtr GetScene() const; - Scene2DPtr GetScene(); + boost::shared_ptr<const Scene2D> GetScene() const; + boost::shared_ptr<Scene2D> GetScene(); /** This method is called by the GUI system and should update/delete the @@ -87,13 +87,13 @@ (in scene coords). A tracker can then be requested from the chosen measure tool, if needed */ - std::vector<MeasureToolPtr> HitTestMeasureTools(ScenePoint2D p); + std::vector<boost::shared_ptr<MeasureTool>> HitTestMeasureTools(ScenePoint2D p); /** With this method, the object takes ownership of the supplied tracker and updates it according to user interaction */ - void SetActiveTracker(FlexiblePointerTrackerPtr tracker); + void SetActiveTracker(boost::shared_ptr<IFlexiblePointerTracker> tracker); /** Forwarded to the underlying scene */ const AffineTransform2D& GetCanvasToSceneTransform() const; @@ -115,7 +115,7 @@ In other words, when a new command is pushed, all the undone (and not redone) commands are removed. */ - void PushCommand(TrackerCommandPtr command); + void PushCommand(boost::shared_ptr<TrackerCommand> command); /** Undoes the command at the top of the undo stack, or throws if there is no @@ -138,10 +138,10 @@ bool CanRedo() const; /** Adds a new measure tool */ - void AddMeasureTool(MeasureToolPtr measureTool); + void AddMeasureTool(boost::shared_ptr<MeasureTool> measureTool); /** Removes a measure tool or throws if it cannot be found */ - void RemoveMeasureTool(MeasureToolPtr measureTool); + void RemoveMeasureTool(boost::shared_ptr<MeasureTool> measureTool); /** The square handle side length in *scene* coordinates @@ -172,7 +172,7 @@ private: double GetCanvasToSceneFactor() const; - std::vector<TrackerCommandPtr> commandStack_; + std::vector<boost::shared_ptr<TrackerCommand>> commandStack_; /** This is always between >= 0 and <= undoStack_.size() and gives the @@ -181,9 +181,9 @@ - If numAppliedCommands_ < numAppliedCommands_.size(), one can redo */ size_t numAppliedCommands_; - std::vector<MeasureToolPtr> measureTools_; - Scene2DPtr scene_; - FlexiblePointerTrackerPtr tracker_; + std::vector<boost::shared_ptr<MeasureTool>> measureTools_; + boost::shared_ptr<Scene2D> scene_; + boost::shared_ptr<IFlexiblePointerTracker> tracker_; // this is cached mutable double canvasToSceneFactor_;
--- a/Resources/CMake/OrthancStoneConfiguration.cmake Wed May 29 13:40:07 2019 +0200 +++ b/Resources/CMake/OrthancStoneConfiguration.cmake Wed May 29 13:42:34 2019 +0200 @@ -476,7 +476,7 @@ ${ORTHANC_STONE_ROOT}/Framework/Scene2DViewport/MeasureTrackers.h ${ORTHANC_STONE_ROOT}/Framework/Scene2DViewport/OneGesturePointerTracker.cpp ${ORTHANC_STONE_ROOT}/Framework/Scene2DViewport/OneGesturePointerTracker.h - ${ORTHANC_STONE_ROOT}/Framework/Scene2DViewport/PointerTypes.h + ${ORTHANC_STONE_ROOT}/Framework/Scene2DViewport/PredeclaredTypes.h ${ORTHANC_STONE_ROOT}/Framework/Scene2DViewport/ViewportController.cpp ${ORTHANC_STONE_ROOT}/Framework/Scene2DViewport/ViewportController.h ${ORTHANC_STONE_ROOT}/Framework/StoneEnumerations.cpp
--- a/Samples/Sdl/BasicScene.cpp Wed May 29 13:40:07 2019 +0200 +++ b/Samples/Sdl/BasicScene.cpp Wed May 29 13:42:34 2019 +0200 @@ -49,10 +49,9 @@ static const unsigned int FONT_SIZE = 32; static const int LAYER_POSITION = 150; -using namespace OrthancStone; - -void PrepareScene(ViewportControllerPtr controller) +void PrepareScene(boost::shared_ptr<OrthancStone::ViewportController> controller) { + using namespace OrthancStone; Scene2D& scene(*controller->GetScene()); // Texture of 2x2 size { @@ -141,10 +140,11 @@ void TakeScreenshot(const std::string& target, - const Scene2D& scene, + const OrthancStone::Scene2D& scene, unsigned int canvasWidth, unsigned int canvasHeight) { + using namespace OrthancStone; // Take a screenshot, then save it as PNG file CairoCompositor compositor(scene, canvasWidth, canvasHeight); compositor.SetFont(0, Orthanc::EmbeddedResources::UBUNTU_FONT, FONT_SIZE, Orthanc::Encoding_Latin1); @@ -161,11 +161,12 @@ } -void HandleApplicationEvent(ViewportControllerPtr controller, - const OpenGLCompositor& compositor, +void HandleApplicationEvent(boost::shared_ptr<OrthancStone::ViewportController> controller, + const OrthancStone::OpenGLCompositor& compositor, const SDL_Event& event, - FlexiblePointerTrackerPtr& activeTracker) + boost::shared_ptr<OrthancStone::IFlexiblePointerTracker>& activeTracker) { + using namespace OrthancStone; Scene2D& scene(*controller->GetScene()); if (event.type == SDL_MOUSEMOTION) { @@ -275,8 +276,9 @@ } -void Run(ViewportControllerPtr controller) +void Run(boost::shared_ptr<OrthancStone::ViewportController> controller) { + using namespace OrthancStone; SdlOpenGLWindow window("Hello", 1024, 768); controller->FitContent(window.GetCanvasWidth(), window.GetCanvasHeight()); @@ -288,7 +290,7 @@ compositor.SetFont(0, Orthanc::EmbeddedResources::UBUNTU_FONT, FONT_SIZE, Orthanc::Encoding_Latin1); - FlexiblePointerTrackerPtr tracker; + boost::shared_ptr<IFlexiblePointerTracker> tracker; bool stop = false; while (!stop) @@ -367,13 +369,14 @@ **/ int main(int argc, char* argv[]) { + using namespace OrthancStone; StoneInitialize(); Orthanc::Logging::EnableInfoLevel(true); try { MessageBroker broker; - ViewportControllerPtr controller = boost::make_shared<ViewportController>( + boost::shared_ptr<ViewportController> controller = boost::make_shared<ViewportController>( boost::ref(broker)); PrepareScene(controller); Run(controller);
--- a/Samples/Sdl/TrackerSample.cpp Wed May 29 13:40:07 2019 +0200 +++ b/Samples/Sdl/TrackerSample.cpp Wed May 29 13:42:34 2019 +0200 @@ -48,18 +48,11 @@ */ - -using namespace Orthanc; -using namespace OrthancStone; - - - - -boost::weak_ptr<TrackerSampleApp> g_app; +boost::weak_ptr<OrthancStone::TrackerSampleApp> g_app; void TrackerSample_SetInfoDisplayMessage(std::string key, std::string value) { - boost::shared_ptr<TrackerSampleApp> app = g_app.lock(); + boost::shared_ptr<OrthancStone::TrackerSampleApp> app = g_app.lock(); if (app) { app->SetInfoDisplayMessage(key, value); @@ -73,6 +66,8 @@ **/ int main(int argc, char* argv[]) { + using namespace OrthancStone; + StoneInitialize(); Orthanc::Logging::EnableInfoLevel(true); // Orthanc::Logging::EnableTraceLevel(true);
--- a/Samples/Sdl/TrackerSampleApp.cpp Wed May 29 13:40:07 2019 +0200 +++ b/Samples/Sdl/TrackerSampleApp.cpp Wed May 29 13:42:34 2019 +0200 @@ -46,8 +46,6 @@ #include <stdio.h> -using namespace Orthanc; - namespace OrthancStone { const char* MeasureToolToString(size_t i) @@ -69,12 +67,12 @@ return descs[i]; } - Scene2DPtr TrackerSampleApp::GetScene() + boost::shared_ptr<Scene2D> TrackerSampleApp::GetScene() { return controller_->GetScene(); } - Scene2DConstPtr TrackerSampleApp::GetScene() const + boost::shared_ptr<const Scene2D> TrackerSampleApp::GetScene() const { return controller_->GetScene(); } @@ -201,7 +199,7 @@ case 0: // line measure { - CreateLineMeasureCommandPtr cmd = + boost::shared_ptr<CreateLineMeasureCommand> cmd = boost::make_shared<CreateLineMeasureCommand>( boost::ref(IObserver::GetBroker()), controller_, @@ -213,7 +211,7 @@ case 1: // angle measure { - CreateAngleMeasureCommandPtr cmd = + boost::shared_ptr<CreateAngleMeasureCommand> cmd = boost::make_shared<CreateAngleMeasureCommand>( boost::ref(IObserver::GetBroker()), controller_, @@ -382,18 +380,20 @@ DisplayInfoText(); } - FlexiblePointerTrackerPtr TrackerSampleApp::CreateSuitableTracker( + boost::shared_ptr<IFlexiblePointerTracker> TrackerSampleApp::CreateSuitableTracker( const SDL_Event & event, const PointerEvent & e) { + using namespace Orthanc; + switch (event.button.button) { case SDL_BUTTON_MIDDLE: - return FlexiblePointerTrackerPtr(new PanSceneTracker + return boost::shared_ptr<IFlexiblePointerTracker>(new PanSceneTracker (controller_, e)); case SDL_BUTTON_RIGHT: - return FlexiblePointerTrackerPtr(new ZoomSceneTracker + return boost::shared_ptr<IFlexiblePointerTracker>(new ZoomSceneTracker (controller_, e, compositor_->GetCanvasHeight())); case SDL_BUTTON_LEFT: @@ -406,7 +406,7 @@ // TODO: if there are conflicts, we should prefer a tracker that // pertains to the type of measuring tool currently selected (TBD?) - FlexiblePointerTrackerPtr hitTestTracker = TrackerHitTest(e); + boost::shared_ptr<IFlexiblePointerTracker> hitTestTracker = TrackerHitTest(e); if (hitTestTracker != NULL) { @@ -419,13 +419,13 @@ { case GuiTool_Rotate: //LOG(TRACE) << "Creating RotateSceneTracker"; - return FlexiblePointerTrackerPtr(new RotateSceneTracker( + return boost::shared_ptr<IFlexiblePointerTracker>(new RotateSceneTracker( controller_, e)); case GuiTool_Pan: - return FlexiblePointerTrackerPtr(new PanSceneTracker( + return boost::shared_ptr<IFlexiblePointerTracker>(new PanSceneTracker( controller_, e)); case GuiTool_Zoom: - return FlexiblePointerTrackerPtr(new ZoomSceneTracker( + return boost::shared_ptr<IFlexiblePointerTracker>(new ZoomSceneTracker( controller_, e, compositor_->GetCanvasHeight())); //case GuiTool_AngleMeasure: // return new AngleMeasureTracker(GetScene(), e); @@ -434,24 +434,24 @@ //case GuiTool_EllipseMeasure: // return new EllipseMeasureTracker(GetScene(), e); case GuiTool_LineMeasure: - return FlexiblePointerTrackerPtr(new CreateLineMeasureTracker( + return boost::shared_ptr<IFlexiblePointerTracker>(new CreateLineMeasureTracker( IObserver::GetBroker(), controller_, e)); case GuiTool_AngleMeasure: - return FlexiblePointerTrackerPtr(new CreateAngleMeasureTracker( + return boost::shared_ptr<IFlexiblePointerTracker>(new CreateAngleMeasureTracker( IObserver::GetBroker(), controller_, e)); case GuiTool_CircleMeasure: LOG(ERROR) << "Not implemented yet!"; - return FlexiblePointerTrackerPtr(); + return boost::shared_ptr<IFlexiblePointerTracker>(); case GuiTool_EllipseMeasure: LOG(ERROR) << "Not implemented yet!"; - return FlexiblePointerTrackerPtr(); + return boost::shared_ptr<IFlexiblePointerTracker>(); default: throw OrthancException(ErrorCode_InternalError, "Wrong tool!"); } } } default: - return FlexiblePointerTrackerPtr(); + return boost::shared_ptr<IFlexiblePointerTracker>(); } } @@ -459,7 +459,7 @@ TrackerSampleApp::TrackerSampleApp(MessageBroker& broker) : IObserver(broker) , currentTool_(GuiTool_Rotate) { - controller_ = ViewportControllerPtr(new ViewportController(broker)); + controller_ = boost::shared_ptr<ViewportController>(new ViewportController(broker)); controller_->RegisterObserverCallback( new Callable<TrackerSampleApp, ViewportController::SceneTransformChanged> @@ -590,10 +590,10 @@ } - FlexiblePointerTrackerPtr TrackerSampleApp::TrackerHitTest(const PointerEvent & e) + boost::shared_ptr<IFlexiblePointerTracker> TrackerSampleApp::TrackerHitTest(const PointerEvent & e) { - // std::vector<MeasureToolPtr> measureTools_; - return FlexiblePointerTrackerPtr(); + // std::vector<boost::shared_ptr<MeasureTool>> measureTools_; + return boost::shared_ptr<IFlexiblePointerTracker>(); } static void GLAPIENTRY
--- a/Samples/Sdl/TrackerSampleApp.h Wed May 29 13:40:07 2019 +0200 +++ b/Samples/Sdl/TrackerSampleApp.h Wed May 29 13:42:34 2019 +0200 @@ -23,7 +23,7 @@ #include "../../Framework/Scene2D/OpenGLCompositor.h" #include "../../Framework/Scene2DViewport/IFlexiblePointerTracker.h" #include "../../Framework/Scene2DViewport/MeasureTool.h" -#include "../../Framework/Scene2DViewport/PointerTypes.h" +#include "../../Framework/Scene2DViewport/PredeclaredTypes.h" #include "../../Framework/Scene2DViewport/ViewportController.h" #include <SDL.h> @@ -64,8 +64,8 @@ void SetInfoDisplayMessage(std::string key, std::string value); void DisableTracker(); - Scene2DPtr GetScene(); - Scene2DConstPtr GetScene() const; + boost::shared_ptr<Scene2D> GetScene(); + boost::shared_ptr<const Scene2D> GetScene() const; void HandleApplicationEvent(const SDL_Event& event); @@ -86,9 +86,9 @@ */ ScenePoint2D GetRandomPointInScene() const; - FlexiblePointerTrackerPtr TrackerHitTest(const PointerEvent& e); + boost::shared_ptr<IFlexiblePointerTracker> TrackerHitTest(const PointerEvent& e); - FlexiblePointerTrackerPtr CreateSuitableTracker( + boost::shared_ptr<IFlexiblePointerTracker> CreateSuitableTracker( const SDL_Event& event, const PointerEvent& e); @@ -100,7 +100,7 @@ /** This adds the command at the top of the undo stack */ - void Commit(TrackerCommandPtr cmd); + void Commit(boost::shared_ptr<TrackerCommand> cmd); void Undo(); void Redo(); @@ -115,10 +115,10 @@ WARNING: the measuring tools do store a reference to the scene, and it paramount that the scene gets destroyed AFTER the measurement tools. */ - ViewportControllerPtr controller_; + boost::shared_ptr<ViewportController> controller_; std::map<std::string, std::string> infoTextMap_; - FlexiblePointerTrackerPtr activeTracker_; + boost::shared_ptr<IFlexiblePointerTracker> activeTracker_; //static const int LAYER_POSITION = 150;