Cleaned up; 'typedef => 'using'; added missing const; made nested Arrangement obsolete (instead use Base_aos).

This commit is contained in:
Efi Fogel 2024-01-30 00:38:51 +02:00
parent 4204321688
commit 963255fe1b
1 changed files with 51 additions and 75 deletions

View File

@ -21,9 +21,7 @@
#include <CGAL/Arrangement_on_surface_2.h> #include <CGAL/Arrangement_on_surface_2.h>
#include <CGAL/Arr_spherical_topology_traits_2.h> #include <CGAL/Arr_spherical_topology_traits_2.h>
#include <CGAL/Arrangement_2/Arr_default_planar_topology.h> #include <CGAL/Arrangement_2/Arr_default_planar_topology.h>
#include <CGAL/Arrangement_2/arrangement_type_traits.h> #include <CGAL/Arrangement_2/arrangement_type_traits.h>
#include <CGAL/Envelope_3/Envelope_pm_dcel.h> #include <CGAL/Envelope_3/Envelope_pm_dcel.h>
namespace CGAL { namespace CGAL {
@ -32,114 +30,93 @@ namespace CGAL {
* Representation of an envelope diagram (a minimization diagram or a * Representation of an envelope diagram (a minimization diagram or a
* maximization diagram). * maximization diagram).
*/ */
template <class GeomTraits_, class TopTraits_ = template <typename GeomTraits_, typename TopTraits_ =
typename Default_planar_topology< typename Default_planar_topology
GeomTraits_, <GeomTraits_,
Envelope_3::Envelope_pm_dcel< Envelope_3::Envelope_pm_dcel
GeomTraits_, <GeomTraits_,
typename GeomTraits_::Xy_monotone_surface_3 typename GeomTraits_::Xy_monotone_surface_3>>::Traits>
> >::Traits
>
class Envelope_diagram_on_surface_2 : class Envelope_diagram_on_surface_2 :
public Arrangement_on_surface_2<GeomTraits_, TopTraits_> public Arrangement_on_surface_2<GeomTraits_, TopTraits_> {
{
public: public:
typedef GeomTraits_ Traits_3; using Traits_3 = GeomTraits_;
typedef TopTraits_ TopTraits; using TopTraits = TopTraits_;
typedef typename Traits_3::Xy_monotone_surface_3 Xy_monotone_surface_3; using Xy_monotone_surface_3 = typename Traits_3::Xy_monotone_surface_3;
protected: protected:
typedef Envelope_3::Envelope_pm_dcel<Traits_3, using Self = Envelope_diagram_on_surface_2<Traits_3, TopTraits>;
Xy_monotone_surface_3> Env_dcel;
typedef Envelope_diagram_on_surface_2<Traits_3, TopTraits> Self;
friend class Arr_accessor<Self>; friend class Arr_accessor<Self>;
public: public:
typedef Arrangement_on_surface_2<Traits_3, using Base = Arrangement_on_surface_2<Traits_3, TopTraits>;
TopTraits> Base;
// This is yacky, but we have not choice because of observer stuff.
typedef Base Arrangement;
typedef typename Env_dcel::Dcel_data_const_iterator Surface_const_iterator; // The following is not needed anymore, but kept for backward compatibility
using Arrangement = Base;
using Face = typename Base::Face;
using Surface_iterator = typename Face::Data_iterator;
using Surface_const_iterator = typename Face::Data_const_iterator;
/*! Default constructor. */ /*! Default constructor. */
Envelope_diagram_on_surface_2() : Envelope_diagram_on_surface_2() : Base() {}
Base()
{}
/*! Constructor with a traits-class instance. */ /*! Constructor with a traits-class instance. */
Envelope_diagram_on_surface_2 (Traits_3* tr) : Envelope_diagram_on_surface_2(const Traits_3* tr) : Base(tr) {}
Base (tr)
{}
}; };
/*! \class /*! \class
* Representation of an envelope diagram (a minimization diagram or a * Representation of an envelope diagram (a minimization diagram or a
* maximization diagram). * maximization diagram).
*/ */
template <typename GeomTraits,
template <class GeomTraits_, typename Dcel_ = Envelope_3::Envelope_pm_dcel
class Dcel_ = Envelope_3::Envelope_pm_dcel< <GeomTraits, typename GeomTraits::Xy_monotone_surface_3>>
GeomTraits_, typename GeomTraits_::Xy_monotone_surface_3
>
>
class Envelope_diagram_2 : class Envelope_diagram_2 :
public Envelope_diagram_on_surface_2< GeomTraits_, public Envelope_diagram_on_surface_2<GeomTraits,
typename Default_planar_topology<GeomTraits_, typename Default_planar_topology
Dcel_>::Traits <GeomTraits, Dcel_>::Traits>
>
{ {
public: public:
typedef GeomTraits_ Traits_3; using Traits_3 = GeomTraits;
typedef typename Traits_3::Xy_monotone_surface_3 Xy_monotone_surface_3; using Xy_monotone_surface_3 = typename Traits_3::Xy_monotone_surface_3;
protected: protected:
typedef Dcel_ Env_dcel; using Env_dcel = Dcel_;
typedef Envelope_diagram_2<Traits_3, Env_dcel> Self; using Self = Envelope_diagram_2<Traits_3, Env_dcel>;
friend class Arr_accessor<Self>; friend class Arr_accessor<Self>;
public: public:
typedef typename Default_planar_topology< Traits_3, using Topology_traits =
Env_dcel >::Traits Topology_traits; typename Default_planar_topology< Traits_3, Env_dcel>::Traits;
typedef Envelope_diagram_on_surface_2<Traits_3, Topology_traits> using Base = Envelope_diagram_on_surface_2<Traits_3, Topology_traits>;
Base; using Surface_iterator = typename Base::Surface_iterator;
typedef typename Env_dcel::Dcel_data_const_iterator Surface_const_iterator; using Surface_const_iterator = typename Base::Surface_const_iterator;
// This is yacky, but we have not choice because of observer stuff.
typedef typename Base::Base Arrangement;
// The following is not needed anymore, but kept for backward compatibility
using Arrangement = typename Base::Base;
/*! Default constructor. */ /*! Default constructor. */
Envelope_diagram_2() : Envelope_diagram_2() : Base() {}
Base()
{}
/*! Constructor with a traits-class instance. */ /*! Constructor with a traits-class instance. */
Envelope_diagram_2 (Traits_3* tr) : Envelope_diagram_2(const Traits_3* tr) : Base(tr) {}
Base (tr)
{}
}; };
//-------------------------------- Envelope_on_surface_3 //-------------------------------- Envelope_on_surface_3
// specialization // specialization
template <class GeomTraits_, class TopTraits_> template <typename GeomTraits_, typename TopTraits_>
class is_arrangement_2< class is_arrangement_2<Envelope_diagram_on_surface_2<GeomTraits_, TopTraits_>> :
Envelope_diagram_on_surface_2<GeomTraits_, TopTraits_> public std::true_type
> : public std::true_type
{}; {};
// specialization // specialization
template <class GeomTraits_, class DCEL_> template <typename GeomTraits_, typename Dcel_>
class is_arrangement_2< class is_arrangement_2<Envelope_diagram_2<GeomTraits_, Dcel_>> :
Envelope_diagram_2<GeomTraits_, DCEL_> public std::true_type
> : public std::true_type
{}; {};
// /*! \class // /*! \class
// * Representation of an envelope diagram (a minimization diagram or a // * Representation of an envelope diagram (a minimization diagram or a
// * maximization diagram). // * maximization diagram).
@ -185,7 +162,6 @@ class is_arrangement_2<
// }; // };
} //namespace CGAL } //namespace CGAL
#endif #endif