22 : QWidget(parent), m_Controls(NULL), m_StatusLabels(NULL), m_NavigationDatas(NULL), m_NavDatasNewFlag(false)
24 m_ShowPositions =
false;
25 m_ShowQuaternions =
false;
26 m_Alignment = Qt::AlignHCenter;
43 m_ShowPositions = enable;
51 m_ShowQuaternions = enable;
59 m_Alignment = alignment;
68 if (m_StatusLabels!=NULL) {
delete m_StatusLabels;}
69 if (m_NavigationDatas != NULL)
71 m_NavigationDatas->clear();
72 if (m_NavDatasNewFlag)
74 delete m_NavigationDatas;
84 m_Controls =
new Ui::QmitkToolTrackingStatusWidgetControls;
110 m_NavigationDatas = navDatas;
111 m_previewToolStorage = NULL;
116 if(m_NavigationDatas == NULL)
118 m_NavigationDatas =
new std::vector<mitk::NavigationData::Pointer>();
119 m_NavDatasNewFlag =
true;
120 m_previewToolStorage = NULL;
123 m_NavigationDatas->push_back(nd);
128 if(m_NavigationDatas == NULL || m_NavigationDatas->size() <= 0)
137 for(
unsigned int i = 0; i < m_NavigationDatas->size(); i++)
139 navData = m_NavigationDatas->at(i).GetPointer();
140 QString name(navData->
GetName());
146 pos =
" [" + QString::number(position[0],
'f',posPrecision) +
";" + QString::number(position[1],
'f',posPrecision) +
";" + QString::number(position[2],
'f',posPrecision) +
"]";
148 if (m_ShowQuaternions)
151 quat =
" / [qx:" + QString::number(quaternion.x(),
'f',quatPrecision) +
";qy:" + QString::number(quaternion.y(),
'f',quatPrecision) +
";qz:" + QString::number(quaternion.z(),
'f',quatPrecision) +
";qr:" + QString::number(quaternion.r()) +
"]";
154 if(!(m_StatusLabels->at(i)->text() == name+pos+quat))
155 m_StatusLabels->at(i)->setText(name+pos+quat);
158 m_StatusLabels->at(i)->setStyleSheet(
"QLabel{background-color: #8bff8b }");
160 m_StatusLabels->at(i)->setStyleSheet(
"QLabel{background-color: #ff7878 }");
168 if(m_NavigationDatas == NULL || m_NavigationDatas->size() <= 0)
175 m_StatusLabels =
new QVector<QLabel*>();
179 for(
unsigned int i = 0; i < m_NavigationDatas->size(); i++)
181 navData = m_NavigationDatas->at(i).GetPointer();
183 QString name(navData->GetName());
185 label =
new QLabel(name,
this);
186 label->setObjectName(name);
187 label->setAlignment(m_Alignment | Qt::AlignVCenter);
188 label->setFrameStyle(QFrame::Panel | QFrame::Sunken);
190 m_StatusLabels->append(label);
192 else m_Controls->m_GridLayout->addWidget(m_StatusLabels->at(i),0,i);
201 for(
unsigned int i = 0; i < toolStorage->GetToolCount(); i++)
203 QString name(toolStorage->GetTool(i)->GetToolName().c_str());
205 label =
new QLabel(name,
this);
206 label->setObjectName(name);
207 label->setAlignment(m_Alignment | Qt::AlignVCenter);
208 label->setFrameStyle(QFrame::Panel | QFrame::Sunken);
209 label->setStyleSheet(
"QLabel{background-color: #dddddd }");
211 else m_Controls->m_GridLayout->addWidget(label);
213 m_previewToolStorage = toolStorage;
222 if(m_StatusLabels != NULL && m_StatusLabels->size() > 0)
224 delete m_StatusLabels;
225 m_StatusLabels =
new QVector< QLabel* >();
228 if(m_NavigationDatas != NULL && m_NavigationDatas->size() > 0)
230 if (m_NavDatasNewFlag)
232 delete m_NavigationDatas;
233 m_NavDatasNewFlag =
false;
235 m_NavigationDatas =
new std::vector<mitk::NavigationData::Pointer>();
236 m_NavDatasNewFlag =
true;
243 void QmitkToolTrackingStatusWidget::RemoveGuiLabels()
249 QWidget* actWidget =
m_Controls->m_GridLayout->itemAt(0)->widget();
250 m_Controls->m_GridLayout->removeWidget(actWidget);
253 else if (
m_Controls->m_VerticalLayout->count() > 0)
255 QWidget* actWidget =
m_Controls->m_VerticalLayout->itemAt(0)->widget();
256 m_Controls->m_VerticalLayout->removeWidget(actWidget);
262 void QmitkToolTrackingStatusWidget::AddEmptyLabel()
265 QLabel* label =
new QLabel(
"No tools loaded yet.",
this);
266 label->setObjectName(
"No tools loaded yet.");
267 label->setAlignment(m_Alignment | Qt::AlignVCenter);
268 label->setFrameStyle(QFrame::Panel | QFrame::Sunken);
269 label->setStyleSheet(
"QLabel{background-color: #dddddd }");
271 else m_Controls->m_GridLayout->addWidget(label);
itk::SmartPointer< Self > Pointer
virtual const char * GetName() const
returns the name of the NavigationData object
virtual OrientationType GetOrientation() const
returns the orientation of the NavigationData object
vnl_quaternion< ScalarType > Quaternion
US_Core_EXPORT const std::string & OBJECTCLASS()
virtual bool IsDataValid() const
returns true if the object contains valid data
virtual PositionType GetPosition() const
returns position of the NavigationData object
static ModuleContext * GetModuleContext()
Returns the module context of the calling module.