-
-
Save jfirebaugh/c5e07939b6c4a5b975e20b966e371e3b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <mapbox/geometry.hpp> | |
#pragma GCC diagnostic push | |
#pragma GCC diagnostic ignored "-Wunused-function" | |
#pragma GCC diagnostic ignored "-Wunused-parameter" | |
#pragma GCC diagnostic ignored "-Wunused-variable" | |
#pragma GCC diagnostic ignored "-Wshadow" | |
#ifdef __clang__ | |
#pragma GCC diagnostic ignored "-Wunknown-pragmas" | |
#endif | |
#pragma GCC diagnostic ignored "-Wpragmas" | |
#pragma GCC diagnostic ignored "-Wdeprecated-register" | |
#pragma GCC diagnostic ignored "-Wshorten-64-to-32" | |
#pragma GCC diagnostic ignored "-Wunused-local-typedefs" | |
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized" | |
#include <boost/geometry.hpp> | |
#pragma GCC diagnostic pop | |
#include <boost/range/iterator_range_core.hpp> | |
#include <cassert> | |
namespace boost { | |
namespace geometry { | |
namespace traits { | |
template <typename CoordinateType> | |
struct tag<mapbox::geometry::point<CoordinateType>> | |
{ | |
using type = point_tag; | |
}; | |
template <typename CoordinateType> | |
struct coordinate_type<mapbox::geometry::point<CoordinateType>> | |
{ | |
using type = CoordinateType; | |
}; | |
template <typename CoordinateType> | |
struct coordinate_system<mapbox::geometry::point<CoordinateType>> | |
{ | |
using type = boost::geometry::cs::cartesian; | |
}; | |
template <typename CoordinateType> | |
struct dimension<mapbox::geometry::point<CoordinateType>> | |
: boost::mpl::int_<2> | |
{ | |
}; | |
template <typename CoordinateType> | |
struct access<mapbox::geometry::point<CoordinateType>, 0> | |
{ | |
static auto get(mapbox::geometry::point<CoordinateType> const& p) | |
{ | |
return p.x; | |
} | |
static void set(mapbox::geometry::point<CoordinateType>& p, CoordinateType x) | |
{ | |
p.x = x; | |
} | |
}; | |
template <typename CoordinateType> | |
struct access<mapbox::geometry::point<CoordinateType>, 1> | |
{ | |
static auto get(mapbox::geometry::point<CoordinateType> const& p) | |
{ | |
return p.y; | |
} | |
static void set(mapbox::geometry::point<CoordinateType>& p, CoordinateType y) | |
{ | |
p.y = y; | |
} | |
}; | |
template <typename CoordinateType> | |
struct tag<mapbox::geometry::linear_ring<CoordinateType>> | |
{ | |
using type = ring_tag; | |
}; | |
template <typename CoordinateType> | |
struct tag<mapbox::geometry::polygon<CoordinateType>> | |
{ | |
using type = polygon_tag; | |
}; | |
template <typename CoordinateType> | |
struct ring_mutable_type<mapbox::geometry::polygon<CoordinateType>> | |
{ | |
using type = mapbox::geometry::linear_ring<CoordinateType>&; | |
}; | |
template <typename CoordinateType> | |
struct ring_const_type<mapbox::geometry::polygon<CoordinateType>> | |
{ | |
using type = mapbox::geometry::linear_ring<CoordinateType> const&; | |
}; | |
template <typename CoordinateType> | |
struct interior_mutable_type<mapbox::geometry::polygon<CoordinateType>> | |
{ | |
using type = boost::iterator_range<typename mapbox::geometry::polygon<CoordinateType>::iterator>; | |
}; | |
template <typename CoordinateType> | |
struct interior_const_type<mapbox::geometry::polygon<CoordinateType>> | |
{ | |
using type = boost::iterator_range<typename mapbox::geometry::polygon<CoordinateType>::const_iterator>; | |
}; | |
template <typename CoordinateType> | |
struct exterior_ring<mapbox::geometry::polygon<CoordinateType>> | |
{ | |
static auto& get(mapbox::geometry::polygon<CoordinateType>& p) | |
{ | |
return p.at(0); | |
} | |
static auto const& get(mapbox::geometry::polygon<CoordinateType> const& p) | |
{ | |
return p.at(0); | |
} | |
}; | |
template <typename CoordinateType> | |
struct interior_rings<mapbox::geometry::polygon<CoordinateType> > | |
{ | |
static auto get(mapbox::geometry::polygon<CoordinateType>& p) | |
{ | |
return boost::make_iterator_range(p.begin() + 1, p.end()); | |
} | |
static auto get(mapbox::geometry::polygon<CoordinateType> const& p) | |
{ | |
return boost::make_iterator_range(p.begin() + 1, p.end()); | |
} | |
}; | |
} | |
} | |
} | |
void testBoost() { | |
mapbox::geometry::polygon<double> polygon; | |
assert(!boost::geometry::is_valid(polygon)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment