Fraxinus  2023.01.05-dev+develop.0da12
An IGT application
cxMetricNamesRep.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 CXMETRICNAMESREP_H
13 #define CXMETRICNAMESREP_H
14 
15 #include "cxResourceVisualizationExport.h"
16 
17 #include <vector>
18 #include "cxRepImpl.h"
19 #include "cxVector3D.h"
20 #include "vtkForwardDeclarations.h"
21 #include "cxBoundingBox3D.h"
22 #include "cxForwardDeclarations.h"
23 class QColor;
24 
25 #include "cxRepImpl.h"
26 
27 namespace cx
28 {
29 
30 typedef boost::shared_ptr<class MetricNamesRep> MetricNamesRepPtr;
31 typedef boost::shared_ptr<class TextDisplay> TextDisplayPtr;
32 typedef boost::shared_ptr<class DataMetric> DataMetricPtr;
33 
43 class cxResourceVisualization_EXPORT MetricNamesRep : public RepImpl
44 {
45  Q_OBJECT
46 public:
47  static MetricNamesRepPtr New(const QString& uid="");
48  virtual ~MetricNamesRep();
49 
50  virtual QString getType() const{ return "MetricNamesRep";}
51  void setFontSize(int size);
52  void setData(std::vector<DataPtr> data);
53 
54 private slots:
55  void callSetColoredTextListSlot();
56 
57 protected:
59  virtual void addRepActorsToViewRenderer(ViewPtr view);
60  virtual void removeRepActorsFromViewRenderer(ViewPtr view);
61  virtual void onModifiedStartRender();
62 
67  void setColoredTextList(std::vector<std::pair<QColor, QString> > text, Eigen::Array2d pos, vtkViewport *vp=0);
68 
69 // vtkRendererPtr getRenderer();
70  DoubleBoundingBox3D findNormalizedBoundingBoxAroundText(std::vector<std::pair<QColor, QString> > text, Eigen::Array2d pos, vtkViewport *vp);
71  DoubleBoundingBox3D moveBoxIntoAnother(DoubleBoundingBox3D box, DoubleBoundingBox3D another);
72  bool equal(std::vector<DataMetricPtr> a, std::vector<DataMetricPtr> b) const;
73  std::vector<DataMetricPtr> convertToMetrics(std::vector<DataPtr> data);
74  std::vector<std::pair<QColor, QString> > getAllMetricTexts() const;
75  QString getText(DataMetricPtr metric, bool showLabel) const;
76 
77  int mFontSize;
78  std::vector<DataMetricPtr> mMetrics;
79  std::vector<TextDisplayPtr> mDisplayText;
80 };
81 
82 } // namespace cx
83 
84 #endif // CXMETRICNAMESREP_H
boost::shared_ptr< DataMetric > DataMetricPtr
Definition: cxDataMetric.h:73
virtual QString getType() const
boost::shared_ptr< class View > ViewPtr
boost::shared_ptr< class MetricNamesRep > MetricNamesRepPtr
boost::shared_ptr< class TextDisplay > TextDisplayPtr
Default implementation of Rep.
Definition: cxRepImpl.h:42
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.
std::vector< TextDisplayPtr > mDisplayText
std::vector< DataMetricPtr > mMetrics
Namespace for all CustusX production code.