NorMIT-nav  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
cx::SpaceTreeNode::SpaceTreeNode
SpaceTreeNode(TreeRepositoryWeakPtr repo, CoordinateSystem space)
Definition: cxSpaceTreeNode.cpp:20
cxLogger.h
cx::TreeNodeImpl
Definition: cxTreeNodeImpl.h:26
cxTreeRepository.h
cx
Namespace for all CustusX production code.
Definition: cx_dev_group_definitions.h:13
cx::SpaceTreeNode::getType
virtual QString getType() const
Definition: cxSpaceTreeNode.cpp:37
csDATA
csDATA
a datas space (d)
Definition: cxDefinitions.h:91
cx::SpaceTreeNode::getUid
virtual QString getUid() const
Definition: cxSpaceTreeNode.cpp:27
cx::SpaceTreeNode::getIcon
virtual QIcon getIcon() const
Definition: cxSpaceTreeNode.cpp:77
cxSpaceTreeNode.h
csREF
csREF
the data reference space (r) using LPS (left-posterior-superior) coordinates.
Definition: cxDefinitions.h:90
cx::SpaceTreeNode::isVisibleNode
virtual bool isVisibleNode() const
Definition: cxSpaceTreeNode.cpp:42
CX_LOG_CHANNEL_DEBUG
#define CX_LOG_CHANNEL_DEBUG(channel)
Definition: cxLogger.h:107
cx::SpaceTreeNode::getName
virtual QString getName() const
Definition: cxSpaceTreeNode.cpp:32
cx::TreeNodePtr
boost::shared_ptr< TreeNode > TreeNodePtr
Definition: cxDataTreeNode.h:22
cx::SpaceTreeNode::getParent
virtual TreeNodePtr getParent() const
Definition: cxSpaceTreeNode.cpp:53
cx::TreeNodeImpl::repo
TreeRepositoryPtr repo()
Definition: cxTreeNodeImpl.cpp:102
cx::CoordinateSystem::toString
QString toString() const
Definition: cxCoordinateSystemHelpers.cpp:19
csPATIENTREF
csPATIENTREF
the patient/tool reference space (pr)
Definition: cxDefinitions.h:92
cx::TreeRepositoryWeakPtr
boost::weak_ptr< class TreeRepository > TreeRepositoryWeakPtr
Definition: cxTreeNode.h:30
cx::CoordinateSystem
Identification of a Coordinate system.
Definition: cxCoordinateSystemHelpers.h:31
cx::CoordinateSystem::mId
COORDINATE_SYSTEM mId
the type of coordinate system
Definition: cxCoordinateSystemHelpers.h:35