13 #include <QHBoxLayout> 27 mInternalUpdate =
false;
40 this->initializeProperties();
42 QWidget* widget = this->
newWidget(
"tool_metric");
44 QVBoxLayout* topLayout =
new QVBoxLayout(widget);
45 topLayout->setMargin(0);
47 QHBoxLayout* hLayout2 =
new QHBoxLayout;
48 hLayout2->setMargin(0);
49 topLayout->addLayout(hLayout2);
51 QHBoxLayout* hLayout =
new QHBoxLayout;
52 hLayout->setMargin(0);
53 topLayout->addLayout(hLayout);
60 QPushButton* sampleButton =
new QPushButton(
"Sample");
61 connect(sampleButton, SIGNAL(clicked()),
this, SLOT(resampleMetric()));
62 sampleButton->setToolTip(
"Set the position equal to the current tool tip position.");
63 hLayout->addWidget(sampleButton);
66 connect(mFrameWidget, SIGNAL(changed()),
this, SLOT(frameWidgetChangedSlot()));
67 topLayout->addWidget(mFrameWidget);
76 void ToolMetricWrapper::initializeProperties()
80 "Select coordinate system to store position in.");
82 mSpaceSelector->setSpaceProvider(
mServices->spaceProvider());
83 connect(mSpaceSelector.get(), SIGNAL(valueWasSet()),
this, SLOT(spaceSelected()));
87 "The name of the tool",
90 connect(mToolNameSelector.get(), SIGNAL(valueWasSet()),
this, SLOT(toolNameSet()));
98 connect(mToolOffsetSelector.get(), SIGNAL(valueWasSet()),
this, SLOT(toolOffsetSet()));
118 return mData->getSpace().toString();
122 void ToolMetricWrapper::resampleMetric()
125 Transform3D qMt =
mServices->spaceProvider()->getActiveToolTipTransform(mData->getSpace(),
true);
126 mData->setFrame(qMt);
127 mData->setToolName(
mServices->tracking()->getActiveTool()->getName());
128 mData->setToolOffset(
mServices->tracking()->getActiveTool()->getTooltipOffset());
132 void ToolMetricWrapper::spaceSelected()
138 mData->setSpace(space);
141 void ToolMetricWrapper::toolNameSet()
145 mData->setToolName(mToolNameSelector->getValue());
148 void ToolMetricWrapper::toolOffsetSet()
152 mData->setToolOffset(mToolOffsetSelector->getValue());
161 mInternalUpdate =
true;
163 mSpaceSelector->setValue(mData->getSpace());
164 mFrameWidget->
setMatrix(mData->getFrame());
165 mToolNameSelector->setValue(mData->getToolName());
166 mToolOffsetSelector->setValue(mData->getToolOffset());
168 mInternalUpdate =
false;
172 void ToolMetricWrapper::frameWidgetChangedSlot()
177 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.