00001 #ifndef X3DTK_MESH_MESH_H 00002 #define X3DTK_MESH_MESH_H 00003 00004 #include "MESH_X3DMeshNode.h" 00005 #include "MESH_SFVertex.h" 00006 #include "MESH_SFEdge.h" 00007 #include "MESH_SFFace.h" 00008 #include "MESH_MeshData.h" 00009 00010 #include <iostream> 00011 #include <typeinfo> 00012 00013 namespace X3DTK { 00014 namespace MESH { 00015 00016 template<class MData, class VData, class EData, class FData, bool RW> class MeshMFTemplateVertex; 00017 template<class MData, class VData, class EData, class FData, bool RW> class MeshMFTemplateEdge; 00018 template<class MData, class VData, class EData, class FData, bool RW> class MeshMFTemplateFace; 00019 00028 template<class MData, class VData, class EData, class FData, bool RW> 00029 class TemplateMesh : public X3DMeshNode 00030 { 00031 public: 00032 typedef MeshMFTemplateVertex<MData, VData, EData, FData, RW> MFVertex; 00033 typedef MeshMFTemplateEdge<MData, VData, EData, FData, RW> MFEdge; 00034 typedef MeshMFTemplateFace<MData, VData, EData, FData, RW> MFFace; 00035 00037 TemplateMesh(); 00039 virtual ~TemplateMesh(); 00040 00042 void setVertex(TemplateVertex<MData, VData, EData, FData, RW> *vertexSet); 00043 00045 const MFVertex &getVertices() const; 00047 const MFEdge &getEdges() const; 00049 inline const MFFace &getFaces() const; 00051 inline MData &data(); 00053 inline const MData &data() const; 00054 00055 #ifdef TEMPLATE_SPECIALIZATION_SUPPORTED 00056 00057 template<class F> 00058 F &getData(); 00060 template<class F> 00061 F &ogetData(); 00062 #endif 00063 00066 SFTemplateFace<MData, VData, EData, FData, RW> *createFace(const MFInt32 &coordIndex, bool ccw = true); 00068 SFTemplateFace<MData, VData, EData, FData, RW> *createFace(unsigned int i, const MFInt32 &coordIndex, bool ccw = true); 00069 00071 bool removeFace(SFTemplateFace<MData, VData, EData, FData, RW> *face); 00072 00073 protected: 00075 void removeFaceFromNeighBourhood(SFTemplateFace<MData, VData, EData, FData, RW> *face); 00076 00077 private: 00078 MFFace _faces; 00079 MData _data; 00080 }; 00081 00084 typedef TemplateMesh<MeshData, VertexData, EdgeData, FaceData, true> Mesh; 00085 typedef SFTemplateVertex<MeshData, VertexData, EdgeData, FaceData, true> SFVertex; 00086 typedef SFTemplateEdge<MeshData, VertexData, EdgeData, FaceData, true> SFEdge; 00087 typedef SFTemplateFace<MeshData, VertexData, EdgeData, FaceData, true> SFFace; 00088 00089 } 00090 } 00091 00092 #include "MESH_Mesh.inl" 00093 00094 #endif