Fraxinus  16.5.0-fx-rc8
An IGT application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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) 2008-2014, SINTEF Department of Medical Technology
5 All rights reserved.
6 
7 Redistribution and use in source and binary forms, with or without
8 modification, are permitted provided that the following conditions are met:
9 
10 1. Redistributions of source code must retain the above copyright notice,
11  this list of conditions and the following disclaimer.
12 
13 2. Redistributions in binary form must reproduce the above copyright notice,
14  this list of conditions and the following disclaimer in the documentation
15  and/or other materials provided with the distribution.
16 
17 3. Neither the name of the copyright holder nor the names of its contributors
18  may be used to endorse or promote products derived from this software
19  without specific prior written permission.
20 
21 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
25 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 =========================================================================*/
32 
33 #ifndef CXMETRICNAMESREP_H
34 #define CXMETRICNAMESREP_H
35 
36 #include "cxResourceVisualizationExport.h"
37 
38 #include <vector>
39 #include "cxRepImpl.h"
40 #include "cxVector3D.h"
41 #include "vtkForwardDeclarations.h"
42 #include "cxBoundingBox3D.h"
43 #include "cxForwardDeclarations.h"
44 class QColor;
45 
46 #include "cxRepImpl.h"
47 
48 namespace cx
49 {
50 
51 typedef boost::shared_ptr<class MetricNamesRep> MetricNamesRepPtr;
52 typedef boost::shared_ptr<class TextDisplay> TextDisplayPtr;
53 typedef boost::shared_ptr<class DataMetric> DataMetricPtr;
54 
64 class cxResourceVisualization_EXPORT MetricNamesRep : public RepImpl
65 {
66  Q_OBJECT
67 public:
68  static MetricNamesRepPtr New(const QString& uid="");
69  virtual ~MetricNamesRep();
70 
71  virtual QString getType() const{ return "MetricNamesRep";}
72  void setFontSize(int size);
73  void setData(std::vector<DataPtr> data);
74 
75 
76 protected:
78  virtual void addRepActorsToViewRenderer(ViewPtr view);
79  virtual void removeRepActorsFromViewRenderer(ViewPtr view);
80  virtual void onModifiedStartRender();
81 
86  void setColoredTextList(std::vector<std::pair<QColor, QString> > text, Eigen::Array2d pos, vtkViewport *vp=0);
87 
88 // vtkRendererPtr getRenderer();
89  DoubleBoundingBox3D findNormalizedBoundingBoxAroundText(std::vector<std::pair<QColor, QString> > text, Eigen::Array2d pos, vtkViewport *vp);
90  DoubleBoundingBox3D moveBoxIntoAnother(DoubleBoundingBox3D box, DoubleBoundingBox3D another);
91  bool equal(std::vector<DataMetricPtr> a, std::vector<DataMetricPtr> b) const;
92  std::vector<DataMetricPtr> convertToMetrics(std::vector<DataPtr> data);
93  std::vector<std::pair<QColor, QString> > getAllMetricTexts() const;
94  QString getText(DataMetricPtr metric, bool showLabel) const;
95 
96  int mFontSize;
97  std::vector<DataMetricPtr> mMetrics;
98  std::vector<TextDisplayPtr> mDisplayText;
99 };
100 
101 } // namespace cx
102 
103 #endif // CXMETRICNAMESREP_H
boost::shared_ptr< DataMetric > DataMetricPtr
Definition: cxDataMetric.h:95
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:63
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