annotate OrthancStone/Sources/Scene2D/PolylineSceneLayer.cpp @ 2068:22a83fb9dd23 deep-learning

added AlignedMatrix and TimerLogger
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 17 May 2023 17:30:52 +0200
parents c074c75cf416
children 07964689cb0b
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
1871
7053b8a0aaec upgrade to year 2022
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1870
diff changeset
5 * Copyright (C) 2017-2022 Osimis S.A., Belgium
7053b8a0aaec upgrade to year 2022
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1870
diff changeset
6 * Copyright (C) 2021-2022 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
584
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 *
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 * 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
9 * modify it under the terms of the GNU Lesser General Public License
584
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 * 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
11 * the License, or (at your option) any later version.
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 *
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 * 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
14 * 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
15 * 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
16 * Lesser General Public License for more details.
1596
4fb8fdf03314 removed annoying whitespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1512
diff changeset
17 *
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
18 * 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
19 * 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
20 * <http://www.gnu.org/licenses/>.
584
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
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 "PolylineSceneLayer.h"
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25
1455
30deba7bc8e2 simplifying include_directories
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1298
diff changeset
26 #include <OrthancException.h>
584
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27
1981
c074c75cf416 moved drawing primitives from AnnotationsSceneLayer to PolylineSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1871
diff changeset
28 #include <boost/math/constants/constants.hpp>
c074c75cf416 moved drawing primitives from AnnotationsSceneLayer to PolylineSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1871
diff changeset
29
c074c75cf416 moved drawing primitives from AnnotationsSceneLayer to PolylineSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1871
diff changeset
30 static const double PI = boost::math::constants::pi<double>();
c074c75cf416 moved drawing primitives from AnnotationsSceneLayer to PolylineSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1871
diff changeset
31
584
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32 namespace OrthancStone
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33 {
804
61ba4b504e9a PolylineSceneLayer now has one color per chain
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 632
diff changeset
34 void PolylineSceneLayer::Copy(const PolylineSceneLayer& other)
61ba4b504e9a PolylineSceneLayer now has one color per chain
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 632
diff changeset
35 {
61ba4b504e9a PolylineSceneLayer now has one color per chain
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 632
diff changeset
36 items_ = other.items_;
61ba4b504e9a PolylineSceneLayer now has one color per chain
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 632
diff changeset
37 thickness_ = other.thickness_;
61ba4b504e9a PolylineSceneLayer now has one color per chain
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 632
diff changeset
38 revision_ ++;
61ba4b504e9a PolylineSceneLayer now has one color per chain
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 632
diff changeset
39 }
61ba4b504e9a PolylineSceneLayer now has one color per chain
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 632
diff changeset
40
61ba4b504e9a PolylineSceneLayer now has one color per chain
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 632
diff changeset
41
584
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
42 ISceneLayer* PolylineSceneLayer::Clone() const
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43 {
1298
8a0a62189f46 replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1270
diff changeset
44 std::unique_ptr<PolylineSceneLayer> cloned(new PolylineSceneLayer);
584
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
45 cloned->Copy(*this);
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
46 return cloned.release();
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
47 }
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
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
50 void PolylineSceneLayer::SetThickness(double thickness)
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
51 {
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
52 if (thickness <= 0)
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
53 {
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
54 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange);
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 else
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 thickness_ = thickness;
804
61ba4b504e9a PolylineSceneLayer now has one color per chain
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 632
diff changeset
59 revision_++;
584
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
60 }
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
61 }
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
62
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
63
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
64 void PolylineSceneLayer::AddChain(const Chain& chain,
804
61ba4b504e9a PolylineSceneLayer now has one color per chain
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 632
diff changeset
65 bool isClosed,
61ba4b504e9a PolylineSceneLayer now has one color per chain
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 632
diff changeset
66 uint8_t red,
61ba4b504e9a PolylineSceneLayer now has one color per chain
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 632
diff changeset
67 uint8_t green,
61ba4b504e9a PolylineSceneLayer now has one color per chain
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 632
diff changeset
68 uint8_t blue)
584
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 if (!chain.empty())
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
71 {
804
61ba4b504e9a PolylineSceneLayer now has one color per chain
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 632
diff changeset
72 items_.push_back(Item());
61ba4b504e9a PolylineSceneLayer now has one color per chain
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 632
diff changeset
73 items_.back().chain_ = chain;
61ba4b504e9a PolylineSceneLayer now has one color per chain
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 632
diff changeset
74 items_.back().closed_ = isClosed;
61ba4b504e9a PolylineSceneLayer now has one color per chain
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 632
diff changeset
75 items_.back().color_ = Color(red, green, blue);
61ba4b504e9a PolylineSceneLayer now has one color per chain
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 632
diff changeset
76
61ba4b504e9a PolylineSceneLayer now has one color per chain
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 632
diff changeset
77 revision_++;
584
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 }
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
80
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
81
632
500c3f70b6c2 - Added a ClearAllChains method to PolylineSceneLayer --> revision must change
Benjamin Golinvaux <bgo@osimis.io>
parents: 584
diff changeset
82 void PolylineSceneLayer::ClearAllChains()
500c3f70b6c2 - Added a ClearAllChains method to PolylineSceneLayer --> revision must change
Benjamin Golinvaux <bgo@osimis.io>
parents: 584
diff changeset
83 {
804
61ba4b504e9a PolylineSceneLayer now has one color per chain
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 632
diff changeset
84 items_.clear();
61ba4b504e9a PolylineSceneLayer now has one color per chain
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 632
diff changeset
85 revision_++;
632
500c3f70b6c2 - Added a ClearAllChains method to PolylineSceneLayer --> revision must change
Benjamin Golinvaux <bgo@osimis.io>
parents: 584
diff changeset
86 }
500c3f70b6c2 - Added a ClearAllChains method to PolylineSceneLayer --> revision must change
Benjamin Golinvaux <bgo@osimis.io>
parents: 584
diff changeset
87
804
61ba4b504e9a PolylineSceneLayer now has one color per chain
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 632
diff changeset
88 const PolylineSceneLayer::Item& PolylineSceneLayer::GetItem(size_t i) const
584
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
89 {
804
61ba4b504e9a PolylineSceneLayer now has one color per chain
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 632
diff changeset
90 if (i < items_.size())
584
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
91 {
804
61ba4b504e9a PolylineSceneLayer now has one color per chain
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 632
diff changeset
92 return items_[i];
584
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
93 }
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
94 else
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
95 {
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
96 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange);
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
97 }
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
98 }
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
99
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
100
1610
b7630b1a0253 ISceneLayer::GetBoundingBox() returns void
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1598
diff changeset
101 void PolylineSceneLayer::GetBoundingBox(Extent2D& target) const
584
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
102 {
1610
b7630b1a0253 ISceneLayer::GetBoundingBox() returns void
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1598
diff changeset
103 target.Clear();
584
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
104
804
61ba4b504e9a PolylineSceneLayer now has one color per chain
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 632
diff changeset
105 for (size_t i = 0; i < items_.size(); i++)
584
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
106 {
804
61ba4b504e9a PolylineSceneLayer now has one color per chain
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 632
diff changeset
107 for (size_t j = 0; j < items_[i].chain_.size(); j++)
584
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
108 {
804
61ba4b504e9a PolylineSceneLayer now has one color per chain
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 632
diff changeset
109 const ScenePoint2D& p = items_[i].chain_[j];
584
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
110 target.AddPoint(p.GetX(), p.GetY());
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
111 }
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
112 }
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
113 }
1981
c074c75cf416 moved drawing primitives from AnnotationsSceneLayer to PolylineSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1871
diff changeset
114
c074c75cf416 moved drawing primitives from AnnotationsSceneLayer to PolylineSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1871
diff changeset
115
c074c75cf416 moved drawing primitives from AnnotationsSceneLayer to PolylineSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1871
diff changeset
116 void PolylineSceneLayer::AddArc(double centerX,
c074c75cf416 moved drawing primitives from AnnotationsSceneLayer to PolylineSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1871
diff changeset
117 double centerY,
c074c75cf416 moved drawing primitives from AnnotationsSceneLayer to PolylineSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1871
diff changeset
118 double radiusX,
c074c75cf416 moved drawing primitives from AnnotationsSceneLayer to PolylineSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1871
diff changeset
119 double radiusY,
c074c75cf416 moved drawing primitives from AnnotationsSceneLayer to PolylineSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1871
diff changeset
120 double startAngle,
c074c75cf416 moved drawing primitives from AnnotationsSceneLayer to PolylineSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1871
diff changeset
121 double endAngle,
c074c75cf416 moved drawing primitives from AnnotationsSceneLayer to PolylineSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1871
diff changeset
122 Color color,
c074c75cf416 moved drawing primitives from AnnotationsSceneLayer to PolylineSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1871
diff changeset
123 unsigned int countSegments)
c074c75cf416 moved drawing primitives from AnnotationsSceneLayer to PolylineSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1871
diff changeset
124 {
c074c75cf416 moved drawing primitives from AnnotationsSceneLayer to PolylineSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1871
diff changeset
125 assert(countSegments != 0);
c074c75cf416 moved drawing primitives from AnnotationsSceneLayer to PolylineSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1871
diff changeset
126
c074c75cf416 moved drawing primitives from AnnotationsSceneLayer to PolylineSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1871
diff changeset
127 if (endAngle >= startAngle)
c074c75cf416 moved drawing primitives from AnnotationsSceneLayer to PolylineSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1871
diff changeset
128 {
c074c75cf416 moved drawing primitives from AnnotationsSceneLayer to PolylineSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1871
diff changeset
129 double increment = (endAngle - startAngle) / static_cast<double>(countSegments - 1);
c074c75cf416 moved drawing primitives from AnnotationsSceneLayer to PolylineSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1871
diff changeset
130
c074c75cf416 moved drawing primitives from AnnotationsSceneLayer to PolylineSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1871
diff changeset
131 Chain chain;
c074c75cf416 moved drawing primitives from AnnotationsSceneLayer to PolylineSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1871
diff changeset
132 chain.resize(countSegments);
c074c75cf416 moved drawing primitives from AnnotationsSceneLayer to PolylineSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1871
diff changeset
133
c074c75cf416 moved drawing primitives from AnnotationsSceneLayer to PolylineSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1871
diff changeset
134 double theta = startAngle;
c074c75cf416 moved drawing primitives from AnnotationsSceneLayer to PolylineSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1871
diff changeset
135 for (unsigned int i = 0; i < countSegments; i++)
c074c75cf416 moved drawing primitives from AnnotationsSceneLayer to PolylineSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1871
diff changeset
136 {
c074c75cf416 moved drawing primitives from AnnotationsSceneLayer to PolylineSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1871
diff changeset
137 chain[i] = ScenePoint2D(centerX + radiusX * cos(theta),
c074c75cf416 moved drawing primitives from AnnotationsSceneLayer to PolylineSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1871
diff changeset
138 centerY + radiusY * sin(theta));
c074c75cf416 moved drawing primitives from AnnotationsSceneLayer to PolylineSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1871
diff changeset
139 theta += increment;
c074c75cf416 moved drawing primitives from AnnotationsSceneLayer to PolylineSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1871
diff changeset
140 }
c074c75cf416 moved drawing primitives from AnnotationsSceneLayer to PolylineSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1871
diff changeset
141
c074c75cf416 moved drawing primitives from AnnotationsSceneLayer to PolylineSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1871
diff changeset
142 AddChain(chain, false, color);
c074c75cf416 moved drawing primitives from AnnotationsSceneLayer to PolylineSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1871
diff changeset
143 }
c074c75cf416 moved drawing primitives from AnnotationsSceneLayer to PolylineSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1871
diff changeset
144 }
c074c75cf416 moved drawing primitives from AnnotationsSceneLayer to PolylineSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1871
diff changeset
145
c074c75cf416 moved drawing primitives from AnnotationsSceneLayer to PolylineSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1871
diff changeset
146
c074c75cf416 moved drawing primitives from AnnotationsSceneLayer to PolylineSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1871
diff changeset
147 void PolylineSceneLayer::AddCircle(double centerX,
c074c75cf416 moved drawing primitives from AnnotationsSceneLayer to PolylineSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1871
diff changeset
148 double centerY,
c074c75cf416 moved drawing primitives from AnnotationsSceneLayer to PolylineSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1871
diff changeset
149 double radius,
c074c75cf416 moved drawing primitives from AnnotationsSceneLayer to PolylineSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1871
diff changeset
150 Color color,
c074c75cf416 moved drawing primitives from AnnotationsSceneLayer to PolylineSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1871
diff changeset
151 unsigned int countSegments)
c074c75cf416 moved drawing primitives from AnnotationsSceneLayer to PolylineSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1871
diff changeset
152 {
c074c75cf416 moved drawing primitives from AnnotationsSceneLayer to PolylineSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1871
diff changeset
153 AddArc(centerX, centerY, radius, radius, 0, 2.0 * PI, color, countSegments);
c074c75cf416 moved drawing primitives from AnnotationsSceneLayer to PolylineSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1871
diff changeset
154 }
c074c75cf416 moved drawing primitives from AnnotationsSceneLayer to PolylineSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1871
diff changeset
155
c074c75cf416 moved drawing primitives from AnnotationsSceneLayer to PolylineSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1871
diff changeset
156
c074c75cf416 moved drawing primitives from AnnotationsSceneLayer to PolylineSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1871
diff changeset
157 void PolylineSceneLayer::AddRectangle(double x1,
c074c75cf416 moved drawing primitives from AnnotationsSceneLayer to PolylineSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1871
diff changeset
158 double y1,
c074c75cf416 moved drawing primitives from AnnotationsSceneLayer to PolylineSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1871
diff changeset
159 double x2,
c074c75cf416 moved drawing primitives from AnnotationsSceneLayer to PolylineSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1871
diff changeset
160 double y2,
c074c75cf416 moved drawing primitives from AnnotationsSceneLayer to PolylineSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1871
diff changeset
161 Color color)
c074c75cf416 moved drawing primitives from AnnotationsSceneLayer to PolylineSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1871
diff changeset
162 {
c074c75cf416 moved drawing primitives from AnnotationsSceneLayer to PolylineSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1871
diff changeset
163 Chain chain;
c074c75cf416 moved drawing primitives from AnnotationsSceneLayer to PolylineSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1871
diff changeset
164 chain.resize(4);
c074c75cf416 moved drawing primitives from AnnotationsSceneLayer to PolylineSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1871
diff changeset
165 chain[0] = ScenePoint2D(x1, y1);
c074c75cf416 moved drawing primitives from AnnotationsSceneLayer to PolylineSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1871
diff changeset
166 chain[1] = ScenePoint2D(x2, y1);
c074c75cf416 moved drawing primitives from AnnotationsSceneLayer to PolylineSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1871
diff changeset
167 chain[2] = ScenePoint2D(x2, y2);
c074c75cf416 moved drawing primitives from AnnotationsSceneLayer to PolylineSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1871
diff changeset
168 chain[3] = ScenePoint2D(x1, y2);
c074c75cf416 moved drawing primitives from AnnotationsSceneLayer to PolylineSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1871
diff changeset
169 AddChain(chain, true, color);
c074c75cf416 moved drawing primitives from AnnotationsSceneLayer to PolylineSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1871
diff changeset
170 }
c074c75cf416 moved drawing primitives from AnnotationsSceneLayer to PolylineSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1871
diff changeset
171
c074c75cf416 moved drawing primitives from AnnotationsSceneLayer to PolylineSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1871
diff changeset
172
c074c75cf416 moved drawing primitives from AnnotationsSceneLayer to PolylineSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1871
diff changeset
173 void PolylineSceneLayer::AddSegment(double x1,
c074c75cf416 moved drawing primitives from AnnotationsSceneLayer to PolylineSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1871
diff changeset
174 double y1,
c074c75cf416 moved drawing primitives from AnnotationsSceneLayer to PolylineSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1871
diff changeset
175 double x2,
c074c75cf416 moved drawing primitives from AnnotationsSceneLayer to PolylineSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1871
diff changeset
176 double y2,
c074c75cf416 moved drawing primitives from AnnotationsSceneLayer to PolylineSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1871
diff changeset
177 Color color)
c074c75cf416 moved drawing primitives from AnnotationsSceneLayer to PolylineSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1871
diff changeset
178 {
c074c75cf416 moved drawing primitives from AnnotationsSceneLayer to PolylineSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1871
diff changeset
179 Chain chain;
c074c75cf416 moved drawing primitives from AnnotationsSceneLayer to PolylineSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1871
diff changeset
180 chain.resize(2);
c074c75cf416 moved drawing primitives from AnnotationsSceneLayer to PolylineSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1871
diff changeset
181 chain[0] = ScenePoint2D(x1, y1);
c074c75cf416 moved drawing primitives from AnnotationsSceneLayer to PolylineSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1871
diff changeset
182 chain[1] = ScenePoint2D(x2, y2);
c074c75cf416 moved drawing primitives from AnnotationsSceneLayer to PolylineSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1871
diff changeset
183 AddChain(chain, false, color);
c074c75cf416 moved drawing primitives from AnnotationsSceneLayer to PolylineSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1871
diff changeset
184 }
584
434ceeb0bcab layers: InfoPanel, Polyline, Texture
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
185 }