/// This file is part of the X3DToolKit library /// Copyright (C) 2002-2004 Yannick Le Goc (legoc@imag.fr) /// http://artis.imag.fr/Members/Yannick.Legoc/X3D/ /// This library is free software; you can redistribute it and/or /// modify it under the terms of the GNU Lesser General Public /// License as published by the Free Software Foundation; either /// version 2.1 of the License, or (at your option) any later version. /// This library is distributed in the hope that it will be useful, /// but WITHOUT ANY WARRANTY; without even the implied warranty of /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU /// Lesser General Public License for more details. /// You should have received a copy of the GNU Lesser General Public /// License along with this library; if not, write to the Free Software /// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #ifndef X3DTK_MESH_SFEDGE_H #define X3DTK_MESH_SFEDGE_H #include "MESH_BaseSFEdge.h" #include "MESH_SFEdgeContent.h" namespace X3DTK { namespace MESH { template class TemplateVertex; template class SFTemplateVertex; template class SFTemplateFace; template class EntityMFTemplateFace; /*! \brief Template class declared in * providing an edge structure for the Mesh class. * * \ingroup MeshSceneGraph */ template class SFTemplateEdge : public BaseSFEdge { friend class TemplateVertex; friend class TemplateMesh; friend class SFTemplateDirectEdge; friend class SFTemplateIndirectEdge; friend class SFTemplateFace; public: typedef EntityMFTemplateFace MFFace; /// Returns the symetric edge. inline SFTemplateEdge *getSymetric(); /// Returns the Vertex from. virtual SFTemplateVertex *getFromVertex() const = 0; /// Gets the Vertex to. virtual SFTemplateVertex *getToVertex() const = 0; /// Gets the left faces. virtual const MFFace &getLeftFaces() const = 0; /// Gets the right faces. virtual const MFFace &getRightFaces() const = 0; /// Gets the faces. The method is inefficient because no reference is returned and /// a copy constructor is called. Prefer getting the left faces first and then the /// right faces. MFFace getFaces() const; /// Returns true if is a boundary. inline bool isBoundary() const; /// Returns true if is non-manifold. inline bool isNonManifold() const; /// Gets the data. inline EData &data(); /// Gets the data. inline const EData &data() const; #ifdef TEMPLATE_SPECIALIZATION_SUPPORTED /// Gets the data F from EData which must be of type clist >. template F &getData(); /// Gets optionally the data F from EData which must be of type clist >. template F &ogetData(); #endif protected: /// Constructor. SFTemplateEdge(SFTemplateEdgeContent *const edgeContent); /// Destructor. virtual ~SFTemplateEdge(); /// Sets the symetric edge. void setSymetric(SFTemplateEdge *symetric); /// Adds a left face. virtual void addLeftFace(SFTemplateFace *face) = 0; /// Adds a right face. virtual void addRightFace(SFTemplateFace *face) = 0; /// Removes a left face. virtual void removeLeftFace(SFTemplateFace *face) = 0; /// Removes a right face. virtual void removeRightFace(SFTemplateFace *face) = 0; private: SFTemplateEdgeContent *const _edgeContent; SFTemplateEdge *_symetric; /// Reverses the face. Is called by SFFace::reverse(). void reverse(SFTemplateFace *face); }; /// operator<< overloaded for SFEdge class. template std::ostream& operator<<(std::ostream& o, const SFTemplateEdge &e); } } #include "MESH_SFEdge.inl" #endif