make box2d<T> adapters more generic.
This commit is contained in:
parent
2e0e61453b
commit
e75db3aa18
1 changed files with 27 additions and 21 deletions
|
@ -133,39 +133,45 @@ struct interior_rings
|
||||||
|
|
||||||
namespace boost { namespace geometry { namespace traits {
|
namespace boost { namespace geometry { namespace traits {
|
||||||
|
|
||||||
template<> struct tag<mapnik::box2d<double> > { using type = box_tag; };
|
template <typename CoordinateType>
|
||||||
|
struct tag<mapnik::box2d<CoordinateType> >
|
||||||
|
{
|
||||||
|
using type = box_tag;
|
||||||
|
};
|
||||||
|
|
||||||
template<> struct point_type<mapnik::box2d<double> > { using type = mapnik::coord2d; };
|
template<> struct point_type<mapnik::box2d<double> > { using type = mapnik::coord2d; };
|
||||||
|
template<> struct point_type<mapnik::box2d<float> > { using type = mapnik::coord2f; };
|
||||||
|
|
||||||
template <>
|
template <typename CoordinateType>
|
||||||
struct indexed_access<mapnik::box2d<double>, min_corner, 0>
|
struct indexed_access<mapnik::box2d<CoordinateType>, min_corner, 0>
|
||||||
{
|
{
|
||||||
using ct = coordinate_type<mapnik::coord2d>::type;
|
using ct = CoordinateType;
|
||||||
static inline ct get(mapnik::box2d<double> const& b) { return b.minx();}
|
static inline ct get(mapnik::box2d<CoordinateType> const& b) { return b.minx();}
|
||||||
static inline void set(mapnik::box2d<double> &b, ct const& value) { b.set_minx(value); }
|
static inline void set(mapnik::box2d<CoordinateType> &b, ct const& value) { b.set_minx(value); }
|
||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <typename CoordinateType>
|
||||||
struct indexed_access<mapnik::box2d<double>, min_corner, 1>
|
struct indexed_access<mapnik::box2d<CoordinateType>, min_corner, 1>
|
||||||
{
|
{
|
||||||
using ct = coordinate_type<mapnik::coord2d>::type;
|
using ct = CoordinateType;
|
||||||
static inline ct get(mapnik::box2d<double> const& b) { return b.miny();}
|
static inline ct get(mapnik::box2d<CoordinateType> const& b) { return b.miny();}
|
||||||
static inline void set(mapnik::box2d<double> &b, ct const& value) { b.set_miny(value); }
|
static inline void set(mapnik::box2d<CoordinateType> &b, ct const& value) { b.set_miny(value); }
|
||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <typename CoordinateType>
|
||||||
struct indexed_access<mapnik::box2d<double>, max_corner, 0>
|
struct indexed_access<mapnik::box2d<CoordinateType>, max_corner, 0>
|
||||||
{
|
{
|
||||||
using ct = coordinate_type<mapnik::coord2d>::type;
|
using ct = CoordinateType;
|
||||||
static inline ct get(mapnik::box2d<double> const& b) { return b.maxx();}
|
static inline ct get(mapnik::box2d<CoordinateType> const& b) { return b.maxx();}
|
||||||
static inline void set(mapnik::box2d<double> &b, ct const& value) { b.set_maxx(value); }
|
static inline void set(mapnik::box2d<CoordinateType> &b, ct const& value) { b.set_maxx(value); }
|
||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <typename CoordinateType>
|
||||||
struct indexed_access<mapnik::box2d<double>, max_corner, 1>
|
struct indexed_access<mapnik::box2d<CoordinateType>, max_corner, 1>
|
||||||
{
|
{
|
||||||
using ct = coordinate_type<mapnik::coord2d>::type;
|
using ct = CoordinateType;
|
||||||
static inline ct get(mapnik::box2d<double> const& b) { return b.maxy();}
|
static inline ct get(mapnik::box2d<CoordinateType> const& b) { return b.maxy();}
|
||||||
static inline void set(mapnik::box2d<double> &b , ct const& value) { b.set_maxy(value); }
|
static inline void set(mapnik::box2d<CoordinateType> &b , ct const& value) { b.set_maxy(value); }
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename CoordinateType>
|
template<typename CoordinateType>
|
||||||
|
|
Loading…
Reference in a new issue