Spatial_sorting example updated to use First_of_pair_property_map

This commit is contained in:
iyaz 2013-05-02 15:40:25 +03:00
parent 8e38300002
commit f8f57d8653
1 changed files with 4 additions and 15 deletions

View File

@ -1,6 +1,7 @@
#include <CGAL/Simple_cartesian.h> #include <CGAL/Simple_cartesian.h>
#include <CGAL/spatial_sort.h> #include <CGAL/spatial_sort.h>
#include <CGAL/Spatial_sort_traits_adapter_2.h> #include <CGAL/Spatial_sort_traits_adapter_2.h>
#include <CGAL/property_map.h>
#include <vector> #include <vector>
typedef CGAL::Simple_cartesian<double> Kernel; typedef CGAL::Simple_cartesian<double> Kernel;
@ -8,21 +9,9 @@ typedef Kernel::Point_2 Point_2;
typedef std::pair<Point_2,int> Point_with_info; typedef std::pair<Point_2,int> Point_with_info;
typedef std::vector< Point_with_info > Data_vector; typedef std::vector< Point_with_info > Data_vector;
//property map typedef CGAL::Spatial_sort_traits_adapter_2<Kernel,
struct First_of_pair{ CGAL::First_of_pair_property_map<Point_with_info>
//classical typedefs > Search_traits_2;
typedef Point_with_info key_type;
typedef Point_2 value_type;
typedef const Point_2& reference;
typedef boost::readable_property_map_tag category;
};
//get function for property map
First_of_pair::reference
get(const First_of_pair&, const First_of_pair::key_type& k) {
return k.first;
}
typedef CGAL::Spatial_sort_traits_adapter_2<Kernel,First_of_pair> Search_traits_2;
int main() int main()
{ {