15 #include "vtkCamera.h" 40 mProperties = properties;
43 void DataViewPropertiesInteractor::addDataAction(QString uid, QWidget* parent)
45 DataPtr data = mServices->patient()->getData(uid);
47 QAction* action =
new QAction(
qstring_cast(data->getName()), parent);
49 action->setIcon(data->getIcon());
52 if (uid.contains(mLastDataActionUid))
54 action->setText(
" " + action->text());
59 mLastDataActionUid = uid;
63 action->setCheckable(
true);
64 std::vector<DataPtr> allVisible = mGroupData->getData(mProperties);
65 action->setChecked(std::count(allVisible.begin(), allVisible.end(), data));
66 connect(action, SIGNAL(triggered()),
this, SLOT(dataActionSlot()));
67 parent->addAction(action);
70 void DataViewPropertiesInteractor::dataActionSlot()
72 QAction* theAction =
static_cast<QAction*
>(sender());
76 QString uid = theAction->data().toString();
77 DataPtr data = mServices->patient()->getData(uid);
83 if (theAction->isChecked())
86 mGroupData->setProperties(uid, props);
90 ActiveDataPtr activeData = mServices->patient()->getActiveData();
91 activeData->setActive(data);
97 mGroupData->setProperties(uid, props);
103 mGroupData->requestInitialize();
123 std::vector<DataPtr> data =
mGroupData->getData();
124 for (
unsigned i = 0; i < data.size(); ++i)
138 if (key.startsWith(
"View"))
150 contextMenu.exec(point);
156 connect(view.get(), SIGNAL(customContextMenuRequested(
const QPoint &)),
this, SLOT(
contextMenuSlot(
const QPoint &)));
162 return QStringList();
163 std::vector<DataPtr> data =
mGroupData->getData(properties);
166 for (
unsigned i = 0; i < data.size(); ++i)
171 QString line = data[i]->
getName();
173 ImagePtr image = boost::dynamic_pointer_cast<
Image>(data[i]);
176 if (image->getCropping())
177 line +=
" (cropped)";
178 if (!image->getAllClipPlanes().empty())
179 line +=
" (clipped)";
184 std::reverse(text.begin(), text.end());
191 QString annotationText;
192 if (
settings()->value(
"View/showOrientationAnnotation").value<bool>())
194 annotationText = QString(
"%1-%2")
198 mPlaneTypeText->setText(0, annotationText);
201 QString showDataText;
202 if (
settings()->value(
"View/showDataText").value<bool>())
206 mDataNameText->setText(0, showDataText);
207 mDataNameText->setFontSize(std::max(12, 22 - 2 * showDataText.size()));
214 mPlaneTypeText->addText(QColor(Qt::green),
"--",
Vector3D(0.98, 0.02, 0.0));
215 this->
getView()->addRep(mPlaneTypeText);
219 mDataNameText->addText(QColor(Qt::green),
"--",
Vector3D(0.02, 0.02, 0.0));
220 this->
getView()->addRep(mDataNameText);
QString qstring_cast(const T &val)
static DataViewProperties createSlice3D()
virtual QString getDataDescription()=0
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
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)
Namespace for all CustusX production code.