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()
136 CoordinateSystem space = mSpaceSelector->getValue();
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);