CustusX  15.8
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 
86  virtual DoubleBoundingBox3D boundingBox() const;
87  void setColor(const QColor& color);
88  QColor getColor();
89  bool getBackfaceCulling();
90  bool getFrontfaceCulling();
91  void setIsWireframe(bool on);
92  bool getIsWireframe() const;
93  vtkPolyDataPtr getTransformedPolyData(Transform3D tranform);
94  bool isFiberBundle() const;
95 
96  virtual void save(const QString &basePath);
97 signals:
98  void meshChanged();
99 public slots:
100  void setBackfaceCullingSlot(bool backfaceCulling);
101  void setFrontfaceCullingSlot(bool backfaceCulling);
102 
103 private:
104  vtkPolyDataPtr mVtkPolyData;
105  QColor mColor;
106  bool mWireframe;
107  bool mBackfaceCulling;
108  bool mFrontfaceCulling;
109 };
110 
111 typedef boost::shared_ptr<Mesh> MeshPtr;
112 
113 } // namespace cx
114 
115 #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
Definition: cxProbeSector.h:47
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
Superclass for all data objects.
Definition: cxData.h:69
static QString getTypeName()
Definition: cxMesh.h:81
boost::shared_ptr< class Mesh > MeshPtr