Fraxinus  2023.01.05-dev+develop.0da12
An IGT application
cxSpaceTreeNode.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 "cxSpaceTreeNode.h"
12 #include "cxLogger.h"
13 #include "cxTreeRepository.h"
14 #include <QIcon>
15 
16 namespace cx
17 {
18 
19 
21  TreeNodeImpl(repo),
22  mSpace(space)
23 {
24 
25 }
26 
27 QString SpaceTreeNode::getUid() const
28 {
29  return mSpace.toString();
30 }
31 
32 QString SpaceTreeNode::getName() const
33 {
34  return mSpace.toString();
35 }
36 
37 QString SpaceTreeNode::getType() const
38 {
39  return "space";
40 }
41 
43 {
44  if (mSpace.mId == csPATIENTREF)
45  {
46  bool toolsVisible = this->repo()->getVisibleNodeTypes().contains("tool");
47  return toolsVisible;
48  }
49 
50  return true;
51 }
52 
54 {
55  if (this->repo()->getMode()=="flat")
56  return this->repo()->getNodeForGroup("space");
57 
58  if (mSpace.mId == csREF)
59  {
60  return this->repo()->getTopNode();
61  }
62  if (mSpace.mId == csPATIENTREF)
63  {
64  return this->repo()->getNode(CoordinateSystem(csREF).toString());
65  }
66  else if (mSpace.mId == csDATA)
67  {
68  return this->repo()->getNode(CoordinateSystem(csREF).toString());
69  }
70  else
71  {
72  CX_LOG_CHANNEL_DEBUG("CA") << "TBD: Not implemented";
73  return TreeNodePtr();
74  }
75 }
76 
78 {
79  if (mSpace.mId == csREF)
80  {
81  return QIcon(":/icons/space_reference.png");
82  }
83  if (mSpace.mId == csPATIENTREF)
84  {
85  return QIcon(":/icons/space_patient_reference.png");
86  }
87  else
88  {
89  return QIcon(":/icons/space_generic.png");
90  }
91 }
92 
93 
94 
95 } // namespace cx
boost::shared_ptr< TreeNode > TreeNodePtr
csREF
the data reference space (r) using LPS (left-posterior-superior) coordinates.
Definition: cxDefinitions.h:90
boost::weak_ptr< class TreeRepository > TreeRepositoryWeakPtr
Definition: cxTreeNode.h:30
virtual QString getType() const
TreeRepositoryPtr repo()
csDATA
a datas space (d)
Definition: cxDefinitions.h:90
virtual TreeNodePtr getParent() const
COORDINATE_SYSTEM mId
the type of coordinate system
csPATIENTREF
the patient/tool reference space (pr)
Definition: cxDefinitions.h:90
virtual QString getName() const
virtual QIcon getIcon() const
virtual QString getUid() const
#define CX_LOG_CHANNEL_DEBUG(channel)
Definition: cxLogger.h:107
Identification of a Coordinate system.
SpaceTreeNode(TreeRepositoryWeakPtr repo, CoordinateSystem space)
virtual bool isVisibleNode() const
Namespace for all CustusX production code.