Mercurial > hg > orthanc-stone
diff Framework/Scene2DViewport/MeasureTools.h @ 700:059e1fd05fd6 refactor-viewport-controller
Introduced the ViewportController that sits between the application and the
Scene2D to handle the trackers and measuring tools. This is a work in progress.
The Scene2D is no longer an observable. Message sending is managed by the
ViewportController.
Move some refs to shared and weak to prevent lifetime issues.
author | Benjamin Golinvaux <bgo@osimis.io> |
---|---|
date | Sun, 19 May 2019 16:26:17 +0200 |
parents | 8b6adfb62a2f |
children | 28b9e3a54200 |
line wrap: on
line diff
--- a/Framework/Scene2DViewport/MeasureTools.h Fri May 17 09:20:46 2019 +0200 +++ b/Framework/Scene2DViewport/MeasureTools.h Sun May 19 16:26:17 2019 +0200 @@ -21,6 +21,7 @@ #pragma once #include <Framework/Scene2DViewport/PointerTypes.h> +#include <Framework/Scene2DViewport/ViewportController.h> #include <Framework/Scene2D/Scene2D.h> #include <Framework/Scene2D/ScenePoint2D.h> @@ -57,10 +58,11 @@ This method is called when the scene transform changes. It allows to recompute the visual elements whose content depend upon the scene transform */ - void OnSceneTransformChanged(const Scene2D::SceneTransformChanged& message); + void OnSceneTransformChanged( + const ViewportController::SceneTransformChanged& message); protected: - MeasureTool(MessageBroker& broker, Scene2DWPtr sceneW); + MeasureTool(MessageBroker& broker, ViewportControllerWPtr controllerW); /** This is the meat of the tool: this method must [create (if needed) and] @@ -69,8 +71,9 @@ */ virtual void RefreshScene() = 0; + ViewportControllerPtr GetController(); Scene2DPtr GetScene(); - + /** enabled_ is not accessible by subclasses because there is a state machine that we do not wanna mess with @@ -78,7 +81,7 @@ bool IsEnabled() const; private: - Scene2DWPtr scene_; + ViewportControllerWPtr controllerW_; bool enabled_; }; }