Fraxinus  2023.01.05-dev+develop.0da12
An IGT application
cxPointMetric.h
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 
12 
13 #ifndef CXPOINTMETRIC_H_
14 #define CXPOINTMETRIC_H_
15 
16 #include "cxResourceExport.h"
17 #include "cxPrecompiledHeader.h"
18 
19 #include "cxDataMetric.h"
20 #include "cxOptionalValue.h"
22 
23 namespace cx
24 {
25 struct CoordinateSystem;
26 
33 typedef boost::shared_ptr<class PointMetric> PointMetricPtr;
34 
42 class cxResource_EXPORT PointMetric: public DataMetric
43 {
44 Q_OBJECT
45 public:
46  virtual ~PointMetric();
47  static PointMetricPtr create(QString uid, QString name, PatientModelServicePtr dataManager, SpaceProviderPtr spaceProvider);
48  virtual QString getParentSpace();
49 
50  void setCoordinate(const Vector3D& p);
51  Vector3D getCoordinate() const;
52  void setSpace(CoordinateSystem space); // use parentframe from Data
53  CoordinateSystem getSpace() const; // use parentframe from Data
54  virtual QString getType() const
55  {
56  return getTypeName();
57  }
58  static QString getTypeName()
59  {
60  return "pointMetric";
61  }
62  virtual QIcon getIcon() {return QIcon(":/icons/metric_point.png");}
63  virtual Vector3D getRefCoord() const;
64 
65  virtual void addXml(QDomNode& dataNode);
66  virtual void parseXml(QDomNode& dataNode);
67  virtual DoubleBoundingBox3D boundingBox() const;
68 
69  virtual QString getValueAsString() const;
70  virtual bool showValueInGraphics() const { return false; }
71 
72 private slots:
73  void resetCachedValues();
74 private:
75  PointMetric(const QString& uid, const QString& name, PatientModelServicePtr dataManager, SpaceProviderPtr spaceProvider);
76  Vector3D mCoordinate;
77  CoordinateSystem mSpace;
78  SpaceListenerPtr mSpaceListener;
79  mutable OptionalValue<Vector3D> mCachedRefCoord;
80 };
81 
85 }
86 
87 #endif /* CXPOINTMETRIC_H_ */
boost::shared_ptr< class SpaceProvider > SpaceProviderPtr
virtual QString getType() const
Definition: cxPointMetric.h:54
virtual QIcon getIcon()
Definition: cxPointMetric.h:62
virtual bool showValueInGraphics() const
Definition: cxPointMetric.h:70
boost::shared_ptr< class PatientModelService > PatientModelServicePtr
Identification of a Coordinate system.
Representation of a floating-point bounding box in 3D. The data are stored as {xmin,xmax,ymin,ymax,zmin,zmax}, in order to simplify communication with vtk.
Data class that represents a single point.
Definition: cxPointMetric.h:42
Eigen::Vector3d Vector3D
Vector3D is a representation of a point or vector in 3D.
Definition: cxVector3D.h:42
static QString getTypeName()
Definition: cxPointMetric.h:58
boost::shared_ptr< class SpaceListener > SpaceListenerPtr
Base class for all Data Metrics.
Definition: cxDataMetric.h:43
Namespace for all CustusX production code.
boost::shared_ptr< class PointMetric > PointMetricPtr