Mercurial > hg > orthanc-stone
changeset 2365:77f819365bb2 refactoring
removed useless files
| author | Sebastien Jodogne <s.jodogne@gmail.com> |
|---|---|
| date | Thu, 08 Oct 2026 17:01:30 +0200 |
| parents | 23acf5a24806 |
| children | 0e47eebd492c |
| files | OrthancStone/Resources/CMake/OrthancStoneConfiguration.cmake OrthancStone/Sources/Scene2DViewport/CreateLineMeasureCommand.cpp OrthancStone/Sources/Scene2DViewport/CreateLineMeasureCommand.h OrthancStone/Sources/Scene2DViewport/CreateLineMeasureTracker.cpp OrthancStone/Sources/Scene2DViewport/CreateLineMeasureTracker.h OrthancStone/Sources/Scene2DViewport/EditLineMeasureCommand.cpp OrthancStone/Sources/Scene2DViewport/EditLineMeasureCommand.h OrthancStone/Sources/Scene2DViewport/EditLineMeasureTracker.cpp OrthancStone/Sources/Scene2DViewport/EditLineMeasureTracker.h OrthancStone/Sources/Scene2DViewport/LineMeasureTool.cpp |
| diffstat | 10 files changed, 3 insertions(+), 522 deletions(-) [+] |
line wrap: on
line diff
--- 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
--- 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 - * <http://www.gnu.org/licenses/>. - **/ - -#include "CreateLineMeasureCommand.h" - -#include <boost/make_shared.hpp> -#include <boost/ref.hpp> - -namespace OrthancStone -{ - CreateLineMeasureCommand::CreateLineMeasureCommand( - boost::weak_ptr<IViewport> viewport, - ScenePoint2D point) - : CreateMeasureCommand(viewport) - , measureTool_(LineMeasureTool::Create(viewport)) - { - - std::unique_ptr<IViewport::ILock> lock(GetViewportLock()); - ViewportController& controller = lock->GetController(); - controller.AddMeasureTool(measureTool_); - measureTool_->Set(point, point); - lock->Invalidate(); - } - - void CreateLineMeasureCommand::SetEnd(ScenePoint2D scenePos) - { - measureTool_->SetEnd(scenePos); - } -}
--- 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 - * <http://www.gnu.org/licenses/>. - **/ -#pragma once - -#include "MeasureCommands.h" - -namespace OrthancStone -{ - class CreateLineMeasureCommand : public CreateMeasureCommand - { - public: - CreateLineMeasureCommand( - boost::weak_ptr<IViewport> viewport, - ScenePoint2D point); - - // the starting position is set in the ctor - void SetEnd(ScenePoint2D scenePos); - - private: - virtual boost::shared_ptr<MeasureTool> GetMeasureTool() ORTHANC_OVERRIDE - { - return measureTool_; - } - boost::shared_ptr<LineMeasureTool> measureTool_; - }; -} - -
--- 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 - * <http://www.gnu.org/licenses/>. - **/ - -#include "CreateLineMeasureTracker.h" -#include "CreateLineMeasureCommand.h" - -#include <OrthancException.h> - -namespace OrthancStone -{ - CreateLineMeasureTracker::CreateLineMeasureTracker( - boost::weak_ptr<IViewport> viewport, - const PointerEvent& e) - : CreateMeasureTracker(viewport) - { - ScenePoint2D point; - - { - std::unique_ptr<IViewport::ILock> 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<IViewport::ILock> 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<CreateLineMeasureTracker*>(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<CreateLineMeasureCommand> CreateLineMeasureTracker::GetCommand() - { - return boost::dynamic_pointer_cast<CreateLineMeasureCommand>(command_); - } -}
--- 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 - * <http://www.gnu.org/licenses/>. - **/ - -#pragma once - -#include "CreateLineMeasureCommand.h" -#include "MeasureTrackers.h" - -#include <boost/shared_ptr.hpp> -#include <boost/weak_ptr.hpp> - -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<IViewport> 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<CreateLineMeasureCommand> GetCommand(); - }; -}
--- 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 - * <http://www.gnu.org/licenses/>. - **/ - -#include "EditLineMeasureCommand.h" - -namespace OrthancStone -{ - EditLineMeasureCommand::EditLineMeasureCommand(const boost::shared_ptr<MeasureTool>& measureTool, - boost::weak_ptr<IViewport> viewport) : - EditMeasureCommand(measureTool, viewport) - { - } - - - void EditLineMeasureCommand::SetStart(ScenePoint2D scenePos) - { - dynamic_cast<LineMeasureTool&>(GetMeasureTool()).SetStart(scenePos); - SetMementoModified(GetMeasureTool().CreateMemento()); - } - - - void EditLineMeasureCommand::SetEnd(ScenePoint2D scenePos) - { - dynamic_cast<LineMeasureTool&>(GetMeasureTool()).SetEnd(scenePos); - SetMementoModified(GetMeasureTool().CreateMemento()); - } -}
--- 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 - * <http://www.gnu.org/licenses/>. - **/ -#pragma once - -#include "MeasureCommands.h" - -namespace OrthancStone -{ - class EditLineMeasureCommand : public EditMeasureCommand - { - public: - EditLineMeasureCommand(const boost::shared_ptr<MeasureTool>& measureTool, - boost::weak_ptr<IViewport> viewport); - - void SetStart(ScenePoint2D scenePos); - void SetEnd(ScenePoint2D scenePos); - }; -}
--- 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 - * <http://www.gnu.org/licenses/>. - **/ - -#include "EditLineMeasureTracker.h" -#include "EditLineMeasureCommand.h" - -#include "../StoneException.h" - - -namespace OrthancStone -{ - EditLineMeasureTracker::EditLineMeasureTracker( - boost::shared_ptr<MeasureTool> measureTool, - boost::weak_ptr<IViewport> viewport, - const PointerEvent& e) - : EditMeasureTracker(viewport, e) - { - ScenePoint2D scenePos; - - { - std::unique_ptr<IViewport::ILock> lock(GetViewportLock()); - const Scene2D& scene = lock->GetController().GetScene(); - scenePos = e.GetMainPosition().Apply(scene.GetCanvasToSceneTransform()); - } - - modifiedZone_ = dynamic_cast<LineMeasureTool&>(*measureTool).LineHitTest(scenePos); - command_.reset(new EditLineMeasureCommand(measureTool, viewport)); - } - - bool EditLineMeasureTracker::PointerMove(const PointerEvent& e, - Scene2D& scene) - { - std::unique_ptr<IViewport::ILock> 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<const LineMeasureTool::Memento&>(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<EditLineMeasureCommand> EditLineMeasureTracker::GetCommand() - { - boost::shared_ptr<EditLineMeasureCommand> ret = boost::dynamic_pointer_cast<EditLineMeasureCommand>(command_); - ORTHANC_ASSERT(ret.get() != NULL, "Internal error in EditLineMeasureTracker::GetCommand()"); - return ret; - } -}
--- 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 - * <http://www.gnu.org/licenses/>. - **/ - -#pragma once - -#include "MeasureTrackers.h" - -namespace OrthancStone -{ - class EditLineMeasureCommand; - - class EditLineMeasureTracker : public EditMeasureTracker - { - private: - LineMeasureTool::LineHighlightArea modifiedZone_; - - boost::shared_ptr<EditLineMeasureCommand> 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> measureTool, - boost::weak_ptr<IViewport> 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; - }; -}
--- 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 @@ * <http://www.gnu.org/licenses/>. **/ +#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 <Logging.h>
