annotate Framework/Scene2DViewport/MeasureToolsToolbox.cpp @ 1048:f6be9412e42a

cleaning up IObservable.h
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 10 Oct 2019 14:11:52 +0200
parents 58eed6bbcabb
children f3bb9a6dd949 b5dec783ba08
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
698
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
1 /**
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
2 * Stone of Orthanc
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
4 * Department, University Hospital of Liege, Belgium
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
5 * Copyright (C) 2017-2019 Osimis S.A., Belgium
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
6 *
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
7 * This program is free software: you can redistribute it and/or
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
8 * modify it under the terms of the GNU Affero General Public License
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
9 * as published by the Free Software Foundation, either version 3 of
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
10 * the License, or (at your option) any later version.
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
11 *
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
12 * This program is distributed in the hope that it will be useful, but
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
15 * Affero General Public License for more details.
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
16 *
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
17 * You should have received a copy of the GNU Affero General Public License
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
19 **/
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
20
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
21 #include "MeasureToolsToolbox.h"
818
e42b491f1fb2 Removed typedefs to shared_ptr by making them explicit. Removed using namespace
Benjamin Golinvaux <bgo@osimis.io>
parents: 774
diff changeset
22 #include "PredeclaredTypes.h"
751
712ff6ff3c19 - undo redo now works fine for both measure tool creation commands
Benjamin Golinvaux <bgo@osimis.io>
parents: 698
diff changeset
23 #include "LayerHolder.h"
774
66ac7a2d1e3a A few renames and cleanups + moved GUI constants to controller + start work on
Benjamin Golinvaux <bgo@osimis.io>
parents: 754
diff changeset
24 #include "ViewportController.h"
698
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
25
736
c0fcb2757b0a enforce relative includes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 698
diff changeset
26 #include "../Scene2D/TextSceneLayer.h"
751
712ff6ff3c19 - undo redo now works fine for both measure tool creation commands
Benjamin Golinvaux <bgo@osimis.io>
parents: 698
diff changeset
27 #include "../Scene2D/Scene2D.h"
1048
f6be9412e42a cleaning up IObservable.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1018
diff changeset
28 #include "../StoneException.h"
698
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
29
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
30 #include <boost/math/constants/constants.hpp>
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
31
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
32 namespace
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
33 {
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
34 double g_pi = boost::math::constants::pi<double>();
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
35 }
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
36
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
37 namespace OrthancStone
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
38 {
901
240359ab1651 Added Dot + magnitude + couple helpers in ScenePoint2D + Added ability to target several sets of 5-layer text packs stored in LayerHolder
Benjamin Golinvaux <bgo@osimis.io>
parents: 893
diff changeset
39 void GetPositionOnBisectingLine(
240359ab1651 Added Dot + magnitude + couple helpers in ScenePoint2D + Added ability to target several sets of 5-layer text packs stored in LayerHolder
Benjamin Golinvaux <bgo@osimis.io>
parents: 893
diff changeset
40 ScenePoint2D& result
240359ab1651 Added Dot + magnitude + couple helpers in ScenePoint2D + Added ability to target several sets of 5-layer text packs stored in LayerHolder
Benjamin Golinvaux <bgo@osimis.io>
parents: 893
diff changeset
41 , const ScenePoint2D& p1
240359ab1651 Added Dot + magnitude + couple helpers in ScenePoint2D + Added ability to target several sets of 5-layer text packs stored in LayerHolder
Benjamin Golinvaux <bgo@osimis.io>
parents: 893
diff changeset
42 , const ScenePoint2D& c
240359ab1651 Added Dot + magnitude + couple helpers in ScenePoint2D + Added ability to target several sets of 5-layer text packs stored in LayerHolder
Benjamin Golinvaux <bgo@osimis.io>
parents: 893
diff changeset
43 , const ScenePoint2D& p2
240359ab1651 Added Dot + magnitude + couple helpers in ScenePoint2D + Added ability to target several sets of 5-layer text packs stored in LayerHolder
Benjamin Golinvaux <bgo@osimis.io>
parents: 893
diff changeset
44 , const double d)
240359ab1651 Added Dot + magnitude + couple helpers in ScenePoint2D + Added ability to target several sets of 5-layer text packs stored in LayerHolder
Benjamin Golinvaux <bgo@osimis.io>
parents: 893
diff changeset
45 {
240359ab1651 Added Dot + magnitude + couple helpers in ScenePoint2D + Added ability to target several sets of 5-layer text packs stored in LayerHolder
Benjamin Golinvaux <bgo@osimis.io>
parents: 893
diff changeset
46 // TODO: fix correct half-plane
240359ab1651 Added Dot + magnitude + couple helpers in ScenePoint2D + Added ability to target several sets of 5-layer text packs stored in LayerHolder
Benjamin Golinvaux <bgo@osimis.io>
parents: 893
diff changeset
47 double p1cAngle = atan2(p1.GetY() - c.GetY(), p1.GetX() - c.GetX());
240359ab1651 Added Dot + magnitude + couple helpers in ScenePoint2D + Added ability to target several sets of 5-layer text packs stored in LayerHolder
Benjamin Golinvaux <bgo@osimis.io>
parents: 893
diff changeset
48 double p2cAngle = atan2(p2.GetY() - c.GetY(), p2.GetX() - c.GetX());
240359ab1651 Added Dot + magnitude + couple helpers in ScenePoint2D + Added ability to target several sets of 5-layer text packs stored in LayerHolder
Benjamin Golinvaux <bgo@osimis.io>
parents: 893
diff changeset
49 double angle = 0.5 * (p1cAngle + p2cAngle);
240359ab1651 Added Dot + magnitude + couple helpers in ScenePoint2D + Added ability to target several sets of 5-layer text packs stored in LayerHolder
Benjamin Golinvaux <bgo@osimis.io>
parents: 893
diff changeset
50 double unitVectorX = cos(angle);
240359ab1651 Added Dot + magnitude + couple helpers in ScenePoint2D + Added ability to target several sets of 5-layer text packs stored in LayerHolder
Benjamin Golinvaux <bgo@osimis.io>
parents: 893
diff changeset
51 double unitVectorY = sin(angle);
240359ab1651 Added Dot + magnitude + couple helpers in ScenePoint2D + Added ability to target several sets of 5-layer text packs stored in LayerHolder
Benjamin Golinvaux <bgo@osimis.io>
parents: 893
diff changeset
52 double posX = c.GetX() + d * unitVectorX;
240359ab1651 Added Dot + magnitude + couple helpers in ScenePoint2D + Added ability to target several sets of 5-layer text packs stored in LayerHolder
Benjamin Golinvaux <bgo@osimis.io>
parents: 893
diff changeset
53 double posY = c.GetX() + d * unitVectorY;
240359ab1651 Added Dot + magnitude + couple helpers in ScenePoint2D + Added ability to target several sets of 5-layer text packs stored in LayerHolder
Benjamin Golinvaux <bgo@osimis.io>
parents: 893
diff changeset
54 result = ScenePoint2D(posX, posY);
240359ab1651 Added Dot + magnitude + couple helpers in ScenePoint2D + Added ability to target several sets of 5-layer text packs stored in LayerHolder
Benjamin Golinvaux <bgo@osimis.io>
parents: 893
diff changeset
55 }
751
712ff6ff3c19 - undo redo now works fine for both measure tool creation commands
Benjamin Golinvaux <bgo@osimis.io>
parents: 698
diff changeset
56
698
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
57 double RadiansToDegrees(double angleRad)
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
58 {
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
59 static const double factor = 180.0 / g_pi;
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
60 return angleRad * factor;
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
61 }
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
62
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
63 void AddSquare(PolylineSceneLayer::Chain& chain,
901
240359ab1651 Added Dot + magnitude + couple helpers in ScenePoint2D + Added ability to target several sets of 5-layer text packs stored in LayerHolder
Benjamin Golinvaux <bgo@osimis.io>
parents: 893
diff changeset
64 const Scene2D& scene,
698
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
65 const ScenePoint2D& centerS,
901
240359ab1651 Added Dot + magnitude + couple helpers in ScenePoint2D + Added ability to target several sets of 5-layer text packs stored in LayerHolder
Benjamin Golinvaux <bgo@osimis.io>
parents: 893
diff changeset
66 const double& sideLengthS)
698
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
67 {
751
712ff6ff3c19 - undo redo now works fine for both measure tool creation commands
Benjamin Golinvaux <bgo@osimis.io>
parents: 698
diff changeset
68 // get the scaling factor
901
240359ab1651 Added Dot + magnitude + couple helpers in ScenePoint2D + Added ability to target several sets of 5-layer text packs stored in LayerHolder
Benjamin Golinvaux <bgo@osimis.io>
parents: 893
diff changeset
69 const double sceneToCanvas =
893
0c5201499af8 Fixes to TrackerSampleApp following IViewport refactoring (FusionMprSdl not working yet)
Benjamin Golinvaux <bgo@osimis.io>
parents: 865
diff changeset
70 scene.GetSceneToCanvasTransform().ComputeZoom();
751
712ff6ff3c19 - undo redo now works fine for both measure tool creation commands
Benjamin Golinvaux <bgo@osimis.io>
parents: 698
diff changeset
71
698
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
72 chain.clear();
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
73 chain.reserve(4);
893
0c5201499af8 Fixes to TrackerSampleApp following IViewport refactoring (FusionMprSdl not working yet)
Benjamin Golinvaux <bgo@osimis.io>
parents: 865
diff changeset
74 ScenePoint2D centerC = centerS.Apply(scene.GetSceneToCanvasTransform());
698
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
75 //TODO: take DPI into account
751
712ff6ff3c19 - undo redo now works fine for both measure tool creation commands
Benjamin Golinvaux <bgo@osimis.io>
parents: 698
diff changeset
76 double handleLX = centerC.GetX() - sideLengthS * sceneToCanvas * 0.5;
712ff6ff3c19 - undo redo now works fine for both measure tool creation commands
Benjamin Golinvaux <bgo@osimis.io>
parents: 698
diff changeset
77 double handleTY = centerC.GetY() - sideLengthS * sceneToCanvas * 0.5;
712ff6ff3c19 - undo redo now works fine for both measure tool creation commands
Benjamin Golinvaux <bgo@osimis.io>
parents: 698
diff changeset
78 double handleRX = centerC.GetX() + sideLengthS * sceneToCanvas * 0.5;
712ff6ff3c19 - undo redo now works fine for both measure tool creation commands
Benjamin Golinvaux <bgo@osimis.io>
parents: 698
diff changeset
79 double handleBY = centerC.GetY() + sideLengthS * sceneToCanvas * 0.5;
698
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
80 ScenePoint2D LTC(handleLX, handleTY);
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
81 ScenePoint2D RTC(handleRX, handleTY);
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
82 ScenePoint2D RBC(handleRX, handleBY);
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
83 ScenePoint2D LBC(handleLX, handleBY);
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
84
893
0c5201499af8 Fixes to TrackerSampleApp following IViewport refactoring (FusionMprSdl not working yet)
Benjamin Golinvaux <bgo@osimis.io>
parents: 865
diff changeset
85 ScenePoint2D startLT = LTC.Apply(scene.GetCanvasToSceneTransform());
0c5201499af8 Fixes to TrackerSampleApp following IViewport refactoring (FusionMprSdl not working yet)
Benjamin Golinvaux <bgo@osimis.io>
parents: 865
diff changeset
86 ScenePoint2D startRT = RTC.Apply(scene.GetCanvasToSceneTransform());
0c5201499af8 Fixes to TrackerSampleApp following IViewport refactoring (FusionMprSdl not working yet)
Benjamin Golinvaux <bgo@osimis.io>
parents: 865
diff changeset
87 ScenePoint2D startRB = RBC.Apply(scene.GetCanvasToSceneTransform());
0c5201499af8 Fixes to TrackerSampleApp following IViewport refactoring (FusionMprSdl not working yet)
Benjamin Golinvaux <bgo@osimis.io>
parents: 865
diff changeset
88 ScenePoint2D startLB = LBC.Apply(scene.GetCanvasToSceneTransform());
698
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
89
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
90 chain.push_back(startLT);
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
91 chain.push_back(startRT);
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
92 chain.push_back(startRB);
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
93 chain.push_back(startLB);
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
94 }
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
95 #if 0
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
96 void AddArc(
901
240359ab1651 Added Dot + magnitude + couple helpers in ScenePoint2D + Added ability to target several sets of 5-layer text packs stored in LayerHolder
Benjamin Golinvaux <bgo@osimis.io>
parents: 893
diff changeset
97 PolylineSceneLayer::Chain & chain
240359ab1651 Added Dot + magnitude + couple helpers in ScenePoint2D + Added ability to target several sets of 5-layer text packs stored in LayerHolder
Benjamin Golinvaux <bgo@osimis.io>
parents: 893
diff changeset
98 , const Scene2D & scene
240359ab1651 Added Dot + magnitude + couple helpers in ScenePoint2D + Added ability to target several sets of 5-layer text packs stored in LayerHolder
Benjamin Golinvaux <bgo@osimis.io>
parents: 893
diff changeset
99 , const ScenePoint2D & p1
240359ab1651 Added Dot + magnitude + couple helpers in ScenePoint2D + Added ability to target several sets of 5-layer text packs stored in LayerHolder
Benjamin Golinvaux <bgo@osimis.io>
parents: 893
diff changeset
100 , const ScenePoint2D & c
240359ab1651 Added Dot + magnitude + couple helpers in ScenePoint2D + Added ability to target several sets of 5-layer text packs stored in LayerHolder
Benjamin Golinvaux <bgo@osimis.io>
parents: 893
diff changeset
101 , const ScenePoint2D & p2
240359ab1651 Added Dot + magnitude + couple helpers in ScenePoint2D + Added ability to target several sets of 5-layer text packs stored in LayerHolder
Benjamin Golinvaux <bgo@osimis.io>
parents: 893
diff changeset
102 , const double& radiusS
698
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
103 , const bool clockwise
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
104 , const int subdivisionsCount)
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
105 {
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
106 double p1cAngle = atan2(p1.GetY() - c.GetY(), p1.GetX() - c.GetX());
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
107 double p2cAngle = atan2(p2.GetY() - c.GetY(), p2.GetX() - c.GetX());
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
108 AddArc(
901
240359ab1651 Added Dot + magnitude + couple helpers in ScenePoint2D + Added ability to target several sets of 5-layer text packs stored in LayerHolder
Benjamin Golinvaux <bgo@osimis.io>
parents: 893
diff changeset
109 chain, scene, c, radiusS, p1cAngle, p2cAngle,
698
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
110 clockwise, subdivisionsCount);
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
111 }
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
112 #endif
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
113
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
114 void AddShortestArc(
901
240359ab1651 Added Dot + magnitude + couple helpers in ScenePoint2D + Added ability to target several sets of 5-layer text packs stored in LayerHolder
Benjamin Golinvaux <bgo@osimis.io>
parents: 893
diff changeset
115 PolylineSceneLayer::Chain& chain
240359ab1651 Added Dot + magnitude + couple helpers in ScenePoint2D + Added ability to target several sets of 5-layer text packs stored in LayerHolder
Benjamin Golinvaux <bgo@osimis.io>
parents: 893
diff changeset
116 , const ScenePoint2D& p1
240359ab1651 Added Dot + magnitude + couple helpers in ScenePoint2D + Added ability to target several sets of 5-layer text packs stored in LayerHolder
Benjamin Golinvaux <bgo@osimis.io>
parents: 893
diff changeset
117 , const ScenePoint2D& c
240359ab1651 Added Dot + magnitude + couple helpers in ScenePoint2D + Added ability to target several sets of 5-layer text packs stored in LayerHolder
Benjamin Golinvaux <bgo@osimis.io>
parents: 893
diff changeset
118 , const ScenePoint2D& p2
240359ab1651 Added Dot + magnitude + couple helpers in ScenePoint2D + Added ability to target several sets of 5-layer text packs stored in LayerHolder
Benjamin Golinvaux <bgo@osimis.io>
parents: 893
diff changeset
119 , const double& radiusS
698
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
120 , const int subdivisionsCount)
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
121 {
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
122 double p1cAngle = atan2(p1.GetY() - c.GetY(), p1.GetX() - c.GetX());
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
123 double p2cAngle = atan2(p2.GetY() - c.GetY(), p2.GetX() - c.GetX());
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
124 AddShortestArc(
751
712ff6ff3c19 - undo redo now works fine for both measure tool creation commands
Benjamin Golinvaux <bgo@osimis.io>
parents: 698
diff changeset
125 chain, c, radiusS, p1cAngle, p2cAngle, subdivisionsCount);
698
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
126 }
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
127
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
128 void AddShortestArc(
901
240359ab1651 Added Dot + magnitude + couple helpers in ScenePoint2D + Added ability to target several sets of 5-layer text packs stored in LayerHolder
Benjamin Golinvaux <bgo@osimis.io>
parents: 893
diff changeset
129 PolylineSceneLayer::Chain& chain
240359ab1651 Added Dot + magnitude + couple helpers in ScenePoint2D + Added ability to target several sets of 5-layer text packs stored in LayerHolder
Benjamin Golinvaux <bgo@osimis.io>
parents: 893
diff changeset
130 , const ScenePoint2D& centerS
240359ab1651 Added Dot + magnitude + couple helpers in ScenePoint2D + Added ability to target several sets of 5-layer text packs stored in LayerHolder
Benjamin Golinvaux <bgo@osimis.io>
parents: 893
diff changeset
131 , const double& radiusS
698
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
132 , const double startAngleRad
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
133 , const double endAngleRad
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
134 , const int subdivisionsCount)
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
135 {
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
136 // this gives a signed difference between angle which
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
137 // is the smallest difference (in magnitude) between
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
138 // the angles
901
240359ab1651 Added Dot + magnitude + couple helpers in ScenePoint2D + Added ability to target several sets of 5-layer text packs stored in LayerHolder
Benjamin Golinvaux <bgo@osimis.io>
parents: 893
diff changeset
139 double delta = NormalizeAngle(endAngleRad - startAngleRad);
698
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
140
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
141 chain.clear();
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
142 chain.reserve(subdivisionsCount + 1);
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
143
901
240359ab1651 Added Dot + magnitude + couple helpers in ScenePoint2D + Added ability to target several sets of 5-layer text packs stored in LayerHolder
Benjamin Golinvaux <bgo@osimis.io>
parents: 893
diff changeset
144 double angleIncr = delta / static_cast<double>(subdivisionsCount);
698
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
145
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
146 double theta = startAngleRad;
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
147 for (int i = 0; i < subdivisionsCount + 1; ++i)
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
148 {
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
149 double offsetX = radiusS * cos(theta);
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
150 double offsetY = radiusS * sin(theta);
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
151 double pointX = centerS.GetX() + offsetX;
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
152 double pointY = centerS.GetY() + offsetY;
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
153 chain.push_back(ScenePoint2D(pointX, pointY));
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
154 theta += angleIncr;
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
155 }
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
156 }
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
157
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
158 #if 0
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
159 void AddArc(
901
240359ab1651 Added Dot + magnitude + couple helpers in ScenePoint2D + Added ability to target several sets of 5-layer text packs stored in LayerHolder
Benjamin Golinvaux <bgo@osimis.io>
parents: 893
diff changeset
160 PolylineSceneLayer::Chain & chain
240359ab1651 Added Dot + magnitude + couple helpers in ScenePoint2D + Added ability to target several sets of 5-layer text packs stored in LayerHolder
Benjamin Golinvaux <bgo@osimis.io>
parents: 893
diff changeset
161 , const Scene2D & scene
240359ab1651 Added Dot + magnitude + couple helpers in ScenePoint2D + Added ability to target several sets of 5-layer text packs stored in LayerHolder
Benjamin Golinvaux <bgo@osimis.io>
parents: 893
diff changeset
162 , const ScenePoint2D & centerS
240359ab1651 Added Dot + magnitude + couple helpers in ScenePoint2D + Added ability to target several sets of 5-layer text packs stored in LayerHolder
Benjamin Golinvaux <bgo@osimis.io>
parents: 893
diff changeset
163 , const double& radiusS
698
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
164 , const double startAngleRad
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
165 , const double endAngleRad
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
166 , const bool clockwise
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
167 , const int subdivisionsCount)
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
168 {
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
169 double startAngleRadN = NormalizeAngle(startAngleRad);
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
170 double endAngleRadN = NormalizeAngle(endAngleRad);
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
171
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
172 double angle1Rad = std::min(startAngleRadN, endAngleRadN);
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
173 double angle2Rad = std::max(startAngleRadN, endAngleRadN);
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
174
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
175 // now we are sure angle1Rad < angle2Rad
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
176 // this means that if we draw from 1 to 2, it will be clockwise (
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
177 // increasing angles).
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
178 // let's fix this:
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
179 if (!clockwise)
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
180 {
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
181 angle2Rad -= 2 * g_pi;
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
182 // now we are sure angle2Rad < angle1Rad (since they were normalized)
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
183 // and, thus, going from 1 to 2 means the angle values will DECREASE,
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
184 // which is the definition of anticlockwise
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
185 }
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
186
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
187 chain.clear();
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
188 chain.reserve(subdivisionsCount + 1);
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
189
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
190 double angleIncr = (angle2Rad - angle1Rad)
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
191 / static_cast<double>(subdivisionsCount);
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
192
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
193 double theta = angle1Rad;
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
194 for (int i = 0; i < subdivisionsCount + 1; ++i)
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
195 {
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
196 double offsetX = radiusS * cos(theta);
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
197 double offsetY = radiusS * sin(theta);
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
198 double pointX = centerS.GetX() + offsetX;
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
199 double pointY = centerS.GetY() + offsetY;
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
200 chain.push_back(ScenePoint2D(pointX, pointY));
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
201 theta += angleIncr;
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
202 }
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
203 }
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
204 #endif
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
205
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
206 void AddCircle(PolylineSceneLayer::Chain& chain,
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
207 const ScenePoint2D& centerS,
901
240359ab1651 Added Dot + magnitude + couple helpers in ScenePoint2D + Added ability to target several sets of 5-layer text packs stored in LayerHolder
Benjamin Golinvaux <bgo@osimis.io>
parents: 893
diff changeset
208 const double& radiusS,
698
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
209 const int numSubdivisions)
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
210 {
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
211 //ScenePoint2D centerC = centerS.Apply(scene.GetSceneToCanvasTransform());
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
212 //TODO: take DPI into account
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
213
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
214 // TODO: automatically compute the number for segments for smooth
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
215 // display based on the radius in pixels.
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
216
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
217 chain.clear();
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
218 chain.reserve(numSubdivisions);
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
219
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
220 double angleIncr = (2.0 * g_pi)
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
221 / static_cast<double>(numSubdivisions);
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
222
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
223 double theta = 0;
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
224 for (int i = 0; i < numSubdivisions; ++i)
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
225 {
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
226 double offsetX = radiusS * cos(theta);
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
227 double offsetY = radiusS * sin(theta);
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
228 double pointX = centerS.GetX() + offsetX;
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
229 double pointY = centerS.GetY() + offsetY;
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
230 chain.push_back(ScenePoint2D(pointX, pointY));
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
231 theta += angleIncr;
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
232 }
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
233 }
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
234
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
235 double NormalizeAngle(double angle)
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
236 {
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
237 double retAngle = angle;
901
240359ab1651 Added Dot + magnitude + couple helpers in ScenePoint2D + Added ability to target several sets of 5-layer text packs stored in LayerHolder
Benjamin Golinvaux <bgo@osimis.io>
parents: 893
diff changeset
238 while (retAngle < -1.0 * g_pi)
698
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
239 retAngle += 2 * g_pi;
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
240 while (retAngle >= g_pi)
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
241 retAngle -= 2 * g_pi;
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
242 return retAngle;
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
243 }
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
244
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
245 double MeasureAngle(const ScenePoint2D& p1, const ScenePoint2D& c, const ScenePoint2D& p2)
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
246 {
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
247 double p1cAngle = atan2(p1.GetY() - c.GetY(), p1.GetX() - c.GetX());
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
248 double p2cAngle = atan2(p2.GetY() - c.GetY(), p2.GetX() - c.GetX());
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
249 double delta = p2cAngle - p1cAngle;
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
250 return NormalizeAngle(delta);
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
251 }
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
252
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
253
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
254 #if 0
901
240359ab1651 Added Dot + magnitude + couple helpers in ScenePoint2D + Added ability to target several sets of 5-layer text packs stored in LayerHolder
Benjamin Golinvaux <bgo@osimis.io>
parents: 893
diff changeset
255 void AddEllipse(PolylineSceneLayer::Chain & chain,
240359ab1651 Added Dot + magnitude + couple helpers in ScenePoint2D + Added ability to target several sets of 5-layer text packs stored in LayerHolder
Benjamin Golinvaux <bgo@osimis.io>
parents: 893
diff changeset
256 const Scene2D & scene,
240359ab1651 Added Dot + magnitude + couple helpers in ScenePoint2D + Added ability to target several sets of 5-layer text packs stored in LayerHolder
Benjamin Golinvaux <bgo@osimis.io>
parents: 893
diff changeset
257 const ScenePoint2D & centerS,
240359ab1651 Added Dot + magnitude + couple helpers in ScenePoint2D + Added ability to target several sets of 5-layer text packs stored in LayerHolder
Benjamin Golinvaux <bgo@osimis.io>
parents: 893
diff changeset
258 const double& halfHAxis,
240359ab1651 Added Dot + magnitude + couple helpers in ScenePoint2D + Added ability to target several sets of 5-layer text packs stored in LayerHolder
Benjamin Golinvaux <bgo@osimis.io>
parents: 893
diff changeset
259 const double& halfVAxis)
698
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
260 {
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
261 chain.clear();
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
262 chain.reserve(4);
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
263 ScenePoint2D centerC = centerS.Apply(scene.GetSceneToCanvasTransform());
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
264 //TODO: take DPI into account
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
265 double handleLX = centerC.GetX() - sideLength / 2;
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
266 double handleTY = centerC.GetY() - sideLength / 2;
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
267 double handleRX = centerC.GetX() + sideLength / 2;
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
268 double handleBY = centerC.GetY() + sideLength / 2;
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
269 ScenePoint2D LTC(handleLX, handleTY);
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
270 ScenePoint2D RTC(handleRX, handleTY);
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
271 ScenePoint2D RBC(handleRX, handleBY);
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
272 ScenePoint2D LBC(handleLX, handleBY);
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
273
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
274 ScenePoint2D startLT = LTC.Apply(scene.GetCanvasToSceneTransform());
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
275 ScenePoint2D startRT = RTC.Apply(scene.GetCanvasToSceneTransform());
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
276 ScenePoint2D startRB = RBC.Apply(scene.GetCanvasToSceneTransform());
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
277 ScenePoint2D startLB = LBC.Apply(scene.GetCanvasToSceneTransform());
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
278
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
279 chain.push_back(startLT);
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
280 chain.push_back(startRT);
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
281 chain.push_back(startRB);
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
282 chain.push_back(startLB);
901
240359ab1651 Added Dot + magnitude + couple helpers in ScenePoint2D + Added ability to target several sets of 5-layer text packs stored in LayerHolder
Benjamin Golinvaux <bgo@osimis.io>
parents: 893
diff changeset
283 }
698
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
284 #endif
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
285
906
52b1c6ff10c5 Disabled OpenGL in GuiAdapter to allow for Cairo-only workflows (THIS IS A TEMP CHANGE!!!) + disabled outlined text by default (build macro)
Benjamin Golinvaux <bgo@osimis.io>
parents: 901
diff changeset
286 #if ORTHANC_STONE_ENABLE_OUTLINED_TEXT == 1
751
712ff6ff3c19 - undo redo now works fine for both measure tool creation commands
Benjamin Golinvaux <bgo@osimis.io>
parents: 698
diff changeset
287 /**
712ff6ff3c19 - undo redo now works fine for both measure tool creation commands
Benjamin Golinvaux <bgo@osimis.io>
parents: 698
diff changeset
288 This utility function assumes that the layer holder contains 5 text layers
712ff6ff3c19 - undo redo now works fine for both measure tool creation commands
Benjamin Golinvaux <bgo@osimis.io>
parents: 698
diff changeset
289 and will use the first four ones for the text background and the fifth one
712ff6ff3c19 - undo redo now works fine for both measure tool creation commands
Benjamin Golinvaux <bgo@osimis.io>
parents: 698
diff changeset
290 for the actual text
712ff6ff3c19 - undo redo now works fine for both measure tool creation commands
Benjamin Golinvaux <bgo@osimis.io>
parents: 698
diff changeset
291 */
698
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
292 void SetTextLayerOutlineProperties(
901
240359ab1651 Added Dot + magnitude + couple helpers in ScenePoint2D + Added ability to target several sets of 5-layer text packs stored in LayerHolder
Benjamin Golinvaux <bgo@osimis.io>
parents: 893
diff changeset
293 Scene2D& scene
240359ab1651 Added Dot + magnitude + couple helpers in ScenePoint2D + Added ability to target several sets of 5-layer text packs stored in LayerHolder
Benjamin Golinvaux <bgo@osimis.io>
parents: 893
diff changeset
294 , boost::shared_ptr<LayerHolder> layerHolder
240359ab1651 Added Dot + magnitude + couple helpers in ScenePoint2D + Added ability to target several sets of 5-layer text packs stored in LayerHolder
Benjamin Golinvaux <bgo@osimis.io>
parents: 893
diff changeset
295 , const char* text
240359ab1651 Added Dot + magnitude + couple helpers in ScenePoint2D + Added ability to target several sets of 5-layer text packs stored in LayerHolder
Benjamin Golinvaux <bgo@osimis.io>
parents: 893
diff changeset
296 , ScenePoint2D p
240359ab1651 Added Dot + magnitude + couple helpers in ScenePoint2D + Added ability to target several sets of 5-layer text packs stored in LayerHolder
Benjamin Golinvaux <bgo@osimis.io>
parents: 893
diff changeset
297 , int startingLayerIndex)
698
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
298 {
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
299 double xoffsets[5] = { 2, 0, -2, 0, 0 };
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
300 double yoffsets[5] = { 0, -2, 0, 2, 0 };
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
301
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
302 // get the scaling factor
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
303 const double pixelToScene =
893
0c5201499af8 Fixes to TrackerSampleApp following IViewport refactoring (FusionMprSdl not working yet)
Benjamin Golinvaux <bgo@osimis.io>
parents: 865
diff changeset
304 scene.GetCanvasToSceneTransform().ComputeZoom();
698
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
305
901
240359ab1651 Added Dot + magnitude + couple helpers in ScenePoint2D + Added ability to target several sets of 5-layer text packs stored in LayerHolder
Benjamin Golinvaux <bgo@osimis.io>
parents: 893
diff changeset
306 for (int i = startingLayerIndex; i < startingLayerIndex + 5; ++i)
698
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
307 {
751
712ff6ff3c19 - undo redo now works fine for both measure tool creation commands
Benjamin Golinvaux <bgo@osimis.io>
parents: 698
diff changeset
308 TextSceneLayer* textLayer = layerHolder->GetTextLayer(i);
901
240359ab1651 Added Dot + magnitude + couple helpers in ScenePoint2D + Added ability to target several sets of 5-layer text packs stored in LayerHolder
Benjamin Golinvaux <bgo@osimis.io>
parents: 893
diff changeset
309 ORTHANC_ASSERT(textLayer != NULL);
698
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
310 textLayer->SetText(text);
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
311
906
52b1c6ff10c5 Disabled OpenGL in GuiAdapter to allow for Cairo-only workflows (THIS IS A TEMP CHANGE!!!) + disabled outlined text by default (build macro)
Benjamin Golinvaux <bgo@osimis.io>
parents: 901
diff changeset
312 if (i == startingLayerIndex + 4)
774
66ac7a2d1e3a A few renames and cleanups + moved GUI constants to controller + start work on
Benjamin Golinvaux <bgo@osimis.io>
parents: 754
diff changeset
313 {
66ac7a2d1e3a A few renames and cleanups + moved GUI constants to controller + start work on
Benjamin Golinvaux <bgo@osimis.io>
parents: 754
diff changeset
314 textLayer->SetColor(TEXT_COLOR_RED,
901
240359ab1651 Added Dot + magnitude + couple helpers in ScenePoint2D + Added ability to target several sets of 5-layer text packs stored in LayerHolder
Benjamin Golinvaux <bgo@osimis.io>
parents: 893
diff changeset
315 TEXT_COLOR_GREEN,
240359ab1651 Added Dot + magnitude + couple helpers in ScenePoint2D + Added ability to target several sets of 5-layer text packs stored in LayerHolder
Benjamin Golinvaux <bgo@osimis.io>
parents: 893
diff changeset
316 TEXT_COLOR_BLUE);
774
66ac7a2d1e3a A few renames and cleanups + moved GUI constants to controller + start work on
Benjamin Golinvaux <bgo@osimis.io>
parents: 754
diff changeset
317 }
698
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
318 else
774
66ac7a2d1e3a A few renames and cleanups + moved GUI constants to controller + start work on
Benjamin Golinvaux <bgo@osimis.io>
parents: 754
diff changeset
319 {
66ac7a2d1e3a A few renames and cleanups + moved GUI constants to controller + start work on
Benjamin Golinvaux <bgo@osimis.io>
parents: 754
diff changeset
320 textLayer->SetColor(TEXT_OUTLINE_COLOR_RED,
901
240359ab1651 Added Dot + magnitude + couple helpers in ScenePoint2D + Added ability to target several sets of 5-layer text packs stored in LayerHolder
Benjamin Golinvaux <bgo@osimis.io>
parents: 893
diff changeset
321 TEXT_OUTLINE_COLOR_GREEN,
240359ab1651 Added Dot + magnitude + couple helpers in ScenePoint2D + Added ability to target several sets of 5-layer text packs stored in LayerHolder
Benjamin Golinvaux <bgo@osimis.io>
parents: 893
diff changeset
322 TEXT_OUTLINE_COLOR_BLUE);
774
66ac7a2d1e3a A few renames and cleanups + moved GUI constants to controller + start work on
Benjamin Golinvaux <bgo@osimis.io>
parents: 754
diff changeset
323 }
698
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
324
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
325 ScenePoint2D textAnchor;
906
52b1c6ff10c5 Disabled OpenGL in GuiAdapter to allow for Cairo-only workflows (THIS IS A TEMP CHANGE!!!) + disabled outlined text by default (build macro)
Benjamin Golinvaux <bgo@osimis.io>
parents: 901
diff changeset
326 int offIndex = i - startingLayerIndex;
52b1c6ff10c5 Disabled OpenGL in GuiAdapter to allow for Cairo-only workflows (THIS IS A TEMP CHANGE!!!) + disabled outlined text by default (build macro)
Benjamin Golinvaux <bgo@osimis.io>
parents: 901
diff changeset
327 ORTHANC_ASSERT(offIndex >= 0 && offIndex < 5);
698
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
328 textLayer->SetPosition(
906
52b1c6ff10c5 Disabled OpenGL in GuiAdapter to allow for Cairo-only workflows (THIS IS A TEMP CHANGE!!!) + disabled outlined text by default (build macro)
Benjamin Golinvaux <bgo@osimis.io>
parents: 901
diff changeset
329 p.GetX() + xoffsets[offIndex] * pixelToScene,
52b1c6ff10c5 Disabled OpenGL in GuiAdapter to allow for Cairo-only workflows (THIS IS A TEMP CHANGE!!!) + disabled outlined text by default (build macro)
Benjamin Golinvaux <bgo@osimis.io>
parents: 901
diff changeset
330 p.GetY() + yoffsets[offIndex] * pixelToScene);
698
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
331 }
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
332 }
906
52b1c6ff10c5 Disabled OpenGL in GuiAdapter to allow for Cairo-only workflows (THIS IS A TEMP CHANGE!!!) + disabled outlined text by default (build macro)
Benjamin Golinvaux <bgo@osimis.io>
parents: 901
diff changeset
333 #else
52b1c6ff10c5 Disabled OpenGL in GuiAdapter to allow for Cairo-only workflows (THIS IS A TEMP CHANGE!!!) + disabled outlined text by default (build macro)
Benjamin Golinvaux <bgo@osimis.io>
parents: 901
diff changeset
334 void SetTextLayerProperties(
52b1c6ff10c5 Disabled OpenGL in GuiAdapter to allow for Cairo-only workflows (THIS IS A TEMP CHANGE!!!) + disabled outlined text by default (build macro)
Benjamin Golinvaux <bgo@osimis.io>
parents: 901
diff changeset
335 Scene2D& scene
52b1c6ff10c5 Disabled OpenGL in GuiAdapter to allow for Cairo-only workflows (THIS IS A TEMP CHANGE!!!) + disabled outlined text by default (build macro)
Benjamin Golinvaux <bgo@osimis.io>
parents: 901
diff changeset
336 , boost::shared_ptr<LayerHolder> layerHolder
52b1c6ff10c5 Disabled OpenGL in GuiAdapter to allow for Cairo-only workflows (THIS IS A TEMP CHANGE!!!) + disabled outlined text by default (build macro)
Benjamin Golinvaux <bgo@osimis.io>
parents: 901
diff changeset
337 , const char* text
52b1c6ff10c5 Disabled OpenGL in GuiAdapter to allow for Cairo-only workflows (THIS IS A TEMP CHANGE!!!) + disabled outlined text by default (build macro)
Benjamin Golinvaux <bgo@osimis.io>
parents: 901
diff changeset
338 , ScenePoint2D p
52b1c6ff10c5 Disabled OpenGL in GuiAdapter to allow for Cairo-only workflows (THIS IS A TEMP CHANGE!!!) + disabled outlined text by default (build macro)
Benjamin Golinvaux <bgo@osimis.io>
parents: 901
diff changeset
339 , int layerIndex)
52b1c6ff10c5 Disabled OpenGL in GuiAdapter to allow for Cairo-only workflows (THIS IS A TEMP CHANGE!!!) + disabled outlined text by default (build macro)
Benjamin Golinvaux <bgo@osimis.io>
parents: 901
diff changeset
340 {
52b1c6ff10c5 Disabled OpenGL in GuiAdapter to allow for Cairo-only workflows (THIS IS A TEMP CHANGE!!!) + disabled outlined text by default (build macro)
Benjamin Golinvaux <bgo@osimis.io>
parents: 901
diff changeset
341 TextSceneLayer* textLayer = layerHolder->GetTextLayer(layerIndex);
52b1c6ff10c5 Disabled OpenGL in GuiAdapter to allow for Cairo-only workflows (THIS IS A TEMP CHANGE!!!) + disabled outlined text by default (build macro)
Benjamin Golinvaux <bgo@osimis.io>
parents: 901
diff changeset
342 ORTHANC_ASSERT(textLayer != NULL);
52b1c6ff10c5 Disabled OpenGL in GuiAdapter to allow for Cairo-only workflows (THIS IS A TEMP CHANGE!!!) + disabled outlined text by default (build macro)
Benjamin Golinvaux <bgo@osimis.io>
parents: 901
diff changeset
343 textLayer->SetText(text);
52b1c6ff10c5 Disabled OpenGL in GuiAdapter to allow for Cairo-only workflows (THIS IS A TEMP CHANGE!!!) + disabled outlined text by default (build macro)
Benjamin Golinvaux <bgo@osimis.io>
parents: 901
diff changeset
344
52b1c6ff10c5 Disabled OpenGL in GuiAdapter to allow for Cairo-only workflows (THIS IS A TEMP CHANGE!!!) + disabled outlined text by default (build macro)
Benjamin Golinvaux <bgo@osimis.io>
parents: 901
diff changeset
345 textLayer->SetColor(TEXT_COLOR_RED, TEXT_COLOR_GREEN, TEXT_COLOR_BLUE);
52b1c6ff10c5 Disabled OpenGL in GuiAdapter to allow for Cairo-only workflows (THIS IS A TEMP CHANGE!!!) + disabled outlined text by default (build macro)
Benjamin Golinvaux <bgo@osimis.io>
parents: 901
diff changeset
346
52b1c6ff10c5 Disabled OpenGL in GuiAdapter to allow for Cairo-only workflows (THIS IS A TEMP CHANGE!!!) + disabled outlined text by default (build macro)
Benjamin Golinvaux <bgo@osimis.io>
parents: 901
diff changeset
347 ScenePoint2D textAnchor;
52b1c6ff10c5 Disabled OpenGL in GuiAdapter to allow for Cairo-only workflows (THIS IS A TEMP CHANGE!!!) + disabled outlined text by default (build macro)
Benjamin Golinvaux <bgo@osimis.io>
parents: 901
diff changeset
348 textLayer->SetPosition(p.GetX(), p.GetY());
52b1c6ff10c5 Disabled OpenGL in GuiAdapter to allow for Cairo-only workflows (THIS IS A TEMP CHANGE!!!) + disabled outlined text by default (build macro)
Benjamin Golinvaux <bgo@osimis.io>
parents: 901
diff changeset
349 }
52b1c6ff10c5 Disabled OpenGL in GuiAdapter to allow for Cairo-only workflows (THIS IS A TEMP CHANGE!!!) + disabled outlined text by default (build macro)
Benjamin Golinvaux <bgo@osimis.io>
parents: 901
diff changeset
350 #endif
865
a29c13497557 Added operators to ScenePoint2D + highlight support on MouseOver for measuring tools
Benjamin Golinvaux <bgo@osimis.io>
parents: 818
diff changeset
351
a29c13497557 Added operators to ScenePoint2D + highlight support on MouseOver for measuring tools
Benjamin Golinvaux <bgo@osimis.io>
parents: 818
diff changeset
352 std::ostream& operator<<(std::ostream& os, const ScenePoint2D& p)
a29c13497557 Added operators to ScenePoint2D + highlight support on MouseOver for measuring tools
Benjamin Golinvaux <bgo@osimis.io>
parents: 818
diff changeset
353 {
a29c13497557 Added operators to ScenePoint2D + highlight support on MouseOver for measuring tools
Benjamin Golinvaux <bgo@osimis.io>
parents: 818
diff changeset
354 os << "x = " << p.GetX() << " , y = " << p.GetY();
a29c13497557 Added operators to ScenePoint2D + highlight support on MouseOver for measuring tools
Benjamin Golinvaux <bgo@osimis.io>
parents: 818
diff changeset
355 return os;
a29c13497557 Added operators to ScenePoint2D + highlight support on MouseOver for measuring tools
Benjamin Golinvaux <bgo@osimis.io>
parents: 818
diff changeset
356 }
a29c13497557 Added operators to ScenePoint2D + highlight support on MouseOver for measuring tools
Benjamin Golinvaux <bgo@osimis.io>
parents: 818
diff changeset
357
698
8b6adfb62a2f Code is broken -- stashing ongoing work in a branch
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
358 }