NorMIT-nav  2023.01.05-dev+develop.0da12
An IGT application
cxShowDataTreeNode.cpp
Go to the documentation of this file.
1 /*=========================================================================
2 This file is part of CustusX, an Image Guided Therapy Application.
3 
4 Copyright (c) SINTEF Department of Medical Technology.
5 All rights reserved.
6 
7 CustusX is released under a BSD 3-Clause license.
8 
9 See Lisence.txt (https://github.com/SINTEFMedtek/CustusX/blob/master/License.txt) for details.
10 =========================================================================*/
11 #include "cxShowDataTreeNode.h"
12 #include "cxPatientModelService.h"
13 #include "cxDefinitions.h"
14 #include "cxData.h"
15 #include "cxTreeRepository.h"
16 #include "cxLogger.h"
17 #include "cxDataMetric.h"
18 #include "cxActiveData.h"
19 #include "cxViewService.h"
20 #include "cxViewGroupData.h"
21 #include "cxVisServices.h"
22 #include <QFont>
23 #include <QLabel>
24 #include "cxMesh.h"
25 #include "cxMeshInfoWidget.h"
27 #include "cxImage.h"
29 #include "cxDataMetric.h"
30 
31 namespace cx
32 {
33 
34 
36  TreeNodeImpl(repo), mData(data)
37 {
38 }
39 
41 {
42  bool flatMode = this->repo()->getMode()=="flat";
43  bool parentVisible = this->getParent()->isVisibleNode();
44  return parentVisible && flatMode;
45 }
46 
48 {
49  return this->repo()->getNode(mData->getUid());
50 }
51 
53 {
54  this->getParent()->activate();
55 }
56 
58 {
59  return QIcon();
60 }
61 
63 {
64  return this->getParent()->getColor();
65 // return QColor("black");
66 }
67 
69 {
70  return QVariant();
71 }
72 
74 {
75  ViewGroupDataPtr group = this->getServices()->view()->getGroup(index);
76  DataViewProperties props = group->getProperties(mData->getUid());
77 
78  // if ((props.hasVolume3D() || props.hasSlice3D()) && props.hasSlice2D())
79  if (props.containsAnyFlagsIn(this->getDefiningDataViewProperties()))
80  return Qt::CheckState(2);
81  else
82  return Qt::CheckState(0);
83 }
84 
86 {
87  ViewGroupDataPtr group = this->getServices()->view()->getGroup(index);
88  DataViewProperties props = group->getProperties(mData->getUid());
89 
90  if (value)
92  else
94 
95  group->setProperties(mData->getUid(), props);
96 }
97 
98 boost::shared_ptr<QWidget> ShowDataTreeNodeBase::createPropertiesWidget() const
99 {
100  return this->getParent()->createPropertiesWidget();
101 }
102 
106 
108  ShowDataTreeNodeBase(repo, data)
109 {
110 }
112 {
113  return mData->getUid() + "_volume";
114 }
116 {
117  return "Volume";
118 }
120 {
121  return "data_volume";
122 }
124 {
126 }
127 
131 
133  ShowDataTreeNodeBase(repo, data)
134 {
135 }
137 {
138  return mData->getUid() + "_slice2D";
139 }
141 {
142  return "Slice 2D";
143 }
145 {
146  return "data_slice2D";
147 }
149 {
151 }
152 
156 
158  ShowDataTreeNodeBase(repo, data)
159 {
160 }
162 {
163  return mData->getUid() + "_slice3D";
164 }
166 {
167  return "Slice 3D";
168 }
170 {
171  return "data_slice3D";
172 }
174 {
176 }
177 
178 } // namespace cx
179 
cx::ShowDataTreeNodeBase::getViewGroupVisibility
virtual QVariant getViewGroupVisibility(int index) const
Definition: cxShowDataTreeNode.cpp:73
cx::ShowSlice2DDataTreeNode::getDefiningDataViewProperties
virtual DataViewProperties getDefiningDataViewProperties() const
Definition: cxShowDataTreeNode.cpp:148
cx::DataViewProperties::createSlice2D
static DataViewProperties createSlice2D()
Definition: cxViewGroupData.cpp:185
cxLogger.h
cx::TreeNodeImpl
Definition: cxTreeNodeImpl.h:26
cx::ViewGroupDataPtr
boost::shared_ptr< class ViewGroupData > ViewGroupDataPtr
Definition: cxViewGroup.h:29
cxTreeRepository.h
cxActiveData.h
cx::ShowVolumeDataTreeNode::getType
virtual QString getType() const
Definition: cxShowDataTreeNode.cpp:119
cx
Namespace for all CustusX production code.
Definition: cx_dev_group_definitions.h:13
cx::ShowDataTreeNodeBase::mData
DataPtr mData
Definition: cxShowDataTreeNode.h:46
cxShowDataTreeNode.h
cxImage.h
cxDataMetric.h
cx::DataViewProperties::containsAnyFlagsIn
bool containsAnyFlagsIn(DataViewProperties required) const
Definition: cxViewGroupData.cpp:243
cx::ShowVolumeDataTreeNode::ShowVolumeDataTreeNode
ShowVolumeDataTreeNode(TreeRepositoryWeakPtr repo, DataPtr data)
Definition: cxShowDataTreeNode.cpp:107
cxImagePropertiesWidget.h
cx::ShowDataTreeNodeBase::setViewGroupVisibility
virtual void setViewGroupVisibility(int index, bool value)
Definition: cxShowDataTreeNode.cpp:85
cxDefinitions.h
cx::DataViewProperties::addFlagsIn
DataViewProperties addFlagsIn(DataViewProperties rhs) const
Definition: cxViewGroupData.cpp:225
cx::ShowVolumeDataTreeNode::getDefiningDataViewProperties
virtual DataViewProperties getDefiningDataViewProperties() const
Definition: cxShowDataTreeNode.cpp:123
cx::ShowDataTreeNodeBase::activate
virtual void activate()
Definition: cxShowDataTreeNode.cpp:52
cx::ShowDataTreeNodeBase::getParent
virtual TreeNodePtr getParent() const
Definition: cxShowDataTreeNode.cpp:47
cx::ShowSlice2DDataTreeNode::getUid
virtual QString getUid() const
Definition: cxShowDataTreeNode.cpp:136
cx::ShowSlice3DDataTreeNode::getDefiningDataViewProperties
virtual DataViewProperties getDefiningDataViewProperties() const
Definition: cxShowDataTreeNode.cpp:173
cxViewGroupData.h
cx::ShowSlice3DDataTreeNode::getName
virtual QString getName() const
Definition: cxShowDataTreeNode.cpp:165
cx::ShowSlice2DDataTreeNode::getType
virtual QString getType() const
Definition: cxShowDataTreeNode.cpp:144
cx::ShowSlice2DDataTreeNode::getName
virtual QString getName() const
Definition: cxShowDataTreeNode.cpp:140
cx::ShowDataTreeNodeBase::isVisibleNode
virtual bool isVisibleNode() const
Definition: cxShowDataTreeNode.cpp:40
cxData.h
cx::ShowDataTreeNodeBase::getColor
virtual QVariant getColor() const
Definition: cxShowDataTreeNode.cpp:62
cxMeshInfoWidget.h
cxViewService.h
cx::ShowSlice3DDataTreeNode::getUid
virtual QString getUid() const
Definition: cxShowDataTreeNode.cpp:161
cx::ShowDataTreeNodeBase::getFont
virtual QVariant getFont() const
Definition: cxShowDataTreeNode.cpp:68
cx::ShowSlice3DDataTreeNode::ShowSlice3DDataTreeNode
ShowSlice3DDataTreeNode(TreeRepositoryWeakPtr repo, DataPtr data)
Definition: cxShowDataTreeNode.cpp:157
cx::DataPtr
boost::shared_ptr< class Data > DataPtr
Definition: cxRegistrationApplicator.h:22
cx::DataViewProperties
Definition: cxViewGroupData.h:79
cxPatientModelService.h
cx::ShowDataTreeNodeBase::createPropertiesWidget
virtual boost::shared_ptr< QWidget > createPropertiesWidget() const
Definition: cxShowDataTreeNode.cpp:98
cx::TreeNodePtr
boost::shared_ptr< TreeNode > TreeNodePtr
Definition: cxDataTreeNode.h:22
cx::TreeNodeImpl::getServices
VisServicesPtr getServices() const
Definition: cxTreeNodeImpl.cpp:97
cx::TreeNodeImpl::repo
TreeRepositoryPtr repo()
Definition: cxTreeNodeImpl.cpp:102
cx::ShowVolumeDataTreeNode::getName
virtual QString getName() const
Definition: cxShowDataTreeNode.cpp:115
cx::DataViewProperties::createSlice3D
static DataViewProperties createSlice3D()
Definition: cxViewGroupData.cpp:176
cx::DataViewProperties::removeFlagsIn
DataViewProperties removeFlagsIn(DataViewProperties rhs) const
Definition: cxViewGroupData.cpp:234
cx::ShowSlice2DDataTreeNode::ShowSlice2DDataTreeNode
ShowSlice2DDataTreeNode(TreeRepositoryWeakPtr repo, DataPtr data)
Definition: cxShowDataTreeNode.cpp:132
cx::ShowDataTreeNodeBase
Definition: cxShowDataTreeNode.h:25
cxSelectDataStringProperty.h
cx::ShowDataTreeNodeBase::getIcon
virtual QIcon getIcon() const
Definition: cxShowDataTreeNode.cpp:57
cxMesh.h
cx::ShowSlice3DDataTreeNode::getType
virtual QString getType() const
Definition: cxShowDataTreeNode.cpp:169
cx::TreeRepositoryWeakPtr
boost::weak_ptr< class TreeRepository > TreeRepositoryWeakPtr
Definition: cxTreeNode.h:30
cx::ShowDataTreeNodeBase::getDefiningDataViewProperties
virtual DataViewProperties getDefiningDataViewProperties() const =0
cx::ShowVolumeDataTreeNode::getUid
virtual QString getUid() const
Definition: cxShowDataTreeNode.cpp:111
cx::ShowDataTreeNodeBase::ShowDataTreeNodeBase
ShowDataTreeNodeBase(TreeRepositoryWeakPtr repo, DataPtr data)
Definition: cxShowDataTreeNode.cpp:35
cx::DataViewProperties::createVolume3D
static DataViewProperties createVolume3D()
Definition: cxViewGroupData.cpp:167
cxVisServices.h