expose mapnik::geometry::polygon<double>::rings_container to allow specialising interior rings container
This commit is contained in:
parent
e68da0d083
commit
6c01870397
5 changed files with 17 additions and 14 deletions
|
@ -29,6 +29,8 @@
|
|||
#include <type_traits>
|
||||
#include <cstddef>
|
||||
|
||||
|
||||
|
||||
namespace mapnik { namespace geometry {
|
||||
|
||||
template <typename T>
|
||||
|
@ -91,10 +93,14 @@ struct linear_ring : line_string<T>
|
|||
};
|
||||
|
||||
template <typename T>
|
||||
using rings_container = std::vector<linear_ring<T>>;
|
||||
|
||||
template <typename T, template <typename> class InteriorRings = rings_container>
|
||||
struct polygon
|
||||
{
|
||||
linear_ring<T> exterior_ring;
|
||||
std::vector<linear_ring<T>> interior_rings;
|
||||
using rings_container = InteriorRings<T>;
|
||||
rings_container interior_rings;
|
||||
|
||||
polygon() = default;
|
||||
inline void set_exterior_ring(linear_ring<T> && ring)
|
||||
|
|
|
@ -47,7 +47,6 @@
|
|||
#include <mapnik/box2d.hpp>
|
||||
|
||||
#include <cstdint>
|
||||
#include <vector>
|
||||
|
||||
// register point
|
||||
BOOST_GEOMETRY_REGISTER_POINT_2D (mapnik::geometry::point<double>, double, boost::geometry::cs::cartesian, x, y)
|
||||
|
@ -180,13 +179,13 @@ struct ring_mutable_type<mapnik::geometry::polygon<CoordinateType> >
|
|||
template <typename CoordinateType>
|
||||
struct interior_const_type<mapnik::geometry::polygon<CoordinateType> >
|
||||
{
|
||||
using type = typename std::vector<mapnik::geometry::linear_ring<CoordinateType> > const&;
|
||||
using type = typename mapnik::geometry::polygon<CoordinateType>::rings_container const&;
|
||||
};
|
||||
|
||||
template <typename CoordinateType>
|
||||
struct interior_mutable_type<mapnik::geometry::polygon<CoordinateType> >
|
||||
{
|
||||
using type = typename std::vector<mapnik::geometry::linear_ring<CoordinateType> >&;
|
||||
using type = typename mapnik::geometry::polygon<CoordinateType>::rings_container&;
|
||||
};
|
||||
|
||||
// exterior
|
||||
|
@ -207,7 +206,7 @@ struct exterior_ring<mapnik::geometry::polygon<CoordinateType> >
|
|||
template <typename CoordinateType>
|
||||
struct interior_rings<mapnik::geometry::polygon<CoordinateType> >
|
||||
{
|
||||
using holes_type = std::vector<mapnik::geometry::linear_ring<CoordinateType> >;
|
||||
using holes_type = typename mapnik::geometry::polygon<CoordinateType>::rings_container;
|
||||
static holes_type& get(mapnik::geometry::polygon<CoordinateType> & p)
|
||||
{
|
||||
return p.interior_rings;
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
|
||||
#include <mapnik/geometry.hpp>
|
||||
#include <boost/fusion/include/adapt_struct.hpp>
|
||||
#include <vector>
|
||||
|
||||
BOOST_FUSION_ADAPT_STRUCT(
|
||||
mapnik::geometry::point<double>,
|
||||
|
@ -43,11 +42,11 @@ BOOST_FUSION_ADAPT_STRUCT(
|
|||
BOOST_FUSION_ADAPT_STRUCT(
|
||||
mapnik::geometry::polygon<double>,
|
||||
(mapnik::geometry::linear_ring<double> const&, exterior_ring)
|
||||
(std::vector<mapnik::geometry::linear_ring<double> > const& , interior_rings))
|
||||
(mapnik::geometry::polygon<double>::rings_container const& , interior_rings))
|
||||
|
||||
BOOST_FUSION_ADAPT_STRUCT(
|
||||
mapnik::geometry::polygon<std::int64_t>,
|
||||
(mapnik::geometry::linear_ring<std::int64_t> const&, exterior_ring)
|
||||
(std::vector<mapnik::geometry::linear_ring<std::int64_t> > const& , interior_rings))
|
||||
(mapnik::geometry::polygon<std::int64_t>::rings_container const& , interior_rings))
|
||||
|
||||
#endif // MAPNIK_GEOMETRY_FUSION_ADAPTED_HPP
|
||||
|
|
|
@ -104,7 +104,7 @@ struct geometry_generator_grammar :
|
|||
karma::rule<OutputIterator, geometry::geometry<double> const&()> polygon;
|
||||
karma::rule<OutputIterator, geometry::polygon<double> const&()> polygon_coord;
|
||||
karma::rule<OutputIterator, geometry::linear_ring<double> const&()> exterior_ring_coord;
|
||||
karma::rule<OutputIterator, std::vector<geometry::linear_ring<double> > const&()> interior_ring_coord;
|
||||
karma::rule<OutputIterator, geometry::polygon<double>::rings_container const&()> interior_ring_coord;
|
||||
karma::rule<OutputIterator, geometry::geometry<double> const& ()> multi_point;
|
||||
karma::rule<OutputIterator, geometry::multi_point<double> const& ()> multi_point_coord;
|
||||
karma::rule<OutputIterator, geometry::geometry<double> const& ()> multi_linestring;
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
#include <mapnik/geometry.hpp>
|
||||
#include <mapnik/util/variant.hpp>
|
||||
|
||||
#include <vector>
|
||||
#include <cstdint>
|
||||
|
||||
// boost
|
||||
|
@ -76,9 +75,9 @@ namespace boost { namespace spirit { namespace traits {
|
|||
|
||||
template <>
|
||||
struct transform_attribute<mapnik::geometry::polygon<double> const,
|
||||
std::vector<mapnik::geometry::linear_ring<double> > const&, karma::domain>
|
||||
mapnik::geometry::polygon<double>::rings_container const&, karma::domain>
|
||||
{
|
||||
using type = std::vector<mapnik::geometry::linear_ring<double> > const&;
|
||||
using type = mapnik::geometry::polygon<double>::rings_container const&;
|
||||
static type pre(mapnik::geometry::polygon<double> const& poly)
|
||||
{
|
||||
return poly.interior_rings;
|
||||
|
@ -164,9 +163,9 @@ namespace boost { namespace spirit { namespace traits {
|
|||
|
||||
template <>
|
||||
struct transform_attribute<mapnik::geometry::polygon<std::int64_t> const,
|
||||
std::vector<mapnik::geometry::linear_ring<std::int64_t> > const&, karma::domain>
|
||||
mapnik::geometry::polygon<std::int64_t>::rings_container const&, karma::domain>
|
||||
{
|
||||
using type = std::vector<mapnik::geometry::linear_ring<std::int64_t> > const&;
|
||||
using type = mapnik::geometry::polygon<std::int64_t>::rings_container const&;
|
||||
static type pre(mapnik::geometry::polygon<std::int64_t> const& poly)
|
||||
{
|
||||
return poly.interior_rings;
|
||||
|
|
Loading…
Add table
Reference in a new issue