comparison Framework/Scene2DViewport/MeasureToolsToolbox.cpp @ 906:52b1c6ff10c5

Disabled OpenGL in GuiAdapter to allow for Cairo-only workflows (THIS IS A TEMP CHANGE!!!) + disabled outlined text by default (build macro)
author Benjamin Golinvaux <bgo@osimis.io>
date Wed, 17 Jul 2019 17:17:34 +0200
parents 240359ab1651
children 58eed6bbcabb
comparison
equal deleted inserted replaced
905:88bf49aebc13 906:52b1c6ff10c5
280 chain.push_back(startRB); 280 chain.push_back(startRB);
281 chain.push_back(startLB); 281 chain.push_back(startLB);
282 } 282 }
283 #endif 283 #endif
284 284
285 #if ORTHANC_STONE_ENABLE_OUTLINED_TEXT == 1
285 /** 286 /**
286 This utility function assumes that the layer holder contains 5 text layers 287 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 288 and will use the first four ones for the text background and the fifth one
288 for the actual text 289 for the actual text
289 */ 290 */
305 { 306 {
306 TextSceneLayer* textLayer = layerHolder->GetTextLayer(i); 307 TextSceneLayer* textLayer = layerHolder->GetTextLayer(i);
307 ORTHANC_ASSERT(textLayer != NULL); 308 ORTHANC_ASSERT(textLayer != NULL);
308 textLayer->SetText(text); 309 textLayer->SetText(text);
309 310
310 if (i == 4) 311 if (i == startingLayerIndex + 4)
311 { 312 {
312 textLayer->SetColor(TEXT_COLOR_RED, 313 textLayer->SetColor(TEXT_COLOR_RED,
313 TEXT_COLOR_GREEN, 314 TEXT_COLOR_GREEN,
314 TEXT_COLOR_BLUE); 315 TEXT_COLOR_BLUE);
315 } 316 }
319 TEXT_OUTLINE_COLOR_GREEN, 320 TEXT_OUTLINE_COLOR_GREEN,
320 TEXT_OUTLINE_COLOR_BLUE); 321 TEXT_OUTLINE_COLOR_BLUE);
321 } 322 }
322 323
323 ScenePoint2D textAnchor; 324 ScenePoint2D textAnchor;
325 int offIndex = i - startingLayerIndex;
326 ORTHANC_ASSERT(offIndex >= 0 && offIndex < 5);
324 textLayer->SetPosition( 327 textLayer->SetPosition(
325 p.GetX() + xoffsets[i] * pixelToScene, 328 p.GetX() + xoffsets[offIndex] * pixelToScene,
326 p.GetY() + yoffsets[i] * pixelToScene); 329 p.GetY() + yoffsets[offIndex] * pixelToScene);
327 } 330 }
328 } 331 }
332 #else
333 void SetTextLayerProperties(
334 Scene2D& scene
335 , boost::shared_ptr<LayerHolder> layerHolder
336 , const char* text
337 , ScenePoint2D p
338 , int layerIndex)
339 {
340 // get the scaling factor
341 const double pixelToScene =
342 scene.GetCanvasToSceneTransform().ComputeZoom();
343
344 TextSceneLayer* textLayer = layerHolder->GetTextLayer(layerIndex);
345 ORTHANC_ASSERT(textLayer != NULL);
346 textLayer->SetText(text);
347
348 textLayer->SetColor(TEXT_COLOR_RED, TEXT_COLOR_GREEN, TEXT_COLOR_BLUE);
349
350 ScenePoint2D textAnchor;
351 textLayer->SetPosition(p.GetX(), p.GetY());
352 }
353 #endif
329 354
330 std::ostream& operator<<(std::ostream& os, const ScenePoint2D& p) 355 std::ostream& operator<<(std::ostream& os, const ScenePoint2D& p)
331 { 356 {
332 os << "x = " << p.GetX() << " , y = " << p.GetY(); 357 os << "x = " << p.GetX() << " , y = " << p.GetY();
333 return os; 358 return os;