diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_grid_generator.h b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_grid_generator.h index 25e790ec012..5a955dc6887 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_grid_generator.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_grid_generator.h @@ -23,13 +23,7 @@ * Definition of the Arr_grid_landmarks_generator template. */ -#include -#include -#include - -#include -#include -#include +#include CGAL_BEGIN_NAMESPACE @@ -37,14 +31,22 @@ CGAL_BEGIN_NAMESPACE * A generator for the landmarks point-locatoion class, which uses a * set of points on a grid as its set of landmarks. */ -template +template > class Arr_grid_landmarks_generator : - public Arr_observer + public Arr_landmarks_generator_base { public: typedef Arrangement_ Arrangement_2; - typedef Arr_grid_landmarks_generator Self; + typedef Nearest_neighbor_ Nearest_neighbor; + + typedef Arr_landmarks_generator_base Base; + typedef Arr_grid_landmarks_generator Self; typedef typename Arrangement_2::Geometry_traits_2 Geometry_traits_2; typedef typename Arrangement_2::Vertex_const_iterator Vertex_const_iterator; @@ -63,7 +65,7 @@ public: protected: - typedef std::vector Points_set; + typedef typename Base::Points_set Points_set; typedef std::pair PL_pair; typedef std::vector Pairs_set; @@ -98,7 +100,7 @@ public: /*! Constructor. */ Arr_grid_landmarks_generator (const Arrangement_2& arr) : - Arr_observer (const_cast(arr)), + Base (arr), ignore_notifications (false), updated (false), num_landmarks (0), @@ -110,7 +112,7 @@ public: Arr_grid_landmarks_generator (const Arrangement_2& arr, unsigned int n_landmarks) : - Arr_observer (const_cast(arr)), + Base (arr), ignore_notifications (false), updated (false), num_landmarks (n_landmarks), diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_halton_generator.h b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_halton_generator.h index 11814af5702..7796c065e1b 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_halton_generator.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_halton_generator.h @@ -50,7 +50,7 @@ public: Nearest_neighbor> Self; typedef typename Arrangement_2::Point_2 Point_2; - typedef std::vector Points_set; + typedef typename Base::Points_set Points_set; typedef typename Arrangement_2::Vertex_const_iterator Vertex_const_iterator; diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_middle_edges_generator.h b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_middle_edges_generator.h index 7481a4eabab..ea67078f937 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_middle_edges_generator.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_middle_edges_generator.h @@ -23,7 +23,7 @@ * Definition of the Arr_middle_edges_landmarks_generator template. */ -#include +#include CGAL_BEGIN_NAMESPACE @@ -40,13 +40,13 @@ template > class Arr_middle_edges_landmarks_generator - : public Arr_landmarks_generator + : public Arr_landmarks_generator_base { public: typedef Arrangement_ Arrangement_2; typedef Arr_middle_edges_landmarks_generator Self; - typedef Arr_landmarks_generator Base; + typedef Arr_landmarks_generator_base Base; typedef typename Arrangement_2::Traits_2 Traits_2; typedef typename Arrangement_2::Edge_const_iterator Edge_const_iterator; @@ -78,11 +78,10 @@ public: /*! Constructor. */ Arr_middle_edges_landmarks_generator (const Arrangement_2& arr, int /* lm_num */ = -1) : - Arr_landmarks_generator (arr) + Base (arr) { - CGAL_PRINT_DEBUG("Arr_middle_edges_landmarks_generator constructor."); - - this->build_landmarks_set(); + //CGAL_PRINT_DEBUG("Arr_middle_edges_landmarks_generator constructor."); + this->build_landmark_set(); } //Observer functions that should be empty, because they @@ -107,8 +106,7 @@ protected: */ virtual void _create_nn_points_set (NN_Points_set &nn_points) { - CGAL_PRINT_DEBUG("create_middle_edges_points_list"); - + //CGAL_PRINT_DEBUG("create_middle_edges_points_list"); Edge_const_iterator eit; Halfedge_const_handle hh; Arrangement_2 *arr = this->arrangement(); @@ -132,7 +130,7 @@ protected: const Point_2& p2 = hh->target()->point(); Point_2 p ((p1.x()+p2.x())/2, (p1.y()+p2.y())/2); - CGAL_PRINT_DEBUG("mid point is= " << p); + //CGAL_PRINT_DEBUG("mid point is= " << p); CGAL::Object obj = CGAL::make_object(hh); NN_Point_2 np(p, obj); diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_random_generator.h b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_random_generator.h index 78622438914..c12e796251d 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_random_generator.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_random_generator.h @@ -51,7 +51,7 @@ public: Nearest_neighbor> Self; typedef typename Arrangement_2::Point_2 Point_2; - typedef std::vector Points_set; + typedef typename Base::Points_set Points_set; typedef typename Arrangement_2::Vertex_const_iterator Vertex_const_iterator; diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_vertices_generator.h b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_vertices_generator.h index 67ea919175d..18431968fee 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_vertices_generator.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_vertices_generator.h @@ -23,10 +23,7 @@ * Definition of the Arr_landmarks_vertices_generator template. */ -#include -#include -#include -#include +#include CGAL_BEGIN_NAMESPACE @@ -39,7 +36,7 @@ template > class Arr_landmarks_vertices_generator : - public Arr_observer + public Arr_landmarks_generator_base { public: @@ -47,6 +44,8 @@ public: typedef typename Arrangement_2::Geometry_traits_2 Geometry_traits_2; typedef Nearest_neighbor_ Nearest_neighbor; + typedef Arr_landmarks_generator_base Base; typedef Arr_landmarks_vertices_generator Self; @@ -61,6 +60,8 @@ public: typedef typename Arrangement_2::Point_2 Point_2; typedef typename Arrangement_2::X_monotone_curve_2 X_monotone_curve_2; + typedef typename Base::Points_set Points_set; + typedef typename Nearest_neighbor::NN_Point_2 NN_Point_2; typedef std::list NN_Point_list; @@ -88,7 +89,7 @@ public: /*! Constructor. */ Arr_landmarks_vertices_generator (const Arrangement_2& arr) : - Arr_observer (const_cast(arr)), + Base (arr), ignore_notifications (false), updated (false), num_small_not_updated_changes(0), @@ -98,6 +99,12 @@ public: build_landmark_set(); } + virtual void _create_points_set (Points_set & /* points */) + { + std::cerr << "should not reach here!"<< std::endl; + CGAL_error(); + } + /*! * Creates the landmark set, using all arrangement vertices. */ diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/point_location.cpp b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/point_location.cpp index ec3876ad7e8..a19f0903885 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/point_location.cpp +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/point_location.cpp @@ -29,6 +29,8 @@ #include #include #include +#include +//#include typedef CGAL::Cartesian Kernel; typedef CGAL::Arr_segment_traits_2 Traits_2; @@ -61,6 +63,12 @@ typedef CGAL::Arr_halton_landmarks_generator Halton_lm_generator; typedef CGAL::Arr_landmarks_point_location Lm_halton_point_location; +typedef CGAL::Arr_middle_edges_landmarks_generator + Middle_edges_generator; +typedef CGAL::Arr_landmarks_point_location + Lm_middle_edges_point_location; +//typedef CGAL::Arr_triangulation_point_location +// Lm_triangulation_point_location; // ===> Add new point location type here <=== @@ -72,7 +80,7 @@ typedef Objects_vector::iterator Object_iterator; // ===> Change the number of point-location startegies // when a new point location is added. <=== -#define NUM_OF_POINT_LOCATION_STRATEGIES 7 +#define NUM_OF_POINT_LOCATION_STRATEGIES 8 /*! */ int check_point_location (Arrangement_2 &arr, Points_list &plist) @@ -108,6 +116,18 @@ int check_point_location (Arrangement_2 &arr, Points_list &plist) timer.stop(); std::cout << "Halton lm construction took " << timer.time() < Add new point location instance here. <=== @@ -205,6 +225,30 @@ int check_point_location (Arrangement_2 &arr, Points_list &plist) timer.stop(); ///END std::cout << "Halton LM location took " << timer.time() < Add a call to operate the the new point location. <=== @@ -219,7 +263,7 @@ int check_point_location (Arrangement_2 &arr, Points_list &plist) { ob_iter[pl_index] = objs[pl_index].begin(); } - + //get size of objects unsigned int size = objs[0].size(); //std::cout <<"size is "<< size << std::endl; @@ -240,7 +284,7 @@ int check_point_location (Arrangement_2 &arr, Points_list &plist) { //assign object to a face if (CGAL::assign (fh_ref, ob_iter[0][qi])) - { + { for (int pl_index=1; pl_indexis_unbounded()) @@ -301,9 +345,9 @@ int check_point_location (Arrangement_2 &arr, Points_list &plist) std::cout << "Error: point location number " << pl_index << " return a different halfedge"<< std::endl; std::cout << "Halfedge (curr): "<< hh_curr->curve() << std::endl; - result = -1; + result = -1; } - } + } } //assign object to a vertex @@ -332,12 +376,12 @@ int check_point_location (Arrangement_2 &arr, Points_list &plist) { std::cout << "Error: point location number " << pl_index << " return a different vertex"<< std::endl; - result = -1; + result = -1; } } std::cout << "Vertex: "<< vh_ref->point() << std::endl; } - + else { std::cout << "Illegal point-location result." << std::endl;