/usr/include/CGAL/Search_traits_adapter.h is in libcgal-dev 4.11-2build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 | // Copyright (c) 2011 GeometryFactory (France).
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org).
// You can redistribute it and/or modify it under the terms of the GNU
// General Public License as published by the Free Software Foundation,
// either version 3 of the License, or (at your option) any later version.
//
// Licensees holding a valid commercial license may use this file in
// accordance with the commercial license agreement provided with the software.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// $URL$
// $Id$
//
//
// Author(s) : Sebastien Loriot
#ifndef CGAL_SEARCH_TRAITS_WITH_INFO
#define CGAL_SEARCH_TRAITS_WITH_INFO
#include <CGAL/license/Spatial_searching.h>
#include <CGAL/Kd_tree_rectangle.h>
#include <CGAL/Euclidean_distance.h> //for default distance specialization
#include <CGAL/property_map.h>
#include <CGAL/assertions.h>
#include <boost/mpl/has_xxx.hpp>
#include <boost/type_traits/is_same.hpp>
namespace CGAL{
using ::get;
template <class Point_with_info,class PointPropertyMap,class Base_traits>
class Search_traits_adapter;
template <class Point_with_info,class PointPropertyMap,class Base_distance>
class Distance_adapter;
namespace internal{
BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF(Has_typedef_Iso_box_d,Iso_box_d,false)
template <class T,bool Has_iso_box_d=Has_typedef_Iso_box_d<T>::value >
struct Get_iso_box_d;
template <class T>
struct Get_iso_box_d<T,false>
{
typedef void type;
};
template <class T>
struct Get_iso_box_d<T,true>
{
typedef typename T::Iso_box_d type;
};
template <class Point_with_info,class PointPropertyMap,class Base_traits>
struct Spatial_searching_default_distance< ::CGAL::Search_traits_adapter<Point_with_info,PointPropertyMap,Base_traits> >{
typedef ::CGAL::Distance_adapter<Point_with_info,
PointPropertyMap,
typename Spatial_searching_default_distance<Base_traits>::type> type;
};
} //namespace internal
template <class Point_with_info,class PointPropertyMap,class Base_traits>
class Search_traits_adapter : public Base_traits{
PointPropertyMap ppmap;
CGAL_static_assertion( ( boost::is_same< boost::lvalue_property_map_tag,
typename boost::property_traits<PointPropertyMap>::category
>::value ) );
public:
typedef Base_traits Base;
typedef typename internal::Get_iso_box_d<Base>::type Iso_box_d;
Search_traits_adapter(const PointPropertyMap& ppmap_=PointPropertyMap(),
const Base_traits& base=Base_traits()
):Base_traits(base),ppmap(ppmap_){}
typedef typename Base_traits::Cartesian_const_iterator_d Cartesian_const_iterator_d;
typedef Point_with_info Point_d;
typedef typename Base_traits::FT FT;
typedef typename Base_traits::Dimension Dimension;
struct Construct_cartesian_const_iterator_d: public Base_traits::Construct_cartesian_const_iterator_d{
PointPropertyMap ppmap;
typedef typename Base_traits::Construct_cartesian_const_iterator_d Base;
Construct_cartesian_const_iterator_d(const typename Base_traits::Construct_cartesian_const_iterator_d& base, const PointPropertyMap& ppmap_)
:Base_traits::Construct_cartesian_const_iterator_d(base), ppmap(ppmap_){}
typename Base_traits::Cartesian_const_iterator_d operator()(const Point_with_info& p) const
{ return Base::operator() (get(ppmap,p)); }
typename Base_traits::Cartesian_const_iterator_d operator()(const Point_with_info& p, int) const
{ return Base::operator() (get(ppmap,p),0); }
// These 2 additional operators forward the call to Base_traits.
// This is needed because of an undocumented requirement of
// Orthogonal_k_neighbor_search and Orthogonal_incremental_neighbor_search:
// Traits::Construct_cartesian_const_iterator should be callable
// on the query point type
typename Base_traits::Cartesian_const_iterator_d operator()(const typename Base_traits::Point_d& p) const
{ return Base::operator() (p); }
typename Base_traits::Cartesian_const_iterator_d operator()(const typename Base_traits::Point_d& p, int) const
{ return Base::operator() (p,0); }
};
struct Construct_iso_box_d: public Base::Construct_iso_box_d{
PointPropertyMap ppmap;
typedef typename Base_traits::FT FT; // needed for VC++, because otherwise it is taken from the private typedef of the base class
typedef typename Base::Construct_iso_box_d Base_functor;
Iso_box_d operator() () const {
return Base_functor::operator() ();
}
Iso_box_d operator() (const Point_with_info& p, const Point_with_info& q) const
{
return Base_functor::operator() (get(ppmap,p),get(ppmap,q));
}
};
const PointPropertyMap& point_property_map() const {return ppmap;}
Construct_cartesian_const_iterator_d construct_cartesian_const_iterator_d_object() const {
return Construct_cartesian_const_iterator_d(
Base::construct_cartesian_const_iterator_d_object(),
ppmap);
}
};
template <class Point_with_info,class PointPropertyMap,class Base_distance>
class Distance_adapter : public Base_distance {
PointPropertyMap ppmap;
typedef typename Base_distance::FT FT;
CGAL_static_assertion( ( boost::is_same< boost::lvalue_property_map_tag,
typename boost::property_traits<PointPropertyMap>::category
>::value ) );
public:
Distance_adapter( const PointPropertyMap& ppmap_=PointPropertyMap(),
const Base_distance& distance=Base_distance()
):Base_distance(distance),ppmap(ppmap_){}
using Base_distance::transformed_distance;
typedef Point_with_info Point_d;
typedef typename Base_distance::Query_item Query_item;
const PointPropertyMap& point_property_map() const {return ppmap;}
FT transformed_distance(const Query_item& p1, const Point_with_info& p2) const
{
return Base_distance::transformed_distance(p1,get(ppmap,p2));
}
template <class FT,class Dimension>
FT min_distance_to_rectangle(const Query_item& p, const CGAL::Kd_tree_rectangle<FT,Dimension>& b) const
{
return Base_distance::min_distance_to_rectangle(p,b);
}
template <class FT,class Dimension>
FT min_distance_to_rectangle(const Query_item& p, const CGAL::Kd_tree_rectangle<FT,Dimension>& b,std::vector<FT>& dists) const
{
return Base_distance::min_distance_to_rectangle(p,b,dists);
}
template <class FT,class Dimension>
FT max_distance_to_rectangle(const Query_item& p,const CGAL::Kd_tree_rectangle<FT,Dimension>& b) const
{
return Base_distance::max_distance_to_rectangle(p,b);
}
template <class FT,class Dimension>
FT max_distance_to_rectangle(const Query_item& p,const CGAL::Kd_tree_rectangle<FT,Dimension>& b,std::vector<FT>& dists) const
{
return Base_distance::max_distance_to_rectangle(p,b,dists);
}
};
}//namespace CGAL
#endif //CGAL_SEARCH_TRAITS_WITH_INFO
|