00001
00002
00004
00005 #ifndef MESHMESH_H
00006 #define MESHMESH_H
00007
00008 #include "MESH_X3DMeshNode.h"
00009 #include "MESH_SFVertex.h"
00010 #include "MESH_VertexSet.h"
00011 #include "MESH_SFDirectEdge.h"
00012 #include "MESH_SFIndirectEdge.h"
00013 #include "MESH_SFFace.h"
00014
00015 #include <iostream>
00016 #include <typeinfo>
00017
00018 namespace X3DTK {
00019 namespace MESH {
00020
00024
00025 template<class MData, class VData, class EData, class FData>
00026 class Mesh : public X3DMeshNode
00027 {
00028 public:
00030 typedef SFVertex<VData, EData, FData> SFVertex;
00032 typedef MFVertex<VData, EData, FData> MFVertex;
00034 typedef SFEdge<EData, FData, VData> SFEdge;
00036 typedef MFEdge<EData, FData, VData> MFEdge;
00038 typedef SFFace<FData, VData, EData> SFFace;
00040 typedef MFFace<FData, VData, EData> MFFace;
00041
00043 Mesh();
00045 virtual SFNode clone() const;
00047 virtual ~Mesh();
00048
00050 void setVertexSet(VertexSet<VData, EData, FData> *vertexSet);
00052 virtual MFAbstractNode getChildrenList() const;
00053
00056 bool addChild(const SFAbstractNode &N);
00059 bool setChild(const SFAbstractNode &N);
00061 bool removeChild(const SFAbstractNode &N);
00062
00064 SFEdge *getEdge(SFVertex *from, SFVertex *to);
00066 const MFVertex &getVertices() const;
00067
00069 inline const MFEdge &getEdges() const;
00071 inline const MFFace &getFaces() const;
00073 inline MData &data();
00075 inline const MData &data() const;
00077 template<class F, bool optional>
00078 F &getData();
00079
00082 SFFace *createFace(const MFInt32 &coordIndex, bool ccw = true);
00084 SFFace *createFace(SFInt32 i, const MFInt32 &coordIndex, bool ccw = true);
00085
00086 protected:
00088 Mesh(const Mesh &N);
00089
00090 private:
00091 MFEdge _edges;
00092 MFFace _faces;
00093 MData _data;
00094
00096 SFEdge *createEdge(SFVertex *from, SFVertex *to);
00097 };
00098
00099 }
00100 }
00101
00102 #include "MESH_Mesh.inl"
00103
00104 #endif