annotate Framework/Scene2D/PolylineSceneLayer.h @ 632:500c3f70b6c2

- Added a ClearAllChains method to PolylineSceneLayer --> revision must change when calling it ==> BumpRevision has been added to base class - Added some docs = Added GetMinDepth + GetMaxDepth to Scene2D (to alleviate the need for app- specific "Z depth registry" : clients may simply add a new layer on top or at the bottom of the existing layer set. - Added the line tracker measurement tools, commands and trackers. Generic base classes + Line measure - started work on the line measure handles
author Benjamin Golinvaux <bgo@osimis.io>
date Thu, 09 May 2019 10:41:31 +0200
parents 434ceeb0bcab
children 61ba4b504e9a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
584
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 /**
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 * Stone of Orthanc
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4 * Department, University Hospital of Liege, Belgium
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5 * Copyright (C) 2017-2019 Osimis S.A., Belgium
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6 *
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 * This program is free software: you can redistribute it and/or
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 * modify it under the terms of the GNU Affero General Public License
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 * as published by the Free Software Foundation, either version 3 of
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 * the License, or (at your option) any later version.
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 *
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 * This program is distributed in the hope that it will be useful, but
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 * Affero General Public License for more details.
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 *
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17 * You should have received a copy of the GNU Affero General Public License
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19 **/
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22 #pragma once
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24 #include "ColorSceneLayer.h"
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25 #include "ScenePoint2D.h"
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27 #include <vector>
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29 namespace OrthancStone
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30 {
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31 class PolylineSceneLayer : public ColorSceneLayer
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32 {
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33 public:
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
34 typedef std::vector<ScenePoint2D> Chain;
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
36 private:
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
37 std::vector<Chain> chains_;
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
38 std::vector<bool> closed_;
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
39 double thickness_;
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
41 public:
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
42 PolylineSceneLayer() :
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43 thickness_(1.0)
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
44 {
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
45 }
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
46
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
47 virtual ISceneLayer* Clone() const;
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
48
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
49 void SetThickness(double thickness);
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
50
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
51 double GetThickness() const
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
52 {
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
53 return thickness_;
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
54 }
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
55
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
56 void Copy(const PolylineSceneLayer& from);
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
57
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
58 void Reserve(size_t countChains);
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
59
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
60 void AddChain(const Chain& chain,
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
61 bool isClosed);
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
62
632
500c3f70b6c2 - Added a ClearAllChains method to PolylineSceneLayer --> revision must change
Benjamin Golinvaux <bgo@osimis.io>
parents: 584
diff changeset
63 void ClearAllChains();
500c3f70b6c2 - Added a ClearAllChains method to PolylineSceneLayer --> revision must change
Benjamin Golinvaux <bgo@osimis.io>
parents: 584
diff changeset
64
584
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
65 size_t GetChainsCount() const
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
66 {
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
67 return chains_.size();
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
68 }
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
69
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
70 const Chain& GetChain(size_t i) const;
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
71
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
72 bool IsClosedChain(size_t i) const;
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
73
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
74 virtual Type GetType() const
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
75 {
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
76 return Type_Polyline;
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
77 }
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
78
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
79 virtual bool GetBoundingBox(Extent2D& target) const;
632
500c3f70b6c2 - Added a ClearAllChains method to PolylineSceneLayer --> revision must change
Benjamin Golinvaux <bgo@osimis.io>
parents: 584
diff changeset
80
584
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
81 };
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
82 }