36 #include "vtkCamera.h"
65 mLastDataActionUid =
"________________________";
66 for (std::vector<DataPtr>::iterator iter=sorted.begin(); iter!=sorted.end(); ++iter)
68 this->addDataAction((*iter)->getUid(), parent);
74 mProperties = properties;
77 void DataViewPropertiesInteractor::addDataAction(QString uid, QWidget* parent)
79 DataPtr data = mServices->patient()->getData(uid);
81 QAction* action =
new QAction(
qstring_cast(data->getName()), parent);
83 action->setIcon(data->getIcon());
86 if (uid.contains(mLastDataActionUid))
88 action->setText(
" " + action->text());
93 mLastDataActionUid = uid;
97 action->setCheckable(
true);
98 std::vector<DataPtr> allVisible = mGroupData->getData(mProperties);
99 action->setChecked(std::count(allVisible.begin(), allVisible.end(), data));
100 connect(action, SIGNAL(triggered()),
this, SLOT(dataActionSlot()));
101 parent->addAction(action);
104 void DataViewPropertiesInteractor::dataActionSlot()
106 QAction* theAction =
static_cast<QAction*
>(sender());
110 QString uid = theAction->data().toString();
111 DataPtr data = mServices->patient()->getData(uid);
115 DataViewProperties old = mGroupData->getProperties(uid);
117 if (theAction->isChecked())
119 DataViewProperties props = old.addFlagsIn(mProperties);
120 mGroupData->setProperties(uid, props);
124 ActiveDataPtr activeData = mServices->patient()->getActiveData();
125 activeData->setActive(data);
130 DataViewProperties props = old.removeFlagsIn(mProperties);
131 mGroupData->setProperties(uid, props);
136 Navigation(mServices).centerToDataInViewGroup(mGroupData);
137 mGroupData->requestInitialize();
157 std::vector<DataPtr> data =
mGroupData->getData();
158 for (
unsigned i = 0; i < data.size(); ++i)
174 contextMenu.exec(point);
180 connect(view.get(), SIGNAL(customContextMenuRequested(
const QPoint &)),
this, SLOT(
contextMenuSlot(
const QPoint &)));
186 return QStringList();
187 std::vector<DataPtr> data =
mGroupData->getData(properties);
190 for (
unsigned i = 0; i < data.size(); ++i)
195 QString line = data[i]->
getName();
197 ImagePtr image = boost::dynamic_pointer_cast<
Image>(data[i]);
200 if (image->getCropping())
201 line +=
" (cropped)";
202 if (!image->getAllClipPlanes().empty())
203 line +=
" (clipped)";
208 std::reverse(text.begin(), text.end());
QString qstring_cast(const T &val)
static DataViewProperties createSlice3D()
boost::shared_ptr< class ViewGroupData > ViewGroupDataPtr
static DataViewProperties createDefault()
virtual void appendToContextMenu(QMenu &contextMenu)=0
boost::shared_ptr< class VisServices > VisServicesPtr
boost::shared_ptr< DataMetric > DataMetricPtr
boost::shared_ptr< class Image > ImagePtr
void addDataActions(QWidget *parent)
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
virtual void videoSourceChangedSlot(QString uid)
std::vector< T > sortOnGroupsAndAcquisitionTime(std::map< QString, T > input)
virtual QString getName() const
ViewGroupDataPtr mGroupData
DataViewPropertiesInteractor(VisServicesPtr services, ViewGroupDataPtr groupData)
static DataViewProperties createFull()
void dataViewPropertiesChanged(QString uid)
QStringList getAllDataNames(DataViewProperties properties) const
void contextMenuSlot(const QPoint &point)
DataViewPropertiesInteractorPtr mShow3DSlicesInteractor
void videoSourceChanged(QString uid)
void setDataViewProperties(DataViewProperties properties)
Base class for all Data Metrics.
void connectContextMenu(ViewPtr view)
ViewWrapper(VisServicesPtr backend)