Fraxinus  16.5.0-fx-rc9
An IGT application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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) 2008-2014, SINTEF Department of Medical Technology
5 All rights reserved.
6 
7 Redistribution and use in source and binary forms, with or without
8 modification, are permitted provided that the following conditions are met:
9 
10 1. Redistributions of source code must retain the above copyright notice,
11  this list of conditions and the following disclaimer.
12 
13 2. Redistributions in binary form must reproduce the above copyright notice,
14  this list of conditions and the following disclaimer in the documentation
15  and/or other materials provided with the distribution.
16 
17 3. Neither the name of the copyright holder nor the names of its contributors
18  may be used to endorse or promote products derived from this software
19  without specific prior written permission.
20 
21 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
25 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 =========================================================================*/
32 #include "cxShowDataTreeNode.h"
33 #include "cxPatientModelService.h"
34 #include "cxDefinitions.h"
35 #include "cxData.h"
36 #include "cxTreeRepository.h"
37 #include "cxLogger.h"
38 #include "cxDataMetric.h"
39 #include "cxActiveData.h"
40 #include "cxViewService.h"
41 #include "cxViewGroupData.h"
42 #include "cxVisServices.h"
43 #include <QFont>
44 #include <QLabel>
45 #include "cxMesh.h"
46 #include "cxMeshInfoWidget.h"
48 #include "cxImage.h"
50 #include "cxDataMetric.h"
51 
52 namespace cx
53 {
54 
55 
57  TreeNodeImpl(repo), mData(data)
58 {
59 }
60 
62 {
63  bool flatMode = this->repo()->getMode()=="flat";
64  bool parentVisible = this->getParent()->isVisibleNode();
65  return parentVisible && flatMode;
66 }
67 
69 {
70  return this->repo()->getNode(mData->getUid());
71 }
72 
74 {
75  this->getParent()->activate();
76 }
77 
79 {
80  return QIcon();
81 }
82 
84 {
85  return this->getParent()->getColor();
86 // return QColor("black");
87 }
88 
90 {
91  return QVariant();
92 }
93 
95 {
96  ViewGroupDataPtr group = this->getServices()->view()->getGroup(index);
97  DataViewProperties props = group->getProperties(mData->getUid());
98 
99  // if ((props.hasVolume3D() || props.hasSlice3D()) && props.hasSlice2D())
100  if (props.containsAnyFlagsIn(this->getDefiningDataViewProperties()))
101  return Qt::CheckState(2);
102  else
103  return Qt::CheckState(0);
104 }
105 
107 {
108  ViewGroupDataPtr group = this->getServices()->view()->getGroup(index);
109  DataViewProperties props = group->getProperties(mData->getUid());
110 
111  if (value)
113  else
115 
116  group->setProperties(mData->getUid(), props);
117 }
118 
120 {
121  return this->getParent()->createPropertiesWidget();
122 }
123 
127 
129  ShowDataTreeNodeBase(repo, data)
130 {
131 }
133 {
134  return mData->getUid() + "_volume";
135 }
137 {
138  return "Volume";
139 }
141 {
142  return "data_volume";
143 }
145 {
147 }
148 
152 
154  ShowDataTreeNodeBase(repo, data)
155 {
156 }
158 {
159  return mData->getUid() + "_slice2D";
160 }
162 {
163  return "Slice 2D";
164 }
166 {
167  return "data_slice2D";
168 }
170 {
172 }
173 
177 
179  ShowDataTreeNodeBase(repo, data)
180 {
181 }
183 {
184  return mData->getUid() + "_slice3D";
185 }
187 {
188  return "Slice 3D";
189 }
191 {
192  return "data_slice3D";
193 }
195 {
197 }
198 
199 } // namespace cx
200 
boost::shared_ptr< TreeNode > TreeNodePtr
static DataViewProperties createSlice3D()
boost::shared_ptr< class ViewGroupData > ViewGroupDataPtr
Definition: cxViewGroup.h:50
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:51
virtual QVariant getColor() const
TreeRepositoryPtr repo()
virtual void setViewGroupVisibility(int index, bool value)
static DataViewProperties createSlice2D()
QWidget * createPropertiesWidget() const
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)