/usr/include/boost/polygon
Edit: /usr/include/boost/polygon/polygon_45_set_traits.hpp (6216B)
/*
Copyright 2008 Intel Corporation
Use, modification and distribution are subject to the Boost Software License,
Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt).
*/
#ifndef BOOST_POLYGON_POLYGON_45_SET_TRAITS_HPP
#define BOOST_POLYGON_POLYGON_45_SET_TRAITS_HPP
namespace boost { namespace polygon{
//default definition of polygon 45 set traits works for any model of polygon 45, polygon 45 with holes or any vector or list thereof
template
struct polygon_45_set_traits {
typedef typename get_coordinate_type::type >::type coordinate_type;
typedef typename get_iterator_type::type iterator_type;
typedef T operator_arg_type;
static inline iterator_type begin(const T& polygon_set) {
return get_iterator_type::begin(polygon_set);
}
static inline iterator_type end(const T& polygon_set) {
return get_iterator_type::end(polygon_set);
}
static inline bool clean(const T& ) { return false; }
static inline bool sorted(const T& ) { return false; }
};
template
struct is_45_polygonal_concept { typedef gtl_no type; };
template <>
struct is_45_polygonal_concept { typedef gtl_yes type; };
template <>
struct is_45_polygonal_concept { typedef gtl_yes type; };
template <>
struct is_45_polygonal_concept { typedef gtl_yes type; };
template
struct is_polygon_45_set_type {
typedef typename is_45_polygonal_concept::type>::type type;
};
template
struct is_polygon_45_set_type > {
typedef typename gtl_or<
typename is_45_polygonal_concept >::type>::type,
typename is_45_polygonal_concept::value_type>::type>::type>::type type;
};
template
struct is_polygon_45_set_type > {
typedef typename gtl_or<
typename is_45_polygonal_concept >::type>::type,
typename is_45_polygonal_concept::value_type>::type>::type>::type type;
};
template
struct is_mutable_polygon_45_set_type {
typedef typename gtl_same_type::type>::type type;
};
template
struct is_mutable_polygon_45_set_type > {
typedef typename gtl_or<
typename gtl_same_type >::type>::type,
typename is_45_polygonal_concept::value_type>::type>::type>::type type;
};
template
struct is_mutable_polygon_45_set_type > {
typedef typename gtl_or<
typename gtl_same_type >::type>::type,
typename is_45_polygonal_concept::value_type>::type>::type>::type type;
};
template
bool fracture_holes_45_by_concept() { return false; }
template <>
inline bool fracture_holes_45_by_concept() { return true; }
template
void get_45_polygons_T(T& t, iT begin, iT end) {
typedef typename polygon_45_set_traits::coordinate_type Unit;
typedef typename geometry_concept::type CType;
typename polygon_45_formation::Polygon45Formation pf(fracture_holes_45_by_concept());
//std::cout << "FORMING POLYGONS\n";
pf.scan(t, begin, end);
}
template
struct polygon_45_set_mutable_traits {};
template
struct polygon_45_set_mutable_traits > {
template
static inline void set(std::list& polygon_set, input_iterator_type input_begin, input_iterator_type input_end) {
polygon_set.clear();
polygon_45_set_data >::coordinate_type> ps;
ps.reserve(std::distance(input_begin, input_end));
ps.insert(input_begin, input_end);
ps.sort();
ps.clean();
get_45_polygons_T(polygon_set, ps.begin(), ps.end());
}
};
template
struct polygon_45_set_mutable_traits > {
template
static inline void set(std::vector& polygon_set, input_iterator_type input_begin, input_iterator_type input_end) {
polygon_set.clear();
size_t num_ele = std::distance(input_begin, input_end);
polygon_set.reserve(num_ele);
polygon_45_set_data >::coordinate_type> ps;
ps.reserve(num_ele);
ps.insert(input_begin, input_end);
ps.sort();
ps.clean();
get_45_polygons_T(polygon_set, ps.begin(), ps.end());
}
};
template
struct polygon_45_set_mutable_traits > {
template
static inline void set(polygon_45_set_data& polygon_set,
input_iterator_type input_begin, input_iterator_type input_end) {
polygon_set.set(input_begin, input_end);
}
};
template
struct polygon_45_set_traits > {
typedef typename polygon_45_set_data::coordinate_type coordinate_type;
typedef typename polygon_45_set_data::iterator_type iterator_type;
typedef typename polygon_45_set_data::operator_arg_type operator_arg_type;
static inline iterator_type begin(const polygon_45_set_data& polygon_set) {
return polygon_set.begin();
}
static inline iterator_type end(const polygon_45_set_data& polygon_set) {
return polygon_set.end();
}
static inline bool clean(const polygon_45_set_data& polygon_set) { polygon_set.clean(); return true; }
static inline bool sorted(const polygon_45_set_data& polygon_set) { polygon_set.sort(); return true; }
};
}
}
#endif