15 #include "vtkCamera.h"
41 mProperties = properties;
44 void DataViewPropertiesInteractor::addDataAction(QString uid, QWidget* parent)
46 DataPtr data = mServices->patient()->getData(uid);
48 QAction* action =
new QAction(
qstring_cast(data->getName()), parent);
50 action->setIcon(data->getIcon());
53 if (uid.contains(mLastDataActionUid))
55 action->setText(
" " + action->text());
60 mLastDataActionUid = uid;
64 action->setCheckable(
true);
65 std::vector<DataPtr> allVisible = mGroupData->getData(mProperties);
66 action->setChecked(std::count(allVisible.begin(), allVisible.end(), data));
67 connect(action, SIGNAL(triggered()),
this, SLOT(dataActionSlot()));
68 parent->addAction(action);
71 void DataViewPropertiesInteractor::dataActionSlot()
73 QAction* theAction =
static_cast<QAction*
>(sender());
77 QString uid = theAction->data().toString();
78 DataPtr data = mServices->patient()->getData(uid);
82 DataViewProperties old = mGroupData->getProperties(uid);
84 if (theAction->isChecked())
86 DataViewProperties props = old.addFlagsIn(mProperties);
87 mGroupData->setProperties(uid, props);
91 ActiveDataPtr activeData = mServices->patient()->getActiveData();
92 activeData->setActive(data);
97 DataViewProperties props = old.removeFlagsIn(mProperties);
98 mGroupData->setProperties(uid, props);
103 Navigation(mServices).centerToDataInViewGroup(mGroupData);
104 mGroupData->requestInitialize();
125 std::vector<DataPtr> data =
mGroupData->getData();
126 for (
unsigned i = 0; i < data.size(); ++i)
140 if (key.startsWith(
"View"))
149 contextMenu.setToolTipsVisible(
true);
153 contextMenu.exec(point);
159 connect(view.get(), SIGNAL(customContextMenuRequested(
const QPoint &)),
this, SLOT(
contextMenuSlot(
const QPoint &)));
165 return QStringList();
166 std::vector<DataPtr> data =
mGroupData->getData(properties);
169 for (
unsigned i = 0; i < data.size(); ++i)
171 DataMetricPtr metric = boost::dynamic_pointer_cast<DataMetric>(data[i]);
174 QString line = data[i]->getName();
176 ImagePtr image = boost::dynamic_pointer_cast<Image>(data[i]);
179 if (image->getCropping())
180 line +=
" (cropped)";
181 if (!image->getAllClipPlanes().empty())
182 line +=
" (clipped)";
187 std::reverse(text.begin(), text.end());
194 QString annotationText;
195 if (
settings()->value(
"View/showOrientationAnnotation").value<bool>())
197 annotationText = QString(
"%1-%2")
201 mPlaneTypeText->setText(0, annotationText);
204 QString showDataText;
205 if (
settings()->value(
"View/showDataText").value<bool>())
209 mDataNameText->setText(0, showDataText);
210 mDataNameText->setFontSize(std::max(12, 22 - 2 * showDataText.size()));
217 mPlaneTypeText->addText(QColor(Qt::green),
"--",
Vector3D(0.98, 0.02, 0.0));
218 this->
getView()->addRep(mPlaneTypeText);
222 mDataNameText->addText(QColor(Qt::green),
"--",
Vector3D(0.02, 0.02, 0.0));
223 this->
getView()->addRep(mDataNameText);
236 controllingTool =
mGroupData->getControllingTool();
239 controllingTool = activeTool;
241 return controllingTool;