Eliminated the error-prone c-style casting of the arrangement object that occurs when using observers.

This commit is contained in:
Efi Fogel 2023-12-12 01:50:26 +02:00
parent a2ea1742c3
commit 5544ff4893
22 changed files with 58 additions and 183 deletions

View File

@ -5706,17 +5706,19 @@ changes when they occur. In our case observers can be attached to an
arrangement object. An attached observer receives notifications about arrangement object. An attached observer receives notifications about
the changes this arrangement undergoes. the changes this arrangement undergoes.
An observer object, the type of which is an instance of the An observer object that observes changes that an arrangement object of
`Arr_observer<Arrangement>` class template, stores a pointer to an type `Arrangement` undergoes must be of a type derived from
arrangement object. When the `Arr_observer<Arrangement>` class `Arrangement::Observer`. The observer object stores a pointer to the
template is instantiated, the `Arrangement` parameter must be observed arrangement object. The observer receives notifications
substituted with the type of the arrangement object. The observer <em>just before</em> a structural change occurs in the arrangement and
receives notifications <em>just before</em> a structural change occurs <em>immediately after</em> such a change takes place.
in the arrangement and <em>immediately after</em> such a change takes `Arrangement::Observer` is an alias to
place. `Arr_observer` serves as a base class for other `Arr_observer<CGAL::Arrangement_on_surface_2<>>`, where
observer classes and defines a set of virtual notification `CGAL::Arrangement_on_surface_2<>` is the type of the arrangement
functions, with default empty implementations. The set of functions object or its base type. It serves as a base type for other observer
can be divided into three categories, as follows: classes and defines a set of virtual notification functions, with
default empty implementations. The set of functions can be divided
into three categories, as follows:
<OL> <OL>

View File

@ -21,12 +21,11 @@ to dynamically maintain the mapping of face handles to indices.
\cgalModels{DefaultConstructible,CopyConstructible,Assignable,ReadablePropertyMap} \cgalModels{DefaultConstructible,CopyConstructible,Assignable,ReadablePropertyMap}
\sa `Arr_observer<Arrangement>`
\sa `Arr_vertex_index_map<Arrangement>` \sa `Arr_vertex_index_map<Arrangement>`
*/ */
template< typename Arrangement > template< typename Arrangement >
class Arr_face_index_map: public Arr_observer<Arrangement> { class Arr_face_index_map: public Arrangement::Observer {
public: public:
/// \name Types /// \name Types
@ -74,4 +73,3 @@ Arr_face_index_map(Arrangement_2& arr);
}; /* end Arr_accessor */ }; /* end Arr_accessor */
} /* end namespace CGAL */ } /* end namespace CGAL */

View File

@ -23,7 +23,6 @@ namespace CGAL {
*/ */
template <typename Arrangement_> template <typename Arrangement_>
class Arr_triangulation_point_location : public Arr_observer<Arrangement_> class Arr_triangulation_point_location : public Arrangement_::Observer {}
{}
} }

View File

@ -21,12 +21,11 @@ to dynamically maintain the mapping of vertex handles to indices.
\cgalModels{DefaultConstructible,CopyConstructible,Assignable,ReadablePropertyMap} \cgalModels{DefaultConstructible,CopyConstructible,Assignable,ReadablePropertyMap}
\sa `Arr_observer<Arrangement>`
\sa `Arr_face_index_map<Arrangement>` \sa `Arr_face_index_map<Arrangement>`
*/ */
template< typename Arrangement > template< typename Arrangement >
class Arr_vertex_index_map: public Arr_observer<Arrangement> { class Arr_vertex_index_map: public Arrangement::Observer {
public: public:
/// \name Types /// \name Types
@ -74,9 +73,3 @@ Arr_vertex_index_map(Arrangement_2& arr);
}; /* end Arr_accessor */ }; /* end Arr_accessor */
} /* end namespace CGAL */ } /* end namespace CGAL */

View File

