Fraxinus  16.5.0-fx-rc9
An IGT application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
cxMesh.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 
34 #ifndef SSCMESH_
35 #define SSCMESH_
36 
37 #include "cxResourceExport.h"
38 #include "cxPrecompiledHeader.h"
39 
40 #include <set>
41 #include <boost/shared_ptr.hpp>
42 
43 #include "vtkForwardDeclarations.h"
44 
45 #include <QColor>
46 #include "cxData.h"
47 
48 class QDomNode;
49 class QDomDocument;
50 
51 namespace cx
52 {
53 
61 class cxResource_EXPORT Mesh: public Data
62 {
63 Q_OBJECT
64 public:
65  static MeshPtr create(const QString& uid, const QString& name = "");
66  Mesh(const QString& uid, const QString& name = "");
67  Mesh(const QString& uid, const QString& name, const vtkPolyDataPtr& polyData);
68  virtual ~Mesh();
69 
70  void setVtkPolyData(const vtkPolyDataPtr& polyData);
71 
72  virtual vtkPolyDataPtr getVtkPolyData() const;
73 
74  void addXml(QDomNode& dataNode);
75  virtual void parseXml(QDomNode& dataNode);
76  virtual bool load(QString path);
77  virtual QString getType() const
78  {
79  return getTypeName();
80  }
81  static QString getTypeName()
82  {
83  return "mesh";
84  }
85  virtual QIcon getIcon() {return QIcon(":/icons/surface.png");}
86 
87  virtual DoubleBoundingBox3D boundingBox() const;
88  void setColor(const QColor& color);
89  QColor getColor();
90  bool getBackfaceCulling();
91  bool getFrontfaceCulling();
92  void setIsWireframe(bool on);
93  bool getIsWireframe() const;
94  vtkPolyDataPtr getTransformedPolyData(Transform3D tranform);
95  bool isFiberBundle() const;
96  bool showGlyph();
97  bool hasGlyph();
98  double getVisSize();
99  const char * getOrientationArray();
100  const char * getColorArray();
101  const char * getGlyphLUT();
102  QStringList getOrientationArrayList();
103  QStringList getColorArrayList();
104 
105  virtual void save(const QString &basePath);
106 signals:
107  void meshChanged();
108 public slots:
109  void setBackfaceCullingSlot(bool backfaceCulling);
110  void setFrontfaceCullingSlot(bool backfaceCulling);
111  void setShowGlyph(bool val);
112  void setVisSize(double size);
113  void setOrientationArray(const char * orientationArray);
114  void setColorArray(const char * colorArray);
115  void setGlyphLUT(const char * glyphLUT);
116 private:
117  vtkPolyDataPtr mVtkPolyData;
118  QColor mColor;
119  bool mWireframe;
120  bool mBackfaceCulling;
121  bool mFrontfaceCulling;
122  bool mHasGlyph;
123  double mVisSize;
124  bool mShowGlyph;
125  bool shouldGlyphBeEnableByDefault();
126  std::string mOrientationArray;
127  std::string mColorArray;
128  std::string mGlyphLUT;
129  QStringList mOrientationArrayList;
130  QStringList mColorArrayList;
131 };
132 
133 typedef boost::shared_ptr<Mesh> MeshPtr;
134 
135 } // namespace cx
136 
137 #endif /*SSCMESH_*/
A mesh data set.
Definition: cxMesh.h:61
Transform3D Transform3D
Transform3D is a representation of an affine 3D transform.
vtkSmartPointer< class vtkPolyData > vtkPolyDataPtr
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.
virtual QString getType() const
Definition: cxMesh.h:77
virtual QIcon getIcon()
Definition: cxMesh.h:85
Superclass for all data objects.
Definition: cxData.h:109
static QString getTypeName()
Definition: cxMesh.h:81
boost::shared_ptr< class Mesh > MeshPtr