comparison OrthancStone/Sources/Scene2DViewport/LayerHolder.h @ 1606:874e178f34e9

- ViewportController now has weak ptr to Viewport - Measuring tools + related commands and all trackers now store only a weak_ptr to the Viewport and lock() on demand for usage - LayerHolder and FixedPoint aligner store only a weak_ptr to the Viewport, too - Fixed float/double warning in GrayscaleWindowingSceneTracker
author Benjamin Golinvaux <bgo@osimis.io>
date Wed, 28 Oct 2020 20:14:34 +0100
parents 8563ea5d8ae4
children 9ac2a65d4172
comparison
equal deleted inserted replaced
1605:b3c439d96d3e 1606:874e178f34e9
21 21
22 #pragma once 22 #pragma once
23 23
24 #include "PredeclaredTypes.h" 24 #include "PredeclaredTypes.h"
25 25
26 #include "../Viewport/IViewport.h"
27
26 #include <boost/noncopyable.hpp> 28 #include <boost/noncopyable.hpp>
27 #include <boost/weak_ptr.hpp> 29 #include <boost/weak_ptr.hpp>
28 #include <boost/shared_ptr.hpp> 30 #include <boost/shared_ptr.hpp>
29 31
30 namespace OrthancStone 32 namespace OrthancStone
42 /** 44 /**
43 This ctor merely stores the scene and layer counts. No layer creation 45 This ctor merely stores the scene and layer counts. No layer creation
44 performed at this time 46 performed at this time
45 */ 47 */
46 LayerHolder( 48 LayerHolder(
47 boost::shared_ptr<IViewport> viewport, 49 boost::weak_ptr<IViewport> viewport,
48 int polylineLayerCount, int textLayerCount, int infoTextCount = 0); 50 int polylineLayerCount, int textLayerCount, int infoTextCount = 0);
49 51
50 /** 52 /**
51 This actually creates the layers 53 This actually creates the layers
52 */ 54 */
93 TextSceneLayer* GetTextLayer(int index = 0); 95 TextSceneLayer* GetTextLayer(int index = 0);
94 96
95 //TextSceneLayer* GetTextLayer(int index = 0); 97 //TextSceneLayer* GetTextLayer(int index = 0);
96 98
97 private: 99 private:
100
101 /**
102 This will return a scoped lock to the viewport.
103 If the viewport does not exist anymore, then nullptr is returned.
104 */
105 IViewport::ILock* GetViewportLock();
106
98 int GetPolylineLayerIndex(int index = 0); 107 int GetPolylineLayerIndex(int index = 0);
99 int GetTextLayerIndex(int index = 0); 108 int GetTextLayerIndex(int index = 0);
100 int GetInfoTextLayerIndex(int index = 0); 109 int GetInfoTextLayerIndex(int index = 0);
101 110
102 int textLayerCount_; 111 int textLayerCount_;
103 int polylineLayerCount_; 112 int polylineLayerCount_;
104 int infoTextCount_; 113 int infoTextCount_;
105 boost::shared_ptr<IViewport> viewport_; 114 boost::weak_ptr<IViewport> viewport_;
106 int baseLayerIndex_; 115 int baseLayerIndex_;
107 }; 116 };
108 } 117 }
109 118