comparison Framework/Scene2DViewport/MeasureToolsToolbox.cpp @ 1203:f3bb9a6dd949 broker

locking abstraction in IViewport
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 29 Nov 2019 21:22:21 +0100
parents f6be9412e42a
children ab06dfdf3b75
comparison
equal deleted inserted replaced
1200:54cbffabdc45 1203:f3bb9a6dd949
304 scene.GetCanvasToSceneTransform().ComputeZoom(); 304 scene.GetCanvasToSceneTransform().ComputeZoom();
305 305
306 for (int i = startingLayerIndex; i < startingLayerIndex + 5; ++i) 306 for (int i = startingLayerIndex; i < startingLayerIndex + 5; ++i)
307 { 307 {
308 TextSceneLayer* textLayer = layerHolder->GetTextLayer(i); 308 TextSceneLayer* textLayer = layerHolder->GetTextLayer(i);
309 ORTHANC_ASSERT(textLayer != NULL); 309 if (textLayer != NULL)
310 textLayer->SetText(text);
311
312 if (i == startingLayerIndex + 4)
313 { 310 {
314 textLayer->SetColor(TEXT_COLOR_RED, 311 textLayer->SetText(text);
315 TEXT_COLOR_GREEN, 312
316 TEXT_COLOR_BLUE); 313 if (i == startingLayerIndex + 4)
314 {
315 textLayer->SetColor(TEXT_COLOR_RED,
316 TEXT_COLOR_GREEN,
317 TEXT_COLOR_BLUE);
318 }
319 else
320 {
321 textLayer->SetColor(TEXT_OUTLINE_COLOR_RED,
322 TEXT_OUTLINE_COLOR_GREEN,
323 TEXT_OUTLINE_COLOR_BLUE);
324 }
325
326 ScenePoint2D textAnchor;
327 int offIndex = i - startingLayerIndex;
328 ORTHANC_ASSERT(offIndex >= 0 && offIndex < 5);
329 textLayer->SetPosition(
330 p.GetX() + xoffsets[offIndex] * pixelToScene,
331 p.GetY() + yoffsets[offIndex] * pixelToScene);
317 } 332 }
318 else
319 {
320 textLayer->SetColor(TEXT_OUTLINE_COLOR_RED,
321 TEXT_OUTLINE_COLOR_GREEN,
322 TEXT_OUTLINE_COLOR_BLUE);
323 }
324
325 ScenePoint2D textAnchor;
326 int offIndex = i - startingLayerIndex;
327 ORTHANC_ASSERT(offIndex >= 0 && offIndex < 5);
328 textLayer->SetPosition(
329 p.GetX() + xoffsets[offIndex] * pixelToScene,
330 p.GetY() + yoffsets[offIndex] * pixelToScene);
331 } 333 }
332 } 334 }
333 #else 335 #else
334 void SetTextLayerProperties( 336 void SetTextLayerProperties(
335 Scene2D& scene 337 Scene2D& scene
337 , const char* text 339 , const char* text
338 , ScenePoint2D p 340 , ScenePoint2D p
339 , int layerIndex) 341 , int layerIndex)
340 { 342 {
341 TextSceneLayer* textLayer = layerHolder->GetTextLayer(layerIndex); 343 TextSceneLayer* textLayer = layerHolder->GetTextLayer(layerIndex);
342 ORTHANC_ASSERT(textLayer != NULL); 344 if (textLayer != NULL)
343 textLayer->SetText(text); 345 {
344 346 textLayer->SetText(text);
345 textLayer->SetColor(TEXT_COLOR_RED, TEXT_COLOR_GREEN, TEXT_COLOR_BLUE); 347 textLayer->SetColor(TEXT_COLOR_RED, TEXT_COLOR_GREEN, TEXT_COLOR_BLUE);
346 348
347 ScenePoint2D textAnchor; 349 ScenePoint2D textAnchor;
348 textLayer->SetPosition(p.GetX(), p.GetY()); 350 textLayer->SetPosition(p.GetX(), p.GetY());
351 }
349 } 352 }
350 #endif 353 #endif
351 354
352 std::ostream& operator<<(std::ostream& os, const ScenePoint2D& p) 355 std::ostream& operator<<(std::ostream& os, const ScenePoint2D& p)
353 { 356 {