CustusX  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 
virtual boost::shared_ptr< QWidget > createPropertiesWidget() const
boost::shared_ptr< TreeNode > TreeNodePtr
static DataViewProperties createSlice3D()
boost::shared_ptr< class ViewGroupData > ViewGroupDataPtr
Definition: cxViewGroup.h:29
virtual DataViewProperties getDefiningDataViewProperties() const =0
ShowSlice2DDataTreeNode(TreeRepositoryWeakPtr repo, DataPtr data)
virtual TreeNodePtr getParent() const
VisServicesPtr getServices() const
virtual QString getName() const
virtual QString getUid() const
boost::weak_ptr< class TreeRepository > TreeRepositoryWeakPtr
Definition: cxTreeNode.h:30
virtual QVariant getColor() const
TreeRepositoryPtr repo()
virtual void setViewGroupVisibility(int index, bool value)
static DataViewProperties createSlice2D()
virtual QString getUid() const
virtual QVariant getViewGroupVisibility(int index) const
boost::shared_ptr< class Data > DataPtr
ShowSlice3DDataTreeNode(TreeRepositoryWeakPtr repo, DataPtr data)
virtual QIcon getIcon() const
virtual QString getType() const
virtual DataViewProperties getDefiningDataViewProperties() const
virtual QString getType() const
ShowDataTreeNodeBase(TreeRepositoryWeakPtr repo, DataPtr data)
virtual QString getUid() const
bool containsAnyFlagsIn(DataViewProperties required) const
virtual bool isVisibleNode() const
virtual QVariant getFont() const
virtual QString getName() const
static DataViewProperties createVolume3D()
virtual DataViewProperties getDefiningDataViewProperties() const
virtual QString getType() const
DataViewProperties removeFlagsIn(DataViewProperties rhs) const
DataViewProperties addFlagsIn(DataViewProperties rhs) const
virtual DataViewProperties getDefiningDataViewProperties() const
virtual QString getName() const
ShowVolumeDataTreeNode(TreeRepositoryWeakPtr repo, DataPtr data)
Namespace for all CustusX production code.