Fraxinus  18.10
An IGT application
cxCustomMetricRep.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 #ifndef CXCUSTOMMETRICREP_H
13 #define CXCUSTOMMETRICREP_H
14 
15 #include "cxResourceVisualizationExport.h"
16 
17 #include "cxDataMetricRep.h"
18 #include "vtkForwardDeclarations.h"
19 #include "cxForwardDeclarations.h"
21 #include "cxTransform3D.h"
22 
23 
24 namespace cx
25 {
26 typedef boost::shared_ptr<class CustomMetricRep> CustomMetricRepPtr;
27 typedef boost::shared_ptr<class CustomMetric> CustomMetricPtr;
28 typedef boost::shared_ptr<class GraphicalGeometric> GraphicalGeometricPtr;
29 typedef boost::shared_ptr<class Image2DProxy> Image2DProxyPtr;
30 
31 
40 class cxResourceVisualization_EXPORT CustomMetricRep: public DataMetricRep
41 {
42 Q_OBJECT
43 public:
44  static CustomMetricRepPtr New(const QString& uid = "");
45  virtual ~CustomMetricRep() {}
46 
47  virtual QString getType() const { return "CustomMetricRep"; }
48 
49 protected:
50  virtual void clear();
51  virtual void onModifiedStartRender();
52 
53  virtual void onEveryRender();
54 private:
56  CustomMetricPtr getCustomMetric();
57  void updateModel();
58 
59  std::vector<GraphicalGeometricPtr> mMeshGeometry;
60  std::vector<Image2DProxyPtr> mImageGeometryProxy;
61  std::vector<CaptionText3DPtr> mDistanceText;
62  void updateMeshModel(DataPtr model);
63  void updateImageModel(DataPtr model);
64  CaptionText3DPtr createDistanceText(Vector3D pos, double distance);
65  void createDistanceMarkers();
66  void hideDistanceMetrics();
67  bool isCloseToCamera(Vector3D pos);
68 };
69 
70 }
71 
72 #endif // CXCUSTOMMETRICREP_H
Base class for all Data Metric reps.
virtual ~CustomMetricRep()
constructor
boost::shared_ptr< class GraphicalGeometric > GraphicalGeometricPtr
virtual QString getType() const
boost::shared_ptr< class Data > DataPtr
boost::shared_ptr< class CustomMetricRep > CustomMetricRepPtr
Eigen::Vector3d Vector3D
Vector3D is a representation of a point or vector in 3D.
Definition: cxVector3D.h:42
boost::shared_ptr< class Image2DProxy > Image2DProxyPtr
boost::shared_ptr< CaptionText3D > CaptionText3DPtr
boost::shared_ptr< class CustomMetric > CustomMetricPtr
Namespace for all CustusX production code.