36 #include "vtkCamera.h" 61 mProperties = properties;
64 void DataViewPropertiesInteractor::addDataAction(QString uid, QWidget* parent)
66 DataPtr data = mServices->patient()->getData(uid);
68 QAction* action =
new QAction(
qstring_cast(data->getName()), parent);
70 action->setIcon(data->getIcon());
73 if (uid.contains(mLastDataActionUid))
75 action->setText(
" " + action->text());
80 mLastDataActionUid = uid;
84 action->setCheckable(
true);
85 std::vector<DataPtr> allVisible = mGroupData->getData(mProperties);
86 action->setChecked(std::count(allVisible.begin(), allVisible.end(), data));
87 connect(action, SIGNAL(triggered()),
this, SLOT(dataActionSlot()));
88 parent->addAction(action);
91 void DataViewPropertiesInteractor::dataActionSlot()
93 QAction* theAction =
static_cast<QAction*
>(sender());
97 QString uid = theAction->data().toString();
98 DataPtr data = mServices->patient()->getData(uid);
104 if (theAction->isChecked())
107 mGroupData->setProperties(uid, props);
111 ActiveDataPtr activeData = mServices->patient()->getActiveData();
112 activeData->setActive(data);
118 mGroupData->setProperties(uid, props);
124 mGroupData->requestInitialize();
144 std::vector<DataPtr> data =
mGroupData->getData();
145 for (
unsigned i = 0; i < data.size(); ++i)
159 if (key.startsWith(
"View"))
171 contextMenu.exec(point);
177 connect(view.get(), SIGNAL(customContextMenuRequested(
const QPoint &)),
this, SLOT(
contextMenuSlot(
const QPoint &)));
183 return QStringList();
184 std::vector<DataPtr> data =
mGroupData->getData(properties);
187 for (
unsigned i = 0; i < data.size(); ++i)
192 QString line = data[i]->
getName();
194 ImagePtr image = boost::dynamic_pointer_cast<
Image>(data[i]);
197 if (image->getCropping())
198 line +=
" (cropped)";
199 if (!image->getAllClipPlanes().empty())
200 line +=
" (clipped)";
205 std::reverse(text.begin(), text.end());
212 QString annotationText;
213 if (
settings()->value(
"View/showOrientationAnnotation").value<bool>())
215 annotationText = QString(
"%1-%2")
219 mPlaneTypeText->setText(0, annotationText);
222 QString showDataText;
223 if (
settings()->value(
"View/showDataText").value<bool>())
227 mDataNameText->setText(0, showDataText);
228 mDataNameText->setFontSize(std::max(12, 22 - 2 * showDataText.size()));
235 mPlaneTypeText->addText(QColor(Qt::green),
"--",
Vector3D(0.98, 0.02, 0.0));
236 this->
getView()->addRep(mPlaneTypeText);
240 mDataNameText->addText(QColor(Qt::green),
"--",
Vector3D(0.02, 0.02, 0.0));
241 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.