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);
84 if (theAction->isChecked())
87 mGroupData->setProperties(uid, props);
91 ActiveDataPtr activeData = mServices->patient()->getActiveData();
92 activeData->setActive(data);
98 mGroupData->setProperties(uid, props);
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)
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;
QString qstring_cast(const T &val)
static DataViewProperties createSlice3D()
virtual QString getDataDescription()=0
ToolPtr getControllingTool()
boost::shared_ptr< class ViewGroupData > ViewGroupDataPtr
static DataViewProperties createDefault()
virtual void appendToContextMenu(QMenu &contextMenu)=0
virtual void setSharedOpenGLContext(SharedOpenGLContextPtr sharedOpenGLContext)
boost::shared_ptr< class VisServices > VisServicesPtr
boost::shared_ptr< DataMetric > DataMetricPtr
boost::shared_ptr< class Image > ImagePtr
SharedOpenGLContextPtr mSharedOpenGLContext
boost::shared_ptr< class ActiveData > ActiveDataPtr
DataViewPropertiesInteractorPtr mDataViewPropertiesInteractor
boost::shared_ptr< class View > ViewPtr
void controllingToolChanged()
virtual void dataViewPropertiesChangedSlot(QString uid)=0
virtual void setViewGroup(ViewGroupDataPtr group)
boost::shared_ptr< class Data > DataPtr
void settingsChangedSlot(QString key)
virtual void videoSourceChangedSlot(QString uid)
boost::shared_ptr< class SharedOpenGLContext > SharedOpenGLContextPtr
virtual QString getName() const
ViewGroupDataPtr mGroupData
DataViewPropertiesInteractor(VisServicesPtr services, ViewGroupDataPtr groupData)
virtual ViewPtr getView()=0
void centerToDataInViewGroup(ViewGroupDataPtr group, DataViewProperties properties=DataViewProperties::createFull())
static DataViewProperties createFull()
Settings * settings()
Shortcut for accessing the settings instance.
void dataViewPropertiesChanged(QString uid)
Eigen::Vector3d Vector3D
Vector3D is a representation of a point or vector in 3D.
Superclass for all data objects.
QStringList getAllDataNames(DataViewProperties properties) const
void contextMenuSlot(const QPoint &point)
static DisplayTextRepPtr New(const QString &uid="")
DataViewProperties removeFlagsIn(DataViewProperties rhs) const
virtual void updateView()
DataViewPropertiesInteractorPtr mShow3DSlicesInteractor
DataViewProperties addFlagsIn(DataViewProperties rhs) const
void videoSourceChanged(QString uid)
void setDataViewProperties(DataViewProperties properties)
Base class for all Data Metrics.
virtual QString getViewDescription()=0
void connectContextMenu(ViewPtr view)
ViewWrapper(VisServicesPtr backend)
virtual void activeToolChangedSlot()
Namespace for all CustusX production code.
boost::shared_ptr< class Tool > ToolPtr