34 #include <QHBoxLayout> 48 mInternalUpdate =
false;
61 this->initializeProperties();
63 QWidget* widget = this->
newWidget(
"tool_metric");
65 QVBoxLayout* topLayout =
new QVBoxLayout(widget);
66 topLayout->setMargin(0);
68 QHBoxLayout* hLayout2 =
new QHBoxLayout;
69 hLayout2->setMargin(0);
70 topLayout->addLayout(hLayout2);
72 QHBoxLayout* hLayout =
new QHBoxLayout;
73 hLayout->setMargin(0);
74 topLayout->addLayout(hLayout);
81 QPushButton* sampleButton =
new QPushButton(
"Sample");
82 connect(sampleButton, SIGNAL(clicked()),
this, SLOT(resampleMetric()));
83 sampleButton->setToolTip(
"Set the position equal to the current tool tip position.");
84 hLayout->addWidget(sampleButton);
87 connect(mFrameWidget, SIGNAL(changed()),
this, SLOT(frameWidgetChangedSlot()));
88 topLayout->addWidget(mFrameWidget);
97 void ToolMetricWrapper::initializeProperties()
101 "Select coordinate system to store position in.");
103 mSpaceSelector->setSpaceProvider(
mServices->spaceProvider());
104 connect(mSpaceSelector.get(), SIGNAL(valueWasSet()),
this, SLOT(spaceSelected()));
108 "The name of the tool",
111 connect(mToolNameSelector.get(), SIGNAL(valueWasSet()),
this, SLOT(toolNameSet()));
119 connect(mToolOffsetSelector.get(), SIGNAL(valueWasSet()),
this, SLOT(toolOffsetSet()));
139 return mData->getSpace().toString();
143 void ToolMetricWrapper::resampleMetric()
146 Transform3D qMt =
mServices->spaceProvider()->getActiveToolTipTransform(mData->getSpace(),
true);
147 mData->setFrame(qMt);
148 mData->setToolName(
mServices->tracking()->getActiveTool()->getName());
149 mData->setToolOffset(
mServices->tracking()->getActiveTool()->getTooltipOffset());
153 void ToolMetricWrapper::spaceSelected()
159 mData->setSpace(space);
162 void ToolMetricWrapper::toolNameSet()
166 mData->setToolName(mToolNameSelector->getValue());
169 void ToolMetricWrapper::toolOffsetSet()
173 mData->setToolOffset(mToolOffsetSelector->getValue());
182 mInternalUpdate =
true;
184 mSpaceSelector->setValue(mData->getSpace());
185 mFrameWidget->
setMatrix(mData->getFrame());
186 mToolNameSelector->setValue(mData->getToolName());
187 mToolOffsetSelector->setValue(mData->getToolOffset());
189 mInternalUpdate =
false;
193 void ToolMetricWrapper::frameWidgetChangedSlot()
198 mData->setFrame(matrix);
boost::shared_ptr< class ToolMetric > ToolMetricPtr
boost::shared_ptr< class VisServices > VisServicesPtr
Transform3D Transform3D
Transform3D is a representation of an affine 3D transform.
boost::shared_ptr< DataMetric > DataMetricPtr
void addColorWidget(QVBoxLayout *layout)
static SpacePropertyPtr initialize(const QString &uid, QString name, QString help, Space value=Space(), std::vector< Space > range=std::vector< Space >(), QDomNode root=QDomNode())
Utility class for describing a bounded numeric range.
QString prettyFormat(Vector3D val, int decimals, int fieldWidth)
QWidget * createDataWidget(ViewServicePtr viewService, PatientModelServicePtr patientModelService, QWidget *parent, PropertyPtr data, QGridLayout *gridLayout, int row)
Create a widget capable of displaying the input data.
Identification of a Coordinate system.
static StringPropertyPtr initialize(const QString &uid, QString name, QString help, QString value, QStringList range, QDomNode root=QDomNode())
static DoublePropertyPtr initialize(const QString &uid, QString name, QString help, double value, DoubleRange range, int decimals, QDomNode root=QDomNode())
QWidget * newWidget(QString objectName)
Namespace for all CustusX production code.