@ -3,7 +3,6 @@
#include <CGAL/basic.h> #include <CGAL/basic.h>
#include <CGAL/Arr_extended_dcel.h> #include <CGAL/Arr_extended_dcel.h>
#include <CGAL/Arr_observer.h>
#include "arr_exact_construction_segments.h" #include "arr_exact_construction_segments.h"
@ -12,15 +11,16 @@ using Ex_arrangement = CGAL::Arrangement_2<Traits, Dcel>;
// An arrangement observer, used to receive notifications of face splits and // An arrangement observer, used to receive notifications of face splits and
// to update the indices of the newly created faces. // to update the indices of the newly created faces.
class Face_index_observer : public CGAL::Arr_observer<Ex_arrangement> { class Face_index_observer : public Ex_arrangement::Observer {
private: private:
size_t n_faces; // the current number of faces size_t n_faces; // the current number of faces
public: public:
Face_index_observer(Ex_arrangement& arr) : Face_index_observer(Ex_arrangement& arr) :
CGAL::Arr_observer<Ex_arrangement>(arr), n_faces(0) Ex_arrangement::Observer(arr),
n_faces(0)
{ {
CGAL_precondition (arr.is_empty()); CGAL_precondition(arr.is_empty());
arr.unbounded_face()->set_data (0); arr.unbounded_face()->set_data (0);
} }

View File

@ -2,15 +2,14 @@
// Using a simple arrangement observer. // Using a simple arrangement observer.
#include <CGAL/basic.h> #include <CGAL/basic.h>
#include <CGAL/Arr_observer.h>
#include "arr_exact_construction_segments.h" #include "arr_exact_construction_segments.h"
#include "arr_print.h" #include "arr_print.h"
// An observer that receives notifications of face splits and face mergers. // An observer that receives notifications of face splits and face mergers.
class My_observer : public CGAL::Arr_observer<Arrangement> { class My_observer : public Arrangement::Observer {
public: public:
My_observer(Arrangement& arr) : CGAL::Arr_observer<Arrangement>(arr) {} My_observer(Arrangement& arr) : Arrangement::Observer(arr) {}
virtual void before_split_face(Face_handle, Halfedge_handle e) { virtual void before_split_face(Face_handle, Halfedge_handle e) {
std::cout << "-> The insertion of : [ " << e->curve() std::cout << "-> The insertion of : [ " << e->curve()

View File

@ -21,7 +21,6 @@
* Definition of the Arr_face_index_map<Arrangement> class. * Definition of the Arr_face_index_map<Arrangement> class.
*/ */
#include <CGAL/Arr_observer.h>
#include <CGAL/Unique_hash_map.h> #include <CGAL/Unique_hash_map.h>
#include <CGAL/property_map.h> #include <CGAL/property_map.h>
@ -35,8 +34,7 @@ namespace CGAL {
* of faces in the arrangement. * of faces in the arrangement.
*/ */
template <class Arrangement_> template <class Arrangement_>
class Arr_face_index_map : public Arr_observer<Arrangement_> class Arr_face_index_map : public Arrangement_::Observer {
{
public: public:
typedef Arrangement_ Arrangement_2; typedef Arrangement_ Arrangement_2;
@ -51,7 +49,7 @@ public:
private: private:
typedef Arr_face_index_map<Arrangement_2> Self; typedef Arr_face_index_map<Arrangement_2> Self;
typedef Arr_observer<Arrangement_2> Base; typedef typename Arrangement_2::Observer Base;
typedef Unique_hash_map<Face_handle, unsigned int> Index_map; typedef Unique_hash_map<Face_handle, unsigned int> Index_map;
@ -73,14 +71,14 @@ public:
/*! Constructor with an associated arrangement. */ /*! Constructor with an associated arrangement. */
Arr_face_index_map (const Arrangement_2& arr) : Arr_face_index_map (const Arrangement_2& arr) :
Base (const_cast<Arrangement_2&> (arr)) Base(const_cast<Arrangement_2&>(arr))
{ {
_init(); _init();
} }
/*! Copy constructor. */ /*! Copy constructor. */
Arr_face_index_map (const Self& other) : Arr_face_index_map (const Self& other) :
Base (const_cast<Arrangement_2&> (*(other.arrangement()))) Base(const_cast<typename Base::Arrangement_2&>(*(other.arrangement())))
{ {
_init(); _init();
} }
@ -92,7 +90,7 @@ public:
return (*this); return (*this);
this->detach(); this->detach();
this->attach (const_cast<Arrangement_2&> (*(other.arrangement()))); this->attach(const_cast<typename Base::Arrangement_2&>(*(other.arrangement())));
return (*this); return (*this);
} }

View File

@ -20,7 +20,6 @@
* Definition of the Arr_landmarks_generator_base<Arrangement> template. * Definition of the Arr_landmarks_generator_base<Arrangement> template.
*/ */
#include <CGAL/Arr_point_location_result.h> #include <CGAL/Arr_point_location_result.h>
#include <CGAL/Arr_observer.h>
#include <CGAL/Arrangement_2/Arr_traits_adaptor_2.h> #include <CGAL/Arrangement_2/Arr_traits_adaptor_2.h>
#include <CGAL/Arr_point_location/Arr_lm_nearest_neighbor.h> #include <CGAL/Arr_point_location/Arr_lm_nearest_neighbor.h>
#include <CGAL/Arr_batched_point_location.h> #include <CGAL/Arr_batched_point_location.h>
@ -43,8 +42,8 @@ namespace CGAL {
*/ */
template <typename Arrangement_, template <typename Arrangement_,
typename Nearest_neighbor_ = typename Nearest_neighbor_ =
Arr_landmarks_nearest_neighbor <Arrangement_> > Arr_landmarks_nearest_neighbor<Arrangement_> >
class Arr_landmarks_generator_base : public Arr_observer <Arrangement_> { class Arr_landmarks_generator_base : public Arrangement_::Observer {
public: public:
typedef Arrangement_ Arrangement_2; typedef Arrangement_ Arrangement_2;
typedef Nearest_neighbor_ Nearest_neighbor; typedef Nearest_neighbor_ Nearest_neighbor;
@ -110,7 +109,7 @@ public:
* \param arr (in) The arrangement. * \param arr (in) The arrangement.
*/ */
Arr_landmarks_generator_base(const Arrangement_2& arr) : Arr_landmarks_generator_base(const Arrangement_2& arr) :
Arr_observer<Arrangement_2> (const_cast<Arrangement_2 &>(arr)), Arrangement_2::Observer(const_cast<Arrangement_2&>(arr)),
m_traits(static_cast<const Traits_adaptor_2*>(arr.geometry_traits())), m_traits(static_cast<const Traits_adaptor_2*>(arr.geometry_traits())),
m_ignore_notifications(false), m_ignore_notifications(false),
m_ignore_remove_edge(false), m_ignore_remove_edge(false),

View File

@ -98,14 +98,13 @@ public:
virtual void build_landmark_set() virtual void build_landmark_set()
{ {
// Go over the arrangement, and insert all its vertices as landmarks. // Go over the arrangement, and insert all its vertices as landmarks.
NN_Point_list nnp_list; NN_Point_list nnp_list;
const Arrangement_2* arr = this->arrangement(); const auto* arr = this->arrangement();
Vertex_const_iterator vit;
num_landmarks = 0; num_landmarks = 0;
for (vit = arr->vertices_begin(); vit != arr->vertices_end(); ++vit) { for (auto vit = arr->vertices_begin(); vit != arr->vertices_end(); ++vit) {
Vertex_const_handle vh = vit; Vertex_const_handle vh = vit;
nnp_list.push_back(NN_Point_2(vh->point(), this->pl_make_result(vh))); nnp_list.push_back(NN_Point_2(vh->point(), this->pl_make_result(vh)));
num_landmarks++; ++num_landmarks;
} }
// Update the search structure. // Update the search structure.

View File

@ -26,7 +26,6 @@
#include <CGAL/Arrangement_2/Arr_traits_adaptor_2.h> #include <CGAL/Arrangement_2/Arr_traits_adaptor_2.h>
#include <CGAL/Arr_point_location/Trapezoidal_decomposition_2.h> #include <CGAL/Arr_point_location/Trapezoidal_decomposition_2.h>
#include <CGAL/Arr_point_location/Td_traits.h> #include <CGAL/Arr_point_location/Td_traits.h>
#include <CGAL/Arr_observer.h>
namespace CGAL { namespace CGAL {
@ -36,7 +35,7 @@ namespace CGAL {
* The Arrangement parameter corresponds to an arrangement instantiation. * The Arrangement parameter corresponds to an arrangement instantiation.
*/ */
template <typename Arrangement_> template <typename Arrangement_>
class Arr_trapezoid_ric_point_location : public Arr_observer <Arrangement_> { class Arr_trapezoid_ric_point_location : public Arrangement_::Observer {
public: public:
//type of arrangement on surface //type of arrangement on surface
typedef Arrangement_ Arrangement_on_surface_2; typedef Arrangement_ Arrangement_on_surface_2;
@ -148,8 +147,8 @@ public:
bool with_guarantees = true, bool with_guarantees = true,
double depth_thrs = CGAL_TD_DEFAULT_DEPTH_THRESHOLD, double depth_thrs = CGAL_TD_DEFAULT_DEPTH_THRESHOLD,
double size_thrs = CGAL_TD_DEFAULT_SIZE_THRESHOLD) : double size_thrs = CGAL_TD_DEFAULT_SIZE_THRESHOLD) :
Arr_observer<Arrangement_on_surface_2> Arrangement_on_surface_2::
(const_cast<Arrangement_on_surface_2 &>(arr)), Observer(const_cast<Arrangement_on_surface_2&>(arr)),
m_with_guarantees(with_guarantees) m_with_guarantees(with_guarantees)
{ {
m_traits = static_cast<const Traits_adaptor_2*> (arr.geometry_traits()); m_traits = static_cast<const Traits_adaptor_2*> (arr.geometry_traits());
@ -352,7 +351,7 @@ protected:
std::vector<Halfedge_const_handle> he_container; std::vector<Halfedge_const_handle> he_container;
Edge_const_iterator eit; Edge_const_iterator eit;
Halfedge_const_handle he_cst; Halfedge_const_handle he_cst;
Arrangement_on_surface_2 *arr = this->arrangement(); auto* arr = this->arrangement();
//collect the arrangement halfedges //collect the arrangement halfedges
for (eit = arr->edges_begin(); eit != arr->edges_end(); ++eit) for (eit = arr->edges_begin(); eit != arr->edges_end(); ++eit)
{ {

View File

@ -39,8 +39,7 @@ namespace CGAL {
* triangulation algorithm. * triangulation algorithm.
*/ */
template <typename Arrangement_> template <typename Arrangement_>
class Arr_triangulation_point_location : public Arr_observer<Arrangement_> class Arr_triangulation_point_location : public Arrangement_::Observer {
{
public: public:
typedef Arrangement_ Arrangement_2; typedef Arrangement_ Arrangement_2;
@ -129,7 +128,7 @@ public:
* \param arr (in) The arrangement. * \param arr (in) The arrangement.
*/ */
Arr_triangulation_point_location(const Arrangement_2& arr) : Arr_triangulation_point_location(const Arrangement_2& arr) :
Arr_observer<Arrangement_2>(const_cast<Arrangement_2&>(arr)), Arrangement_2::Observer(const_cast<Arrangement_2&>(arr)),
m_traits(static_cast<const Traits_adaptor_2*>(arr.geometry_traits())), m_traits(static_cast<const Traits_adaptor_2*>(arr.geometry_traits())),
m_ignore_notifications(false), m_ignore_notifications(false),
m_ignore_remove_edge(false) m_ignore_remove_edge(false)

View File

@ -22,7 +22,6 @@
/*! \file /*! \file
* Definition of the Arr_vertex_index_map<Arrangement> class. * Definition of the Arr_vertex_index_map<Arrangement> class.
*/ */
#include <CGAL/Arr_observer.h>
#include <CGAL/Unique_hash_map.h> #include <CGAL/Unique_hash_map.h>
#include <CGAL/property_map.h> #include <CGAL/property_map.h>
@ -36,8 +35,7 @@ namespace CGAL {
* of vertices in the arrangement. * of vertices in the arrangement.
*/ */
template <class Arrangement_> template <class Arrangement_>
class Arr_vertex_index_map : public Arr_observer<Arrangement_> class Arr_vertex_index_map : public Arrangement_::Observer {
{
public: public:
typedef Arrangement_ Arrangement_2; typedef Arrangement_ Arrangement_2;
@ -52,7 +50,7 @@ public:
private: private:
typedef Arr_vertex_index_map<Arrangement_2> Self; typedef Arr_vertex_index_map<Arrangement_2> Self;
typedef Arr_observer<Arrangement_2> Base; typedef typename Arrangement_2::Observer Base;
typedef Unique_hash_map<Vertex_handle, unsigned int> Index_map; typedef Unique_hash_map<Vertex_handle, unsigned int> Index_map;
@ -67,21 +65,21 @@ public:
/*! Default constructor. */ /*! Default constructor. */
Arr_vertex_index_map () : Arr_vertex_index_map () :
Base (), Base(),
n_vertices (0), n_vertices (0),
rev_map (MIN_REV_MAP_SIZE) rev_map (MIN_REV_MAP_SIZE)
{} {}
/*! Constructor with an associated arrangement. */ /*! Constructor with an associated arrangement. */
Arr_vertex_index_map (const Arrangement_2& arr) : Arr_vertex_index_map (const Arrangement_2& arr) :
Base (const_cast<Arrangement_2&> (arr)) Base(const_cast<Arrangement_2&>(arr))
{ {
_init(); _init();
} }
/*! Copy constructor. */ /*! Copy constructor. */
Arr_vertex_index_map (const Self& other) : Arr_vertex_index_map (const Self& other) :
Base (const_cast<Arrangement_2&> (*(other.arrangement()))) Base(const_cast<typename Base::Arrangement_2&> (*(other.arrangement())))
{ {
_init(); _init();
} }
@ -93,7 +91,7 @@ public:
return (*this); return (*this);
this->detach(); this->detach();
this->attach (const_cast<Arrangement_2&> (*(other.arrangement()))); this->attach (const_cast<typename Base::Arrangement_2&> (*(other.arrangement())));
return (*this); return (*this);
} }

View File

@ -115,12 +115,9 @@ public:
typedef typename Base::Inner_ccb_const_iterator Hole_const_iterator; typedef typename Base::Inner_ccb_const_iterator Hole_const_iterator;
private: private:
friend class Arr_observer<Self>;
friend class Arr_accessor<Self>; friend class Arr_accessor<Self>;
public: public:
/// \name Constructors. /// \name Constructors.
//@{ //@{
@ -215,34 +212,6 @@ public:
} }
//@} //@}
protected:
/// \name Managing and notifying the arrangement observers.
//@{
typedef Arr_observer<Self> Observer;
/*!
* Register a new observer (so it starts receiving notifications).
* \param p_obs A pointer to the observer object.
*/
void _register_observer (Observer *p_obs)
{
Base::_register_observer ((typename Base::Observer*)p_obs);
return;
}
/*!
* Unregister a new observer (so it stops receiving notifications).
* \param p_obs A pointer to the observer object.
* \return Whether the observer was successfully unregistered.
*/
bool _unregister_observer (Observer *p_obs)
{
return (Base::_unregister_observer ((typename Base::Observer*)p_obs));
}
//@}
}; };
} //namespace CGAL } //namespace CGAL

View File

@ -273,29 +273,6 @@ bool Arrangement_on_surface_with_history_2<GeomTr,TopTr>::are_mergeable
e2->curve())); e2->curve()));
} }
//-----------------------------------------------------------------------------
// Register a new observer (so it starts receiving notifications).
//
template<class GeomTr, class TopTr>
void Arrangement_on_surface_with_history_2<GeomTr,TopTr>::
_register_observer(Arr_observer<Self> *p_obs)
{
Base_arr_2::_register_observer
(reinterpret_cast<Arr_observer<Base_arr_2>*>(p_obs));
return;
}
//-----------------------------------------------------------------------------
// Unregister an observer (so it stops receiving notifications).
//
template<class GeomTr, class TopTr>
bool Arrangement_on_surface_with_history_2<GeomTr,TopTr>::
_unregister_observer(Arr_observer<Self> *p_obs)
{
return (Base_arr_2::_unregister_observer
(reinterpret_cast<Arr_observer<Base_arr_2>*>(p_obs)));
}
} //namespace CGAL } //namespace CGAL
#endif #endif

View File

@ -109,6 +109,8 @@ public:
typedef typename Topology_traits::Dcel Dcel; typedef typename Topology_traits::Dcel Dcel;
typedef typename Dcel::Size Size; typedef typename Dcel::Size Size;
typedef Arr_observer<Self> Observer;
protected: protected:
friend class Arr_observer<Self>; friend class Arr_observer<Self>;
friend class Arr_accessor<Self>; friend class Arr_accessor<Self>;
@ -892,7 +894,6 @@ protected:
typedef CGAL_ALLOCATOR(Point_2) Points_alloc; typedef CGAL_ALLOCATOR(Point_2) Points_alloc;
typedef CGAL_ALLOCATOR(X_monotone_curve_2) Curves_alloc; typedef CGAL_ALLOCATOR(X_monotone_curve_2) Curves_alloc;
typedef Arr_observer<Self> Observer;
typedef std::list<Observer*> Observers_container; typedef std::list<Observer*> Observers_container;
typedef typename Observers_container::iterator Observers_iterator; typedef typename Observers_container::iterator Observers_iterator;

View File

@ -26,7 +26,6 @@
#include <CGAL/Arrangement_on_surface_2.h> #include <CGAL/Arrangement_on_surface_2.h>
#include <CGAL/Arr_overlay_2.h> #include <CGAL/Arr_overlay_2.h>
#include <CGAL/Arr_consolidated_curve_data_traits_2.h> #include <CGAL/Arr_consolidated_curve_data_traits_2.h>
#include <CGAL/Arr_observer.h>
#include <CGAL/In_place_list.h> #include <CGAL/In_place_list.h>
#include <CGAL/Arrangement_2/Arr_with_history_accessor.h> #include <CGAL/Arrangement_2/Arr_with_history_accessor.h>
@ -75,10 +74,7 @@ public:
typedef typename Geometry_traits_2::Curve_2 Curve_2; typedef typename Geometry_traits_2::Curve_2 Curve_2;
typedef typename Geometry_traits_2::X_monotone_curve_2 X_monotone_curve_2; typedef typename Geometry_traits_2::X_monotone_curve_2 X_monotone_curve_2;
typedef Arr_observer<Self> Observer;
protected: protected:
friend class Arr_observer<Self>;
friend class Arr_accessor<Self>; friend class Arr_accessor<Self>;
friend class Arr_with_history_accessor<Self>; friend class Arr_with_history_accessor<Self>;
@ -582,24 +578,6 @@ public:
//@} //@}
protected: protected:
/// \name Managing and notifying the arrangement observers.
//@{
/*!
* Register a new observer (so it starts receiving notifications).
* \param p_obs A pointer to the observer object.
*/
void _register_observer (Observer *p_obs);
/*!
* Unregister an observer (so it stops receiving notifications).
* \param p_obs A pointer to the observer object.
* \return Whether the observer was successfully unregistered.
*/
bool _unregister_observer (Observer *p_obs);
//@}
/// \name Curve insertion and deletion. /// \name Curve insertion and deletion.
//@{ //@{

View File

@ -119,7 +119,6 @@ public:
private: private:
typedef Arrangement_with_history_2<Geometry_traits_2, Dcel> Self; typedef Arrangement_with_history_2<Geometry_traits_2, Dcel> Self;
friend class Arr_observer<Self>;
friend class Arr_accessor<Self>; friend class Arr_accessor<Self>;
public: public:
@ -233,35 +232,8 @@ public:
return (Face_const_handle (p_oc->face())); return (Face_const_handle (p_oc->face()));
} }
//@} //@}
protected:
/// \name Managing and notifying the arrangement observers.
//@{
typedef Arr_observer<Self> Observer;
/*!
* Register a new observer (so it starts receiving notifications).
* \param p_obs A pointer to the observer object.
*/
void _register_observer (Observer *p_obs)
{
Base::_register_observer ((typename Base::Observer*)p_obs);
return;
}
/*!
* Unregister a new observer (so it stops receiving notifications).
* \param p_obs A pointer to the observer object.
* \return Whether the observer was successfully unregistered.
*/
bool _unregister_observer (Observer *p_obs)
{
return (Base::_unregister_observer ((typename Base::Observer*)p_obs));
}
//@}
}; };
} //namespace CGAL } //namespace CGAL

View File

@ -5,7 +5,6 @@
#include <CGAL/MP_Float.h> #include <CGAL/MP_Float.h>
#include <CGAL/Arr_segment_traits_2.h> #include <CGAL/Arr_segment_traits_2.h>
#include <CGAL/Arrangement_2.h> #include <CGAL/Arrangement_2.h>
#include <CGAL/Arr_observer.h>
#include <CGAL/Arr_enums.h> #include <CGAL/Arr_enums.h>
#include <iostream> #include <iostream>
@ -57,14 +56,11 @@ void compare_results(std::string str)
// An arrangement observer, used to receive notifications of face splits and // An arrangement observer, used to receive notifications of face splits and
// face mergers. // face mergers.
class Test_observer : public CGAL::Arr_observer<Arrangement_2> class Test_observer : public Arrangement_2::Observer {
{
public: public:
Test_observer (Arrangement_2& arr) : Test_observer(Arrangement_2& arr) : Arrangement_2::Observer(arr) {}
CGAL::Arr_observer<Arrangement_2> (arr)
{}
/// \name Notification functions on global arrangement operations. /// \name Notification functions on global arrangement operations.
//@{ //@{

View File

@ -28,7 +28,6 @@
#include <time.h> #include <time.h>
#include <CGAL/enum.h> #include <CGAL/enum.h>
#include <CGAL/Arr_observer.h>
#include <CGAL/Envelope_3/Envelope_base.h> #include <CGAL/Envelope_3/Envelope_base.h>
#include <CGAL/Envelope_3/Envelope_overlay_2.h> #include <CGAL/Envelope_3/Envelope_overlay_2.h>
#include <CGAL/Envelope_3/Envelope_element_visitor_3.h> #include <CGAL/Envelope_3/Envelope_element_visitor_3.h>
@ -134,7 +133,8 @@ protected:
typedef typename Minimization_diagram_2::Inner_ccb_iterator typedef typename Minimization_diagram_2::Inner_ccb_iterator
Inner_ccb_iterator; Inner_ccb_iterator;
typedef Arr_observer<Minimization_diagram_2> Md_observer; typedef typename Minimization_diagram_2::Observer
Md_observer;
typedef typename Minimization_diagram_2::Dcel::Dcel_data_iterator typedef typename Minimization_diagram_2::Dcel::Dcel_data_iterator
Envelope_data_iterator; Envelope_data_iterator;

View File

@ -96,7 +96,7 @@ protected:
typedef typename Minimization_diagram_2::Dcel::Dcel_data_iterator typedef typename Minimization_diagram_2::Dcel::Dcel_data_iterator
Envelope_data_iterator; Envelope_data_iterator;
typedef Arr_observer<Minimization_diagram_2> Md_observer; typedef typename Minimization_diagram_2::Observer Md_observer;
typedef Arr_accessor<Minimization_diagram_2> Md_accessor; typedef Arr_accessor<Minimization_diagram_2> Md_accessor;
typedef typename Topology_traits::Default_point_location_strategy typedef typename Topology_traits::Default_point_location_strategy

View File

@ -77,9 +77,9 @@ private:
// An arrangement observer, used to receive notifications of face splits and // An arrangement observer, used to receive notifications of face splits and
// face mergers. // face mergers.
class My_observer : public CGAL::Arr_observer<Arrangement_2> { class My_observer : public Arrangement_2::Observer {
public: public:
My_observer(Arrangement_2& arr) : Arr_observer<Arrangement_2>(arr) {} My_observer(Arrangement_2& arr) : Arrangement_2::Observer(arr) {}
virtual void after_split_face(Face_handle f, Face_handle new_f, virtual void after_split_face(Face_handle f, Face_handle new_f,
bool /* is_hole */) bool /* is_hole */)

View File

@ -21,7 +21,6 @@
#include <memory> #include <memory>
#include <CGAL/boost/iterator/transform_iterator.hpp> #include <CGAL/boost/iterator/transform_iterator.hpp>
#include <CGAL/Constrained_Delaunay_triangulation_2.h> #include <CGAL/Constrained_Delaunay_triangulation_2.h>
#include <CGAL/Arr_observer.h>
#include <CGAL/assertions.h> #include <CGAL/assertions.h>
#include <CGAL/use.h> #include <CGAL/use.h>
@ -86,10 +85,10 @@ private:
}; };
// Observer to track any changes of the attached arrangement. // Observer to track any changes of the attached arrangement.
class Observer : public Arr_observer<Arrangement_2> class Observer : public Arrangement_2::Observer
{ {
typedef Arr_observer<Arrangement_2> Base; typedef typename Arrangement_2::Observer Base;
typedef Observer Self; typedef Observer Self;