35 #include <QTreeWidget>
36 #include <QTreeWidgetItem>
37 #include <QStringList>
38 #include <QVBoxLayout>
64 BaseWidget(parent,
"ToolPropertiesWidget",
"Tool Properties")
67 QVBoxLayout* layout =
new QVBoxLayout(
this);
70 layout->addWidget(activeToolWidget);
75 info->layout()->setMargin(0);
76 layout->addWidget(info);
90 BaseWidget(parent,
"ToolCorePropertiesWidget",
"Tool Properties"),
91 mSelector(toolSelector),
92 mTrackingService(trackingService),
93 mSpaceProvider(spaceProvider),
94 mManualToolWidget(NULL)
96 mToptopLayout =
new QVBoxLayout(
this);
106 if (mManualToolWidget)
109 this->setToolTip(
"Tool properties");
113 QHBoxLayout* generalLayout =
new QHBoxLayout;
114 mReferenceStatusLabel =
new QLabel(
"Reference frame <undefined>",
this);
115 generalLayout->addWidget(mReferenceStatusLabel);
116 mTrackingSystemStatusLabel =
new QLabel(
"Tracking <undefined>",
this);
117 generalLayout->addWidget(mTrackingSystemStatusLabel);
119 mToptopLayout->addLayout(generalLayout);
121 QGroupBox* activeGroup =
new QGroupBox(
this);
122 activeGroup->setTitle(
"Tool");
123 mToptopLayout->addWidget(activeGroup);
124 QVBoxLayout* activeGroupLayout =
new QVBoxLayout;
125 activeGroup->setLayout(activeGroupLayout);
127 QHBoxLayout* activeToolLayout =
new QHBoxLayout;
128 activeToolLayout->addWidget(
new QLabel(
"Name:",
this));
129 mToolNameLabel =
new QLabel(
this);
130 activeToolLayout->addWidget(mToolNameLabel);
131 mActiveToolVisibleLabel =
new QLabel(
"Visible: NA");
132 activeToolLayout->addWidget(mActiveToolVisibleLabel);
133 activeGroupLayout->addLayout(activeToolLayout);
135 QGroupBox* manualGroup =
new QGroupBox(
this);
136 manualGroup->setTitle(
"Manual Tool");
137 mToptopLayout->addWidget(manualGroup);
138 QVBoxLayout* manualGroupLayout =
new QVBoxLayout;
139 mManualGroup = manualGroup;
140 manualGroup->setLayout(manualGroupLayout);
141 manualGroupLayout->setMargin(0);
143 manualGroupLayout->addWidget(mManualToolWidget);
148 "Select coordinate system to store position in.");
149 mSpaceSelector->setSpaceProvider(mSpaceProvider);
152 mSpaceSelector->setValue(mSpaceProvider->getPr());
153 manualGroupLayout->addWidget(
new SpaceEditWidget(
this, mSpaceSelector));
157 mToptopLayout->addWidget(mUSSectorConfigBox);
158 mUSSectorConfigBox->hide();
160 QGridLayout* gridLayout =
new QGridLayout;
161 activeGroupLayout->addLayout(gridLayout);
166 mMetadataLabel =
new QTextEdit;
167 mToptopLayout->addWidget(mMetadataLabel);
173 this->reconnectTools();
181 this->updateFrontend();
182 this->toolPositionChanged();
185 void ToolPropertiesWidget::toolPositionChanged()
190 mManualGroup->setVisible(mTool->getVisible());
191 mManualToolWidget->blockSignals(
true);
196 Transform3D qMt = mSpaceProvider->get_toMfrom(space_mt, space_q);
199 mManualToolWidget->blockSignals(
false);
201 this->updateBrowser();
204 QString ToolPropertiesWidget::createDescriptionForTool(
ToolPtr current)
206 QString meta = current->getMetadata().toString();
207 return QString(
"Tool=%1: visible=%2\n%3\n")
208 .arg(current->getName())
209 .arg(current->getVisible())
213 void ToolPropertiesWidget::updateBrowser()
217 for (TrackingService::ToolMap::iterator i=mTools.begin(); i!=mTools.end(); ++i)
219 text += this->createDescriptionForTool(i->second) +
"\n";
222 int sstart = mMetadataLabel->textCursor().selectionStart();
223 int send = mMetadataLabel->textCursor().selectionEnd();
224 int textPos = mMetadataLabel->textCursor().position();
226 mMetadataLabel->setPlainText(text);
227 QTextCursor cursor = mMetadataLabel->textCursor();
229 cursor.setPosition(sstart, QTextCursor::MoveAnchor);
230 cursor.setPosition(send, QTextCursor::KeepAnchor);
232 mMetadataLabel->setTextCursor(cursor);
244 Transform3D qMpr = mSpaceProvider->get_toMfrom(space_pr, space_q);
247 mTool->set_prMt(prMt);
255 mSpaceSelector->setValue(space);
256 mSpaceSelector->setHelp(QString(
"The space q to display tool position in,\n"
262 void ToolPropertiesWidget::reconnectTools()
264 for (TrackingService::ToolMap::iterator i=mTools.begin(); i!=mTools.end(); ++i)
269 mTools = mTrackingService->getTools();
270 for (TrackingService::ToolMap::iterator i=mTools.begin(); i!=mTools.end(); ++i)
279 mTool = mTrackingService->getTool(mSelector->getValue());
281 mToolOffset->setTool(mTool);
283 mToptopLayout->update();
288 void ToolPropertiesWidget::updateFrontend()
292 mToolNameLabel->setText(
qstring_cast(mTool->getName()));
293 QString text = mTool->getVisible() ?
"Visible" :
"Not Visible";
294 mActiveToolVisibleLabel->setText(text);
298 mToolNameLabel->setText(
"none");
299 mActiveToolVisibleLabel->setText(
"");
302 ToolPtr reference = mTrackingService->getReferenceTool();
305 QString text = reference->getVisible() ?
"Visible" :
"Not Visible";
306 mReferenceStatusLabel->setText(
"Reference " + text);
310 mReferenceStatusLabel->setText(
"Reference is the tracker");
313 QString status =
"Unconfigured";
315 status =
"Configured";
317 status =
"Initialized";
320 mTrackingSystemStatusLabel->setText(
"Tracking status: " + status);
boost::shared_ptr< class SpaceProvider > SpaceProviderPtr
QString qstring_cast(const T &val)
Transform3D Transform3D
Transform3D is a representation of an affine 3D transform.
boost::shared_ptr< class TrackingService > TrackingServicePtr
static SpacePropertyPtr initialize(const QString &uid, QString name, QString help, Space value=Space(), std::vector< Space > range=std::vector< Space >(), QDomNode root=QDomNode())
static StringPropertyActiveProbeConfigurationPtr New(TrackingServicePtr trackingService)
boost::shared_ptr< class StringPropertyBase > StringPropertyBasePtr
Identification of a Coordinate system.
void changed()
emit when the underlying data value is changed: The user interface will be updated.
cxLogicManager_EXPORT SpaceProviderPtr spaceProvider()
cxLogicManager_EXPORT TrackingServicePtr trackingService()
boost::shared_ptr< class Tool > ToolPtr