mirror of https://github.com/CGAL/cgal
Spatial_sorting example updated to use First_of_pair_property_map
This commit is contained in:
parent
8e38300002
commit
f8f57d8653
|
|
@ -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()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue