MCPcopy Create free account
hub / github.com/MITK/MITK / GetDecorationColor

Method GetDecorationColor

Modules/QtWidgets/src/QmitkStdMultiWidget.cpp:455–510  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

453}
454
455mitk::Color QmitkStdMultiWidget::GetDecorationColor(unsigned int widgetNumber)
456{
457 // The implementation looks a bit messy here, but it avoids
458 // synchronization of the color of the geometry nodes and an
459 // internal member here.
460 // Default colors were chosen for decent visibility.
461 // Feel free to change your preferences in the workbench.
462 float tmp[3] = { 0.0f, 0.0f, 0.0f };
463 switch (widgetNumber)
464 {
465 case 0:
466 {
467 if (m_PlaneNode1.IsNotNull())
468 {
469 if (m_PlaneNode1->GetColor(tmp))
470 {
471 return dynamic_cast<mitk::ColorProperty *>(m_PlaneNode1->GetProperty("color"))->GetColor();
472 }
473 }
474 float red[3] = { 0.753f, 0.0f, 0.0f }; // This is #C00000 in hex
475 return mitk::Color(red);
476 }
477 case 1:
478 {
479 if (m_PlaneNode2.IsNotNull())
480 {
481 if (m_PlaneNode2->GetColor(tmp))
482 {
483 return dynamic_cast<mitk::ColorProperty *>(m_PlaneNode2->GetProperty("color"))->GetColor();
484 }
485 }
486 float green[3] = { 0.0f, 0.69f, 0.0f }; // This is #00B000 in hex
487 return mitk::Color(green);
488 }
489 case 2:
490 {
491 if (m_PlaneNode3.IsNotNull())
492 {
493 if (m_PlaneNode3->GetColor(tmp))
494 {
495 return dynamic_cast<mitk::ColorProperty *>(m_PlaneNode3->GetProperty("color"))->GetColor();
496 }
497 }
498 float blue[3] = { 0.0, 0.502f, 1.0f }; // This is #0080FF in hex
499 return mitk::Color(blue);
500 }
501 case 3:
502 {
503 return m_DecorationColorWidget4;
504 }
505 default:
506 MITK_ERROR << "Decoration color for unknown widget!";
507 float black[3] = { 0.0f, 0.0f, 0.0f };
508 return mitk::Color(black);
509 }
510}
511
512void QmitkStdMultiWidget::mousePressEvent(QMouseEvent*)

Callers 1

Calls 3

IsNotNullMethod · 0.80
GetColorMethod · 0.45
GetPropertyMethod · 0.45

Tested by

no test coverage detected