Mercurial > hg > orthanc-stone
annotate OrthancStone/Sources/Volumes/VolumeSceneLayerSource.h @ 1853:cbb5c4a66160
back to mainline
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 29 Jun 2021 16:29:37 +0200 |
parents | 9ac2a65d4172 |
children | 3889ae96d2e9 |
rev | line source |
---|---|
815 | 1 /** |
2 * Stone of Orthanc | |
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics | |
4 * Department, University Hospital of Liege, Belgium | |
1739
9ac2a65d4172
upgrade to year 2021
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1640
diff
changeset
|
5 * Copyright (C) 2017-2021 Osimis S.A., Belgium |
815 | 6 * |
7 * This program is free software: you can redistribute it and/or | |
1598
8563ea5d8ae4
relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
8 * modify it under the terms of the GNU Lesser General Public License |
815 | 9 * as published by the Free Software Foundation, either version 3 of |
10 * the License, or (at your option) any later version. | |
11 * | |
12 * This program is distributed in the hope that it will be useful, but | |
13 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
1598
8563ea5d8ae4
relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
8563ea5d8ae4
relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
15 * Lesser General Public License for more details. |
1596
4fb8fdf03314
removed annoying whitespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1571
diff
changeset
|
16 * |
1598
8563ea5d8ae4
relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
17 * You should have received a copy of the GNU Lesser General Public |
8563ea5d8ae4
relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
18 * License along with this program. If not, see |
8563ea5d8ae4
relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
19 * <http://www.gnu.org/licenses/>. |
815 | 20 **/ |
21 | |
22 | |
23 #pragma once | |
24 | |
25 #include "../Scene2D/Scene2D.h" | |
1606
874e178f34e9
- ViewportController now has weak ptr to Viewport
Benjamin Golinvaux <bgo@osimis.io>
parents:
1598
diff
changeset
|
26 #include "../Viewport/IViewport.h" |
815 | 27 #include "IVolumeSlicer.h" |
28 | |
29 #include <boost/shared_ptr.hpp> | |
30 | |
31 namespace OrthancStone | |
32 { | |
1433
8635b333fa5b
[BREAKING] VolumeSceneLayerSource now locks the viewport properly before using the scene. The ctor now accepts the viewport instead of a ref. to the scene. RtViewer sample has been adapted accordingly.
Benjamin Golinvaux <bgo@osimis.io>
parents:
1345
diff
changeset
|
33 class IViewport; |
815 | 34 /** |
35 This class applies one "volume slicer" to a "3D volume", in order | |
36 to create one "2D scene layer" that will be set onto the "2D | |
37 scene". The style of the layer can be fine-tuned using a "layer | |
38 style configurator". The class only changes the layer if the | |
39 cutting plane has been modified since the last call to "Update()". | |
921
81d30cd93b65
Ability to ask the loader for the geometry in PULL mode (when subscribing to the messages is not possible) + small changes (removed const/ref qualifiers for boost::shared_ptr param, added traces, doc change)
Benjamin Golinvaux <bgo@osimis.io>
parents:
815
diff
changeset
|
40 */ |
815 | 41 class VolumeSceneLayerSource : public boost::noncopyable |
42 { | |
43 private: | |
1640
52b8b96cb55f
cleaning namespaces
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1606
diff
changeset
|
44 boost::weak_ptr<IViewport> viewport_; |
1311
3d26447ddd28
warning fixes + doc + indentation + header files in cmake for VC++ sln browsing
Benjamin Golinvaux <bgo@osimis.io>
parents:
1298
diff
changeset
|
45 int layerDepth_; |
3d26447ddd28
warning fixes + doc + indentation + header files in cmake for VC++ sln browsing
Benjamin Golinvaux <bgo@osimis.io>
parents:
1298
diff
changeset
|
46 boost::shared_ptr<IVolumeSlicer> slicer_; |
1298
8a0a62189f46
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1270
diff
changeset
|
47 std::unique_ptr<ILayerStyleConfigurator> configurator_; |
8a0a62189f46
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1270
diff
changeset
|
48 std::unique_ptr<CoordinateSystem3D> lastPlane_; |
1311
3d26447ddd28
warning fixes + doc + indentation + header files in cmake for VC++ sln browsing
Benjamin Golinvaux <bgo@osimis.io>
parents:
1298
diff
changeset
|
49 uint64_t lastRevision_; |
3d26447ddd28
warning fixes + doc + indentation + header files in cmake for VC++ sln browsing
Benjamin Golinvaux <bgo@osimis.io>
parents:
1298
diff
changeset
|
50 uint64_t lastConfiguratorRevision_; |
815 | 51 |
52 void ClearLayer(); | |
53 | |
1606
874e178f34e9
- ViewportController now has weak ptr to Viewport
Benjamin Golinvaux <bgo@osimis.io>
parents:
1598
diff
changeset
|
54 /** |
874e178f34e9
- ViewportController now has weak ptr to Viewport
Benjamin Golinvaux <bgo@osimis.io>
parents:
1598
diff
changeset
|
55 This will return a scoped lock to the viewport. |
874e178f34e9
- ViewportController now has weak ptr to Viewport
Benjamin Golinvaux <bgo@osimis.io>
parents:
1598
diff
changeset
|
56 If the viewport does not exist anymore, then nullptr is returned. |
874e178f34e9
- ViewportController now has weak ptr to Viewport
Benjamin Golinvaux <bgo@osimis.io>
parents:
1598
diff
changeset
|
57 */ |
874e178f34e9
- ViewportController now has weak ptr to Viewport
Benjamin Golinvaux <bgo@osimis.io>
parents:
1598
diff
changeset
|
58 IViewport::ILock* GetViewportLock(); |
874e178f34e9
- ViewportController now has weak ptr to Viewport
Benjamin Golinvaux <bgo@osimis.io>
parents:
1598
diff
changeset
|
59 IViewport::ILock* GetViewportLock() const; |
874e178f34e9
- ViewportController now has weak ptr to Viewport
Benjamin Golinvaux <bgo@osimis.io>
parents:
1598
diff
changeset
|
60 |
815 | 61 public: |
1640
52b8b96cb55f
cleaning namespaces
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1606
diff
changeset
|
62 VolumeSceneLayerSource(boost::weak_ptr<IViewport> viewport, |
815 | 63 int layerDepth, |
64 const boost::shared_ptr<IVolumeSlicer>& slicer); | |
65 | |
934
094d10ed7ec2
VolumeSceneLayerSource dtor now clears the layer
Benjamin Golinvaux <bgo@osimis.io>
parents:
921
diff
changeset
|
66 ~VolumeSceneLayerSource(); |
094d10ed7ec2
VolumeSceneLayerSource dtor now clears the layer
Benjamin Golinvaux <bgo@osimis.io>
parents:
921
diff
changeset
|
67 |
815 | 68 const IVolumeSlicer& GetSlicer() const |
69 { | |
70 return *slicer_; | |
71 } | |
72 | |
73 void RemoveConfigurator(); | |
74 | |
75 void SetConfigurator(ILayerStyleConfigurator* configurator); | |
76 | |
77 bool HasConfigurator() const | |
78 { | |
79 return configurator_.get() != NULL; | |
80 } | |
81 | |
82 ILayerStyleConfigurator& GetConfigurator() const; | |
83 | |
1311
3d26447ddd28
warning fixes + doc + indentation + header files in cmake for VC++ sln browsing
Benjamin Golinvaux <bgo@osimis.io>
parents:
1298
diff
changeset
|
84 /** |
3d26447ddd28
warning fixes + doc + indentation + header files in cmake for VC++ sln browsing
Benjamin Golinvaux <bgo@osimis.io>
parents:
1298
diff
changeset
|
85 Make sure the Scene2D is protected from concurrent accesses before |
3d26447ddd28
warning fixes + doc + indentation + header files in cmake for VC++ sln browsing
Benjamin Golinvaux <bgo@osimis.io>
parents:
1298
diff
changeset
|
86 calling this method. |
3d26447ddd28
warning fixes + doc + indentation + header files in cmake for VC++ sln browsing
Benjamin Golinvaux <bgo@osimis.io>
parents:
1298
diff
changeset
|
87 |
3d26447ddd28
warning fixes + doc + indentation + header files in cmake for VC++ sln browsing
Benjamin Golinvaux <bgo@osimis.io>
parents:
1298
diff
changeset
|
88 If the scene that has been supplied to the ctor is part of an IViewport, |
3d26447ddd28
warning fixes + doc + indentation + header files in cmake for VC++ sln browsing
Benjamin Golinvaux <bgo@osimis.io>
parents:
1298
diff
changeset
|
89 you can lock the whole viewport data (including scene) by means of the |
3d26447ddd28
warning fixes + doc + indentation + header files in cmake for VC++ sln browsing
Benjamin Golinvaux <bgo@osimis.io>
parents:
1298
diff
changeset
|
90 IViewport::Lock method. |
3d26447ddd28
warning fixes + doc + indentation + header files in cmake for VC++ sln browsing
Benjamin Golinvaux <bgo@osimis.io>
parents:
1298
diff
changeset
|
91 */ |
1345
0d6a01ffa1dd
Clean version of the hack commited in
Benjamin Golinvaux <bgo@osimis.io>
parents:
1344
diff
changeset
|
92 void Update(const CoordinateSystem3D& plane); |
815 | 93 }; |
94 } |