# HG changeset patch # User Sebastien Jodogne # Date 1791471690 -7200 # Node ID 77f819365bb2359addb365a182623a183bed32a8 # Parent 23acf5a24806cc6e6e245c8c223b3ee1b9be9730 removed useless files diff -r 23acf5a24806 -r 77f819365bb2 OrthancStone/Resources/CMake/OrthancStoneConfiguration.cmake --- a/OrthancStone/Resources/CMake/OrthancStoneConfiguration.cmake Thu Oct 08 16:57:36 2026 +0200 +++ b/OrthancStone/Resources/CMake/OrthancStoneConfiguration.cmake Thu Oct 08 17:01:30 2026 +0200 @@ -323,13 +323,9 @@ ${ORTHANC_STONE_ROOT}/Scene2DViewport/BaseFlexiblePointerTracker.cpp #${ORTHANC_STONE_ROOT}/Scene2DViewport/CreateAngleMeasureCommand.cpp #${ORTHANC_STONE_ROOT}/Scene2DViewport/CreateAngleMeasureTracker.cpp - #${ORTHANC_STONE_ROOT}/Scene2DViewport/CreateLineMeasureCommand.cpp - #${ORTHANC_STONE_ROOT}/Scene2DViewport/CreateLineMeasureTracker.cpp #${ORTHANC_STONE_ROOT}/Scene2DViewport/CreateMeasureTracker.cpp ${ORTHANC_STONE_ROOT}/Scene2DViewport/EditAngleMeasureCommand.cpp ${ORTHANC_STONE_ROOT}/Scene2DViewport/EditAngleMeasureTracker.cpp - ${ORTHANC_STONE_ROOT}/Scene2DViewport/EditLineMeasureCommand.cpp - ${ORTHANC_STONE_ROOT}/Scene2DViewport/EditLineMeasureTracker.cpp ${ORTHANC_STONE_ROOT}/Scene2DViewport/LayerHolder.cpp ${ORTHANC_STONE_ROOT}/Scene2DViewport/LineMeasureTool.cpp ${ORTHANC_STONE_ROOT}/Scene2DViewport/MeasureCommands.cpp diff -r 23acf5a24806 -r 77f819365bb2 OrthancStone/Sources/Scene2DViewport/CreateLineMeasureCommand.cpp --- a/OrthancStone/Sources/Scene2DViewport/CreateLineMeasureCommand.cpp Thu Oct 08 16:57:36 2026 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,48 +0,0 @@ -/** - * Stone of Orthanc - * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics - * Department, University Hospital of Liege, Belgium - * Copyright (C) 2017-2023 Osimis S.A., Belgium - * Copyright (C) 2021-2026 Sebastien Jodogne, ICTEAM UCLouvain, Belgium - * - * This program is free software: you can redistribute it and/or - * modify it under the terms of the GNU Lesser 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this program. If not, see - * . - **/ - -#include "CreateLineMeasureCommand.h" - -#include -#include - -namespace OrthancStone -{ - CreateLineMeasureCommand::CreateLineMeasureCommand( - boost::weak_ptr viewport, - ScenePoint2D point) - : CreateMeasureCommand(viewport) - , measureTool_(LineMeasureTool::Create(viewport)) - { - - std::unique_ptr lock(GetViewportLock()); - ViewportController& controller = lock->GetController(); - controller.AddMeasureTool(measureTool_); - measureTool_->Set(point, point); - lock->Invalidate(); - } - - void CreateLineMeasureCommand::SetEnd(ScenePoint2D scenePos) - { - measureTool_->SetEnd(scenePos); - } -} diff -r 23acf5a24806 -r 77f819365bb2 OrthancStone/Sources/Scene2DViewport/CreateLineMeasureCommand.h --- a/OrthancStone/Sources/Scene2DViewport/CreateLineMeasureCommand.h Thu Oct 08 16:57:36 2026 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +0,0 @@ -/** - * Stone of Orthanc - * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics - * Department, University Hospital of Liege, Belgium - * Copyright (C) 2017-2023 Osimis S.A., Belgium - * Copyright (C) 2021-2026 Sebastien Jodogne, ICTEAM UCLouvain, Belgium - * - * This program is free software: you can redistribute it and/or - * modify it under the terms of the GNU Lesser 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this program. If not, see - * . - **/ -#pragma once - -#include "MeasureCommands.h" - -namespace OrthancStone -{ - class CreateLineMeasureCommand : public CreateMeasureCommand - { - public: - CreateLineMeasureCommand( - boost::weak_ptr viewport, - ScenePoint2D point); - - // the starting position is set in the ctor - void SetEnd(ScenePoint2D scenePos); - - private: - virtual boost::shared_ptr GetMeasureTool() ORTHANC_OVERRIDE - { - return measureTool_; - } - boost::shared_ptr measureTool_; - }; -} - - diff -r 23acf5a24806 -r 77f819365bb2 OrthancStone/Sources/Scene2DViewport/CreateLineMeasureTracker.cpp --- a/OrthancStone/Sources/Scene2DViewport/CreateLineMeasureTracker.cpp Thu Oct 08 16:57:36 2026 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,100 +0,0 @@ -/** - * Stone of Orthanc - * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics - * Department, University Hospital of Liege, Belgium - * Copyright (C) 2017-2023 Osimis S.A., Belgium - * Copyright (C) 2021-2026 Sebastien Jodogne, ICTEAM UCLouvain, Belgium - * - * This program is free software: you can redistribute it and/or - * modify it under the terms of the GNU Lesser 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this program. If not, see - * . - **/ - -#include "CreateLineMeasureTracker.h" -#include "CreateLineMeasureCommand.h" - -#include - -namespace OrthancStone -{ - CreateLineMeasureTracker::CreateLineMeasureTracker( - boost::weak_ptr viewport, - const PointerEvent& e) - : CreateMeasureTracker(viewport) - { - ScenePoint2D point; - - { - std::unique_ptr lock(GetViewportLock()); - ViewportController& controller = lock->GetController(); - point = e.GetMainPosition().Apply(controller.GetScene().GetCanvasToSceneTransform()); - } - - command_.reset(new CreateLineMeasureCommand(viewport, point)); - } - - CreateLineMeasureTracker::~CreateLineMeasureTracker() - { - - } - - bool CreateLineMeasureTracker::PointerMove(const PointerEvent& event, - Scene2D& scene) - { - if (!alive_) - { - throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError, - "Internal error: wrong state in CreateLineMeasureTracker::" - "PointerMove: active_ == false"); - } - - std::unique_ptr lock(GetViewportLock()); - ViewportController& controller = lock->GetController(); - - ScenePoint2D scenePos = event.GetMainPosition().Apply( - controller.GetScene().GetCanvasToSceneTransform()); - - //LOG(TRACE) << "scenePos.GetX() = " << scenePos.GetX() << " " << - // "scenePos.GetY() = " << scenePos.GetY(); - - /*CreateLineMeasureTracker* concreteThis = - dynamic_cast(this); - assert(concreteThis != NULL);*/ - - GetCommand()->SetEnd(scenePos); - return true; - } - - void CreateLineMeasureTracker::PointerUp(const PointerEvent& e, - Scene2D& scene) - { - // TODO: the current app does not prevent multiple PointerDown AND - // PointerUp to be sent to the tracker. - // Unless we augment the PointerEvent structure with the button index, - // we cannot really tell if this pointer up event matches the initial - // pointer down event. Let's make it simple for now. - alive_ = false; - } - - void CreateLineMeasureTracker::PointerDown(const PointerEvent& e, - Scene2D& scene) - { - LOG(WARNING) << "Additional touches (fingers, pen, mouse buttons...) " - "are ignored when the line measure creation tracker is active"; - } - - boost::shared_ptr CreateLineMeasureTracker::GetCommand() - { - return boost::dynamic_pointer_cast(command_); - } -} diff -r 23acf5a24806 -r 77f819365bb2 OrthancStone/Sources/Scene2DViewport/CreateLineMeasureTracker.h --- a/OrthancStone/Sources/Scene2DViewport/CreateLineMeasureTracker.h Thu Oct 08 16:57:36 2026 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,61 +0,0 @@ -/** - * Stone of Orthanc - * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics - * Department, University Hospital of Liege, Belgium - * Copyright (C) 2017-2023 Osimis S.A., Belgium - * Copyright (C) 2021-2026 Sebastien Jodogne, ICTEAM UCLouvain, Belgium - * - * This program is free software: you can redistribute it and/or - * modify it under the terms of the GNU Lesser 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this program. If not, see - * . - **/ - -#pragma once - -#include "CreateLineMeasureCommand.h" -#include "MeasureTrackers.h" - -#include -#include - -namespace OrthancStone -{ - class CreateLineMeasureTracker : public CreateMeasureTracker - { - public: - /** - When you create this tracker, you need to supply it with the undo stack - where it will store the commands that perform the actual measure tool - creation and modification. - In turn, a container for these commands to store the actual measuring - must be supplied, too - */ - CreateLineMeasureTracker( - boost::weak_ptr viewport, - const PointerEvent& e); - - ~CreateLineMeasureTracker(); - - virtual bool PointerMove(const PointerEvent& e, - Scene2D& scene) ORTHANC_OVERRIDE; - - virtual void PointerUp(const PointerEvent& e, - Scene2D& scene) ORTHANC_OVERRIDE; - - virtual void PointerDown(const PointerEvent& e, - Scene2D& scene) ORTHANC_OVERRIDE; - - private: - boost::shared_ptr GetCommand(); - }; -} diff -r 23acf5a24806 -r 77f819365bb2 OrthancStone/Sources/Scene2DViewport/EditLineMeasureCommand.cpp --- a/OrthancStone/Sources/Scene2DViewport/EditLineMeasureCommand.cpp Thu Oct 08 16:57:36 2026 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,46 +0,0 @@ -/** - * Stone of Orthanc - * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics - * Department, University Hospital of Liege, Belgium - * Copyright (C) 2017-2023 Osimis S.A., Belgium - * Copyright (C) 2021-2026 Sebastien Jodogne, ICTEAM UCLouvain, Belgium - * - * This program is free software: you can redistribute it and/or - * modify it under the terms of the GNU Lesser 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this program. If not, see - * . - **/ - -#include "EditLineMeasureCommand.h" - -namespace OrthancStone -{ - EditLineMeasureCommand::EditLineMeasureCommand(const boost::shared_ptr& measureTool, - boost::weak_ptr viewport) : - EditMeasureCommand(measureTool, viewport) - { - } - - - void EditLineMeasureCommand::SetStart(ScenePoint2D scenePos) - { - dynamic_cast(GetMeasureTool()).SetStart(scenePos); - SetMementoModified(GetMeasureTool().CreateMemento()); - } - - - void EditLineMeasureCommand::SetEnd(ScenePoint2D scenePos) - { - dynamic_cast(GetMeasureTool()).SetEnd(scenePos); - SetMementoModified(GetMeasureTool().CreateMemento()); - } -} diff -r 23acf5a24806 -r 77f819365bb2 OrthancStone/Sources/Scene2DViewport/EditLineMeasureCommand.h --- a/OrthancStone/Sources/Scene2DViewport/EditLineMeasureCommand.h Thu Oct 08 16:57:36 2026 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,37 +0,0 @@ -/** - * Stone of Orthanc - * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics - * Department, University Hospital of Liege, Belgium - * Copyright (C) 2017-2023 Osimis S.A., Belgium - * Copyright (C) 2021-2026 Sebastien Jodogne, ICTEAM UCLouvain, Belgium - * - * This program is free software: you can redistribute it and/or - * modify it under the terms of the GNU Lesser 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this program. If not, see - * . - **/ -#pragma once - -#include "MeasureCommands.h" - -namespace OrthancStone -{ - class EditLineMeasureCommand : public EditMeasureCommand - { - public: - EditLineMeasureCommand(const boost::shared_ptr& measureTool, - boost::weak_ptr viewport); - - void SetStart(ScenePoint2D scenePos); - void SetEnd(ScenePoint2D scenePos); - }; -} diff -r 23acf5a24806 -r 77f819365bb2 OrthancStone/Sources/Scene2DViewport/EditLineMeasureTracker.cpp --- a/OrthancStone/Sources/Scene2DViewport/EditLineMeasureTracker.cpp Thu Oct 08 16:57:36 2026 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,116 +0,0 @@ -/** - * Stone of Orthanc - * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics - * Department, University Hospital of Liege, Belgium - * Copyright (C) 2017-2023 Osimis S.A., Belgium - * Copyright (C) 2021-2026 Sebastien Jodogne, ICTEAM UCLouvain, Belgium - * - * This program is free software: you can redistribute it and/or - * modify it under the terms of the GNU Lesser 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this program. If not, see - * . - **/ - -#include "EditLineMeasureTracker.h" -#include "EditLineMeasureCommand.h" - -#include "../StoneException.h" - - -namespace OrthancStone -{ - EditLineMeasureTracker::EditLineMeasureTracker( - boost::shared_ptr measureTool, - boost::weak_ptr viewport, - const PointerEvent& e) - : EditMeasureTracker(viewport, e) - { - ScenePoint2D scenePos; - - { - std::unique_ptr lock(GetViewportLock()); - const Scene2D& scene = lock->GetController().GetScene(); - scenePos = e.GetMainPosition().Apply(scene.GetCanvasToSceneTransform()); - } - - modifiedZone_ = dynamic_cast(*measureTool).LineHitTest(scenePos); - command_.reset(new EditLineMeasureCommand(measureTool, viewport)); - } - - bool EditLineMeasureTracker::PointerMove(const PointerEvent& e, - Scene2D& scene) - { - std::unique_ptr lock(GetViewportLock()); - ViewportController& controller = lock->GetController(); - const Scene2D& scene2 = controller.GetScene(); - - ScenePoint2D scenePos = e.GetMainPosition().Apply( - scene2.GetCanvasToSceneTransform()); - - ScenePoint2D delta = scenePos - GetOriginalClickPosition(); - - const LineMeasureTool::Memento& memento = - dynamic_cast(command_->GetMementoOriginal()); - - switch (modifiedZone_) - { - case LineMeasureTool::LineHighlightArea_Start: - { - ScenePoint2D newStart = memento.GetStart() + delta; - GetCommand()->SetStart(newStart); - break; - } - - case LineMeasureTool::LineHighlightArea_End: - { - ScenePoint2D newEnd = memento.GetEnd() + delta; - GetCommand()->SetEnd(newEnd); - break; - } - - case LineMeasureTool::LineHighlightArea_Segment: - { - ScenePoint2D newStart = memento.GetStart() + delta; - ScenePoint2D newEnd = memento.GetEnd() + delta; - GetCommand()->SetStart(newStart); - GetCommand()->SetEnd(newEnd); - break; - } - - default: - LOG(WARNING) << "Warning: please retry the measuring tool editing operation!"; - break; - } - - return true; - } - - void EditLineMeasureTracker::PointerUp(const PointerEvent& e, - Scene2D& scene) - { - alive_ = false; - } - - void EditLineMeasureTracker::PointerDown(const PointerEvent& e, - Scene2D& scene) - { - LOG(WARNING) << "Additional touches (fingers, pen, mouse buttons...) " - "are ignored when the edit line tracker is active"; - } - - boost::shared_ptr EditLineMeasureTracker::GetCommand() - { - boost::shared_ptr ret = boost::dynamic_pointer_cast(command_); - ORTHANC_ASSERT(ret.get() != NULL, "Internal error in EditLineMeasureTracker::GetCommand()"); - return ret; - } -} diff -r 23acf5a24806 -r 77f819365bb2 OrthancStone/Sources/Scene2DViewport/EditLineMeasureTracker.h --- a/OrthancStone/Sources/Scene2DViewport/EditLineMeasureTracker.h Thu Oct 08 16:57:36 2026 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,60 +0,0 @@ -/** - * Stone of Orthanc - * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics - * Department, University Hospital of Liege, Belgium - * Copyright (C) 2017-2023 Osimis S.A., Belgium - * Copyright (C) 2021-2026 Sebastien Jodogne, ICTEAM UCLouvain, Belgium - * - * This program is free software: you can redistribute it and/or - * modify it under the terms of the GNU Lesser 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this program. If not, see - * . - **/ - -#pragma once - -#include "MeasureTrackers.h" - -namespace OrthancStone -{ - class EditLineMeasureCommand; - - class EditLineMeasureTracker : public EditMeasureTracker - { - private: - LineMeasureTool::LineHighlightArea modifiedZone_; - - boost::shared_ptr GetCommand(); - - public: - /** - When you create this tracker, you need to supply it with the undo stack - where it will store the commands that perform the actual measure tool - creation and modification. - In turn, a container for these commands to store the actual measuring - must be supplied, too - */ - EditLineMeasureTracker( - boost::shared_ptr measureTool, - boost::weak_ptr viewport, - const PointerEvent& e); - - virtual bool PointerMove(const PointerEvent& e, - Scene2D& scene) ORTHANC_OVERRIDE; - - virtual void PointerUp(const PointerEvent& e, - Scene2D& scene) ORTHANC_OVERRIDE; - - virtual void PointerDown(const PointerEvent& e, - Scene2D& scene) ORTHANC_OVERRIDE; - }; -} diff -r 23acf5a24806 -r 77f819365bb2 OrthancStone/Sources/Scene2DViewport/LineMeasureTool.cpp --- a/OrthancStone/Sources/Scene2DViewport/LineMeasureTool.cpp Thu Oct 08 16:57:36 2026 +0200 +++ b/OrthancStone/Sources/Scene2DViewport/LineMeasureTool.cpp Thu Oct 08 17:01:30 2026 +0200 @@ -20,11 +20,11 @@ * . **/ +#include "../StoneException.h" +#include "LayerHolder.h" #include "LineMeasureTool.h" +#include "MeasureCommands.h" #include "MeasureToolsToolbox.h" -#include "EditLineMeasureTracker.h" -#include "LayerHolder.h" -#include "../StoneException.h" #include