34 #include <QHBoxLayout>
50 mInternalUpdate =
false;
63 this->initializeProperties();
65 QWidget* widget =
new QWidget;
67 QVBoxLayout* topLayout =
new QVBoxLayout(widget);
68 topLayout->setMargin(0);
70 QHBoxLayout* hLayout2 =
new QHBoxLayout;
71 hLayout2->setMargin(0);
72 topLayout->addLayout(hLayout2);
74 QHBoxLayout* hLayout =
new QHBoxLayout;
75 hLayout->setMargin(0);
76 topLayout->addLayout(hLayout);
83 QPushButton* sampleButton =
new QPushButton(
"Sample");
84 connect(sampleButton, SIGNAL(clicked()),
this, SLOT(resampleMetric()));
85 sampleButton->setToolTip(
"Set the position equal to the current tool tip position.");
86 hLayout->addWidget(sampleButton);
89 connect(mFrameWidget, SIGNAL(changed()),
this, SLOT(frameWidgetChangedSlot()));
90 topLayout->addWidget(mFrameWidget);
99 void ToolMetricWrapper::initializeProperties()
103 "Select coordinate system to store position in.");
106 connect(mSpaceSelector.get(), SIGNAL(valueWasSet()),
this, SLOT(spaceSelected()));
110 "The name of the tool",
113 connect(mToolNameSelector.get(), SIGNAL(valueWasSet()),
this, SLOT(toolNameSet()));
121 connect(mToolOffsetSelector.get(), SIGNAL(valueWasSet()),
this, SLOT(toolOffsetSet()));
141 return mData->getSpace().toString();
145 void ToolMetricWrapper::resampleMetric()
149 mData->setFrame(qMt);
151 mData->setToolOffset(
trackingService()->getActiveTool()->getTooltipOffset());
155 void ToolMetricWrapper::spaceSelected()
159 CoordinateSystem space = mSpaceSelector->getValue();
161 mData->setSpace(space);
164 void ToolMetricWrapper::toolNameSet()
168 mData->setToolName(mToolNameSelector->getValue());
171 void ToolMetricWrapper::toolOffsetSet()
175 mData->setToolOffset(mToolOffsetSelector->getValue());
184 mInternalUpdate =
true;
186 mSpaceSelector->setValue(mData->getSpace());
187 mFrameWidget->
setMatrix(mData->getFrame());
188 mToolNameSelector->setValue(mData->getToolName());
189 mToolOffsetSelector->setValue(mData->getToolOffset());
191 mInternalUpdate =
false;
195 void ToolMetricWrapper::frameWidgetChangedSlot()
200 mData->setFrame(matrix);
boost::shared_ptr< class ToolMetric > ToolMetricPtr
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)
ViewServicePtr mViewService
QWidget * createDataWidget(ViewServicePtr viewService, PatientModelServicePtr patientModelService, QWidget *parent, PropertyPtr data, QGridLayout *gridLayout, int row)
Create a widget capable of displaying the input data.
PatientModelServicePtr mPatientModelService
boost::shared_ptr< class PatientModelService > PatientModelServicePtr
cxLogicManager_EXPORT SpaceProviderPtr spaceProvider()
static StringPropertyPtr initialize(const QString &uid, QString name, QString help, QString value, QStringList range, QDomNode root=QDomNode())
cxLogicManager_EXPORT ViewServicePtr viewService()
static DoublePropertyPtr initialize(const QString &uid, QString name, QString help, double value, DoubleRange range, int decimals, QDomNode root=QDomNode())
cxLogicManager_EXPORT TrackingServicePtr trackingService()