diff --git a/include/boost/geometry/core/closure.hpp b/include/boost/geometry/core/closure.hpp index 3185626c5..b61e352e9 100644 --- a/include/boost/geometry/core/closure.hpp +++ b/include/boost/geometry/core/closure.hpp @@ -14,10 +14,9 @@ #ifndef BOOST_GEOMETRY_CORE_CLOSURE_HPP #define BOOST_GEOMETRY_CORE_CLOSURE_HPP - #include #include -#include +#include #include #include @@ -139,7 +138,7 @@ struct closure = geometry::traits::closure::value; }; -// Specialization for polygon: the closure is the closure of its rings +// Specialization for Polygon: the closure is the closure of its rings template struct closure { @@ -150,6 +149,24 @@ struct closure >::value ; }; +template +struct closure + : public core_detail::closure::closed {}; + +template +struct closure + : public core_detail::closure::closed {}; + +// Specialization for MultiPolygon: the closure is the closure of Polygon's rings +template +struct closure +{ + static const closure_selector value = core_dispatch::closure + < + polygon_tag, + typename boost::range_value::type + >::value ; +}; } // namespace core_dispatch #endif // DOXYGEN_NO_DISPATCH diff --git a/include/boost/geometry/core/geometry_id.hpp b/include/boost/geometry/core/geometry_id.hpp index 3fb2c11be..5fc5a8005 100644 --- a/include/boost/geometry/core/geometry_id.hpp +++ b/include/boost/geometry/core/geometry_id.hpp @@ -18,8 +18,6 @@ #include #include -#include - #include #include @@ -45,29 +43,40 @@ struct geometry_id template <> -struct geometry_id : boost::mpl::int_<1> {}; +struct geometry_id : boost::mpl::int_<1> {}; template <> -struct geometry_id : boost::mpl::int_<2> {}; +struct geometry_id : boost::mpl::int_<2> {}; template <> -struct geometry_id : boost::mpl::int_<3> {}; +struct geometry_id : boost::mpl::int_<3> {}; template <> -struct geometry_id : boost::mpl::int_<92> {}; +struct geometry_id : boost::mpl::int_<4> {}; template <> -struct geometry_id : boost::mpl::int_<93> {}; +struct geometry_id : boost::mpl::int_<5> {}; template <> -struct geometry_id : boost::mpl::int_<94> {}; +struct geometry_id : boost::mpl::int_<6> {}; +template <> +struct geometry_id : boost::mpl::int_<92> {}; + + +template <> +struct geometry_id : boost::mpl::int_<93> {}; + + +template <> +struct geometry_id : boost::mpl::int_<94> {}; + } // namespace core_dispatch #endif diff --git a/include/boost/geometry/core/interior_rings.hpp b/include/boost/geometry/core/interior_rings.hpp index 10af2ae4e..798f41577 100644 --- a/include/boost/geometry/core/interior_rings.hpp +++ b/include/boost/geometry/core/interior_rings.hpp @@ -17,7 +17,7 @@ #include #include -#include +#include #include #include @@ -85,6 +85,17 @@ struct interior_rings }; +template +struct interior_type +{ + typedef typename core_dispatch::interior_type + < + polygon_tag, + typename boost::range_value::type + >::type type; +}; + + } // namespace core_dispatch #endif diff --git a/include/boost/geometry/core/is_areal.hpp b/include/boost/geometry/core/is_areal.hpp index 5ddfa753b..23858605f 100644 --- a/include/boost/geometry/core/is_areal.hpp +++ b/include/boost/geometry/core/is_areal.hpp @@ -16,8 +16,7 @@ #define BOOST_GEOMETRY_CORE_IS_AREAL_HPP -#include - +#include #include #include @@ -36,7 +35,7 @@ template struct is_areal : boost::false_type {}; template <> struct is_areal : boost::true_type {}; template <> struct is_areal : boost::true_type {}; template <> struct is_areal : boost::true_type {}; - +template <> struct is_areal : boost::true_type {}; } // namespace core_dispatch #endif diff --git a/include/boost/geometry/core/point_order.hpp b/include/boost/geometry/core/point_order.hpp index 4442afc72..501dda777 100644 --- a/include/boost/geometry/core/point_order.hpp +++ b/include/boost/geometry/core/point_order.hpp @@ -16,7 +16,7 @@ #include -#include +#include #include #include @@ -135,6 +135,26 @@ struct point_order >::value ; }; +template +struct point_order + : public detail::point_order::clockwise {}; + +template +struct point_order + : public detail::point_order::clockwise {}; + + +// Specialization for multi_polygon: the order is the order of its polygons +template +struct point_order +{ + static const order_selector value = core_dispatch::point_order + < + polygon_tag, + typename boost::range_value::type + >::value ; +}; + } // namespace core_dispatch #endif // DOXYGEN_NO_DISPATCH diff --git a/include/boost/geometry/core/point_type.hpp b/include/boost/geometry/core/point_type.hpp index ebb8eeeca..f70e1fedd 100644 --- a/include/boost/geometry/core/point_type.hpp +++ b/include/boost/geometry/core/point_type.hpp @@ -16,7 +16,7 @@ #include -#include +#include #include #include @@ -102,6 +102,38 @@ struct point_type }; +template +struct point_type +{ + typedef typename boost::range_value + < + MultiPoint + >::type type; +}; + + +template +struct point_type +{ + typedef typename point_type + < + linestring_tag, + typename boost::range_value::type + >::type type; +}; + + +template +struct point_type +{ + typedef typename point_type + < + polygon_tag, + typename boost::range_value::type + >::type type; +}; + + } // namespace core_dispatch #endif // DOXYGEN_NO_DISPATCH diff --git a/include/boost/geometry/core/ring_type.hpp b/include/boost/geometry/core/ring_type.hpp index 9b984faf3..fe551f060 100644 --- a/include/boost/geometry/core/ring_type.hpp +++ b/include/boost/geometry/core/ring_type.hpp @@ -18,8 +18,10 @@ #include #include +#include +#include #include - +#include #include #include @@ -102,6 +104,38 @@ struct ring_return_type }; +template +struct ring_return_type +{ + typedef typename ring_return_type + < + linestring_tag, + typename mpl::if_ + < + boost::is_const, + typename boost::range_value::type const, + typename boost::range_value::type + >::type + >::type type; +}; + + +template +struct ring_return_type +{ + typedef typename ring_return_type + < + polygon_tag, + typename mpl::if_ + < + boost::is_const, + typename boost::range_value::type const, + typename boost::range_value::type + >::type + >::type type; +}; + + template struct ring_type {}; @@ -124,8 +158,25 @@ struct ring_type }; +template +struct ring_type +{ + typedef typename boost::remove_reference + < + typename ring_return_type::type + >::type type; +}; +template +struct ring_type +{ + typedef typename boost::remove_reference + < + typename ring_return_type::type + >::type type; +}; + } // namespace core_dispatch #endif diff --git a/include/boost/geometry/core/tags.hpp b/include/boost/geometry/core/tags.hpp index adaecd64a..160477b8c 100644 --- a/include/boost/geometry/core/tags.hpp +++ b/include/boost/geometry/core/tags.hpp @@ -88,6 +88,49 @@ struct box_tag : single_tag, areal_tag {}; struct segment_tag : single_tag, linear_tag {}; +/// OGC Multi point identifying tag +struct multi_point_tag : multi_tag, pointlike_tag {}; + +/// OGC Multi linestring identifying tag +struct multi_linestring_tag : multi_tag, linear_tag {}; + +/// OGC Multi polygon identifying tag +struct multi_polygon_tag : multi_tag, polygonal_tag {}; + +/// OGC Geometry Collection identifying tag +struct geometry_collection_tag : multi_tag {}; + + +/*! +\brief Meta-function to get for a tag of a multi-geometry + the tag of the corresponding single-geometry +*/ +template +struct single_tag_of +{}; + +#ifndef DOXYGEN_NO_DETAIL + +template <> +struct single_tag_of +{ + typedef point_tag type; +}; + +template <> +struct single_tag_of +{ + typedef linestring_tag type; +}; + +template <> +struct single_tag_of +{ + typedef polygon_tag type; +}; + +#endif + }} // namespace boost::geometry diff --git a/include/boost/geometry/core/topological_dimension.hpp b/include/boost/geometry/core/topological_dimension.hpp index 02f1ed341..22ed676fc 100644 --- a/include/boost/geometry/core/topological_dimension.hpp +++ b/include/boost/geometry/core/topological_dimension.hpp @@ -49,10 +49,12 @@ struct top_dim : boost::mpl::int_<1> {}; // ring: topological dimension of two, but some people say: 1 !! +// NOTE: This is not OGC LinearRing! template <> struct top_dim : boost::mpl::int_<2> {}; +// TODO: This is wrong! Boxes may have various topological dimensions template <> struct top_dim : boost::mpl::int_<2> {}; @@ -61,6 +63,17 @@ template <> struct top_dim : boost::mpl::int_<2> {}; +template <> +struct top_dim : boost::mpl::int_<0> {}; + + +template <> +struct top_dim : boost::mpl::int_<1> {}; + + +template <> +struct top_dim : boost::mpl::int_<2> {}; + } // namespace core_dispatch #endif diff --git a/include/boost/geometry/multi/core/closure.hpp b/include/boost/geometry/multi/core/closure.hpp index 3964db256..9e7cf3c24 100644 --- a/include/boost/geometry/multi/core/closure.hpp +++ b/include/boost/geometry/multi/core/closure.hpp @@ -14,45 +14,6 @@ #ifndef BOOST_GEOMETRY_MULTI_CORE_CLOSURE_HPP #define BOOST_GEOMETRY_MULTI_CORE_CLOSURE_HPP - -#include -#include -#include - #include -#include - -namespace boost { namespace geometry -{ - - -#ifndef DOXYGEN_NO_DISPATCH -namespace core_dispatch -{ - -template -struct closure : public core_detail::closure::closed {}; - -template -struct closure : public core_detail::closure::closed {}; - -// Specialization for polygon: the closure is the closure of its rings -template -struct closure -{ - static const closure_selector value = core_dispatch::closure - < - polygon_tag, - typename boost::range_value::type - >::value ; -}; - - -} // namespace core_dispatch -#endif // DOXYGEN_NO_DISPATCH - - -}} // namespace boost::geometry - #endif // BOOST_GEOMETRY_MULTI_CORE_CLOSURE_HPP diff --git a/include/boost/geometry/multi/core/geometry_id.hpp b/include/boost/geometry/multi/core/geometry_id.hpp index 9d69cb20d..7d5e888ba 100644 --- a/include/boost/geometry/multi/core/geometry_id.hpp +++ b/include/boost/geometry/multi/core/geometry_id.hpp @@ -15,42 +15,6 @@ #ifndef BOOST_GEOMETRY_MULTI_CORE_GEOMETRY_ID_HPP #define BOOST_GEOMETRY_MULTI_CORE_GEOMETRY_ID_HPP - -#include -#include - - -#include -#include #include -#include - - -namespace boost { namespace geometry -{ - - -#ifndef DOXYGEN_NO_DISPATCH -namespace core_dispatch -{ - -template <> -struct geometry_id : boost::mpl::int_<4> {}; - - -template <> -struct geometry_id : boost::mpl::int_<5> {}; - - -template <> -struct geometry_id : boost::mpl::int_<6> {}; - - -} // namespace core_dispatch -#endif - - -}} // namespace boost::geometry - #endif // BOOST_GEOMETRY_MULTI_CORE_GEOMETRY_ID_HPP diff --git a/include/boost/geometry/multi/core/interior_rings.hpp b/include/boost/geometry/multi/core/interior_rings.hpp index 5a200d486..deeeff81d 100644 --- a/include/boost/geometry/multi/core/interior_rings.hpp +++ b/include/boost/geometry/multi/core/interior_rings.hpp @@ -16,40 +16,7 @@ #define BOOST_GEOMETRY_MULTI_CORE_INTERIOR_RINGS_HPP -#include - -#include - #include -#include - - -namespace boost { namespace geometry -{ - - -#ifndef DOXYGEN_NO_DISPATCH -namespace core_dispatch -{ - - -template -struct interior_type -{ - typedef typename core_dispatch::interior_type - < - polygon_tag, - typename boost::range_value::type - >::type type; -}; - - -} // namespace core_dispatch -#endif - - - -}} // namespace boost::geometry #endif // BOOST_GEOMETRY_MULTI_CORE_INTERIOR_RINGS_HPP diff --git a/include/boost/geometry/multi/core/is_areal.hpp b/include/boost/geometry/multi/core/is_areal.hpp index ad8daeb49..30f98527a 100644 --- a/include/boost/geometry/multi/core/is_areal.hpp +++ b/include/boost/geometry/multi/core/is_areal.hpp @@ -16,28 +16,7 @@ #define BOOST_GEOMETRY_MULTI_CORE_IS_AREAL_HPP -#include - - #include -#include - - -namespace boost { namespace geometry -{ - - -#ifndef DOXYGEN_NO_DISPATCH -namespace core_dispatch -{ - -template <> struct is_areal : boost::true_type {}; - -} // namespace core_dispatch -#endif - - -}} // namespace boost::geometry #endif // BOOST_GEOMETRY_MULTI_CORE_IS_AREAL_HPP diff --git a/include/boost/geometry/multi/core/point_order.hpp b/include/boost/geometry/multi/core/point_order.hpp index 6b08468e8..119e55c3b 100644 --- a/include/boost/geometry/multi/core/point_order.hpp +++ b/include/boost/geometry/multi/core/point_order.hpp @@ -15,43 +15,7 @@ #define BOOST_GEOMETRY_MULTI_CORE_POINT_ORDER_HPP -#include - #include -#include -namespace boost { namespace geometry -{ - - -#ifndef DOXYGEN_NO_DISPATCH -namespace core_dispatch -{ - -template -struct point_order - : public detail::point_order::clockwise {}; - -template -struct point_order - : public detail::point_order::clockwise {}; - - -// Specialization for multi_polygon: the order is the order of its polygons -template -struct point_order -{ - static const order_selector value = core_dispatch::point_order - < - polygon_tag, - typename boost::range_value::type - >::value ; -}; - -} // namespace core_dispatch -#endif // DOXYGEN_NO_DISPATCH - - -}} // namespace boost::geometry #endif // BOOST_GEOMETRY_MULTI_CORE_POINT_ORDER_HPP diff --git a/include/boost/geometry/multi/core/point_type.hpp b/include/boost/geometry/multi/core/point_type.hpp index 3c77e973b..a7277d09a 100644 --- a/include/boost/geometry/multi/core/point_type.hpp +++ b/include/boost/geometry/multi/core/point_type.hpp @@ -16,49 +16,7 @@ #define BOOST_GEOMETRY_MULTI_CORE_POINT_TYPE_HPP -#include - #include -#include - - - -namespace boost { namespace geometry -{ - -#ifndef DOXYGEN_NO_DISPATCH -namespace core_dispatch -{ - -template -struct point_type -{ - typedef typename boost::range_value::type type; -}; - - -template -struct point_type -{ - typedef typename point_type::type>::type type; -}; - - - -template -struct point_type -{ - typedef typename point_type::type>::type type; -}; - - -} -#endif - - -}} // namespace boost::geometry #endif // BOOST_GEOMETRY_MULTI_CORE_POINT_TYPE_HPP diff --git a/include/boost/geometry/multi/core/ring_type.hpp b/include/boost/geometry/multi/core/ring_type.hpp index f03564dde..b27b5527c 100644 --- a/include/boost/geometry/multi/core/ring_type.hpp +++ b/include/boost/geometry/multi/core/ring_type.hpp @@ -19,75 +19,7 @@ #define BOOST_GEOMETRY_MULTI_CORE_RING_TYPE_HPP -#include - #include -#include - - -namespace boost { namespace geometry -{ - - -#ifndef DOXYGEN_NO_DISPATCH -namespace core_dispatch -{ - -template -struct ring_return_type -{ - typedef typename ring_return_type - < - polygon_tag, - typename mpl::if_ - < - boost::is_const, - typename boost::range_value::type const, - typename boost::range_value::type - >::type - >::type type; -}; - -template -struct ring_return_type -{ - typedef typename ring_return_type - < - linestring_tag, - typename mpl::if_ - < - boost::is_const, - typename boost::range_value::type const, - typename boost::range_value::type - >::type - >::type type; -}; - - -template -struct ring_type -{ - typedef typename boost::remove_reference - < - typename ring_return_type::type - >::type type; -}; - -template -struct ring_type -{ - typedef typename boost::remove_reference - < - typename ring_return_type::type - >::type type; -}; - - -} // namespace core_dispatch -#endif - - -}} // namespace boost::geometry #endif // BOOST_GEOMETRY_MULTI_CORE_RING_TYPE_HPP diff --git a/include/boost/geometry/multi/core/tags.hpp b/include/boost/geometry/multi/core/tags.hpp index dcfca65b2..fb0758d95 100644 --- a/include/boost/geometry/multi/core/tags.hpp +++ b/include/boost/geometry/multi/core/tags.hpp @@ -15,57 +15,8 @@ #ifndef BOOST_GEOMETRY_MULTI_CORE_TAGS_HPP #define BOOST_GEOMETRY_MULTI_CORE_TAGS_HPP + #include -namespace boost { namespace geometry -{ - -/// OGC Multi point identifying tag -struct multi_point_tag : multi_tag, pointlike_tag {}; - -/// OGC Multi linestring identifying tag -struct multi_linestring_tag : multi_tag, linear_tag {}; - -/// OGC Multi polygon identifying tag -struct multi_polygon_tag : multi_tag, polygonal_tag {}; - -/// OGC Geometry Collection identifying tag -struct geometry_collection_tag : multi_tag {}; - - - - -/*! -\brief Meta-function to get for a tag of a multi-geometry - the tag of the corresponding single-geometry -*/ -template -struct single_tag_of -{}; - -#ifndef DOXYGEN_NO_DETAIL - -template <> -struct single_tag_of -{ - typedef point_tag type; -}; - -template <> -struct single_tag_of -{ - typedef linestring_tag type; -}; - -template <> -struct single_tag_of -{ - typedef polygon_tag type; -}; - -#endif - - -}} // namespace boost::geometry #endif // BOOST_GEOMETRY_MULTI_CORE_TAGS_HPP diff --git a/include/boost/geometry/multi/core/topological_dimension.hpp b/include/boost/geometry/multi/core/topological_dimension.hpp index 55118f1c7..b4f1e89ae 100644 --- a/include/boost/geometry/multi/core/topological_dimension.hpp +++ b/include/boost/geometry/multi/core/topological_dimension.hpp @@ -16,37 +16,7 @@ #define BOOST_GEOMETRY_MULTI_TOPOLOGICAL_DIMENSION_HPP -#include - - #include -#include - - -namespace boost { namespace geometry -{ - -#ifndef DOXYGEN_NO_DISPATCH -namespace core_dispatch -{ - -template <> -struct top_dim : boost::mpl::int_<0> {}; - - -template <> -struct top_dim : boost::mpl::int_<1> {}; - - -template <> -struct top_dim : boost::mpl::int_<2> {}; - - -} // namespace core_dispatch -#endif - - -}} // namespace boost::geometry #endif