// Copyright (c) 2006,2007,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org). // // $URL$ // $Id$ // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial // // // Author(s): Ron Wein // Efi Fogel #ifndef CGAL_ARR_EXTENDED_DCEL_H #define CGAL_ARR_EXTENDED_DCEL_H #include #include /*! \file * The definition of the extended DCEL classes. */ #include namespace CGAL { /*! \class * An extended DCEL vertex with auxiliary data field. */ template class Arr_extended_vertex : public VertexBase { using Vertex_base = VertexBase; using Vertex_data = VertexData; using Self = Arr_extended_vertex; public: typedef Vertex_data Data; private: Data m_data; // The auxiliary data field. public: /*! obtains the auxiliary data (const version). */ const Data& data() const { return m_data; } /*! obtains the auxiliary data (non-const version). */ Data& data() { return m_data; } /*! sets the auxiliary data. */ void set_data(const Data& data) { m_data = data; } /*! assigns from another vertex. */ virtual void assign(const Vertex_base& v) { Vertex_base::assign(v); const Self& ex_v = static_cast(v); m_data = ex_v.m_data; } template struct rebind { using Pnt = Point_; using Rebind_vertex_base = typename Vertex_base::template rebind; using Other_vertex_base = typename Rebind_vertex_base::other; using other = Arr_extended_vertex; }; }; /*! \class * An extended DCEL halfedge with auxiliary data field. */ template class Arr_extended_halfedge : public HalfedgeBase { using Halfedge_base = HalfedgeBase; using Halfedge_data = HalfedgeData; using Self = Arr_extended_halfedge; public: typedef Halfedge_data Data; private: Data m_data; // The auxiliary data field. public: /*! obtains the auxiliary data (const version). */ const Data& data() const { return m_data; } /*! obtains the auxiliary data (non-const version). */ Data& data() { return m_data; } /*! sets the auxiliary data. */ void set_data(const Data& data) { m_data = data; } /*! assigns from another halfedge. */ virtual void assign(const Halfedge_base& he) { Halfedge_base::assign(he); const Self& ex_he = static_cast(he); m_data = ex_he.m_data; } template struct rebind { using Xcv = XMonotoneCurve; using Rebind_halfedge_base = typename Halfedge_base::template rebind; using Other_halfedge_base = typename Rebind_halfedge_base::other; using other = Arr_extended_halfedge; }; }; /*! \class * An extended DCEL face with auxiliary data field. */ template class Arr_extended_face : public FaceBase { using Face_base = FaceBase; using Face_data = FaceData; using Self = Arr_extended_face; public: typedef Face_data Data; private: Data m_data; // The auxiliary data field. public: /*! obtains the auxiliary data (const version). */ const Data& data() const { return m_data; } /*! obtains the auxiliary data (non-const version). */ Data& data() { return m_data; } /*! sets the auxiliary data. */ void set_data(const Data& data) { m_data = data; } /*! assigns from another face. */ virtual void assign(const Face_base& f) { Face_base::assign(f); const Self& ex_f = static_cast(f); m_data = ex_f.m_data; } }; /*! \class * A DCEL class whose faces are extended with an auxiliary data field. * The Traits parameter corresponds to a geometric traits class, which * defines the Point_2 and X_monotone_curve_2 types. * The FaceData parameter specifies the object type stored with each face. */ template , typename HalfedgeBase = Arr_halfedge_base, typename FaceBase = Arr_face_base> class Arr_face_extended_dcel : public Arr_dcel_base> { public: using Face_base = FaceBase; using Face_data = FaceData; /*! \struct * An auxiliary structure for rebinding the DCEL with a new traits class. */ template class rebind { private: using Pnt = typename T::Point_2; using Xcv = typename T::X_monotone_curve_2; using Rebind_vertex = typename VertexBase::template rebind; using Vertex_other = typename Rebind_vertex::other; using Rebind_halfedge = typename HalfedgeBase::template rebind; using Halfedge_other = typename Rebind_halfedge::other; public: using other = Arr_face_extended_dcel; }; /*! constructs default. */ Arr_face_extended_dcel() {} /*! destructs. */ virtual ~Arr_face_extended_dcel() {} }; /*! \class * A DCEL class whose features are extended with auxiliary data fields. * The Traits parameter corresponds to a geometric traits class, which * defines the Point_2 and X_monotone_curve_2 types. * The VertexData, HalfedgeData and FaceData parameter specify the object types * stored with each vertex, halfedge and face, respectively. */ template , typename HalfedgeBase = Arr_halfedge_base, typename FaceBase = Arr_face_base> class Arr_extended_dcel : public Arr_dcel_base, Arr_extended_halfedge, Arr_extended_face> { public: using Vertex_data = VertexData; using Halfedge_data = HalfedgeData; using Face_data = FaceData; using Vertex_base = VertexBase; using Halfedge_base = HalfedgeBase; using Face_base = FaceBase; /*! \struct * An auxiliary structure for rebinding the DCEL with a new traits class. */ template struct rebind { private: using Pnt = typename T::Point_2; using Xcv = typename T::X_monotone_curve_2; using Rebind_vertex = typename VertexBase::template rebind; using Vertex_other = typename Rebind_vertex::other; using Rebind_halfedge = typename HalfedgeBase::template rebind; using Halfedge_other = typename Rebind_halfedge::other; public: using other = Arr_extended_dcel; }; /*! constructs default. */ Arr_extended_dcel() {} /*! destructs. */ virtual ~Arr_extended_dcel() {} }; } // namespace CGAL #include #endif