Mercurial > hg > orthanc-stone
comparison Framework/Scene2DViewport/MeasureToolsToolbox.cpp @ 893:0c5201499af8
Fixes to TrackerSampleApp following IViewport refactoring (FusionMprSdl not working yet)
Removal of the useless scene_ inside ViewportController
author | Benjamin Golinvaux <bgo@osimis.io> |
---|---|
date | Mon, 15 Jul 2019 12:48:19 +0200 |
parents | a29c13497557 |
children | 240359ab1651 |
comparison
equal
deleted
inserted
replaced
892:50cd372e2460 | 893:0c5201499af8 |
---|---|
58 static const double factor = 180.0 / g_pi; | 58 static const double factor = 180.0 / g_pi; |
59 return angleRad * factor; | 59 return angleRad * factor; |
60 } | 60 } |
61 | 61 |
62 void AddSquare(PolylineSceneLayer::Chain& chain, | 62 void AddSquare(PolylineSceneLayer::Chain& chain, |
63 boost::shared_ptr<const Scene2D> scene, | 63 const Scene2D& scene, |
64 const ScenePoint2D& centerS, | 64 const ScenePoint2D& centerS, |
65 const double& sideLengthS) | 65 const double& sideLengthS) |
66 { | 66 { |
67 // get the scaling factor | 67 // get the scaling factor |
68 const double sceneToCanvas = | 68 const double sceneToCanvas = |
69 scene->GetSceneToCanvasTransform().ComputeZoom(); | 69 scene.GetSceneToCanvasTransform().ComputeZoom(); |
70 | 70 |
71 chain.clear(); | 71 chain.clear(); |
72 chain.reserve(4); | 72 chain.reserve(4); |
73 ScenePoint2D centerC = centerS.Apply(scene->GetSceneToCanvasTransform()); | 73 ScenePoint2D centerC = centerS.Apply(scene.GetSceneToCanvasTransform()); |
74 //TODO: take DPI into account | 74 //TODO: take DPI into account |
75 double handleLX = centerC.GetX() - sideLengthS * sceneToCanvas * 0.5; | 75 double handleLX = centerC.GetX() - sideLengthS * sceneToCanvas * 0.5; |
76 double handleTY = centerC.GetY() - sideLengthS * sceneToCanvas * 0.5; | 76 double handleTY = centerC.GetY() - sideLengthS * sceneToCanvas * 0.5; |
77 double handleRX = centerC.GetX() + sideLengthS * sceneToCanvas * 0.5; | 77 double handleRX = centerC.GetX() + sideLengthS * sceneToCanvas * 0.5; |
78 double handleBY = centerC.GetY() + sideLengthS * sceneToCanvas * 0.5; | 78 double handleBY = centerC.GetY() + sideLengthS * sceneToCanvas * 0.5; |
79 ScenePoint2D LTC(handleLX, handleTY); | 79 ScenePoint2D LTC(handleLX, handleTY); |
80 ScenePoint2D RTC(handleRX, handleTY); | 80 ScenePoint2D RTC(handleRX, handleTY); |
81 ScenePoint2D RBC(handleRX, handleBY); | 81 ScenePoint2D RBC(handleRX, handleBY); |
82 ScenePoint2D LBC(handleLX, handleBY); | 82 ScenePoint2D LBC(handleLX, handleBY); |
83 | 83 |
84 ScenePoint2D startLT = LTC.Apply(scene->GetCanvasToSceneTransform()); | 84 ScenePoint2D startLT = LTC.Apply(scene.GetCanvasToSceneTransform()); |
85 ScenePoint2D startRT = RTC.Apply(scene->GetCanvasToSceneTransform()); | 85 ScenePoint2D startRT = RTC.Apply(scene.GetCanvasToSceneTransform()); |
86 ScenePoint2D startRB = RBC.Apply(scene->GetCanvasToSceneTransform()); | 86 ScenePoint2D startRB = RBC.Apply(scene.GetCanvasToSceneTransform()); |
87 ScenePoint2D startLB = LBC.Apply(scene->GetCanvasToSceneTransform()); | 87 ScenePoint2D startLB = LBC.Apply(scene.GetCanvasToSceneTransform()); |
88 | 88 |
89 chain.push_back(startLT); | 89 chain.push_back(startLT); |
90 chain.push_back(startRT); | 90 chain.push_back(startRT); |
91 chain.push_back(startRB); | 91 chain.push_back(startRB); |
92 chain.push_back(startLB); | 92 chain.push_back(startLB); |
286 This utility function assumes that the layer holder contains 5 text layers | 286 This utility function assumes that the layer holder contains 5 text layers |
287 and will use the first four ones for the text background and the fifth one | 287 and will use the first four ones for the text background and the fifth one |
288 for the actual text | 288 for the actual text |
289 */ | 289 */ |
290 void SetTextLayerOutlineProperties( | 290 void SetTextLayerOutlineProperties( |
291 boost::shared_ptr<Scene2D> scene, boost::shared_ptr<LayerHolder> layerHolder, | 291 Scene2D& scene, boost::shared_ptr<LayerHolder> layerHolder, |
292 const char* text, ScenePoint2D p) | 292 const char* text, ScenePoint2D p) |
293 { | 293 { |
294 double xoffsets[5] = { 2, 0, -2, 0, 0 }; | 294 double xoffsets[5] = { 2, 0, -2, 0, 0 }; |
295 double yoffsets[5] = { 0, -2, 0, 2, 0 }; | 295 double yoffsets[5] = { 0, -2, 0, 2, 0 }; |
296 | 296 |
297 // get the scaling factor | 297 // get the scaling factor |
298 const double pixelToScene = | 298 const double pixelToScene = |
299 scene->GetCanvasToSceneTransform().ComputeZoom(); | 299 scene.GetCanvasToSceneTransform().ComputeZoom(); |
300 | 300 |
301 for (int i = 0; i < 5; ++i) | 301 for (int i = 0; i < 5; ++i) |
302 { | 302 { |
303 TextSceneLayer* textLayer = layerHolder->GetTextLayer(i); | 303 TextSceneLayer* textLayer = layerHolder->GetTextLayer(i); |
304 textLayer->SetText(text); | 304 textLayer->SetText(text); |