changeset 2372:6de9b26f7811 refactoring

fix build on older compilers
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 08 Oct 2026 20:13:01 +0200
parents 3644864d95ad
children 8ec75d7efdee
files OrthancStone/Sources/Scene2DViewport/AngleMeasureTool.cpp OrthancStone/Sources/Scene2DViewport/LineMeasureTool.cpp OrthancStone/Sources/Scene2DViewport/MeasureTool.cpp OrthancStone/Sources/Scene2DViewport/MeasureToolsToolbox.cpp OrthancStone/Sources/Scene2DViewport/ViewportController.h
diffstat 5 files changed, 21 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancStone/Sources/Scene2DViewport/AngleMeasureTool.cpp	Thu Oct 08 19:52:31 2026 +0200
+++ b/OrthancStone/Sources/Scene2DViewport/AngleMeasureTool.cpp	Thu Oct 08 20:13:01 2026 +0200
@@ -72,11 +72,13 @@
         std::unique_ptr<IViewport::ILock> lock(sharedViewport->Lock());
         if (isCreation)
         {
-          lock->GetController().PushCommand(boost::make_shared<CreateMeasureCommand>(lock->GetController(), boost::dynamic_pointer_cast<MeasureTool>(tool_)));
+          boost::shared_ptr<MeasureCommand> command(new CreateMeasureCommand(lock->GetController(), tool_));
+          lock->GetController().PushCommand(command);
         }
         else
         {
-          editCommand_ = boost::make_shared<EditMeasureCommand>(lock->GetController(), boost::dynamic_pointer_cast<MeasureTool>(tool_));
+          boost::shared_ptr<EditMeasureCommand> command(new EditMeasureCommand(lock->GetController(), tool_));
+          editCommand_ = command;
         }
       }
     }
--- a/OrthancStone/Sources/Scene2DViewport/LineMeasureTool.cpp	Thu Oct 08 19:52:31 2026 +0200
+++ b/OrthancStone/Sources/Scene2DViewport/LineMeasureTool.cpp	Thu Oct 08 20:13:01 2026 +0200
@@ -70,11 +70,13 @@
         std::unique_ptr<IViewport::ILock> lock(sharedViewport->Lock());
         if (isCreation)
         {
-          lock->GetController().PushCommand(boost::make_shared<CreateMeasureCommand>(lock->GetController(), boost::dynamic_pointer_cast<MeasureTool>(tool_)));
+          boost::shared_ptr<MeasureCommand> command(new CreateMeasureCommand(lock->GetController(), tool_));
+          lock->GetController().PushCommand(command);
         }
         else
         {
-          editCommand_ = boost::make_shared<EditMeasureCommand>(lock->GetController(), boost::dynamic_pointer_cast<MeasureTool>(tool_));
+          boost::shared_ptr<EditMeasureCommand> command(new EditMeasureCommand(lock->GetController(), tool_));
+          editCommand_ = command;
         }
       }
     }
--- a/OrthancStone/Sources/Scene2DViewport/MeasureTool.cpp	Thu Oct 08 19:52:31 2026 +0200
+++ b/OrthancStone/Sources/Scene2DViewport/MeasureTool.cpp	Thu Oct 08 20:13:01 2026 +0200
@@ -20,16 +20,16 @@
  * <http://www.gnu.org/licenses/>.
  **/
 
+
 #include "MeasureTool.h"
 
+#include "../Viewport/IViewport.h"
+
 #include <Logging.h>
 #include <Enumerations.h>
 #include <OrthancException.h>
 
 #include <boost/shared_ptr.hpp>
-#include <boost/math/constants/constants.hpp>
-
-#include "../Viewport/IViewport.h"
 
 namespace OrthancStone
 {
--- a/OrthancStone/Sources/Scene2DViewport/MeasureToolsToolbox.cpp	Thu Oct 08 19:52:31 2026 +0200
+++ b/OrthancStone/Sources/Scene2DViewport/MeasureToolsToolbox.cpp	Thu Oct 08 20:13:01 2026 +0200
@@ -21,19 +21,20 @@
  **/
 
 #include "MeasureToolsToolbox.h"
+
+#include "../Scene2D/Scene2D.h"
+#include "../Scene2D/TextSceneLayer.h"
+#include "../StoneException.h"
 #include "LayerHolder.h"
-#include "ViewportController.h"
-
-#include "../Scene2D/TextSceneLayer.h"
-#include "../Scene2D/Scene2D.h"
-#include "../StoneException.h"
 
 #include <boost/math/constants/constants.hpp>
 
-namespace
-{
-  double g_pi = boost::math::constants::pi<double>();
-}
+
+static const double g_pi = boost::math::constants::pi<double>();
+static const uint8_t TEXT_COLOR_RED = 0;
+static const uint8_t TEXT_COLOR_GREEN = 223;
+static const uint8_t TEXT_COLOR_BLUE = 81;
+
 
 namespace OrthancStone
 {
--- a/OrthancStone/Sources/Scene2DViewport/ViewportController.h	Thu Oct 08 19:52:31 2026 +0200
+++ b/OrthancStone/Sources/Scene2DViewport/ViewportController.h	Thu Oct 08 20:13:01 2026 +0200
@@ -44,10 +44,6 @@
   const double HANDLE_SIDE_LENGTH_CANVAS_COORD = 10.0;
   const double HIT_TEST_MAX_DISTANCE_CANVAS_COORD = 15.0;
 
-  const uint8_t TEXT_COLOR_RED = 0;
-  const uint8_t TEXT_COLOR_GREEN = 223;
-  const uint8_t TEXT_COLOR_BLUE = 81;
-
   const uint8_t TOOL_ANGLE_LINES_COLOR_RED = 0;
   const uint8_t TOOL_ANGLE_LINES_COLOR_GREEN = 183;
   const uint8_t TOOL_ANGLE_LINES_COLOR_BLUE = 17;