annotate Framework/Scene2DViewport/LayerHolder.h @ 879:12b591d5d63c am-dev

some Qt integration (wip)
author Alain Mazy <alain@mazy.be>
date Fri, 05 Jul 2019 14:52:43 +0200
parents e42b491f1fb2
children 0aff28f15ea2
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
751
712ff6ff3c19 - undo redo now works fine for both measure tool creation commands
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
1 /**
712ff6ff3c19 - undo redo now works fine for both measure tool creation commands
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
2 * Stone of Orthanc
712ff6ff3c19 - undo redo now works fine for both measure tool creation commands
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
712ff6ff3c19 - undo redo now works fine for both measure tool creation commands
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
4 * Department, University Hospital of Liege, Belgium
712ff6ff3c19 - undo redo now works fine for both measure tool creation commands
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
5 * Copyright (C) 2017-2019 Osimis S.A., Belgium
712ff6ff3c19 - undo redo now works fine for both measure tool creation commands
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
6 *
712ff6ff3c19 - undo redo now works fine for both measure tool creation commands
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
7 * This program is free software: you can redistribute it and/or
712ff6ff3c19 - undo redo now works fine for both measure tool creation commands
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
8 * modify it under the terms of the GNU Affero General Public License
712ff6ff3c19 - undo redo now works fine for both measure tool creation commands
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
9 * as published by the Free Software Foundation, either version 3 of
712ff6ff3c19 - undo redo now works fine for both measure tool creation commands
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
10 * the License, or (at your option) any later version.
712ff6ff3c19 - undo redo now works fine for both measure tool creation commands
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
11 *
712ff6ff3c19 - undo redo now works fine for both measure tool creation commands
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
12 * This program is distributed in the hope that it will be useful, but
712ff6ff3c19 - undo redo now works fine for both measure tool creation commands
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
712ff6ff3c19 - undo redo now works fine for both measure tool creation commands
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
712ff6ff3c19 - undo redo now works fine for both measure tool creation commands
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
15 * Affero General Public License for more details.
712ff6ff3c19 - undo redo now works fine for both measure tool creation commands
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
16 *
712ff6ff3c19 - undo redo now works fine for both measure tool creation commands
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
17 * You should have received a copy of the GNU Affero General Public License
712ff6ff3c19 - undo redo now works fine for both measure tool creation commands
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
712ff6ff3c19 - undo redo now works fine for both measure tool creation commands
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
19 **/
761
07adcffba38c truncation warning fixes + CRLF -> LF + random measuring tool creation (keyb
Benjamin Golinvaux <bgo@osimis.io>
parents: 751
diff changeset
20
07adcffba38c truncation warning fixes + CRLF -> LF + random measuring tool creation (keyb
Benjamin Golinvaux <bgo@osimis.io>
parents: 751
diff changeset
21 #pragma once
07adcffba38c truncation warning fixes + CRLF -> LF + random measuring tool creation (keyb
Benjamin Golinvaux <bgo@osimis.io>
parents: 751
diff changeset
22
818
e42b491f1fb2 Removed typedefs to shared_ptr by making them explicit. Removed using namespace
Benjamin Golinvaux <bgo@osimis.io>
parents: 761
diff changeset
23 #include "PredeclaredTypes.h"
e42b491f1fb2 Removed typedefs to shared_ptr by making them explicit. Removed using namespace
Benjamin Golinvaux <bgo@osimis.io>
parents: 761
diff changeset
24
761
07adcffba38c truncation warning fixes + CRLF -> LF + random measuring tool creation (keyb
Benjamin Golinvaux <bgo@osimis.io>
parents: 751
diff changeset
25 #include "boost/noncopyable.hpp"
818
e42b491f1fb2 Removed typedefs to shared_ptr by making them explicit. Removed using namespace
Benjamin Golinvaux <bgo@osimis.io>
parents: 761
diff changeset
26 #include "boost/weak_ptr.hpp"
e42b491f1fb2 Removed typedefs to shared_ptr by making them explicit. Removed using namespace
Benjamin Golinvaux <bgo@osimis.io>
parents: 761
diff changeset
27 #include "boost/shared_ptr.hpp"
751
712ff6ff3c19 - undo redo now works fine for both measure tool creation commands
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
28
712ff6ff3c19 - undo redo now works fine for both measure tool creation commands
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
29 namespace OrthancStone
712ff6ff3c19 - undo redo now works fine for both measure tool creation commands
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
30 {
712ff6ff3c19 - undo redo now works fine for both measure tool creation commands
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
31 class PolylineSceneLayer;
712ff6ff3c19 - undo redo now works fine for both measure tool creation commands
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
32 class TextSceneLayer;
712ff6ff3c19 - undo redo now works fine for both measure tool creation commands
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
33
761
07adcffba38c truncation warning fixes + CRLF -> LF + random measuring tool creation (keyb
Benjamin Golinvaux <bgo@osimis.io>
parents: 751
diff changeset
34 /**
07adcffba38c truncation warning fixes + CRLF -> LF + random measuring tool creation (keyb
Benjamin Golinvaux <bgo@osimis.io>
parents: 751
diff changeset
35 This class holds the indices of a set a layer and supplies
07adcffba38c truncation warning fixes + CRLF -> LF + random measuring tool creation (keyb
Benjamin Golinvaux <bgo@osimis.io>
parents: 751
diff changeset
36 getters to the concrete layer objects. Sounds very ad hoc, and it is.
07adcffba38c truncation warning fixes + CRLF -> LF + random measuring tool creation (keyb
Benjamin Golinvaux <bgo@osimis.io>
parents: 751
diff changeset
37 */
07adcffba38c truncation warning fixes + CRLF -> LF + random measuring tool creation (keyb
Benjamin Golinvaux <bgo@osimis.io>
parents: 751
diff changeset
38 class LayerHolder : public boost::noncopyable
07adcffba38c truncation warning fixes + CRLF -> LF + random measuring tool creation (keyb
Benjamin Golinvaux <bgo@osimis.io>
parents: 751
diff changeset
39 {
07adcffba38c truncation warning fixes + CRLF -> LF + random measuring tool creation (keyb
Benjamin Golinvaux <bgo@osimis.io>
parents: 751
diff changeset
40 public:
07adcffba38c truncation warning fixes + CRLF -> LF + random measuring tool creation (keyb
Benjamin Golinvaux <bgo@osimis.io>
parents: 751
diff changeset
41 /**
07adcffba38c truncation warning fixes + CRLF -> LF + random measuring tool creation (keyb
Benjamin Golinvaux <bgo@osimis.io>
parents: 751
diff changeset
42 This ctor merely stores the scene and layer counts. No layer creation
07adcffba38c truncation warning fixes + CRLF -> LF + random measuring tool creation (keyb
Benjamin Golinvaux <bgo@osimis.io>
parents: 751
diff changeset
43 performed at this time
07adcffba38c truncation warning fixes + CRLF -> LF + random measuring tool creation (keyb
Benjamin Golinvaux <bgo@osimis.io>
parents: 751
diff changeset
44 */
07adcffba38c truncation warning fixes + CRLF -> LF + random measuring tool creation (keyb
Benjamin Golinvaux <bgo@osimis.io>
parents: 751
diff changeset
45 LayerHolder(
818
e42b491f1fb2 Removed typedefs to shared_ptr by making them explicit. Removed using namespace
Benjamin Golinvaux <bgo@osimis.io>
parents: 761
diff changeset
46 boost::weak_ptr<ViewportController> controllerW,
761
07adcffba38c truncation warning fixes + CRLF -> LF + random measuring tool creation (keyb
Benjamin Golinvaux <bgo@osimis.io>
parents: 751
diff changeset
47 int polylineLayerCount, int textLayerCount);
07adcffba38c truncation warning fixes + CRLF -> LF + random measuring tool creation (keyb
Benjamin Golinvaux <bgo@osimis.io>
parents: 751
diff changeset
48
07adcffba38c truncation warning fixes + CRLF -> LF + random measuring tool creation (keyb
Benjamin Golinvaux <bgo@osimis.io>
parents: 751
diff changeset
49 /**
07adcffba38c truncation warning fixes + CRLF -> LF + random measuring tool creation (keyb
Benjamin Golinvaux <bgo@osimis.io>
parents: 751
diff changeset
50 This actually creates the layers
07adcffba38c truncation warning fixes + CRLF -> LF + random measuring tool creation (keyb
Benjamin Golinvaux <bgo@osimis.io>
parents: 751
diff changeset
51 */
751
712ff6ff3c19 - undo redo now works fine for both measure tool creation commands
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
52 void CreateLayers();
761
07adcffba38c truncation warning fixes + CRLF -> LF + random measuring tool creation (keyb
Benjamin Golinvaux <bgo@osimis.io>
parents: 751
diff changeset
53
07adcffba38c truncation warning fixes + CRLF -> LF + random measuring tool creation (keyb
Benjamin Golinvaux <bgo@osimis.io>
parents: 751
diff changeset
54 /**
07adcffba38c truncation warning fixes + CRLF -> LF + random measuring tool creation (keyb
Benjamin Golinvaux <bgo@osimis.io>
parents: 751
diff changeset
55 This creates the layers if they are not created yet. Can be useful in
07adcffba38c truncation warning fixes + CRLF -> LF + random measuring tool creation (keyb
Benjamin Golinvaux <bgo@osimis.io>
parents: 751
diff changeset
56 some scenarios
07adcffba38c truncation warning fixes + CRLF -> LF + random measuring tool creation (keyb
Benjamin Golinvaux <bgo@osimis.io>
parents: 751
diff changeset
57 */
07adcffba38c truncation warning fixes + CRLF -> LF + random measuring tool creation (keyb
Benjamin Golinvaux <bgo@osimis.io>
parents: 751
diff changeset
58 void CreateLayersIfNeeded();
07adcffba38c truncation warning fixes + CRLF -> LF + random measuring tool creation (keyb
Benjamin Golinvaux <bgo@osimis.io>
parents: 751
diff changeset
59
07adcffba38c truncation warning fixes + CRLF -> LF + random measuring tool creation (keyb
Benjamin Golinvaux <bgo@osimis.io>
parents: 751
diff changeset
60 /**
07adcffba38c truncation warning fixes + CRLF -> LF + random measuring tool creation (keyb
Benjamin Golinvaux <bgo@osimis.io>
parents: 751
diff changeset
61 Whether the various text and polylines layers have all been created or
07adcffba38c truncation warning fixes + CRLF -> LF + random measuring tool creation (keyb
Benjamin Golinvaux <bgo@osimis.io>
parents: 751
diff changeset
62 none at all
07adcffba38c truncation warning fixes + CRLF -> LF + random measuring tool creation (keyb
Benjamin Golinvaux <bgo@osimis.io>
parents: 751
diff changeset
63 */
07adcffba38c truncation warning fixes + CRLF -> LF + random measuring tool creation (keyb
Benjamin Golinvaux <bgo@osimis.io>
parents: 751
diff changeset
64 bool AreLayersCreated() const;
07adcffba38c truncation warning fixes + CRLF -> LF + random measuring tool creation (keyb
Benjamin Golinvaux <bgo@osimis.io>
parents: 751
diff changeset
65
751
712ff6ff3c19 - undo redo now works fine for both measure tool creation commands
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
66 /**
712ff6ff3c19 - undo redo now works fine for both measure tool creation commands
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
67 This removes the layers from the scene
712ff6ff3c19 - undo redo now works fine for both measure tool creation commands
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
68 */
712ff6ff3c19 - undo redo now works fine for both measure tool creation commands
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
69 void DeleteLayers();
761
07adcffba38c truncation warning fixes + CRLF -> LF + random measuring tool creation (keyb
Benjamin Golinvaux <bgo@osimis.io>
parents: 751
diff changeset
70
751
712ff6ff3c19 - undo redo now works fine for both measure tool creation commands
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
71 /**
712ff6ff3c19 - undo redo now works fine for both measure tool creation commands
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
72 Please note that the returned pointer belongs to the scene.Don't you dare
712ff6ff3c19 - undo redo now works fine for both measure tool creation commands
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
73 storing or deleting it, you fool!
712ff6ff3c19 - undo redo now works fine for both measure tool creation commands
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
74
712ff6ff3c19 - undo redo now works fine for both measure tool creation commands
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
75 This throws if the index is not valid or if the layers are not created or
712ff6ff3c19 - undo redo now works fine for both measure tool creation commands
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
76 have been deleted
712ff6ff3c19 - undo redo now works fine for both measure tool creation commands
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
77 */
712ff6ff3c19 - undo redo now works fine for both measure tool creation commands
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
78 PolylineSceneLayer* GetPolylineLayer(int index = 0);
712ff6ff3c19 - undo redo now works fine for both measure tool creation commands
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
79
712ff6ff3c19 - undo redo now works fine for both measure tool creation commands
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
80 /**
712ff6ff3c19 - undo redo now works fine for both measure tool creation commands
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
81 Please note that the returned pointer belongs to the scene. Don't you dare
712ff6ff3c19 - undo redo now works fine for both measure tool creation commands
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
82 storing or deleting it, you fool!
712ff6ff3c19 - undo redo now works fine for both measure tool creation commands
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
83
712ff6ff3c19 - undo redo now works fine for both measure tool creation commands
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
84 This throws if the index is not valid or if the layers are not created or
712ff6ff3c19 - undo redo now works fine for both measure tool creation commands
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
85 have been deleted
712ff6ff3c19 - undo redo now works fine for both measure tool creation commands
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
86 */
712ff6ff3c19 - undo redo now works fine for both measure tool creation commands
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
87 TextSceneLayer* GetTextLayer(int index = 0);
712ff6ff3c19 - undo redo now works fine for both measure tool creation commands
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
88
712ff6ff3c19 - undo redo now works fine for both measure tool creation commands
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
89 private:
712ff6ff3c19 - undo redo now works fine for both measure tool creation commands
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
90 int GetPolylineLayerIndex(int index = 0);
712ff6ff3c19 - undo redo now works fine for both measure tool creation commands
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
91 int GetTextLayerIndex(int index = 0);
818
e42b491f1fb2 Removed typedefs to shared_ptr by making them explicit. Removed using namespace
Benjamin Golinvaux <bgo@osimis.io>
parents: 761
diff changeset
92 boost::shared_ptr<Scene2D> GetScene();
751
712ff6ff3c19 - undo redo now works fine for both measure tool creation commands
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
93
712ff6ff3c19 - undo redo now works fine for both measure tool creation commands
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
94 int textLayerCount_;
712ff6ff3c19 - undo redo now works fine for both measure tool creation commands
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
95 int polylineLayerCount_;
818
e42b491f1fb2 Removed typedefs to shared_ptr by making them explicit. Removed using namespace
Benjamin Golinvaux <bgo@osimis.io>
parents: 761
diff changeset
96 boost::weak_ptr<ViewportController> controllerW_;
751
712ff6ff3c19 - undo redo now works fine for both measure tool creation commands
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
97 int baseLayerIndex_;
761
07adcffba38c truncation warning fixes + CRLF -> LF + random measuring tool creation (keyb
Benjamin Golinvaux <bgo@osimis.io>
parents: 751
diff changeset
98 };
751
712ff6ff3c19 - undo redo now works fine for both measure tool creation commands
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
99 }
712ff6ff3c19 - undo redo now works fine for both measure tool creation commands
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
100