From 8aadb31dc88f5088795ab940a9ced218203846c0 Mon Sep 17 00:00:00 2001 From: Menelaos Karavelas Date: Tue, 3 Jun 2014 13:41:39 +0300 Subject: [PATCH 01/27] [test][strategies] add unit test for pythagoras point box strategy --- test/strategies/pythagoras_point_box.cpp | 491 +++++++++++++++++++++++ 1 file changed, 491 insertions(+) create mode 100644 test/strategies/pythagoras_point_box.cpp diff --git a/test/strategies/pythagoras_point_box.cpp b/test/strategies/pythagoras_point_box.cpp new file mode 100644 index 000000000..dfc8f453b --- /dev/null +++ b/test/strategies/pythagoras_point_box.cpp @@ -0,0 +1,491 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) +// Unit Test + +// Copyright (c) 2007-2014 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2008-2014 Bruno Lalande, Paris, France. +// Copyright (c) 2009-2014 Mateusz Loskot, London, UK. + +// This file was modified by Oracle on 2014. +// Modifications copyright (c) 2014, Oracle and/or its affiliates. + +// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle + +// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library +// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. + +// Use, modification and distribution is 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_TEST_MODULE +#define BOOST_TEST_MODULE test_pythagoras_point_box +#endif + +#include + +#if defined(_MSC_VER) +# pragma warning( disable : 4101 ) +#endif + +#include + +#include +#include + +#include +#include +#include +#include + + +#include +#include +#include +#include + +#include + +#ifdef HAVE_TTMATH +# include +#endif + + +namespace bg = boost::geometry; + + +BOOST_GEOMETRY_REGISTER_C_ARRAY_CS(cs::cartesian) +BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian) + + +template +inline void assign_values(Box& box, + Coordinate const& x1, + Coordinate const& y1, + Coordinate const& z1, + Coordinate const& x2, + Coordinate const& y2, + Coordinate const& z2) +{ + typename bg::point_type::type p1, p2; + bg::assign_values(p1, x1, y1, z1); + bg::assign_values(p2, x2, y2, z2); + bg::assign(box, p1); + bg::expand(box, p2); +} + +template +inline void test_null_distance_3d() +{ + Point p; + bg::assign_values(p, 1, 2, 4); + Box b; + assign_values(b, 1, 2, 3, 4, 5, 6); + + typedef bg::strategy::distance::pythagoras_point_box<> pythagoras_pb_type; + typedef typename bg::strategy::distance::services::return_type + < + pythagoras_pb_type, Point, Box + >::type return_type; + + pythagoras_pb_type pythagoras_pb; + return_type result = pythagoras_pb.apply(p, b); + + BOOST_CHECK_EQUAL(result, return_type(0)); + + bg::assign_values(p, 1, 3, 4); + result = pythagoras_pb.apply(p, b); + BOOST_CHECK_EQUAL(result, return_type(0)); + + bg::assign_values(p, 2, 3, 4); + result = pythagoras_pb.apply(p, b); + BOOST_CHECK_EQUAL(result, return_type(0)); +} + +template +inline void test_axis_3d() +{ + Box b; + assign_values(b, 0, 0, 0, 1, 1, 1); + Point p; + bg::assign_values(p, 2, 0, 0); + + typedef bg::strategy::distance::pythagoras_point_box<> pythagoras_pb_type; + typedef typename bg::strategy::distance::services::return_type + < + pythagoras_pb_type, Point, Box + >::type return_type; + + pythagoras_pb_type pythagoras_pb; + + return_type result = pythagoras_pb.apply(p, b); + BOOST_CHECK_EQUAL(result, return_type(1)); + + bg::assign_values(p, 0, 2, 0); + result = pythagoras_pb.apply(p, b); + BOOST_CHECK_EQUAL(result, return_type(1)); + + bg::assign_values(p, 0, 0, 2); + result = pythagoras_pb.apply(p, b); + BOOST_CHECK_CLOSE(result, return_type(1), 0.001); +} + +template +inline void test_arbitrary_3d() +{ + Box b; + assign_values(b, 0, 0, 0, 1, 2, 3); + Point p; + bg::assign_values(p, 9, 8, 7); + + { + typedef bg::strategy::distance::pythagoras_point_box<> strategy_type; + typedef typename bg::strategy::distance::services::return_type + < + strategy_type, Point, Box + >::type return_type; + + strategy_type strategy; + return_type result = strategy.apply(p, b); + BOOST_CHECK_CLOSE(result, return_type(10.77032961427), 0.001); + } + + { + // Check comparable distance + typedef bg::strategy::distance::comparable::pythagoras_point_box<> + strategy_type; + + typedef typename bg::strategy::distance::services::return_type + < + strategy_type, Point, Box + >::type return_type; + + strategy_type strategy; + return_type result = strategy.apply(p, b); + BOOST_CHECK_EQUAL(result, return_type(116)); + } +} + +template +inline void test_services() +{ + namespace bgsd = bg::strategy::distance; + namespace services = bg::strategy::distance::services; + + { + // Compile-check if there is a strategy for this type + typedef typename services::default_strategy + < + bg::point_tag, bg::box_tag, Point, Box + >::type pythagoras_pb_strategy_type; + + // reverse geometry tags + typedef typename services::default_strategy + < + bg::box_tag, bg::point_tag, Box, Point + >::type reversed_pythagoras_pb_strategy_type; + } + + Point p; + bg::assign_values(p, 1, 2, 3); + + Box b; + assign_values(b, 4, 5, 6, 14, 15, 16); + + double const sqr_expected = 3*3 + 3*3 + 3*3; // 27 + double const expected = sqrt(sqr_expected); // sqrt(27)=5.1961524227 + + // 1: normal, calculate distance: + + typedef bgsd::pythagoras_point_box strategy_type; + + BOOST_CONCEPT_ASSERT + ( (bg::concept::PointDistanceStrategy) ); + + typedef typename bgsd::services::return_type + < + strategy_type, Point, Box + >::type return_type; + + strategy_type strategy; + return_type result = strategy.apply(p, b); + BOOST_CHECK_CLOSE(result, return_type(expected), 0.001); + + // 2: the strategy should return the same result if we reverse parameters + // result = strategy.apply(p2, p1); + // BOOST_CHECK_CLOSE(result, return_type(expected), 0.001); + + + // 3: "comparable" to construct a "comparable strategy" for Point/Box + // a "comparable strategy" is a strategy which does not calculate the exact distance, but + // which returns results which can be mutually compared (e.g. avoid sqrt) + + // 3a: "comparable_type" + typedef typename services::comparable_type + < + strategy_type + >::type comparable_type; + + // 3b: "get_comparable" + comparable_type comparable = bgsd::services::get_comparable + < + strategy_type + >::apply(strategy); + + typedef typename bgsd::services::return_type + < + comparable_type, Point, Box + >::type comparable_return_type; + + comparable_return_type c_result = comparable.apply(p, b); + BOOST_CHECK_CLOSE(c_result, return_type(sqr_expected), 0.001); + + // 4: the comparable_type should have a distance_strategy_constructor as well, + // knowing how to compare something with a fixed distance + comparable_return_type c_dist5 = services::result_from_distance + < + comparable_type, Point, Box + >::apply(comparable, 5.0); + + comparable_return_type c_dist6 = services::result_from_distance + < + comparable_type, Point, Box + >::apply(comparable, 6.0); + + // If this is the case: + BOOST_CHECK(c_dist5 < c_result && c_result < c_dist6); + + // This should also be the case + return_type dist5 = services::result_from_distance + < + strategy_type, Point, Box + >::apply(strategy, 5.0); + return_type dist6 = services::result_from_distance + < + strategy_type, Point, Box + >::apply(strategy, 6.0); + BOOST_CHECK(dist5 < result && result < dist6); +} + +template +< + typename CoordinateType, + typename CalculationType, + typename AssignType +> +inline void test_big_2d_with(AssignType const& x1, AssignType const& y1, + AssignType const& x2, AssignType const& y2, + AssignType const& zero) +{ + typedef bg::model::point point_type; + typedef bg::model::box box_type; + typedef bg::strategy::distance::pythagoras_point_box + < + CalculationType + > pythagoras_pb_type; + + pythagoras_pb_type pythagoras_pb; + typedef typename bg::strategy::distance::services::return_type + < + pythagoras_pb_type, point_type, box_type + >::type return_type; + + + point_type p; + box_type b; + bg::assign_values(b, zero, zero, x1, y1); + bg::assign_values(p, x2, y2); + return_type d = pythagoras_pb.apply(p, b); + + BOOST_CHECK_CLOSE(d, return_type(1076554.5485833955678294387789057), 0.001); +} + +template +inline void test_big_2d() +{ + test_big_2d_with + (123456.78900001, 234567.89100001, + 987654.32100001, 876543.21900001, + 0.0); +} + +template +inline void test_big_2d_string() +{ + test_big_2d_with + ("123456.78900001", "234567.89100001", + "987654.32100001", "876543.21900001", + "0.0000000000000"); +} + +template +inline void test_integer(bool check_types) +{ + typedef bg::model::point point_type; + typedef bg::model::box box_type; + + point_type p; + box_type b; + bg::assign_values(b, 0, 0, 12345678, 23456789); + bg::assign_values(p, 98765432, 87654321); + + typedef bg::strategy::distance::pythagoras_point_box<> pythagoras_pb_type; + pythagoras_pb_type pythagoras_pb; + BOOST_AUTO(distance, pythagoras_pb.apply(p, b)); + BOOST_CHECK_CLOSE(distance, 107655455.02347542, 0.001); + + typedef typename bg::strategy::distance::services::comparable_type + < + pythagoras_pb_type + >::type comparable_type; + comparable_type comparable; + BOOST_AUTO(cdistance, comparable.apply(p, b)); + BOOST_CHECK_EQUAL(cdistance, 11589696996311540); + + typedef BOOST_TYPEOF(cdistance) cdistance_type; + typedef BOOST_TYPEOF(distance) distance_type; + + distance_type distance2 = sqrt(distance_type(cdistance)); + BOOST_CHECK_CLOSE(distance, distance2, 0.001); + + if (check_types) + { + BOOST_CHECK((boost::is_same::type::value)); + BOOST_CHECK((boost::is_same::type::value)); + } +} + +template +void test_all_3d() +{ + test_null_distance_3d >(); + test_axis_3d >(); + test_arbitrary_3d >(); + + test_null_distance_3d >(); + test_axis_3d >(); + test_arbitrary_3d >(); +} + +template +void test_all_3d() +{ + test_all_3d(); + test_all_3d(); + test_all_3d(); + test_all_3d(); + test_all_3d >(); + test_all_3d >(); + test_all_3d >(); +} + +template +void time_compare_s(int const n) +{ + typedef bg::model::box

box_type; + + boost::timer t; + P p; + box_type b; + bg::assign_values(b, 0, 0, 1, 1); + bg::assign_values(p, 2, 2); + Strategy strategy; + typename bg::strategy::distance::services::return_type + < + Strategy, P, box_type + >::type s = 0; + for (int i = 0; i < n; i++) + { + for (int j = 0; j < n; j++) + { + bg::set<0>(p, bg::get<0>(p) + 0.001); + s += strategy.apply(p, b); + } + } + std::cout << "s: " << s << " t: " << t.elapsed() << std::endl; +} + +template +inline void time_compare(int const n) +{ + time_compare_s >(n); + time_compare_s + < + P, bg::strategy::distance::comparable::pythagoras_point_box<> + >(n); +} + + + + +BOOST_AUTO_TEST_CASE( test_integer_all ) +{ + test_integer(true); + test_integer(true); + test_integer(false); +} + + +BOOST_AUTO_TEST_CASE( test_3d_all ) +{ + test_all_3d(); + test_all_3d(); + test_all_3d(); + + test_all_3d(); + + test_all_3d >(); + test_all_3d >(); + test_all_3d >(); +} + + +BOOST_AUTO_TEST_CASE( test_big_2d_all ) +{ + test_big_2d(); + test_big_2d(); + test_big_2d(); + test_big_2d(); +} + + +BOOST_AUTO_TEST_CASE( test_services_all ) +{ + test_services + < + bg::model::point, + bg::model::box, + long double + >(); + test_services, float>(); + + // reverse the point and box types + test_services + < + double[3], + bg::model::box >, + long double + >(); + test_services, float>(); +} + + +BOOST_AUTO_TEST_CASE( test_time_compare ) +{ + // TODO move this to another non-unit test + // time_compare >(10000); +} + + +#if defined(HAVE_TTMATH) +BOOST_AUTO_TEST_CASE( test_ttmath_all ) +{ + typedef ttmath::Big<1,4> tt; + typedef bg::model::point tt_point; + + //test_all_3d(); + test_all_3d(); + test_all_3d(); + test_big_2d(); + test_big_2d_string(); +} +#endif From 795fdf82a7aa601691ad4b9e950afa041d98e67e Mon Sep 17 00:00:00 2001 From: Menelaos Karavelas Date: Tue, 3 Jun 2014 18:58:33 +0300 Subject: [PATCH 02/27] [test][strategies] add entry for unit test for pythagoras point-box --- test/strategies/Jamfile.v2 | 1 + 1 file changed, 1 insertion(+) diff --git a/test/strategies/Jamfile.v2 b/test/strategies/Jamfile.v2 index e994e46f0..567aca453 100644 --- a/test/strategies/Jamfile.v2 +++ b/test/strategies/Jamfile.v2 @@ -20,6 +20,7 @@ test-suite boost-geometry-strategies [ run haversine.cpp ] [ run projected_point.cpp ] [ run pythagoras.cpp ] + [ run pythagoras_point_box.cpp ] [ run spherical_side.cpp ] [ run segment_intersection_collinear.cpp ] [ run transform_cs.cpp ] From da20d7c4099beff6fa01765ca4a4a2b665d70f1c Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Tue, 3 Jun 2014 21:21:03 +0200 Subject: [PATCH 03/27] [multi][core] Move functionalities of multi/core into core --- include/boost/geometry/core/closure.hpp | 23 ++++++- include/boost/geometry/core/geometry_id.hpp | 25 ++++--- .../boost/geometry/core/interior_rings.hpp | 13 +++- include/boost/geometry/core/is_areal.hpp | 5 +- include/boost/geometry/core/point_order.hpp | 22 +++++- include/boost/geometry/core/point_type.hpp | 34 +++++++++- include/boost/geometry/core/ring_type.hpp | 53 ++++++++++++++- include/boost/geometry/core/tags.hpp | 43 ++++++++++++ .../geometry/core/topological_dimension.hpp | 13 ++++ include/boost/geometry/multi/core/closure.hpp | 39 ----------- .../boost/geometry/multi/core/geometry_id.hpp | 36 ---------- .../geometry/multi/core/interior_rings.hpp | 33 --------- .../boost/geometry/multi/core/is_areal.hpp | 21 ------ .../boost/geometry/multi/core/point_order.hpp | 36 ---------- .../boost/geometry/multi/core/point_type.hpp | 42 ------------ .../boost/geometry/multi/core/ring_type.hpp | 68 ------------------- include/boost/geometry/multi/core/tags.hpp | 51 +------------- .../multi/core/topological_dimension.hpp | 30 -------- 18 files changed, 214 insertions(+), 373 deletions(-) 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 From 676090691fede935f9b60383c04663114217e365 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Tue, 3 Jun 2014 21:54:01 +0200 Subject: [PATCH 04/27] [multi][views] Move range_type<> from multi/ directory. Also tweak the parameters of the dispatched implementation - reverse the order and add default Tag. --- .../multi/views/detail/range_type.hpp | 41 --------------- .../geometry/views/detail/range_type.hpp | 52 ++++++++++++++----- 2 files changed, 40 insertions(+), 53 deletions(-) diff --git a/include/boost/geometry/multi/views/detail/range_type.hpp b/include/boost/geometry/multi/views/detail/range_type.hpp index 172feb251..f8cb0e6e5 100644 --- a/include/boost/geometry/multi/views/detail/range_type.hpp +++ b/include/boost/geometry/multi/views/detail/range_type.hpp @@ -15,48 +15,7 @@ #define BOOST_GEOMETRY_MULTI_VIEWS_DETAIL_RANGE_TYPE_HPP -#include - #include -namespace boost { namespace geometry -{ - -#ifndef DOXYGEN_NO_DISPATCH -namespace dispatch -{ - -// multi-point acts itself as a range -template -struct range_type -{ - typedef Geometry type; -}; - - -template -struct range_type -{ - typedef typename boost::range_value::type type; -}; - - -template -struct range_type -{ - // Call its single-version - typedef typename geometry::detail::range_type - < - typename boost::range_value::type - >::type type; -}; - - -} // namespace dispatch -#endif // DOXYGEN_NO_DISPATCH - - -}} // namespace boost::geometry - #endif // BOOST_GEOMETRY_MULTI_VIEWS_DETAIL_RANGE_TYPE_HPP diff --git a/include/boost/geometry/views/detail/range_type.hpp b/include/boost/geometry/views/detail/range_type.hpp index a40670cf9..fff634c37 100644 --- a/include/boost/geometry/views/detail/range_type.hpp +++ b/include/boost/geometry/views/detail/range_type.hpp @@ -16,7 +16,7 @@ #include -#include +#include #include #include @@ -33,7 +33,8 @@ namespace dispatch { -template +template ::type> struct range_type { BOOST_MPL_ASSERT_MSG @@ -45,31 +46,59 @@ struct range_type template -struct range_type -{ - typedef Geometry type; -}; - -template -struct range_type +struct range_type { typedef Geometry type; }; template -struct range_type +struct range_type +{ + typedef Geometry type; +}; + + +template +struct range_type { typedef typename ring_type::type type; }; + template -struct range_type +struct range_type { typedef box_view type; }; +// multi-point acts itself as a range +template +struct range_type +{ + typedef Geometry type; +}; + + +template +struct range_type +{ + typedef typename boost::range_value::type type; +}; + + +template +struct range_type +{ + // Call its single-version + typedef typename dispatch::range_type + < + typename boost::range_value::type + >::type type; +}; + + } // namespace dispatch #endif // DOXYGEN_NO_DISPATCH @@ -93,7 +122,6 @@ struct range_type { typedef typename dispatch::range_type < - typename tag::type, Geometry >::type type; }; From 82a2b50b0ce00619834dff8699ec85a426742087 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Tue, 3 Jun 2014 22:17:56 +0200 Subject: [PATCH 05/27] [multi][strategies] Move centroid_average from multi/ directory --- .../strategies/cartesian/centroid_average.hpp | 97 +-------------- .../strategies/cartesian/centroid_average.hpp | 114 ++++++++++++++++++ .../boost/geometry/strategies/strategies.hpp | 1 + 3 files changed, 116 insertions(+), 96 deletions(-) create mode 100644 include/boost/geometry/strategies/cartesian/centroid_average.hpp diff --git a/include/boost/geometry/multi/strategies/cartesian/centroid_average.hpp b/include/boost/geometry/multi/strategies/cartesian/centroid_average.hpp index f28daf20b..ce614e2e7 100644 --- a/include/boost/geometry/multi/strategies/cartesian/centroid_average.hpp +++ b/include/boost/geometry/multi/strategies/cartesian/centroid_average.hpp @@ -15,102 +15,7 @@ #define BOOST_GEOMETRY_MULTI_STRATEGIES_CARTESIAN_CENTROID_AVERAGE_HPP -#include -#include - -#include -#include -#include -#include - - -namespace boost { namespace geometry -{ - -namespace strategy { namespace centroid -{ - - -/*! -\brief Centroid calculation taking average of points -\ingroup strategies -*/ -template -< - typename PointCentroid, - typename Point = PointCentroid -> -class average -{ -private : - - /*! subclass to keep state */ - class sum - { - friend class average; - int count; - PointCentroid centroid; - - public : - inline sum() - : count(0) - { - assign_zero(centroid); - } - }; - -public : - typedef sum state_type; - typedef PointCentroid centroid_point_type; - typedef Point point_type; - - static inline void apply(Point const& p, sum& state) - { - add_point(state.centroid, p); - state.count++; - } - - static inline void result(sum const& state, PointCentroid& centroid) - { - centroid = state.centroid; - divide_value(centroid, state.count); - } - -}; - - -#ifndef DOXYGEN_NO_STRATEGY_SPECIALIZATIONS - - -namespace services -{ - -template -struct default_strategy -< - cartesian_tag, - pointlike_tag, - DimensionCount, - Point, - Geometry -> -{ - typedef average - < - Point, - typename point_type::type - > type; -}; - -} // namespace services - -#endif - - -}} // namespace strategy::centroid - - -}} // namespace boost::geometry +#include #endif // BOOST_GEOMETRY_MULTI_STRATEGIES_CARTESIAN_CENTROID_AVERAGE_HPP diff --git a/include/boost/geometry/strategies/cartesian/centroid_average.hpp b/include/boost/geometry/strategies/cartesian/centroid_average.hpp new file mode 100644 index 000000000..76e2f7144 --- /dev/null +++ b/include/boost/geometry/strategies/cartesian/centroid_average.hpp @@ -0,0 +1,114 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) + +// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. +// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. + +// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library +// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. + +// Use, modification and distribution is 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_GEOMETRY_STRATEGIES_CARTESIAN_CENTROID_AVERAGE_HPP +#define BOOST_GEOMETRY_STRATEGIES_CARTESIAN_CENTROID_AVERAGE_HPP + + +#include +#include +#include +#include +#include + + +namespace boost { namespace geometry +{ + +namespace strategy { namespace centroid +{ + + +/*! +\brief Centroid calculation taking average of points +\ingroup strategies +*/ +template +< + typename PointCentroid, + typename Point = PointCentroid +> +class average +{ +private : + + /*! subclass to keep state */ + class sum + { + friend class average; + int count; + PointCentroid centroid; + + public : + inline sum() + : count(0) + { + assign_zero(centroid); + } + }; + +public : + typedef sum state_type; + typedef PointCentroid centroid_point_type; + typedef Point point_type; + + static inline void apply(Point const& p, sum& state) + { + add_point(state.centroid, p); + state.count++; + } + + static inline void result(sum const& state, PointCentroid& centroid) + { + centroid = state.centroid; + divide_value(centroid, state.count); + } + +}; + + +#ifndef DOXYGEN_NO_STRATEGY_SPECIALIZATIONS + + +namespace services +{ + +template +struct default_strategy +< + cartesian_tag, + pointlike_tag, + DimensionCount, + Point, + Geometry +> +{ + typedef average + < + Point, + typename point_type::type + > type; +}; + +} // namespace services + +#endif + + +}} // namespace strategy::centroid + + +}} // namespace boost::geometry + + +#endif // BOOST_GEOMETRY_STRATEGIES_CARTESIAN_CENTROID_AVERAGE_HPP diff --git a/include/boost/geometry/strategies/strategies.hpp b/include/boost/geometry/strategies/strategies.hpp index 972078d20..321df8808 100644 --- a/include/boost/geometry/strategies/strategies.hpp +++ b/include/boost/geometry/strategies/strategies.hpp @@ -34,6 +34,7 @@ #include #include +#include #include #include #include From f63fabcbb799b1e111a8e338ae6ebeccbe5b8269 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Wed, 4 Jun 2014 02:20:23 +0200 Subject: [PATCH 06/27] [multi][geometries] Move models, concepts and register macros from multi/ directory --- .../geometry/geometries/concepts/check.hpp | 44 ++++++++- .../concepts/multi_linestring_concept.hpp | 91 ++++++++++++++++++ .../concepts/multi_point_concept.hpp | 90 ++++++++++++++++++ .../concepts/multi_polygon_concept.hpp | 91 ++++++++++++++++++ .../boost/geometry/geometries/geometries.hpp | 4 + .../geometry/geometries/multi_linestring.hpp | 80 ++++++++++++++++ .../boost/geometry/geometries/multi_point.hpp | 94 +++++++++++++++++++ .../geometry/geometries/multi_polygon.hpp | 77 +++++++++++++++ .../geometries/register/multi_linestring.hpp | 59 ++++++++++++ .../geometries/register/multi_point.hpp | 59 ++++++++++++ .../geometries/register/multi_polygon.hpp | 59 ++++++++++++ .../multi/geometries/concepts/check.hpp | 61 ------------ .../concepts/multi_linestring_concept.hpp | 71 +------------- .../concepts/multi_point_concept.hpp | 70 +------------- .../concepts/multi_polygon_concept.hpp | 71 +------------- .../multi/geometries/multi_linestring.hpp | 67 +------------ .../geometry/multi/geometries/multi_point.hpp | 75 +-------------- .../multi/geometries/multi_polygon.hpp | 59 +----------- .../geometries/register/multi_linestring.hpp | 39 +------- .../multi/geometries/register/multi_point.hpp | 39 +------- .../geometries/register/multi_polygon.hpp | 39 +------- 21 files changed, 757 insertions(+), 582 deletions(-) create mode 100644 include/boost/geometry/geometries/concepts/multi_linestring_concept.hpp create mode 100644 include/boost/geometry/geometries/concepts/multi_point_concept.hpp create mode 100644 include/boost/geometry/geometries/concepts/multi_polygon_concept.hpp create mode 100644 include/boost/geometry/geometries/multi_linestring.hpp create mode 100644 include/boost/geometry/geometries/multi_point.hpp create mode 100644 include/boost/geometry/geometries/multi_polygon.hpp create mode 100644 include/boost/geometry/geometries/register/multi_linestring.hpp create mode 100644 include/boost/geometry/geometries/register/multi_point.hpp create mode 100644 include/boost/geometry/geometries/register/multi_polygon.hpp diff --git a/include/boost/geometry/geometries/concepts/check.hpp b/include/boost/geometry/geometries/concepts/check.hpp index 8bd4c30d2..07ef84f4a 100644 --- a/include/boost/geometry/geometries/concepts/check.hpp +++ b/include/boost/geometry/geometries/concepts/check.hpp @@ -18,13 +18,17 @@ #include #include - #include +#include #include +#include #include #include +#include +#include +#include #include #include #include @@ -32,8 +36,6 @@ #include -#include - namespace boost { namespace geometry { @@ -138,6 +140,42 @@ struct check {}; +template +struct check + : detail::concept_check::check > +{}; + + +template +struct check + : detail::concept_check::check > +{}; + + +template +struct check + : detail::concept_check::check > +{}; + + +template +struct check + : detail::concept_check::check > +{}; + + +template +struct check + : detail::concept_check::check > +{}; + + +template +struct check + : detail::concept_check::check > +{}; + + } // namespace dispatch #endif diff --git a/include/boost/geometry/geometries/concepts/multi_linestring_concept.hpp b/include/boost/geometry/geometries/concepts/multi_linestring_concept.hpp new file mode 100644 index 000000000..f13f7ac7e --- /dev/null +++ b/include/boost/geometry/geometries/concepts/multi_linestring_concept.hpp @@ -0,0 +1,91 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) + +// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. +// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. + +// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library +// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. + +// Use, modification and distribution is 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_GEOMETRY_GEOMETRIES_CONCEPTS_MULTI_LINESTRING_CONCEPT_HPP +#define BOOST_GEOMETRY_GEOMETRIES_CONCEPTS_MULTI_LINESTRING_CONCEPT_HPP + + +#include +#include +#include + + +#include + + +namespace boost { namespace geometry { namespace concept +{ + + +/*! +\brief multi-linestring concept +\ingroup concepts +\par Formal definition: +The multi linestring concept is defined as following: +- there must be a specialization of traits::tag defining multi_linestring_tag as + type +- it must behave like a Boost.Range +- its range value must fulfil the Linestring concept + +*/ +template +class MultiLinestring +{ +#ifndef DOXYGEN_NO_CONCEPT_MEMBERS + typedef typename boost::range_value::type linestring_type; + + BOOST_CONCEPT_ASSERT( (concept::Linestring) ); + BOOST_CONCEPT_ASSERT( (boost::RandomAccessRangeConcept) ); + + +public : + + BOOST_CONCEPT_USAGE(MultiLinestring) + { + Geometry* mls = 0; + traits::clear::apply(*mls); + traits::resize::apply(*mls, 0); + linestring_type* ls = 0; + traits::push_back::apply(*mls, *ls); + } +#endif +}; + + +/*! +\brief concept for multi-linestring (const version) +\ingroup const_concepts +*/ +template +class ConstMultiLinestring +{ +#ifndef DOXYGEN_NO_CONCEPT_MEMBERS + typedef typename boost::range_value::type linestring_type; + + BOOST_CONCEPT_ASSERT( (concept::ConstLinestring) ); + BOOST_CONCEPT_ASSERT( (boost::RandomAccessRangeConcept) ); + + +public : + + BOOST_CONCEPT_USAGE(ConstMultiLinestring) + { + } +#endif +}; + +}}} // namespace boost::geometry::concept + + +#endif // BOOST_GEOMETRY_GEOMETRIES_CONCEPTS_MULTI_LINESTRING_CONCEPT_HPP diff --git a/include/boost/geometry/geometries/concepts/multi_point_concept.hpp b/include/boost/geometry/geometries/concepts/multi_point_concept.hpp new file mode 100644 index 000000000..81c087166 --- /dev/null +++ b/include/boost/geometry/geometries/concepts/multi_point_concept.hpp @@ -0,0 +1,90 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) + +// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. +// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. + +// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library +// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. + +// Use, modification and distribution is 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_GEOMETRY_GEOMETRIES_CONCEPTS_MULTI_POINT_CONCEPT_HPP +#define BOOST_GEOMETRY_GEOMETRIES_CONCEPTS_MULTI_POINT_CONCEPT_HPP + + +#include +#include +#include + + +#include + + +namespace boost { namespace geometry { namespace concept +{ + + +/*! +\brief MultiPoint concept +\ingroup concepts +\par Formal definition: +The multi point concept is defined as following: +- there must be a specialization of traits::tag defining multi_point_tag as type +- it must behave like a Boost.Range +- its range value must fulfil the Point concept + +*/ +template +class MultiPoint +{ +#ifndef DOXYGEN_NO_CONCEPT_MEMBERS + typedef typename boost::range_value::type point_type; + + BOOST_CONCEPT_ASSERT( (concept::Point) ); + BOOST_CONCEPT_ASSERT( (boost::RandomAccessRangeConcept) ); + + +public : + + BOOST_CONCEPT_USAGE(MultiPoint) + { + Geometry* mp = 0; + traits::clear::apply(*mp); + traits::resize::apply(*mp, 0); + point_type* point = 0; + traits::push_back::apply(*mp, *point); + } +#endif +}; + + +/*! +\brief concept for multi-point (const version) +\ingroup const_concepts +*/ +template +class ConstMultiPoint +{ +#ifndef DOXYGEN_NO_CONCEPT_MEMBERS + typedef typename boost::range_value::type point_type; + + BOOST_CONCEPT_ASSERT( (concept::ConstPoint) ); + BOOST_CONCEPT_ASSERT( (boost::RandomAccessRangeConcept) ); + + +public : + + BOOST_CONCEPT_USAGE(ConstMultiPoint) + { + } +#endif +}; + +}}} // namespace boost::geometry::concept + + +#endif // BOOST_GEOMETRY_GEOMETRIES_CONCEPTS_MULTI_POINT_CONCEPT_HPP diff --git a/include/boost/geometry/geometries/concepts/multi_polygon_concept.hpp b/include/boost/geometry/geometries/concepts/multi_polygon_concept.hpp new file mode 100644 index 000000000..b13d330f3 --- /dev/null +++ b/include/boost/geometry/geometries/concepts/multi_polygon_concept.hpp @@ -0,0 +1,91 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) + +// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. +// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. + +// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library +// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. + +// Use, modification and distribution is 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_GEOMETRY_GEOMETRIES_CONCEPTS_MULTI_POLYGON_CONCEPT_HPP +#define BOOST_GEOMETRY_GEOMETRIES_CONCEPTS_MULTI_POLYGON_CONCEPT_HPP + + +#include +#include +#include + +#include + + +namespace boost { namespace geometry { namespace concept +{ + + +/*! +\brief multi-polygon concept +\ingroup concepts +\par Formal definition: +The multi polygon concept is defined as following: +- there must be a specialization of traits::tag defining multi_polygon_tag + as type +- it must behave like a Boost.Range +- its range value must fulfil the Polygon concept + +*/ +template +class MultiPolygon +{ +#ifndef DOXYGEN_NO_CONCEPT_MEMBERS + typedef typename boost::range_value::type polygon_type; + + BOOST_CONCEPT_ASSERT( (concept::Polygon) ); + BOOST_CONCEPT_ASSERT( (boost::RandomAccessRangeConcept) ); + + +public : + + BOOST_CONCEPT_USAGE(MultiPolygon) + { + Geometry* mp = 0; + traits::clear::apply(*mp); + traits::resize::apply(*mp, 0); + polygon_type* poly = 0; + traits::push_back::apply(*mp, *poly); + } +#endif +}; + + +/*! +\brief concept for multi-polygon (const version) +\ingroup const_concepts +*/ +template +class ConstMultiPolygon +{ +#ifndef DOXYGEN_NO_CONCEPT_MEMBERS + typedef typename boost::range_value::type polygon_type; + + BOOST_CONCEPT_ASSERT( (concept::ConstPolygon) ); + BOOST_CONCEPT_ASSERT( (boost::RandomAccessRangeConcept) ); + + +public : + + BOOST_CONCEPT_USAGE(ConstMultiPolygon) + { + } +#endif +}; + + +}}} // namespace boost::geometry::concept + + +#endif // BOOST_GEOMETRY_GEOMETRIES_CONCEPTS_MULTI_POLYGON_CONCEPT_HPP diff --git a/include/boost/geometry/geometries/geometries.hpp b/include/boost/geometry/geometries/geometries.hpp index cda55c1d2..de9e2b1fd 100644 --- a/include/boost/geometry/geometries/geometries.hpp +++ b/include/boost/geometry/geometries/geometries.hpp @@ -18,6 +18,10 @@ #include #include +#include +#include +#include + #include #include #include diff --git a/include/boost/geometry/geometries/multi_linestring.hpp b/include/boost/geometry/geometries/multi_linestring.hpp new file mode 100644 index 000000000..2ba8e7196 --- /dev/null +++ b/include/boost/geometry/geometries/multi_linestring.hpp @@ -0,0 +1,80 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) + +// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. +// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. + +// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library +// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. + +// Use, modification and distribution is 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_GEOMETRY_GEOMETRIES_MULTI_LINESTRING_HPP +#define BOOST_GEOMETRY_GEOMETRIES_MULTI_LINESTRING_HPP + +#include +#include + +#include + +#include +#include + + +namespace boost { namespace geometry +{ + + +namespace model +{ + +/*! +\brief multi_line, a collection of linestring +\details Multi-linestring can be used to group lines belonging to each other, + e.g. a highway (with interruptions) +\ingroup geometries + +\qbk{before.synopsis, +[heading Model of] +[link geometry.reference.concepts.concept_multi_linestring MultiLineString Concept] +} +*/ +template +< + typename LineString, + template class Container = std::vector, + template class Allocator = std::allocator +> +class multi_linestring : public Container > +{ + BOOST_CONCEPT_ASSERT( (concept::Linestring) ); +}; + + +} // namespace model + + +#ifndef DOXYGEN_NO_TRAITS_SPECIALIZATIONS +namespace traits +{ + +template +< + typename LineString, + template class Container, + template class Allocator +> +struct tag< model::multi_linestring > +{ + typedef multi_linestring_tag type; +}; + +} // namespace traits +#endif // DOXYGEN_NO_TRAITS_SPECIALIZATIONS + + +}} // namespace boost::geometry + +#endif // BOOST_GEOMETRY_GEOMETRIES_MULTI_LINESTRING_HPP diff --git a/include/boost/geometry/geometries/multi_point.hpp b/include/boost/geometry/geometries/multi_point.hpp new file mode 100644 index 000000000..d0a782a1d --- /dev/null +++ b/include/boost/geometry/geometries/multi_point.hpp @@ -0,0 +1,94 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) + +// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. +// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. + +// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library +// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. + +// Use, modification and distribution is 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_GEOMETRY_GEOMETRIES_MULTI_POINT_HPP +#define BOOST_GEOMETRY_GEOMETRIES_MULTI_POINT_HPP + +#include +#include + +#include + +#include +#include + + +namespace boost { namespace geometry +{ + +namespace model +{ + + +/*! +\brief multi_point, a collection of points +\ingroup geometries +\tparam Point \tparam_point +\tparam Container \tparam_container +\tparam Allocator \tparam_allocator +\details Multipoint can be used to group points belonging to each other, + e.g. a constellation, or the result set of an intersection +\qbk{before.synopsis, +[heading Model of] +[link geometry.reference.concepts.concept_multi_point MultiPoint Concept] +} +*/ +template +< + typename Point, + template class Container = std::vector, + template class Allocator = std::allocator +> +class multi_point : public Container > +{ + BOOST_CONCEPT_ASSERT( (concept::Point) ); + + typedef Container > base_type; + +public : + /// \constructor_default{multi_point} + inline multi_point() + : base_type() + {} + + /// \constructor_begin_end{multi_point} + template + inline multi_point(Iterator begin, Iterator end) + : base_type(begin, end) + {} +}; + +} // namespace model + + +#ifndef DOXYGEN_NO_TRAITS_SPECIALIZATIONS +namespace traits +{ + +template +< + typename Point, + template class Container, + template class Allocator +> +struct tag< model::multi_point > +{ + typedef multi_point_tag type; +}; + +} // namespace traits +#endif // DOXYGEN_NO_TRAITS_SPECIALIZATIONS + +}} // namespace boost::geometry + +#endif // BOOST_GEOMETRY_GEOMETRIES_MULTI_POINT_HPP diff --git a/include/boost/geometry/geometries/multi_polygon.hpp b/include/boost/geometry/geometries/multi_polygon.hpp new file mode 100644 index 000000000..228074cd3 --- /dev/null +++ b/include/boost/geometry/geometries/multi_polygon.hpp @@ -0,0 +1,77 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) + +// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. +// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. + +// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library +// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. + +// Use, modification and distribution is 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_GEOMETRY_GEOMETRIES_MULTI_POLYGON_HPP +#define BOOST_GEOMETRY_GEOMETRIES_MULTI_POLYGON_HPP + +#include +#include + +#include + +#include +#include + +namespace boost { namespace geometry +{ + +namespace model +{ + +/*! +\brief multi_polygon, a collection of polygons +\details Multi-polygon can be used to group polygons belonging to each other, + e.g. Hawaii +\ingroup geometries + +\qbk{before.synopsis, +[heading Model of] +[link geometry.reference.concepts.concept_multi_polygon MultiPolygon Concept] +} +*/ +template +< + typename Polygon, + template class Container = std::vector, + template class Allocator = std::allocator +> +class multi_polygon : public Container > +{ + BOOST_CONCEPT_ASSERT( (concept::Polygon) ); +}; + + +} // namespace model + + +#ifndef DOXYGEN_NO_TRAITS_SPECIALIZATIONS +namespace traits +{ + +template +< + typename Polygon, + template class Container, + template class Allocator +> +struct tag< model::multi_polygon > +{ + typedef multi_polygon_tag type; +}; + +} // namespace traits +#endif // DOXYGEN_NO_TRAITS_SPECIALIZATIONS + +}} // namespace boost::geometry + +#endif // BOOST_GEOMETRY_GEOMETRIES_MULTI_POLYGON_HPP diff --git a/include/boost/geometry/geometries/register/multi_linestring.hpp b/include/boost/geometry/geometries/register/multi_linestring.hpp new file mode 100644 index 000000000..ad11289d1 --- /dev/null +++ b/include/boost/geometry/geometries/register/multi_linestring.hpp @@ -0,0 +1,59 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) + +// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. +// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. + +// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library +// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. + +// Use, modification and distribution is 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_GEOMETRY_GEOMETRIES_REGISTER_MULTI_LINESTRING_HPP +#define BOOST_GEOMETRY_GEOMETRIES_REGISTER_MULTI_LINESTRING_HPP + +#include +#include + +/*! +\brief \brief_macro{multi_linestring} +\ingroup register +\details \details_macro{BOOST_GEOMETRY_REGISTER_MULTI_LINESTRING, multi_linestring} The + multi_linestring may contain template parameters, which must be specified then. +\param MultiLineString \param_macro_type{multi_linestring} + +\qbk{ +[heading Example] +[register_multi_linestring] +[register_multi_linestring_output] +} +*/ +#define BOOST_GEOMETRY_REGISTER_MULTI_LINESTRING(MultiLineString) \ +namespace boost { namespace geometry { namespace traits { \ + template<> struct tag { typedef multi_linestring_tag type; }; \ +}}} + + +/*! +\brief \brief_macro{templated multi_linestring} +\ingroup register +\details \details_macro{BOOST_GEOMETRY_REGISTER_MULTI_LINESTRING_TEMPLATED, templated multi_linestring} + \details_macro_templated{multi_linestring, linestring} +\param MultiLineString \param_macro_type{multi_linestring (without template parameters)} + +\qbk{ +[heading Example] +[register_multi_linestring_templated] +[register_multi_linestring_templated_output] +} +*/ +#define BOOST_GEOMETRY_REGISTER_MULTI_LINESTRING_TEMPLATED(MultiLineString) \ +namespace boost { namespace geometry { namespace traits { \ + template struct tag< MultiLineString > { typedef multi_linestring_tag type; }; \ +}}} + + +#endif // BOOST_GEOMETRY_GEOMETRIES_REGISTER_MULTI_LINESTRING_HPP diff --git a/include/boost/geometry/geometries/register/multi_point.hpp b/include/boost/geometry/geometries/register/multi_point.hpp new file mode 100644 index 000000000..4e875ae0c --- /dev/null +++ b/include/boost/geometry/geometries/register/multi_point.hpp @@ -0,0 +1,59 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) + +// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. +// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. + +// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library +// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. + +// Use, modification and distribution is 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_GEOMETRY_GEOMETRIES_REGISTER_MULTI_POINT_HPP +#define BOOST_GEOMETRY_GEOMETRIES_REGISTER_MULTI_POINT_HPP + +#include +#include + +/*! +\brief \brief_macro{multi_point} +\ingroup register +\details \details_macro{BOOST_GEOMETRY_REGISTER_MULTI_POINT, multi_point} The + multi_point may contain template parameters, which must be specified then. +\param MultiPoint \param_macro_type{multi_point} + +\qbk{ +[heading Example] +[register_multi_point] +[register_multi_point_output] +} +*/ +#define BOOST_GEOMETRY_REGISTER_MULTI_POINT(MultiPoint) \ +namespace boost { namespace geometry { namespace traits { \ + template<> struct tag { typedef multi_point_tag type; }; \ +}}} + + +/*! +\brief \brief_macro{templated multi_point} +\ingroup register +\details \details_macro{BOOST_GEOMETRY_REGISTER_MULTI_POINT_TEMPLATED, templated multi_point} + \details_macro_templated{multi_point, point} +\param MultiPoint \param_macro_type{multi_point (without template parameters)} + +\qbk{ +[heading Example] +[register_multi_point_templated] +[register_multi_point_templated_output] +} +*/ +#define BOOST_GEOMETRY_REGISTER_MULTI_POINT_TEMPLATED(MultiPoint) \ +namespace boost { namespace geometry { namespace traits { \ + template struct tag< MultiPoint > { typedef multi_point_tag type; }; \ +}}} + + +#endif // BOOST_GEOMETRY_GEOMETRIES_REGISTER_MULTI_POINT_HPP diff --git a/include/boost/geometry/geometries/register/multi_polygon.hpp b/include/boost/geometry/geometries/register/multi_polygon.hpp new file mode 100644 index 000000000..1c3818b55 --- /dev/null +++ b/include/boost/geometry/geometries/register/multi_polygon.hpp @@ -0,0 +1,59 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) + +// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. +// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. + +// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library +// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. + +// Use, modification and distribution is 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_GEOMETRY_GEOMETRIES_REGISTER_MULTI_POLYGON_HPP +#define BOOST_GEOMETRY_GEOMETRIES_REGISTER_MULTI_POLYGON_HPP + +#include +#include + +/*! +\brief \brief_macro{multi_polygon} +\ingroup register +\details \details_macro{BOOST_GEOMETRY_REGISTER_MULTI_POLYGON, multi_polygon} The + multi_polygon may contain template parameters, which must be specified then. +\param MultiPolygon \param_macro_type{multi_polygon} + +\qbk{ +[heading Example] +[register_multi_polygon] +[register_multi_polygon_output] +} +*/ +#define BOOST_GEOMETRY_REGISTER_MULTI_POLYGON(MultiPolygon) \ +namespace boost { namespace geometry { namespace traits { \ + template<> struct tag { typedef multi_polygon_tag type; }; \ +}}} + + +/*! +\brief \brief_macro{templated multi_polygon} +\ingroup register +\details \details_macro{BOOST_GEOMETRY_REGISTER_MULTI_POLYGON_TEMPLATED, templated multi_polygon} + \details_macro_templated{multi_polygon, polygon} +\param MultiPolygon \param_macro_type{multi_polygon (without template parameters)} + +\qbk{ +[heading Example] +[register_multi_polygon_templated] +[register_multi_polygon_templated_output] +} +*/ +#define BOOST_GEOMETRY_REGISTER_MULTI_POLYGON_TEMPLATED(MultiPolygon) \ +namespace boost { namespace geometry { namespace traits { \ + template struct tag< MultiPolygon > { typedef multi_polygon_tag type; }; \ +}}} + + +#endif // BOOST_GEOMETRY_GEOMETRIES_REGISTER_MULTI_POLYGON_HPP diff --git a/include/boost/geometry/multi/geometries/concepts/check.hpp b/include/boost/geometry/multi/geometries/concepts/check.hpp index 61afc913c..c741afd79 100644 --- a/include/boost/geometry/multi/geometries/concepts/check.hpp +++ b/include/boost/geometry/multi/geometries/concepts/check.hpp @@ -16,68 +16,7 @@ #define BOOST_GEOMETRY_MULTI_GEOMETRIES_CONCEPTS_CHECK_HPP - -#include - -#include - #include -#include -#include -#include - - -namespace boost { namespace geometry -{ - - - -#ifndef DOXYGEN_NO_DISPATCH -namespace dispatch -{ - - -template -struct check - : detail::concept_check::check > -{}; - - -template -struct check - : detail::concept_check::check > -{}; - - -template -struct check - : detail::concept_check::check > -{}; - - -template -struct check - : detail::concept_check::check > -{}; - - -template -struct check - : detail::concept_check::check > -{}; - - -template -struct check - : detail::concept_check::check > -{}; - - -} // namespace dispatch -#endif - - -}} // namespace boost::geometry #endif // BOOST_GEOMETRY_MULTI_GEOMETRIES_CONCEPTS_CHECK_HPP diff --git a/include/boost/geometry/multi/geometries/concepts/multi_linestring_concept.hpp b/include/boost/geometry/multi/geometries/concepts/multi_linestring_concept.hpp index 3e67afbdf..9a9438efc 100644 --- a/include/boost/geometry/multi/geometries/concepts/multi_linestring_concept.hpp +++ b/include/boost/geometry/multi/geometries/concepts/multi_linestring_concept.hpp @@ -16,76 +16,7 @@ #define BOOST_GEOMETRY_MULTI_GEOMETRIES_CONCEPTS_MULTI_LINESTRING_CONCEPT_HPP -#include -#include -#include - - -#include - - -namespace boost { namespace geometry { namespace concept -{ - - -/*! -\brief multi-linestring concept -\ingroup concepts -\par Formal definition: -The multi linestring concept is defined as following: -- there must be a specialization of traits::tag defining multi_linestring_tag as - type -- it must behave like a Boost.Range -- its range value must fulfil the Linestring concept - -*/ -template -class MultiLinestring -{ -#ifndef DOXYGEN_NO_CONCEPT_MEMBERS - typedef typename boost::range_value::type linestring_type; - - BOOST_CONCEPT_ASSERT( (concept::Linestring) ); - BOOST_CONCEPT_ASSERT( (boost::RandomAccessRangeConcept) ); - - -public : - - BOOST_CONCEPT_USAGE(MultiLinestring) - { - Geometry* mls = 0; - traits::clear::apply(*mls); - traits::resize::apply(*mls, 0); - linestring_type* ls = 0; - traits::push_back::apply(*mls, *ls); - } -#endif -}; - - -/*! -\brief concept for multi-linestring (const version) -\ingroup const_concepts -*/ -template -class ConstMultiLinestring -{ -#ifndef DOXYGEN_NO_CONCEPT_MEMBERS - typedef typename boost::range_value::type linestring_type; - - BOOST_CONCEPT_ASSERT( (concept::ConstLinestring) ); - BOOST_CONCEPT_ASSERT( (boost::RandomAccessRangeConcept) ); - - -public : - - BOOST_CONCEPT_USAGE(ConstMultiLinestring) - { - } -#endif -}; - -}}} // namespace boost::geometry::concept +#include #endif // BOOST_GEOMETRY_MULTI_GEOMETRIES_CONCEPTS_MULTI_LINESTRING_CONCEPT_HPP diff --git a/include/boost/geometry/multi/geometries/concepts/multi_point_concept.hpp b/include/boost/geometry/multi/geometries/concepts/multi_point_concept.hpp index ca1112f26..14c1d25e5 100644 --- a/include/boost/geometry/multi/geometries/concepts/multi_point_concept.hpp +++ b/include/boost/geometry/multi/geometries/concepts/multi_point_concept.hpp @@ -16,75 +16,7 @@ #define BOOST_GEOMETRY_MULTI_GEOMETRIES_CONCEPTS_MULTI_POINT_CONCEPT_HPP -#include -#include -#include - - -#include - - -namespace boost { namespace geometry { namespace concept -{ - - -/*! -\brief MultiPoint concept -\ingroup concepts -\par Formal definition: -The multi point concept is defined as following: -- there must be a specialization of traits::tag defining multi_point_tag as type -- it must behave like a Boost.Range -- its range value must fulfil the Point concept - -*/ -template -class MultiPoint -{ -#ifndef DOXYGEN_NO_CONCEPT_MEMBERS - typedef typename boost::range_value::type point_type; - - BOOST_CONCEPT_ASSERT( (concept::Point) ); - BOOST_CONCEPT_ASSERT( (boost::RandomAccessRangeConcept) ); - - -public : - - BOOST_CONCEPT_USAGE(MultiPoint) - { - Geometry* mp = 0; - traits::clear::apply(*mp); - traits::resize::apply(*mp, 0); - point_type* point = 0; - traits::push_back::apply(*mp, *point); - } -#endif -}; - - -/*! -\brief concept for multi-point (const version) -\ingroup const_concepts -*/ -template -class ConstMultiPoint -{ -#ifndef DOXYGEN_NO_CONCEPT_MEMBERS - typedef typename boost::range_value::type point_type; - - BOOST_CONCEPT_ASSERT( (concept::ConstPoint) ); - BOOST_CONCEPT_ASSERT( (boost::RandomAccessRangeConcept) ); - - -public : - - BOOST_CONCEPT_USAGE(ConstMultiPoint) - { - } -#endif -}; - -}}} // namespace boost::geometry::concept +#include #endif // BOOST_GEOMETRY_MULTI_GEOMETRIES_CONCEPTS_MULTI_POINT_CONCEPT_HPP diff --git a/include/boost/geometry/multi/geometries/concepts/multi_polygon_concept.hpp b/include/boost/geometry/multi/geometries/concepts/multi_polygon_concept.hpp index ec37ef15a..5e46fb753 100644 --- a/include/boost/geometry/multi/geometries/concepts/multi_polygon_concept.hpp +++ b/include/boost/geometry/multi/geometries/concepts/multi_polygon_concept.hpp @@ -16,76 +16,7 @@ #define BOOST_GEOMETRY_MULTI_GEOMETRIES_CONCEPTS_MULTI_POLYGON_CONCEPT_HPP -#include -#include -#include - -#include - - -namespace boost { namespace geometry { namespace concept -{ - - -/*! -\brief multi-polygon concept -\ingroup concepts -\par Formal definition: -The multi polygon concept is defined as following: -- there must be a specialization of traits::tag defining multi_polygon_tag - as type -- it must behave like a Boost.Range -- its range value must fulfil the Polygon concept - -*/ -template -class MultiPolygon -{ -#ifndef DOXYGEN_NO_CONCEPT_MEMBERS - typedef typename boost::range_value::type polygon_type; - - BOOST_CONCEPT_ASSERT( (concept::Polygon) ); - BOOST_CONCEPT_ASSERT( (boost::RandomAccessRangeConcept) ); - - -public : - - BOOST_CONCEPT_USAGE(MultiPolygon) - { - Geometry* mp = 0; - traits::clear::apply(*mp); - traits::resize::apply(*mp, 0); - polygon_type* poly = 0; - traits::push_back::apply(*mp, *poly); - } -#endif -}; - - -/*! -\brief concept for multi-polygon (const version) -\ingroup const_concepts -*/ -template -class ConstMultiPolygon -{ -#ifndef DOXYGEN_NO_CONCEPT_MEMBERS - typedef typename boost::range_value::type polygon_type; - - BOOST_CONCEPT_ASSERT( (concept::ConstPolygon) ); - BOOST_CONCEPT_ASSERT( (boost::RandomAccessRangeConcept) ); - - -public : - - BOOST_CONCEPT_USAGE(ConstMultiPolygon) - { - } -#endif -}; - - -}}} // namespace boost::geometry::concept +#include #endif // BOOST_GEOMETRY_MULTI_GEOMETRIES_CONCEPTS_MULTI_POLYGON_CONCEPT_HPP diff --git a/include/boost/geometry/multi/geometries/multi_linestring.hpp b/include/boost/geometry/multi/geometries/multi_linestring.hpp index 67d4da06b..696d907dc 100644 --- a/include/boost/geometry/multi/geometries/multi_linestring.hpp +++ b/include/boost/geometry/multi/geometries/multi_linestring.hpp @@ -11,70 +11,11 @@ // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_GEOMETRY_MULTI_GEOMETRIES_LINESTRING_HPP -#define BOOST_GEOMETRY_MULTI_GEOMETRIES_LINESTRING_HPP - -#include -#include - -#include - -#include - -#include - -namespace boost { namespace geometry -{ +#ifndef BOOST_GEOMETRY_MULTI_GEOMETRIES_MULTI_LINESTRING_HPP +#define BOOST_GEOMETRY_MULTI_GEOMETRIES_MULTI_LINESTRING_HPP -namespace model -{ - -/*! -\brief multi_line, a collection of linestring -\details Multi-linestring can be used to group lines belonging to each other, - e.g. a highway (with interruptions) -\ingroup geometries - -\qbk{before.synopsis, -[heading Model of] -[link geometry.reference.concepts.concept_multi_linestring MultiLineString Concept] -} -*/ -template -< - typename LineString, - template class Container = std::vector, - template class Allocator = std::allocator -> -class multi_linestring : public Container > -{ - BOOST_CONCEPT_ASSERT( (concept::Linestring) ); -}; +#include -} // namespace model - - -#ifndef DOXYGEN_NO_TRAITS_SPECIALIZATIONS -namespace traits -{ - -template -< - typename LineString, - template class Container, - template class Allocator -> -struct tag< model::multi_linestring > -{ - typedef multi_linestring_tag type; -}; - -} // namespace traits -#endif // DOXYGEN_NO_TRAITS_SPECIALIZATIONS - - -}} // namespace boost::geometry - -#endif // BOOST_GEOMETRY_MULTI_GEOMETRIES_LINESTRING_HPP +#endif // BOOST_GEOMETRY_MULTI_GEOMETRIES_MULTI_LINESTRING_HPP diff --git a/include/boost/geometry/multi/geometries/multi_point.hpp b/include/boost/geometry/multi/geometries/multi_point.hpp index 002d8f8a4..750ad7802 100644 --- a/include/boost/geometry/multi/geometries/multi_point.hpp +++ b/include/boost/geometry/multi/geometries/multi_point.hpp @@ -14,81 +14,8 @@ #ifndef BOOST_GEOMETRY_MULTI_GEOMETRIES_MULTI_POINT_HPP #define BOOST_GEOMETRY_MULTI_GEOMETRIES_MULTI_POINT_HPP -#include -#include -#include +#include -#include - -#include - -namespace boost { namespace geometry -{ - -namespace model -{ - - -/*! -\brief multi_point, a collection of points -\ingroup geometries -\tparam Point \tparam_point -\tparam Container \tparam_container -\tparam Allocator \tparam_allocator -\details Multipoint can be used to group points belonging to each other, - e.g. a constellation, or the result set of an intersection -\qbk{before.synopsis, -[heading Model of] -[link geometry.reference.concepts.concept_multi_point MultiPoint Concept] -} -*/ -template -< - typename Point, - template class Container = std::vector, - template class Allocator = std::allocator -> -class multi_point : public Container > -{ - BOOST_CONCEPT_ASSERT( (concept::Point) ); - - typedef Container > base_type; - -public : - /// \constructor_default{multi_point} - inline multi_point() - : base_type() - {} - - /// \constructor_begin_end{multi_point} - template - inline multi_point(Iterator begin, Iterator end) - : base_type(begin, end) - {} -}; - -} // namespace model - - -#ifndef DOXYGEN_NO_TRAITS_SPECIALIZATIONS -namespace traits -{ - -template -< - typename Point, - template class Container, - template class Allocator -> -struct tag< model::multi_point > -{ - typedef multi_point_tag type; -}; - -} // namespace traits -#endif // DOXYGEN_NO_TRAITS_SPECIALIZATIONS - -}} // namespace boost::geometry #endif // BOOST_GEOMETRY_MULTI_GEOMETRIES_MULTI_POINT_HPP diff --git a/include/boost/geometry/multi/geometries/multi_polygon.hpp b/include/boost/geometry/multi/geometries/multi_polygon.hpp index af8d04287..06fefc785 100644 --- a/include/boost/geometry/multi/geometries/multi_polygon.hpp +++ b/include/boost/geometry/multi/geometries/multi_polygon.hpp @@ -14,65 +14,8 @@ #ifndef BOOST_GEOMETRY_MULTI_GEOMETRIES_MULTI_POLYGON_HPP #define BOOST_GEOMETRY_MULTI_GEOMETRIES_MULTI_POLYGON_HPP -#include -#include -#include +#include -#include - -#include - -namespace boost { namespace geometry -{ - -namespace model -{ - -/*! -\brief multi_polygon, a collection of polygons -\details Multi-polygon can be used to group polygons belonging to each other, - e.g. Hawaii -\ingroup geometries - -\qbk{before.synopsis, -[heading Model of] -[link geometry.reference.concepts.concept_multi_polygon MultiPolygon Concept] -} -*/ -template -< - typename Polygon, - template class Container = std::vector, - template class Allocator = std::allocator -> -class multi_polygon : public Container > -{ - BOOST_CONCEPT_ASSERT( (concept::Polygon) ); -}; - - -} // namespace model - - -#ifndef DOXYGEN_NO_TRAITS_SPECIALIZATIONS -namespace traits -{ - -template -< - typename Polygon, - template class Container, - template class Allocator -> -struct tag< model::multi_polygon > -{ - typedef multi_polygon_tag type; -}; - -} // namespace traits -#endif // DOXYGEN_NO_TRAITS_SPECIALIZATIONS - -}} // namespace boost::geometry #endif // BOOST_GEOMETRY_MULTI_GEOMETRIES_MULTI_POLYGON_HPP diff --git a/include/boost/geometry/multi/geometries/register/multi_linestring.hpp b/include/boost/geometry/multi/geometries/register/multi_linestring.hpp index 9e96def31..2783a8455 100644 --- a/include/boost/geometry/multi/geometries/register/multi_linestring.hpp +++ b/include/boost/geometry/multi/geometries/register/multi_linestring.hpp @@ -15,45 +15,8 @@ #ifndef BOOST_GEOMETRY_MULTI_GEOMETRIES_REGISTER_MULTI_LINESTRING_HPP #define BOOST_GEOMETRY_MULTI_GEOMETRIES_REGISTER_MULTI_LINESTRING_HPP -#include -#include -/*! -\brief \brief_macro{multi_linestring} -\ingroup register -\details \details_macro{BOOST_GEOMETRY_REGISTER_MULTI_LINESTRING, multi_linestring} The - multi_linestring may contain template parameters, which must be specified then. -\param MultiLineString \param_macro_type{multi_linestring} - -\qbk{ -[heading Example] -[register_multi_linestring] -[register_multi_linestring_output] -} -*/ -#define BOOST_GEOMETRY_REGISTER_MULTI_LINESTRING(MultiLineString) \ -namespace boost { namespace geometry { namespace traits { \ - template<> struct tag { typedef multi_linestring_tag type; }; \ -}}} - - -/*! -\brief \brief_macro{templated multi_linestring} -\ingroup register -\details \details_macro{BOOST_GEOMETRY_REGISTER_MULTI_LINESTRING_TEMPLATED, templated multi_linestring} - \details_macro_templated{multi_linestring, linestring} -\param MultiLineString \param_macro_type{multi_linestring (without template parameters)} - -\qbk{ -[heading Example] -[register_multi_linestring_templated] -[register_multi_linestring_templated_output] -} -*/ -#define BOOST_GEOMETRY_REGISTER_MULTI_LINESTRING_TEMPLATED(MultiLineString) \ -namespace boost { namespace geometry { namespace traits { \ - template struct tag< MultiLineString > { typedef multi_linestring_tag type; }; \ -}}} +#include #endif // BOOST_GEOMETRY_MULTI_GEOMETRIES_REGISTER_MULTI_LINESTRING_HPP diff --git a/include/boost/geometry/multi/geometries/register/multi_point.hpp b/include/boost/geometry/multi/geometries/register/multi_point.hpp index b5a7cf236..6063492c2 100644 --- a/include/boost/geometry/multi/geometries/register/multi_point.hpp +++ b/include/boost/geometry/multi/geometries/register/multi_point.hpp @@ -15,45 +15,8 @@ #ifndef BOOST_GEOMETRY_MULTI_GEOMETRIES_REGISTER_MULTI_POINT_HPP #define BOOST_GEOMETRY_MULTI_GEOMETRIES_REGISTER_MULTI_POINT_HPP -#include -#include -/*! -\brief \brief_macro{multi_point} -\ingroup register -\details \details_macro{BOOST_GEOMETRY_REGISTER_MULTI_POINT, multi_point} The - multi_point may contain template parameters, which must be specified then. -\param MultiPoint \param_macro_type{multi_point} - -\qbk{ -[heading Example] -[register_multi_point] -[register_multi_point_output] -} -*/ -#define BOOST_GEOMETRY_REGISTER_MULTI_POINT(MultiPoint) \ -namespace boost { namespace geometry { namespace traits { \ - template<> struct tag { typedef multi_point_tag type; }; \ -}}} - - -/*! -\brief \brief_macro{templated multi_point} -\ingroup register -\details \details_macro{BOOST_GEOMETRY_REGISTER_MULTI_POINT_TEMPLATED, templated multi_point} - \details_macro_templated{multi_point, point} -\param MultiPoint \param_macro_type{multi_point (without template parameters)} - -\qbk{ -[heading Example] -[register_multi_point_templated] -[register_multi_point_templated_output] -} -*/ -#define BOOST_GEOMETRY_REGISTER_MULTI_POINT_TEMPLATED(MultiPoint) \ -namespace boost { namespace geometry { namespace traits { \ - template struct tag< MultiPoint > { typedef multi_point_tag type; }; \ -}}} +#include #endif // BOOST_GEOMETRY_MULTI_GEOMETRIES_REGISTER_MULTI_POINT_HPP diff --git a/include/boost/geometry/multi/geometries/register/multi_polygon.hpp b/include/boost/geometry/multi/geometries/register/multi_polygon.hpp index 6d2138331..6a3e47e3d 100644 --- a/include/boost/geometry/multi/geometries/register/multi_polygon.hpp +++ b/include/boost/geometry/multi/geometries/register/multi_polygon.hpp @@ -15,45 +15,8 @@ #ifndef BOOST_GEOMETRY_MULTI_GEOMETRIES_REGISTER_MULTI_POLYGON_HPP #define BOOST_GEOMETRY_MULTI_GEOMETRIES_REGISTER_MULTI_POLYGON_HPP -#include -#include -/*! -\brief \brief_macro{multi_polygon} -\ingroup register -\details \details_macro{BOOST_GEOMETRY_REGISTER_MULTI_POLYGON, multi_polygon} The - multi_polygon may contain template parameters, which must be specified then. -\param MultiPolygon \param_macro_type{multi_polygon} - -\qbk{ -[heading Example] -[register_multi_polygon] -[register_multi_polygon_output] -} -*/ -#define BOOST_GEOMETRY_REGISTER_MULTI_POLYGON(MultiPolygon) \ -namespace boost { namespace geometry { namespace traits { \ - template<> struct tag { typedef multi_polygon_tag type; }; \ -}}} - - -/*! -\brief \brief_macro{templated multi_polygon} -\ingroup register -\details \details_macro{BOOST_GEOMETRY_REGISTER_MULTI_POLYGON_TEMPLATED, templated multi_polygon} - \details_macro_templated{multi_polygon, polygon} -\param MultiPolygon \param_macro_type{multi_polygon (without template parameters)} - -\qbk{ -[heading Example] -[register_multi_polygon_templated] -[register_multi_polygon_templated_output] -} -*/ -#define BOOST_GEOMETRY_REGISTER_MULTI_POLYGON_TEMPLATED(MultiPolygon) \ -namespace boost { namespace geometry { namespace traits { \ - template struct tag< MultiPolygon > { typedef multi_polygon_tag type; }; \ -}}} +#include #endif // BOOST_GEOMETRY_MULTI_GEOMETRIES_REGISTER_MULTI_POLYGON_HPP From b0a1704779a7ad314da0e057c87afb8bec36e0d1 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Wed, 4 Jun 2014 03:25:07 +0200 Subject: [PATCH 07/27] [multi][io] Move wkt and dsv implementation for Multi Geometries from multi/ directory --- include/boost/geometry/io/dsv/write.hpp | 53 +++++++ .../boost/geometry/io/wkt/detail/prefix.hpp | 21 +++ include/boost/geometry/io/wkt/read.hpp | 130 +++++++++++++++- include/boost/geometry/io/wkt/write.hpp | 77 ++++++++- include/boost/geometry/multi/io/dsv/write.hpp | 65 -------- .../geometry/multi/io/wkt/detail/prefix.hpp | 32 +--- include/boost/geometry/multi/io/wkt/read.hpp | 147 ------------------ include/boost/geometry/multi/io/wkt/write.hpp | 90 +---------- 8 files changed, 276 insertions(+), 339 deletions(-) diff --git a/include/boost/geometry/io/dsv/write.hpp b/include/boost/geometry/io/dsv/write.hpp index 62929f807..fe1bb3672 100644 --- a/include/boost/geometry/io/dsv/write.hpp +++ b/include/boost/geometry/io/dsv/write.hpp @@ -26,6 +26,7 @@ #include #include #include +#include #include @@ -339,9 +340,61 @@ private: dsv_settings m_settings; }; + +template +struct dsv_multi +{ + typedef dispatch::dsv + < + typename single_tag_of + < + typename tag::type + >::type, + typename boost::range_value::type + > dispatch_one; + + typedef typename boost::range_iterator + < + MultiGeometry const + >::type iterator; + + + template + static inline void apply(std::basic_ostream& os, + MultiGeometry const& multi, + dsv_settings const& settings) + { + os << settings.list_open; + + bool first = true; + for(iterator it = boost::begin(multi); + it != boost::end(multi); + ++it, first = false) + { + os << (first ? "" : settings.list_separator); + dispatch_one::apply(os, *it, settings); + } + os << settings.list_close; + } +}; + }} // namespace detail::dsv #endif // DOXYGEN_NO_DETAIL +// TODO: The alternative to this could be a forward declaration of dispatch::dsv<> +// or braking the code into the interface and implementation part +#ifndef DOXYGEN_NO_DISPATCH +namespace dispatch +{ + +template +struct dsv + : detail::dsv::dsv_multi +{}; + +} // namespace dispatch +#endif // DOXYGEN_NO_DISPATCH + /*! \brief Main DSV-streaming function \details DSV stands for Delimiter Separated Values. Geometries can be streamed diff --git a/include/boost/geometry/io/wkt/detail/prefix.hpp b/include/boost/geometry/io/wkt/detail/prefix.hpp index 45e43b88d..b566e02aa 100644 --- a/include/boost/geometry/io/wkt/detail/prefix.hpp +++ b/include/boost/geometry/io/wkt/detail/prefix.hpp @@ -17,10 +17,16 @@ namespace boost { namespace geometry { + #ifndef DOXYGEN_NO_DETAIL namespace detail { namespace wkt { +struct prefix_null +{ + static inline const char* apply() { return ""; } +}; + struct prefix_point { static inline const char* apply() { return "POINT"; } @@ -36,6 +42,21 @@ struct prefix_linestring static inline const char* apply() { return "LINESTRING"; } }; +struct prefix_multipoint +{ + static inline const char* apply() { return "MULTIPOINT"; } +}; + +struct prefix_multilinestring +{ + static inline const char* apply() { return "MULTILINESTRING"; } +}; + +struct prefix_multipolygon +{ + static inline const char* apply() { return "MULTIPOLYGON"; } +}; + }} // namespace wkt::impl #endif diff --git a/include/boost/geometry/io/wkt/read.hpp b/include/boost/geometry/io/wkt/read.hpp index 535a247db..aaaac2c9f 100644 --- a/include/boost/geometry/io/wkt/read.hpp +++ b/include/boost/geometry/io/wkt/read.hpp @@ -36,6 +36,8 @@ #include #include #include +#include +#include #include @@ -306,8 +308,6 @@ struct ring_parser }; - - /*! \brief Internal, parses a polygon from a string like this "((x y,x y),(x y,x y))" \note used for parsing polygons and multi-polygons @@ -358,6 +358,7 @@ struct polygon_parser } }; + inline bool one_of(tokenizer::iterator const& it, std::string const& value, bool& is_present) { @@ -469,7 +470,101 @@ struct geometry_parser }; +template class Parser, typename PrefixPolicy> +struct multi_parser +{ + static inline void apply(std::string const& wkt, MultiGeometry& geometry) + { + traits::clear::apply(geometry); + tokenizer tokens(wkt, boost::char_separator(" ", ",()")); + tokenizer::iterator it; + if (initialize(tokens, PrefixPolicy::apply(), wkt, it)) + { + handle_open_parenthesis(it, tokens.end(), wkt); + + // Parse sub-geometries + while(it != tokens.end() && *it != ")") + { + traits::resize::apply(geometry, boost::size(geometry) + 1); + Parser + < + typename boost::range_value::type + >::apply(it, tokens.end(), wkt, *(boost::end(geometry) - 1)); + if (it != tokens.end() && *it == ",") + { + // Skip "," after multi-element is parsed + ++it; + } + } + + handle_close_parenthesis(it, tokens.end(), wkt); + } + + check_end(it, tokens.end(), wkt); + } +}; + +template +struct noparenthesis_point_parser +{ + static inline void apply(tokenizer::iterator& it, tokenizer::iterator end, + std::string const& wkt, P& point) + { + parsing_assigner::value>::apply(it, end, point, wkt); + } +}; + +template +struct multi_point_parser +{ + static inline void apply(std::string const& wkt, MultiGeometry& geometry) + { + traits::clear::apply(geometry); + + tokenizer tokens(wkt, boost::char_separator(" ", ",()")); + tokenizer::iterator it; + + if (initialize(tokens, PrefixPolicy::apply(), wkt, it)) + { + handle_open_parenthesis(it, tokens.end(), wkt); + + // If first point definition starts with "(" then parse points as (x y) + // otherwise as "x y" + bool using_brackets = (it != tokens.end() && *it == "("); + + while(it != tokens.end() && *it != ")") + { + traits::resize::apply(geometry, boost::size(geometry) + 1); + + if (using_brackets) + { + point_parser + < + typename boost::range_value::type + >::apply(it, tokens.end(), wkt, *(boost::end(geometry) - 1)); + } + else + { + noparenthesis_point_parser + < + typename boost::range_value::type + >::apply(it, tokens.end(), wkt, *(boost::end(geometry) - 1)); + } + + if (it != tokens.end() && *it == ",") + { + // Skip "," after point is parsed + ++it; + } + } + + handle_close_parenthesis(it, tokens.end(), wkt); + } + + check_end(it, tokens.end(), wkt); + } +}; /*! @@ -589,7 +684,6 @@ struct segment_parser }; - }} // namespace detail::wkt #endif // DOXYGEN_NO_DETAIL @@ -643,6 +737,36 @@ struct read_wkt {}; +template +struct read_wkt + : detail::wkt::multi_point_parser + < + MultiGeometry, + detail::wkt::prefix_multipoint + > +{}; + +template +struct read_wkt + : detail::wkt::multi_parser + < + MultiGeometry, + detail::wkt::linestring_parser, + detail::wkt::prefix_multilinestring + > +{}; + +template +struct read_wkt + : detail::wkt::multi_parser + < + MultiGeometry, + detail::wkt::polygon_parser, + detail::wkt::prefix_multipolygon + > +{}; + + // Box (Non-OGC) template struct read_wkt diff --git a/include/boost/geometry/io/wkt/write.hpp b/include/boost/geometry/io/wkt/write.hpp index 05648f5c7..23ed375de 100644 --- a/include/boost/geometry/io/wkt/write.hpp +++ b/include/boost/geometry/io/wkt/write.hpp @@ -20,23 +20,24 @@ #include #include #include +#include +#include +#include #include #include +#include #include #include #include #include -#include +#include #include #include #include -#include -#include -#include namespace boost { namespace geometry { @@ -207,6 +208,33 @@ struct wkt_poly } }; +template +struct wkt_multi +{ + template + static inline void apply(std::basic_ostream& os, + Multi const& geometry) + { + os << PrefixPolicy::apply(); + // TODO: check EMPTY here + os << "("; + + for (typename boost::range_iterator::type + it = boost::begin(geometry); + it != boost::end(geometry); + ++it) + { + if (it != boost::begin(geometry)) + { + os << ","; + } + StreamPolicy::apply(os, *it); + } + + os << ")"; + } +}; + template struct wkt_box { @@ -336,6 +364,47 @@ struct wkt > {}; +template +struct wkt + : detail::wkt::wkt_multi + < + Multi, + detail::wkt::wkt_point + < + typename boost::range_value::type, + detail::wkt::prefix_null + >, + detail::wkt::prefix_multipoint + > +{}; + +template +struct wkt + : detail::wkt::wkt_multi + < + Multi, + detail::wkt::wkt_sequence + < + typename boost::range_value::type + >, + detail::wkt::prefix_multilinestring + > +{}; + +template +struct wkt + : detail::wkt::wkt_multi + < + Multi, + detail::wkt::wkt_poly + < + typename boost::range_value::type, + detail::wkt::prefix_null + >, + detail::wkt::prefix_multipolygon + > +{}; + template struct devarianted_wkt diff --git a/include/boost/geometry/multi/io/dsv/write.hpp b/include/boost/geometry/multi/io/dsv/write.hpp index 1a054659a..092869f56 100644 --- a/include/boost/geometry/multi/io/dsv/write.hpp +++ b/include/boost/geometry/multi/io/dsv/write.hpp @@ -14,73 +14,8 @@ #ifndef BOOST_GEOMETRY_MULTI_IO_DSV_WRITE_HPP #define BOOST_GEOMETRY_MULTI_IO_DSV_WRITE_HPP -#include - -#include -#include #include -namespace boost { namespace geometry -{ - -#ifndef DOXYGEN_NO_DETAIL -namespace detail { namespace dsv -{ - -template -struct dsv_multi -{ - typedef dispatch::dsv - < - typename single_tag_of - < - typename tag::type - >::type, - typename boost::range_value::type - > dispatch_one; - - typedef typename boost::range_iterator - < - MultiGeometry const - >::type iterator; - - - template - static inline void apply(std::basic_ostream& os, - MultiGeometry const& multi, - dsv_settings const& settings) - { - os << settings.list_open; - - bool first = true; - for(iterator it = boost::begin(multi); - it != boost::end(multi); - ++it, first = false) - { - os << (first ? "" : settings.list_separator); - dispatch_one::apply(os, *it, settings); - } - os << settings.list_close; - } -}; - -}} // namespace detail::dsv -#endif // DOXYGEN_NO_DETAIL - - -#ifndef DOXYGEN_NO_DISPATCH -namespace dispatch -{ - -template -struct dsv - : detail::dsv::dsv_multi -{}; - -} // namespace dispatch -#endif // DOXYGEN_NO_DISPATCH - -}} // namespace boost::geometry #endif // BOOST_GEOMETRY_MULTI_IO_DSV_WRITE_HPP diff --git a/include/boost/geometry/multi/io/wkt/detail/prefix.hpp b/include/boost/geometry/multi/io/wkt/detail/prefix.hpp index 37b07979b..34e2b241d 100644 --- a/include/boost/geometry/multi/io/wkt/detail/prefix.hpp +++ b/include/boost/geometry/multi/io/wkt/detail/prefix.hpp @@ -14,38 +14,8 @@ #ifndef BOOST_GEOMETRY_MULTI_IO_WKT_DETAIL_PREFIX_HPP #define BOOST_GEOMETRY_MULTI_IO_WKT_DETAIL_PREFIX_HPP -#include -namespace boost { namespace geometry -{ +#include -#ifndef DOXYGEN_NO_DETAIL -namespace detail { namespace wkt -{ - -struct prefix_null -{ - static inline const char* apply() { return ""; } -}; - -struct prefix_multipoint -{ - static inline const char* apply() { return "MULTIPOINT"; } -}; - -struct prefix_multilinestring -{ - static inline const char* apply() { return "MULTILINESTRING"; } -}; - -struct prefix_multipolygon -{ - static inline const char* apply() { return "MULTIPOLYGON"; } -}; - -}} // namespace wkt::impl -#endif - -}} // namespace boost::geometry #endif // BOOST_GEOMETRY_MULTI_IO_WKT_DETAIL_PREFIX_HPP diff --git a/include/boost/geometry/multi/io/wkt/read.hpp b/include/boost/geometry/multi/io/wkt/read.hpp index 1a3bc1d25..37e5f9e72 100644 --- a/include/boost/geometry/multi/io/wkt/read.hpp +++ b/include/boost/geometry/multi/io/wkt/read.hpp @@ -14,155 +14,8 @@ #ifndef BOOST_GEOMETRY_MULTI_IO_WKT_READ_MULTI_HPP #define BOOST_GEOMETRY_MULTI_IO_WKT_READ_MULTI_HPP -#include -#include -#include -#include -#include -#include #include -namespace boost { namespace geometry -{ - -namespace detail { namespace wkt -{ - -template class Parser, typename PrefixPolicy> -struct multi_parser -{ - static inline void apply(std::string const& wkt, MultiGeometry& geometry) - { - traits::clear::apply(geometry); - - tokenizer tokens(wkt, boost::char_separator(" ", ",()")); - tokenizer::iterator it; - if (initialize(tokens, PrefixPolicy::apply(), wkt, it)) - { - handle_open_parenthesis(it, tokens.end(), wkt); - - // Parse sub-geometries - while(it != tokens.end() && *it != ")") - { - traits::resize::apply(geometry, boost::size(geometry) + 1); - Parser - < - typename boost::range_value::type - >::apply(it, tokens.end(), wkt, *(boost::end(geometry) - 1)); - if (it != tokens.end() && *it == ",") - { - // Skip "," after multi-element is parsed - ++it; - } - } - - handle_close_parenthesis(it, tokens.end(), wkt); - } - - check_end(it, tokens.end(), wkt); - } -}; - -template -struct noparenthesis_point_parser -{ - static inline void apply(tokenizer::iterator& it, tokenizer::iterator end, - std::string const& wkt, P& point) - { - parsing_assigner::value>::apply(it, end, point, wkt); - } -}; - -template -struct multi_point_parser -{ - static inline void apply(std::string const& wkt, MultiGeometry& geometry) - { - traits::clear::apply(geometry); - - tokenizer tokens(wkt, boost::char_separator(" ", ",()")); - tokenizer::iterator it; - - if (initialize(tokens, PrefixPolicy::apply(), wkt, it)) - { - handle_open_parenthesis(it, tokens.end(), wkt); - - // If first point definition starts with "(" then parse points as (x y) - // otherwise as "x y" - bool using_brackets = (it != tokens.end() && *it == "("); - - while(it != tokens.end() && *it != ")") - { - traits::resize::apply(geometry, boost::size(geometry) + 1); - - if (using_brackets) - { - point_parser - < - typename boost::range_value::type - >::apply(it, tokens.end(), wkt, *(boost::end(geometry) - 1)); - } - else - { - noparenthesis_point_parser - < - typename boost::range_value::type - >::apply(it, tokens.end(), wkt, *(boost::end(geometry) - 1)); - } - - if (it != tokens.end() && *it == ",") - { - // Skip "," after point is parsed - ++it; - } - } - - handle_close_parenthesis(it, tokens.end(), wkt); - } - - check_end(it, tokens.end(), wkt); - } -}; - -}} // namespace detail::wkt - -#ifndef DOXYGEN_NO_DISPATCH -namespace dispatch -{ - -template -struct read_wkt - : detail::wkt::multi_point_parser - < - MultiGeometry, - detail::wkt::prefix_multipoint - > -{}; - -template -struct read_wkt - : detail::wkt::multi_parser - < - MultiGeometry, - detail::wkt::linestring_parser, - detail::wkt::prefix_multilinestring - > -{}; - -template -struct read_wkt - : detail::wkt::multi_parser - < - MultiGeometry, - detail::wkt::polygon_parser, - detail::wkt::prefix_multipolygon - > -{}; - -} // namespace dispatch -#endif // DOXYGEN_NO_DISPATCH - -}} // namespace boost::geometry #endif // BOOST_GEOMETRY_MULTI_IO_WKT_READ_MULTI_HPP diff --git a/include/boost/geometry/multi/io/wkt/write.hpp b/include/boost/geometry/multi/io/wkt/write.hpp index 47087e944..2c26d3d2e 100644 --- a/include/boost/geometry/multi/io/wkt/write.hpp +++ b/include/boost/geometry/multi/io/wkt/write.hpp @@ -14,96 +14,8 @@ #ifndef BOOST_GEOMETRY_MULTI_IO_WKT_WRITE_HPP #define BOOST_GEOMETRY_MULTI_IO_WKT_WRITE_HPP -#include -#include -#include + #include -namespace boost { namespace geometry -{ - -#ifndef DOXYGEN_NO_DETAIL -namespace detail { namespace wkt -{ - -template -struct wkt_multi -{ - template - static inline void apply(std::basic_ostream& os, - Multi const& geometry) - { - os << PrefixPolicy::apply(); - // TODO: check EMPTY here - os << "("; - - for (typename boost::range_iterator::type - it = boost::begin(geometry); - it != boost::end(geometry); - ++it) - { - if (it != boost::begin(geometry)) - { - os << ","; - } - StreamPolicy::apply(os, *it); - } - - os << ")"; - } -}; - -}} // namespace wkt::impl -#endif - -#ifndef DOXYGEN_NO_DISPATCH -namespace dispatch -{ - -template -struct wkt - : detail::wkt::wkt_multi - < - Multi, - detail::wkt::wkt_point - < - typename boost::range_value::type, - detail::wkt::prefix_null - >, - detail::wkt::prefix_multipoint - > -{}; - -template -struct wkt - : detail::wkt::wkt_multi - < - Multi, - detail::wkt::wkt_sequence - < - typename boost::range_value::type - >, - detail::wkt::prefix_multilinestring - > -{}; - -template -struct wkt - : detail::wkt::wkt_multi - < - Multi, - detail::wkt::wkt_poly - < - typename boost::range_value::type, - detail::wkt::prefix_null - >, - detail::wkt::prefix_multipolygon - > -{}; - -} // namespace dispatch -#endif - -}} // namespace boost::geometry #endif // BOOST_GEOMETRY_MULTI_IO_WKT_WRITE_HPP From 0bec8e26c366cdd1d0f1165861011cb62987a507 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Wed, 4 Jun 2014 13:24:29 +0200 Subject: [PATCH 08/27] [multi] Include headers of moved parts from geometry/ directory. --- .../multi/geometries/multi_geometries.hpp | 6 ++-- include/boost/geometry/multi/io/wkt/wkt.hpp | 4 +-- include/boost/geometry/multi/multi.hpp | 34 +++++++++---------- 3 files changed, 22 insertions(+), 22 deletions(-) diff --git a/include/boost/geometry/multi/geometries/multi_geometries.hpp b/include/boost/geometry/multi/geometries/multi_geometries.hpp index 90cf85a0f..53042091b 100644 --- a/include/boost/geometry/multi/geometries/multi_geometries.hpp +++ b/include/boost/geometry/multi/geometries/multi_geometries.hpp @@ -14,8 +14,8 @@ #ifndef BOOST_GEOMETRY_MULTI_GEOMETRIES_MULTI_GEOMETRIES_HPP #define BOOST_GEOMETRY_MULTI_GEOMETRIES_MULTI_GEOMETRIES_HPP -#include -#include -#include +#include +#include +#include #endif // BOOST_GEOMETRY_MULTI_GEOMETRIES_MULTI_GEOMETRIES_HPP diff --git a/include/boost/geometry/multi/io/wkt/wkt.hpp b/include/boost/geometry/multi/io/wkt/wkt.hpp index 55f1713d4..a6159e140 100644 --- a/include/boost/geometry/multi/io/wkt/wkt.hpp +++ b/include/boost/geometry/multi/io/wkt/wkt.hpp @@ -14,7 +14,7 @@ #ifndef BOOST_GEOMETRY_MULTI_IO_WKT_WKT_HPP #define BOOST_GEOMETRY_MULTI_IO_WKT_WKT_HPP -#include -#include +#include +#include #endif // BOOST_GEOMETRY_MULTI_IO_WKT_WKT_HPP diff --git a/include/boost/geometry/multi/multi.hpp b/include/boost/geometry/multi/multi.hpp index f019d7ffc..2e678f30a 100644 --- a/include/boost/geometry/multi/multi.hpp +++ b/include/boost/geometry/multi/multi.hpp @@ -18,15 +18,15 @@ #define BOOST_GEOMETRY_MULTI_HPP -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include @@ -68,16 +68,16 @@ #include #include -#include -#include -#include -#include +#include +#include +#include +#include -#include -#include +#include +#include -#include -#include +#include +#include #endif // BOOST_GEOMETRY_MULTI_HPP From 1a2a2f4de1521e21039c9b3fc69cc1fd6d818a0f Mon Sep 17 00:00:00 2001 From: Barend Gehrels Date: Wed, 4 Jun 2014 13:26:26 +0200 Subject: [PATCH 09/27] [buffer] remove RobustPolicy from side_on_convex_range because side of a point w.r.t. a segment cannot be done with rescaling, due to rounding the point can be located on the other side of the segment This adds 4 more failing testcases, but it has to be done first because the solution is not reliable --- .../buffer/multi_polygon_buffer.cpp | 10 +++- .../buffer/buffered_piece_collection.hpp | 6 +-- .../buffer/side_on_convex_range.hpp | 51 +++++-------------- 3 files changed, 25 insertions(+), 42 deletions(-) diff --git a/extensions/test/algorithms/buffer/multi_polygon_buffer.cpp b/extensions/test/algorithms/buffer/multi_polygon_buffer.cpp index e0f27904f..7417bd2bf 100644 --- a/extensions/test/algorithms/buffer/multi_polygon_buffer.cpp +++ b/extensions/test/algorithms/buffer/multi_polygon_buffer.cpp @@ -292,7 +292,9 @@ void test_all() test_one("rt_g3", rt_g3, 16.5711, 1.0); test_one("rt_h", rt_h, 47.6012, 1.0); +#if defined(BOOST_GEOMETRY_BUFFER_INCLUDE_FAILING_TESTS) test_one("rt_h", rt_h, 61.7058, 1.0); +#endif test_one("rt_i", rt_i, 10.7528, 1.0); test_one("rt_i", rt_i, 13.6569, 1.0); test_one("rt_j", rt_j, 28.7309, 1.0); @@ -323,7 +325,9 @@ void test_all() test_one("rt_p6", rt_p6, 18.4853, 1.0); test_one("rt_p7", rt_p7, 26.2279, 1.0); test_one("rt_p8", rt_p8, 29.0563, 1.0); +#if defined(BOOST_GEOMETRY_BUFFER_INCLUDE_FAILING_TESTS) test_one("rt_p9", rt_p9, 26.1421, 1.0); +#endif test_one("rt_p10", rt_p10, 23.3995, 1.0); test_one("rt_p11", rt_p11, 28.7426, 1.0); @@ -334,23 +338,25 @@ void test_all() test_one("rt_p14", rt_p14, 20.8284, 1.0); test_one("rt_p15", rt_p15, 23.6569, 1.0); test_one("rt_p16", rt_p16, 23.4853, 1.0); - test_one("rt_p17", rt_p17, 25.3137, 1.0); #if defined(BOOST_GEOMETRY_BUFFER_INCLUDE_FAILING_TESTS) + test_one("rt_p17", rt_p17, 25.3137, 1.0); test_one("rt_p18", rt_p18, 23.3137, 1.0); #endif test_one("rt_p19", rt_p19, 25.5637, 1.0); #if defined(BOOST_GEOMETRY_BUFFER_INCLUDE_FAILING_TESTS) test_one("rt_p20", rt_p20, 25.4853, 1.0); -#endif test_one("rt_p21", rt_p21, 17.1716, 1.0); test_one("rt_p22", rt_p22, 26.5711, 1.0); +#endif test_one("rt_q1", rt_q1, 27, 1.0); test_one("rt_q2", rt_q2, 26.4853, 1.0); test_one("rt_r", rt_r, 21.0761, 1.0); test_one("rt_s1", rt_s1, 20.4853, 1.0); +#if defined(BOOST_GEOMETRY_BUFFER_INCLUDE_FAILING_TESTS) test_one("rt_s2", rt_s2, 24.6495, 1.0); +#endif test_one("rt_t", rt_t, 15.6569, 1.0); } diff --git a/include/boost/geometry/extensions/algorithms/buffer/buffered_piece_collection.hpp b/include/boost/geometry/extensions/algorithms/buffer/buffered_piece_collection.hpp index 244ff2714..bef204766 100644 --- a/include/boost/geometry/extensions/algorithms/buffer/buffered_piece_collection.hpp +++ b/include/boost/geometry/extensions/algorithms/buffer/buffered_piece_collection.hpp @@ -389,7 +389,7 @@ struct buffered_piece_collection int const side_wrt_circle = side_on_convex_range(turn.point, boost::begin(ring) + seg_id.segment_index, boost::begin(ring) + pc.last_segment_index, - seg_id, on_segment_seg_id, m_robust_policy); + seg_id, on_segment_seg_id); switch (side_wrt_circle) { case 0 : turn.count_on_offsetted++; break; @@ -398,7 +398,7 @@ struct buffered_piece_collection return; } - int side_helper = side_on_convex_range(turn.point, pc.helper_segments, m_robust_policy); + int side_helper = side_on_convex_range(turn.point, pc.helper_segments); if (side_helper == 1) { // Left or outside @@ -408,7 +408,7 @@ struct buffered_piece_collection int const side_offsetted = side_on_convex_range(turn.point, boost::begin(ring) + seg_id.segment_index, boost::begin(ring) + pc.last_segment_index, - seg_id, on_segment_seg_id, m_robust_policy); + seg_id, on_segment_seg_id); if (side_offsetted == 1) { return; diff --git a/include/boost/geometry/extensions/algorithms/buffer/side_on_convex_range.hpp b/include/boost/geometry/extensions/algorithms/buffer/side_on_convex_range.hpp index d1ae7c37c..9c58054b6 100644 --- a/include/boost/geometry/extensions/algorithms/buffer/side_on_convex_range.hpp +++ b/include/boost/geometry/extensions/algorithms/buffer/side_on_convex_range.hpp @@ -52,9 +52,8 @@ inline bool collinear_point_on_segment(P0 const& subject, P1 const& p1, P2 const } -template -inline int side_on_convex_range(Point const& subject, - Range const& range, RobustPolicy const& robust_policy) +template +inline int side_on_convex_range(Point const& subject, Range const& range) { // TODO merge this implementation with next function with same name if (boost::empty(range)) @@ -64,26 +63,16 @@ inline int side_on_convex_range(Point const& subject, bool has_collinear = false; - typedef typename geometry::robust_point_type - < - Point, - RobustPolicy - >::type robust_point_type; - typedef typename boost::range_iterator::type iterator_type; iterator_type it = boost::begin(range); - robust_point_type subject_rob, previous_rob; - geometry::recalculate(subject_rob, subject, robust_policy); - geometry::recalculate(previous_rob, *it, robust_policy); + Point previous = *it; for (++it; it != boost::end(range); ++it) { - robust_point_type current_rob; - geometry::recalculate(current_rob, *it, robust_policy); - - int const side = SideStrategy::apply(subject_rob, previous_rob, current_rob); + Point current = *it; + int const side = SideStrategy::apply(subject, previous, current); switch(side) { case 1 : @@ -92,32 +81,24 @@ inline int side_on_convex_range(Point const& subject, // Check if it is really on the segment. // If not, it is either on the left (because polygon is convex) // or it is still on one of the other segments (if segments are collinear) - if (collinear_point_on_segment(subject_rob, previous_rob, current_rob)) + if (collinear_point_on_segment(subject, previous, current)) { return 0; } has_collinear = true; break; } - previous_rob = current_rob; + previous = current; } return has_collinear ? 1 : -1; } -template +template static inline int side_on_convex_range(Point const& subject, Iterator first, Iterator last, /* by value: */ segment_identifier seg_id, - segment_identifier& on_segment_seg_id, - RobustPolicy const& robust_policy) + segment_identifier& on_segment_seg_id) { - - typedef typename geometry::robust_point_type - < - Point, - RobustPolicy - >::type robust_point_type; - bool has_collinear = false; Iterator it = first; @@ -126,16 +107,12 @@ static inline int side_on_convex_range(Point const& subject, return 1; } - robust_point_type subject_rob, previous_rob; - geometry::recalculate(subject_rob, subject, robust_policy); - geometry::recalculate(previous_rob, *it, robust_policy); + Point previous = *it; for (++it; it != last; ++it, seg_id.segment_index++) { - robust_point_type current_rob; - geometry::recalculate(current_rob, *it, robust_policy); - - int const side = SideStrategy::apply(subject_rob, previous_rob, current_rob); + Point current = *it; + int const side = SideStrategy::apply(subject, previous, current); switch(side) { case 1 : @@ -144,7 +121,7 @@ static inline int side_on_convex_range(Point const& subject, // Check if it is REALLY on the segment. // If not, it is either on the left (because polygon is convex) // or it is still on one of the other segments (if segments are collinear) - if (collinear_point_on_segment(subject_rob, previous_rob, current_rob)) + if (collinear_point_on_segment(subject, previous, current)) { on_segment_seg_id = seg_id; return 0; @@ -152,7 +129,7 @@ static inline int side_on_convex_range(Point const& subject, has_collinear = true; break; } - previous_rob = current_rob; + previous = current; } return has_collinear ? 1 : -1; } From 77969d41945123778eac90909ab97eb52794e7f7 Mon Sep 17 00:00:00 2001 From: Barend Gehrels Date: Wed, 4 Jun 2014 13:30:45 +0200 Subject: [PATCH 10/27] [buffer] merged implementations of side_on_convex_range --- .../buffer/side_on_convex_range.hpp | 51 ++++--------------- 1 file changed, 10 insertions(+), 41 deletions(-) diff --git a/include/boost/geometry/extensions/algorithms/buffer/side_on_convex_range.hpp b/include/boost/geometry/extensions/algorithms/buffer/side_on_convex_range.hpp index 9c58054b6..e8ff9e267 100644 --- a/include/boost/geometry/extensions/algorithms/buffer/side_on_convex_range.hpp +++ b/include/boost/geometry/extensions/algorithms/buffer/side_on_convex_range.hpp @@ -52,47 +52,6 @@ inline bool collinear_point_on_segment(P0 const& subject, P1 const& p1, P2 const } -template -inline int side_on_convex_range(Point const& subject, Range const& range) -{ - // TODO merge this implementation with next function with same name - if (boost::empty(range)) - { - return 1; - } - - bool has_collinear = false; - - typedef typename boost::range_iterator::type iterator_type; - - iterator_type it = boost::begin(range); - - Point previous = *it; - - for (++it; it != boost::end(range); ++it) - { - Point current = *it; - int const side = SideStrategy::apply(subject, previous, current); - switch(side) - { - case 1 : - return 1; - case 0 : - // Check if it is really on the segment. - // If not, it is either on the left (because polygon is convex) - // or it is still on one of the other segments (if segments are collinear) - if (collinear_point_on_segment(subject, previous, current)) - { - return 0; - } - has_collinear = true; - break; - } - previous = current; - } - return has_collinear ? 1 : -1; -} - template static inline int side_on_convex_range(Point const& subject, Iterator first, Iterator last, @@ -134,6 +93,16 @@ static inline int side_on_convex_range(Point const& subject, return has_collinear ? 1 : -1; } +template +inline int side_on_convex_range(Point const& subject, Range const& range) +{ + segment_identifier dummy; + return side_on_convex_range(subject, + boost::begin(range), boost::end(range), + dummy, dummy); +} + + }} // namespace detail::buffer #endif // DOXYGEN_NO_DETAIL From 320f796b9d8b4b45313cd82f080ea3fccb376d1c Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Wed, 4 Jun 2014 14:52:28 +0200 Subject: [PATCH 11/27] [geometry] Replace headers of parts moved from multi/ directory. --- .../algorithms/detail/disjoint/areal_areal.hpp | 1 - .../algorithms/detail/disjoint/linear_areal.hpp | 1 - .../algorithms/detail/disjoint/linear_linear.hpp | 1 - .../detail/distance/backward_compatibility.hpp | 1 - .../algorithms/detail/distance/box_to_box.hpp | 1 - .../detail/distance/geometry_to_geometry_rtree.hpp | 1 - .../algorithms/detail/distance/interface.hpp | 2 -- .../algorithms/detail/distance/multi_to_multi.hpp | 1 - .../detail/distance/multipoint_to_range.hpp | 7 ++++--- .../detail/distance/range_to_segment_or_box.hpp | 1 - .../algorithms/detail/distance/single_to_multi.hpp | 12 +++++------- .../algorithms/detail/equals/collect_vectors.hpp | 4 ++-- .../detail/overlay/follow_linear_linear.hpp | 1 - .../algorithms/detail/overlay/linear_linear.hpp | 1 - .../detail/overlay/pointlike_pointlike.hpp | 3 +-- .../algorithms/detail/within/within_no_turns.hpp | 2 -- .../boost/geometry/algorithms/not_implemented.hpp | 1 - include/boost/geometry/io/svg/svg_mapper.hpp | 1 - include/boost/geometry/io/wkt/detail/wkt_multi.hpp | 3 +-- include/boost/geometry/iterators/point_iterator.hpp | 1 - .../boost/geometry/iterators/point_iterator_type.hpp | 1 - include/boost/geometry/multi/algorithms/append.hpp | 4 ++-- include/boost/geometry/multi/algorithms/area.hpp | 6 +++--- include/boost/geometry/multi/algorithms/centroid.hpp | 6 +++--- include/boost/geometry/multi/algorithms/clear.hpp | 4 ++-- include/boost/geometry/multi/algorithms/convert.hpp | 5 ++--- include/boost/geometry/multi/algorithms/correct.hpp | 6 +++--- .../boost/geometry/multi/algorithms/covered_by.hpp | 8 ++++---- .../multi/algorithms/detail/extreme_points.hpp | 5 ++--- .../multi/algorithms/detail/for_each_range.hpp | 4 ++-- .../algorithms/detail/overlay/copy_segment_point.hpp | 4 ++-- .../algorithms/detail/overlay/copy_segments.hpp | 6 +++--- .../multi/algorithms/detail/overlay/get_ring.hpp | 6 +++--- .../multi/algorithms/detail/overlay/get_turns.hpp | 11 +++++------ .../multi/algorithms/detail/overlay/select_rings.hpp | 6 +++--- .../algorithms/detail/overlay/self_turn_points.hpp | 5 +++-- .../multi/algorithms/detail/point_on_border.hpp | 6 ++++-- .../algorithms/detail/sections/range_by_section.hpp | 7 ++++--- .../algorithms/detail/sections/sectionalize.hpp | 5 +++-- include/boost/geometry/multi/algorithms/envelope.hpp | 9 ++++----- include/boost/geometry/multi/algorithms/equals.hpp | 8 ++++---- include/boost/geometry/multi/algorithms/for_each.hpp | 7 +++---- .../boost/geometry/multi/algorithms/intersection.hpp | 12 ++++++------ include/boost/geometry/multi/algorithms/length.hpp | 4 ++-- .../geometry/multi/algorithms/num_geometries.hpp | 4 ++-- .../geometry/multi/algorithms/num_interior_rings.hpp | 3 +-- .../boost/geometry/multi/algorithms/num_points.hpp | 4 ++-- .../boost/geometry/multi/algorithms/perimeter.hpp | 4 ++-- .../geometry/multi/algorithms/remove_spikes.hpp | 8 ++++---- include/boost/geometry/multi/algorithms/reverse.hpp | 8 ++++---- include/boost/geometry/multi/algorithms/simplify.hpp | 8 +++++--- .../boost/geometry/multi/algorithms/transform.hpp | 6 +++--- include/boost/geometry/multi/algorithms/unique.hpp | 5 +++-- include/boost/geometry/multi/algorithms/within.hpp | 5 ----- 54 files changed, 111 insertions(+), 135 deletions(-) diff --git a/include/boost/geometry/algorithms/detail/disjoint/areal_areal.hpp b/include/boost/geometry/algorithms/detail/disjoint/areal_areal.hpp index 05f264602..140d87daf 100644 --- a/include/boost/geometry/algorithms/detail/disjoint/areal_areal.hpp +++ b/include/boost/geometry/algorithms/detail/disjoint/areal_areal.hpp @@ -22,7 +22,6 @@ #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_DISJOINT_AREAL_AREAL_HPP #include -#include #include #include diff --git a/include/boost/geometry/algorithms/detail/disjoint/linear_areal.hpp b/include/boost/geometry/algorithms/detail/disjoint/linear_areal.hpp index c0ab55578..d4f2bff28 100644 --- a/include/boost/geometry/algorithms/detail/disjoint/linear_areal.hpp +++ b/include/boost/geometry/algorithms/detail/disjoint/linear_areal.hpp @@ -32,7 +32,6 @@ #include #include #include -#include #include #include diff --git a/include/boost/geometry/algorithms/detail/disjoint/linear_linear.hpp b/include/boost/geometry/algorithms/detail/disjoint/linear_linear.hpp index 0eab4c649..52f114edd 100644 --- a/include/boost/geometry/algorithms/detail/disjoint/linear_linear.hpp +++ b/include/boost/geometry/algorithms/detail/disjoint/linear_linear.hpp @@ -30,7 +30,6 @@ #include #include #include -#include #include #include diff --git a/include/boost/geometry/algorithms/detail/distance/backward_compatibility.hpp b/include/boost/geometry/algorithms/detail/distance/backward_compatibility.hpp index 5dd69cbcd..363439d20 100644 --- a/include/boost/geometry/algorithms/detail/distance/backward_compatibility.hpp +++ b/include/boost/geometry/algorithms/detail/distance/backward_compatibility.hpp @@ -25,7 +25,6 @@ #include #include #include -#include #include #include diff --git a/include/boost/geometry/algorithms/detail/distance/box_to_box.hpp b/include/boost/geometry/algorithms/detail/distance/box_to_box.hpp index 7b032a19c..57c908d38 100644 --- a/include/boost/geometry/algorithms/detail/distance/box_to_box.hpp +++ b/include/boost/geometry/algorithms/detail/distance/box_to_box.hpp @@ -12,7 +12,6 @@ #include #include -#include #include #include diff --git a/include/boost/geometry/algorithms/detail/distance/geometry_to_geometry_rtree.hpp b/include/boost/geometry/algorithms/detail/distance/geometry_to_geometry_rtree.hpp index faa1f20a8..078aba793 100644 --- a/include/boost/geometry/algorithms/detail/distance/geometry_to_geometry_rtree.hpp +++ b/include/boost/geometry/algorithms/detail/distance/geometry_to_geometry_rtree.hpp @@ -19,7 +19,6 @@ #include #include -#include #include #include diff --git a/include/boost/geometry/algorithms/detail/distance/interface.hpp b/include/boost/geometry/algorithms/detail/distance/interface.hpp index 506dffbc9..ace6df8ee 100644 --- a/include/boost/geometry/algorithms/detail/distance/interface.hpp +++ b/include/boost/geometry/algorithms/detail/distance/interface.hpp @@ -24,7 +24,6 @@ #include #include -#include #include #include @@ -32,7 +31,6 @@ #include #include -#include #include #include diff --git a/include/boost/geometry/algorithms/detail/distance/multi_to_multi.hpp b/include/boost/geometry/algorithms/detail/distance/multi_to_multi.hpp index 1e6e3c77f..29ceb96be 100644 --- a/include/boost/geometry/algorithms/detail/distance/multi_to_multi.hpp +++ b/include/boost/geometry/algorithms/detail/distance/multi_to_multi.hpp @@ -24,7 +24,6 @@ #include #include #include -#include #include #include diff --git a/include/boost/geometry/algorithms/detail/distance/multipoint_to_range.hpp b/include/boost/geometry/algorithms/detail/distance/multipoint_to_range.hpp index 5a800175c..1774fab72 100644 --- a/include/boost/geometry/algorithms/detail/distance/multipoint_to_range.hpp +++ b/include/boost/geometry/algorithms/detail/distance/multipoint_to_range.hpp @@ -12,9 +12,8 @@ #include -#include -#include -#include +#include +#include #include @@ -22,6 +21,8 @@ #include #include +#include + #include diff --git a/include/boost/geometry/algorithms/detail/distance/range_to_segment_or_box.hpp b/include/boost/geometry/algorithms/detail/distance/range_to_segment_or_box.hpp index edaba1252..8d02e1cce 100644 --- a/include/boost/geometry/algorithms/detail/distance/range_to_segment_or_box.hpp +++ b/include/boost/geometry/algorithms/detail/distance/range_to_segment_or_box.hpp @@ -16,7 +16,6 @@ #include #include -#include #include #include #include diff --git a/include/boost/geometry/algorithms/detail/distance/single_to_multi.hpp b/include/boost/geometry/algorithms/detail/distance/single_to_multi.hpp index f0c18476d..d462a66a5 100644 --- a/include/boost/geometry/algorithms/detail/distance/single_to_multi.hpp +++ b/include/boost/geometry/algorithms/detail/distance/single_to_multi.hpp @@ -23,18 +23,15 @@ #include #include +#include #include #include +#include + #include #include -#include -#include -#include - -#include - #include #include @@ -42,6 +39,8 @@ #include +#include + // includes needed from multi.hpp -- start #include #include @@ -52,7 +51,6 @@ #include #include -#include // includes needed from multi.hpp -- end #include diff --git a/include/boost/geometry/algorithms/detail/equals/collect_vectors.hpp b/include/boost/geometry/algorithms/detail/equals/collect_vectors.hpp index 807848fa0..53de99629 100644 --- a/include/boost/geometry/algorithms/detail/equals/collect_vectors.hpp +++ b/include/boost/geometry/algorithms/detail/equals/collect_vectors.hpp @@ -20,10 +20,10 @@ #include #include -#include - #include #include +#include + #include #include diff --git a/include/boost/geometry/algorithms/detail/overlay/follow_linear_linear.hpp b/include/boost/geometry/algorithms/detail/overlay/follow_linear_linear.hpp index 6407706cb..e93978bb4 100644 --- a/include/boost/geometry/algorithms/detail/overlay/follow_linear_linear.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/follow_linear_linear.hpp @@ -19,7 +19,6 @@ #include #include -#include #include #include diff --git a/include/boost/geometry/algorithms/detail/overlay/linear_linear.hpp b/include/boost/geometry/algorithms/detail/overlay/linear_linear.hpp index 74b9e0134..944c8fd56 100644 --- a/include/boost/geometry/algorithms/detail/overlay/linear_linear.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/linear_linear.hpp @@ -18,7 +18,6 @@ #include #include -#include #include diff --git a/include/boost/geometry/algorithms/detail/overlay/pointlike_pointlike.hpp b/include/boost/geometry/algorithms/detail/overlay/pointlike_pointlike.hpp index 157f1993a..0af062d27 100644 --- a/include/boost/geometry/algorithms/detail/overlay/pointlike_pointlike.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/pointlike_pointlike.hpp @@ -17,10 +17,9 @@ #include #include +#include #include #include -#include -#include #include #include diff --git a/include/boost/geometry/algorithms/detail/within/within_no_turns.hpp b/include/boost/geometry/algorithms/detail/within/within_no_turns.hpp index a9cb49452..8da05e58f 100644 --- a/include/boost/geometry/algorithms/detail/within/within_no_turns.hpp +++ b/include/boost/geometry/algorithms/detail/within/within_no_turns.hpp @@ -134,8 +134,6 @@ struct within_no_turns } }; -// TODO: later move it to directory boost/geometry/multi/algorithms/detail/within - template ::type, diff --git a/include/boost/geometry/algorithms/not_implemented.hpp b/include/boost/geometry/algorithms/not_implemented.hpp index 008f111cc..cd40a2772 100644 --- a/include/boost/geometry/algorithms/not_implemented.hpp +++ b/include/boost/geometry/algorithms/not_implemented.hpp @@ -18,7 +18,6 @@ #include #include -#include namespace boost { namespace geometry diff --git a/include/boost/geometry/io/svg/svg_mapper.hpp b/include/boost/geometry/io/svg/svg_mapper.hpp index fbe0a37da..b53fef2ce 100644 --- a/include/boost/geometry/io/svg/svg_mapper.hpp +++ b/include/boost/geometry/io/svg/svg_mapper.hpp @@ -37,7 +37,6 @@ #include #include -#include #include #include diff --git a/include/boost/geometry/io/wkt/detail/wkt_multi.hpp b/include/boost/geometry/io/wkt/detail/wkt_multi.hpp index 0e5abbca8..2b2d1946a 100644 --- a/include/boost/geometry/io/wkt/detail/wkt_multi.hpp +++ b/include/boost/geometry/io/wkt/detail/wkt_multi.hpp @@ -14,9 +14,8 @@ #ifndef BOOST_GEOMETRY_DOMAINS_GIS_IO_WKT_DETAIL_WKT_MULTI_HPP #define BOOST_GEOMETRY_DOMAINS_GIS_IO_WKT_DETAIL_WKT_MULTI_HPP - +#include #include -#include namespace boost { namespace geometry diff --git a/include/boost/geometry/iterators/point_iterator.hpp b/include/boost/geometry/iterators/point_iterator.hpp index aa01a0eaa..09134b6cd 100644 --- a/include/boost/geometry/iterators/point_iterator.hpp +++ b/include/boost/geometry/iterators/point_iterator.hpp @@ -18,7 +18,6 @@ #include #include #include -#include #include #include diff --git a/include/boost/geometry/iterators/point_iterator_type.hpp b/include/boost/geometry/iterators/point_iterator_type.hpp index 0d6bfcc75..4991b2718 100644 --- a/include/boost/geometry/iterators/point_iterator_type.hpp +++ b/include/boost/geometry/iterators/point_iterator_type.hpp @@ -20,7 +20,6 @@ #include #include #include -#include #include #include diff --git a/include/boost/geometry/multi/algorithms/append.hpp b/include/boost/geometry/multi/algorithms/append.hpp index 3eb606e6c..2a2596c54 100644 --- a/include/boost/geometry/multi/algorithms/append.hpp +++ b/include/boost/geometry/multi/algorithms/append.hpp @@ -21,8 +21,8 @@ #include -#include -#include +#include +#include namespace boost { namespace geometry diff --git a/include/boost/geometry/multi/algorithms/area.hpp b/include/boost/geometry/multi/algorithms/area.hpp index 333499748..1a9598747 100644 --- a/include/boost/geometry/multi/algorithms/area.hpp +++ b/include/boost/geometry/multi/algorithms/area.hpp @@ -18,9 +18,9 @@ #include #include -#include -#include -#include +#include +#include +#include #include #include diff --git a/include/boost/geometry/multi/algorithms/centroid.hpp b/include/boost/geometry/multi/algorithms/centroid.hpp index 82e6a8af8..dcf426de5 100644 --- a/include/boost/geometry/multi/algorithms/centroid.hpp +++ b/include/boost/geometry/multi/algorithms/centroid.hpp @@ -18,9 +18,9 @@ #include #include -#include -#include -#include +#include +#include +#include #include diff --git a/include/boost/geometry/multi/algorithms/clear.hpp b/include/boost/geometry/multi/algorithms/clear.hpp index ea32ee8b4..e00bd01aa 100644 --- a/include/boost/geometry/multi/algorithms/clear.hpp +++ b/include/boost/geometry/multi/algorithms/clear.hpp @@ -15,9 +15,9 @@ #define BOOST_GEOMETRY_MULTI_ALGORITHMS_CLEAR_HPP -#include -#include #include +#include +#include namespace boost { namespace geometry diff --git a/include/boost/geometry/multi/algorithms/convert.hpp b/include/boost/geometry/multi/algorithms/convert.hpp index ccc1835af..1ade9138f 100644 --- a/include/boost/geometry/multi/algorithms/convert.hpp +++ b/include/boost/geometry/multi/algorithms/convert.hpp @@ -18,9 +18,8 @@ #include #include - -#include -#include +#include +#include namespace boost { namespace geometry diff --git a/include/boost/geometry/multi/algorithms/correct.hpp b/include/boost/geometry/multi/algorithms/correct.hpp index d28d1e78e..7821b924c 100644 --- a/include/boost/geometry/multi/algorithms/correct.hpp +++ b/include/boost/geometry/multi/algorithms/correct.hpp @@ -18,10 +18,10 @@ #include #include -#include +#include +#include -#include -#include +#include namespace boost { namespace geometry diff --git a/include/boost/geometry/multi/algorithms/covered_by.hpp b/include/boost/geometry/multi/algorithms/covered_by.hpp index 034304c91..dffd9bd1b 100644 --- a/include/boost/geometry/multi/algorithms/covered_by.hpp +++ b/include/boost/geometry/multi/algorithms/covered_by.hpp @@ -22,10 +22,10 @@ #include -#include -#include -#include -#include +#include +#include +#include +#include #include diff --git a/include/boost/geometry/multi/algorithms/detail/extreme_points.hpp b/include/boost/geometry/multi/algorithms/detail/extreme_points.hpp index 6bf997ed3..5c08f61d2 100644 --- a/include/boost/geometry/multi/algorithms/detail/extreme_points.hpp +++ b/include/boost/geometry/multi/algorithms/detail/extreme_points.hpp @@ -17,11 +17,10 @@ #include -#include -#include - #include +#include +#include namespace boost { namespace geometry diff --git a/include/boost/geometry/multi/algorithms/detail/for_each_range.hpp b/include/boost/geometry/multi/algorithms/detail/for_each_range.hpp index 0938d6a2e..5f5b9a7ec 100644 --- a/include/boost/geometry/multi/algorithms/detail/for_each_range.hpp +++ b/include/boost/geometry/multi/algorithms/detail/for_each_range.hpp @@ -20,8 +20,8 @@ #include -#include -#include +#include +#include namespace boost { namespace geometry diff --git a/include/boost/geometry/multi/algorithms/detail/overlay/copy_segment_point.hpp b/include/boost/geometry/multi/algorithms/detail/overlay/copy_segment_point.hpp index 3f0eea575..2f744e6a1 100644 --- a/include/boost/geometry/multi/algorithms/detail/overlay/copy_segment_point.hpp +++ b/include/boost/geometry/multi/algorithms/detail/overlay/copy_segment_point.hpp @@ -15,10 +15,10 @@ #include -#include -#include #include +#include +#include namespace boost { namespace geometry { diff --git a/include/boost/geometry/multi/algorithms/detail/overlay/copy_segments.hpp b/include/boost/geometry/multi/algorithms/detail/overlay/copy_segments.hpp index e6d62dffb..a856813e0 100644 --- a/include/boost/geometry/multi/algorithms/detail/overlay/copy_segments.hpp +++ b/include/boost/geometry/multi/algorithms/detail/overlay/copy_segments.hpp @@ -15,9 +15,9 @@ #include -#include -#include -#include +#include +#include +#include namespace boost { namespace geometry diff --git a/include/boost/geometry/multi/algorithms/detail/overlay/get_ring.hpp b/include/boost/geometry/multi/algorithms/detail/overlay/get_ring.hpp index 2d04f7ccd..bd3acf1bc 100644 --- a/include/boost/geometry/multi/algorithms/detail/overlay/get_ring.hpp +++ b/include/boost/geometry/multi/algorithms/detail/overlay/get_ring.hpp @@ -14,9 +14,9 @@ #include #include -#include -#include -#include +#include +#include +#include namespace boost { namespace geometry { diff --git a/include/boost/geometry/multi/algorithms/detail/overlay/get_turns.hpp b/include/boost/geometry/multi/algorithms/detail/overlay/get_turns.hpp index 0affcff98..f2d67e3c1 100644 --- a/include/boost/geometry/multi/algorithms/detail/overlay/get_turns.hpp +++ b/include/boost/geometry/multi/algorithms/detail/overlay/get_turns.hpp @@ -9,14 +9,13 @@ #ifndef BOOST_GEOMETRY_MULTI_ALGORITHMS_DETAIL_OVERLAY_GET_TURNS_HPP #define BOOST_GEOMETRY_MULTI_ALGORITHMS_DETAIL_OVERLAY_GET_TURNS_HPP - -#include -#include -#include - #include -#include +#include +#include +#include + +#include #include #include diff --git a/include/boost/geometry/multi/algorithms/detail/overlay/select_rings.hpp b/include/boost/geometry/multi/algorithms/detail/overlay/select_rings.hpp index acb91f7dd..7c5040b40 100644 --- a/include/boost/geometry/multi/algorithms/detail/overlay/select_rings.hpp +++ b/include/boost/geometry/multi/algorithms/detail/overlay/select_rings.hpp @@ -12,11 +12,11 @@ #include -#include -#include - #include +#include +#include + namespace boost { namespace geometry { diff --git a/include/boost/geometry/multi/algorithms/detail/overlay/self_turn_points.hpp b/include/boost/geometry/multi/algorithms/detail/overlay/self_turn_points.hpp index 165ead6f7..acb0d3246 100644 --- a/include/boost/geometry/multi/algorithms/detail/overlay/self_turn_points.hpp +++ b/include/boost/geometry/multi/algorithms/detail/overlay/self_turn_points.hpp @@ -10,10 +10,11 @@ #define BOOST_GEOMETRY_MULTI_ALGORITHMS_DETAIL_OVERLAY_SELF_TURN_POINTS_HPP -#include -#include #include +#include +#include + namespace boost { namespace geometry { diff --git a/include/boost/geometry/multi/algorithms/detail/point_on_border.hpp b/include/boost/geometry/multi/algorithms/detail/point_on_border.hpp index bbf958571..8585c2f23 100644 --- a/include/boost/geometry/multi/algorithms/detail/point_on_border.hpp +++ b/include/boost/geometry/multi/algorithms/detail/point_on_border.hpp @@ -17,12 +17,14 @@ #ifndef BOOST_GEOMETRY_MULTI_ALGORITHMS_DETAIL_POINT_ON_BORDER_HPP #define BOOST_GEOMETRY_MULTI_ALGORITHMS_DETAIL_POINT_ON_BORDER_HPP + #include -#include -#include #include +#include +#include + namespace boost { namespace geometry { diff --git a/include/boost/geometry/multi/algorithms/detail/sections/range_by_section.hpp b/include/boost/geometry/multi/algorithms/detail/sections/range_by_section.hpp index b5b041c1f..ecdcbe6c5 100644 --- a/include/boost/geometry/multi/algorithms/detail/sections/range_by_section.hpp +++ b/include/boost/geometry/multi/algorithms/detail/sections/range_by_section.hpp @@ -21,11 +21,12 @@ #include #include -#include -#include -#include #include +#include +#include +#include + namespace boost { namespace geometry { diff --git a/include/boost/geometry/multi/algorithms/detail/sections/sectionalize.hpp b/include/boost/geometry/multi/algorithms/detail/sections/sectionalize.hpp index 1778fe9eb..4eecc4a4c 100644 --- a/include/boost/geometry/multi/algorithms/detail/sections/sectionalize.hpp +++ b/include/boost/geometry/multi/algorithms/detail/sections/sectionalize.hpp @@ -23,10 +23,11 @@ #include #include -#include -#include #include +#include +#include + namespace boost { namespace geometry { diff --git a/include/boost/geometry/multi/algorithms/envelope.hpp b/include/boost/geometry/multi/algorithms/envelope.hpp index b70aab41e..2e3e92bc6 100644 --- a/include/boost/geometry/multi/algorithms/envelope.hpp +++ b/include/boost/geometry/multi/algorithms/envelope.hpp @@ -18,13 +18,12 @@ #include - -#include #include -#include -#include -#include +#include +#include +#include +#include namespace boost { namespace geometry diff --git a/include/boost/geometry/multi/algorithms/equals.hpp b/include/boost/geometry/multi/algorithms/equals.hpp index 54cd07504..295223e58 100644 --- a/include/boost/geometry/multi/algorithms/equals.hpp +++ b/include/boost/geometry/multi/algorithms/equals.hpp @@ -15,12 +15,12 @@ #define BOOST_GEOMETRY_MULTI_ALGORITHMS_EQUALS_HPP -#include -#include -#include - #include +#include +#include +#include + namespace boost { namespace geometry { diff --git a/include/boost/geometry/multi/algorithms/for_each.hpp b/include/boost/geometry/multi/algorithms/for_each.hpp index 9712b9c45..e1780e8ea 100644 --- a/include/boost/geometry/multi/algorithms/for_each.hpp +++ b/include/boost/geometry/multi/algorithms/for_each.hpp @@ -18,12 +18,11 @@ #include #include -#include -#include -#include - #include +#include +#include +#include namespace boost { namespace geometry diff --git a/include/boost/geometry/multi/algorithms/intersection.hpp b/include/boost/geometry/multi/algorithms/intersection.hpp index 3b7f9d572..e21067eb0 100644 --- a/include/boost/geometry/multi/algorithms/intersection.hpp +++ b/include/boost/geometry/multi/algorithms/intersection.hpp @@ -10,12 +10,12 @@ #define BOOST_GEOMETRY_MULTI_ALGORITHMS_INTERSECTION_HPP -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include #include #include diff --git a/include/boost/geometry/multi/algorithms/length.hpp b/include/boost/geometry/multi/algorithms/length.hpp index e18cbe3d9..7e4ddbae0 100644 --- a/include/boost/geometry/multi/algorithms/length.hpp +++ b/include/boost/geometry/multi/algorithms/length.hpp @@ -18,8 +18,8 @@ #include #include -#include -#include +#include +#include #include #include diff --git a/include/boost/geometry/multi/algorithms/num_geometries.hpp b/include/boost/geometry/multi/algorithms/num_geometries.hpp index a102d08f2..1336b3c94 100644 --- a/include/boost/geometry/multi/algorithms/num_geometries.hpp +++ b/include/boost/geometry/multi/algorithms/num_geometries.hpp @@ -21,8 +21,8 @@ #include #include -#include -#include +#include +#include namespace boost { namespace geometry diff --git a/include/boost/geometry/multi/algorithms/num_interior_rings.hpp b/include/boost/geometry/multi/algorithms/num_interior_rings.hpp index e43b31d16..5b52508b7 100644 --- a/include/boost/geometry/multi/algorithms/num_interior_rings.hpp +++ b/include/boost/geometry/multi/algorithms/num_interior_rings.hpp @@ -20,8 +20,7 @@ #include #include -#include -#include +#include #include diff --git a/include/boost/geometry/multi/algorithms/num_points.hpp b/include/boost/geometry/multi/algorithms/num_points.hpp index 294c08603..180523a98 100644 --- a/include/boost/geometry/multi/algorithms/num_points.hpp +++ b/include/boost/geometry/multi/algorithms/num_points.hpp @@ -18,8 +18,8 @@ #include -#include -#include +#include +#include #include diff --git a/include/boost/geometry/multi/algorithms/perimeter.hpp b/include/boost/geometry/multi/algorithms/perimeter.hpp index df13f200e..6b651b3ab 100644 --- a/include/boost/geometry/multi/algorithms/perimeter.hpp +++ b/include/boost/geometry/multi/algorithms/perimeter.hpp @@ -19,8 +19,8 @@ #include -#include -#include +#include +#include #include #include diff --git a/include/boost/geometry/multi/algorithms/remove_spikes.hpp b/include/boost/geometry/multi/algorithms/remove_spikes.hpp index eb08ab11d..25076a2fd 100644 --- a/include/boost/geometry/multi/algorithms/remove_spikes.hpp +++ b/include/boost/geometry/multi/algorithms/remove_spikes.hpp @@ -13,10 +13,10 @@ #define BOOST_GEOMETRY_MULTI_ALGORITHMS_REMOVE_SPIKES_HPP -#include -#include -#include -#include +#include +#include +#include +#include #include diff --git a/include/boost/geometry/multi/algorithms/reverse.hpp b/include/boost/geometry/multi/algorithms/reverse.hpp index 7a4938ef8..70c37d50d 100644 --- a/include/boost/geometry/multi/algorithms/reverse.hpp +++ b/include/boost/geometry/multi/algorithms/reverse.hpp @@ -18,12 +18,12 @@ #include #include + +#include +#include + #include -#include -#include - - namespace boost { namespace geometry { diff --git a/include/boost/geometry/multi/algorithms/simplify.hpp b/include/boost/geometry/multi/algorithms/simplify.hpp index 2c7461b66..30e45c5f1 100644 --- a/include/boost/geometry/multi/algorithms/simplify.hpp +++ b/include/boost/geometry/multi/algorithms/simplify.hpp @@ -14,14 +14,16 @@ #ifndef BOOST_GEOMETRY_MULTI_ALGORITHMS_SIMPLIFY_HPP #define BOOST_GEOMETRY_MULTI_ALGORITHMS_SIMPLIFY_HPP + #include +#include + #include -#include -#include +#include +#include #include -#include namespace boost { namespace geometry diff --git a/include/boost/geometry/multi/algorithms/transform.hpp b/include/boost/geometry/multi/algorithms/transform.hpp index 13c53e615..d4c83f05c 100644 --- a/include/boost/geometry/multi/algorithms/transform.hpp +++ b/include/boost/geometry/multi/algorithms/transform.hpp @@ -16,11 +16,11 @@ #include -#include #include -#include -#include +#include +#include +#include namespace boost { namespace geometry { diff --git a/include/boost/geometry/multi/algorithms/unique.hpp b/include/boost/geometry/multi/algorithms/unique.hpp index 64c56aafb..d20de8ab7 100644 --- a/include/boost/geometry/multi/algorithms/unique.hpp +++ b/include/boost/geometry/multi/algorithms/unique.hpp @@ -18,8 +18,9 @@ #include #include -#include -#include + +#include +#include namespace boost { namespace geometry diff --git a/include/boost/geometry/multi/algorithms/within.hpp b/include/boost/geometry/multi/algorithms/within.hpp index 8c3cc8a3a..9fdc5dd39 100644 --- a/include/boost/geometry/multi/algorithms/within.hpp +++ b/include/boost/geometry/multi/algorithms/within.hpp @@ -22,9 +22,4 @@ #include -#include -#include -#include -#include - #endif // BOOST_GEOMETRY_MULTI_ALGORITHMS_WITHIN_HPP From 55e684c64c715763ea83cf4d2a02393bb9bdb1b7 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Wed, 4 Jun 2014 15:53:46 +0200 Subject: [PATCH 12/27] [multi][algorithm/detail] Move most of the code of details from multi/ directory. This commit doesn't move for_each_range. Details used only by multi/algorithms aren't moved as well. --- .../algorithms/detail/extreme_points.hpp | 24 ++++ .../detail/overlay/copy_segment_point.hpp | 85 +++++++++++++ .../detail/overlay/copy_segments.hpp | 49 +++++++- .../algorithms/detail/overlay/get_ring.hpp | 24 +++- .../algorithms/detail/overlay/get_turns.hpp | 72 ++++++++++- .../detail/overlay/select_rings.hpp | 31 ++++- .../detail/overlay/self_turn_points.hpp | 16 +++ .../algorithms/detail/point_on_border.hpp | 60 +++++++++ .../detail/sections/range_by_section.hpp | 62 +++++++++- .../detail/sections/sectionalize.hpp | 73 ++++++++++- .../algorithms/detail/extreme_points.hpp | 48 -------- .../detail/overlay/copy_segment_point.hpp | 116 ------------------ .../detail/overlay/copy_segments.hpp | 71 ----------- .../algorithms/detail/overlay/get_ring.hpp | 40 ------ .../algorithms/detail/overlay/get_turns.hpp | 93 +------------- .../detail/overlay/select_rings.hpp | 49 -------- .../detail/overlay/self_turn_points.hpp | 33 ----- .../algorithms/detail/point_on_border.hpp | 89 -------------- .../detail/sections/range_by_section.hpp | 86 +------------ .../detail/sections/sectionalize.hpp | 98 --------------- 20 files changed, 481 insertions(+), 738 deletions(-) diff --git a/include/boost/geometry/algorithms/detail/extreme_points.hpp b/include/boost/geometry/algorithms/detail/extreme_points.hpp index 772735522..ac522f995 100644 --- a/include/boost/geometry/algorithms/detail/extreme_points.hpp +++ b/include/boost/geometry/algorithms/detail/extreme_points.hpp @@ -21,6 +21,7 @@ #include #include #include +#include #include #include @@ -451,6 +452,29 @@ struct extreme_points } }; +template +struct extreme_points +{ + template + static inline bool apply(MultiPolygon const& multi, Extremes& extremes, Intruders& intruders) + { + // Get one for the very first polygon, that is (for the moment) enough. + // It is not guaranteed the "extreme" then, but for the current purpose + // (point_on_surface) it can just be this point. + if (boost::size(multi) >= 1) + { + return extreme_points + < + typename boost::range_value::type, + Dimension, + polygon_tag + >::apply(*boost::begin(multi), extremes, intruders); + } + + return false; + } +}; + } // namespace dispatch #endif // DOXYGEN_NO_DISPATCH diff --git a/include/boost/geometry/algorithms/detail/overlay/copy_segment_point.hpp b/include/boost/geometry/algorithms/detail/overlay/copy_segment_point.hpp index 5e18d0453..4040fbe6b 100644 --- a/include/boost/geometry/algorithms/detail/overlay/copy_segment_point.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/copy_segment_point.hpp @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -124,6 +125,30 @@ struct copy_segment_point_box }; +template +< + typename MultiGeometry, + typename SegmentIdentifier, + typename PointOut, + typename Policy +> +struct copy_segment_point_multi +{ + static inline bool apply(MultiGeometry const& multi, + SegmentIdentifier const& seg_id, bool second, + PointOut& point) + { + + BOOST_ASSERT + ( + seg_id.multi_index >= 0 + && seg_id.multi_index < int(boost::size(multi)) + ); + + // Call the single-version + return Policy::apply(multi[seg_id.multi_index], seg_id, second, point); + } +}; }} // namespace detail::copy_segments @@ -188,6 +213,66 @@ struct copy_segment_point {}; +template +< + typename MultiGeometry, + bool Reverse, + typename SegmentIdentifier, + typename PointOut +> +struct copy_segment_point + < + multi_polygon_tag, + MultiGeometry, + Reverse, + SegmentIdentifier, + PointOut + > + : detail::copy_segments::copy_segment_point_multi + < + MultiGeometry, + SegmentIdentifier, + PointOut, + detail::copy_segments::copy_segment_point_polygon + < + typename boost::range_value::type, + Reverse, + SegmentIdentifier, + PointOut + > + > +{}; + +template +< + typename MultiGeometry, + bool Reverse, + typename SegmentIdentifier, + typename PointOut +> +struct copy_segment_point + < + multi_linestring_tag, + MultiGeometry, + Reverse, + SegmentIdentifier, + PointOut + > + : detail::copy_segments::copy_segment_point_multi + < + MultiGeometry, + SegmentIdentifier, + PointOut, + detail::copy_segments::copy_segment_point_range + < + typename boost::range_value::type, + Reverse, + SegmentIdentifier, + PointOut + > + > +{}; + } // namespace dispatch #endif // DOXYGEN_NO_DISPATCH diff --git a/include/boost/geometry/algorithms/detail/overlay/copy_segments.hpp b/include/boost/geometry/algorithms/detail/overlay/copy_segments.hpp index f7fee8bb9..d4bf0a90f 100644 --- a/include/boost/geometry/algorithms/detail/overlay/copy_segments.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/copy_segments.hpp @@ -15,19 +15,21 @@ #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_COPY_SEGMENTS_HPP -#include -#include -#include #include +#include #include +#include #include +#include #include #include #include #include +#include +#include #include #include #include @@ -37,6 +39,7 @@ #include #include + namespace boost { namespace geometry { @@ -239,6 +242,37 @@ struct copy_segments_box }; +template +struct copy_segments_multi +{ + template + < + typename MultiGeometry, + typename SegmentIdentifier, + typename RobustPolicy, + typename RangeOut + > + static inline void apply(MultiGeometry const& multi_geometry, + SegmentIdentifier const& seg_id, int to_index, + RobustPolicy const& robust_policy, + RangeOut& current_output) + { + + BOOST_ASSERT + ( + seg_id.multi_index >= 0 + && seg_id.multi_index < int(boost::size(multi_geometry)) + ); + + // Call the single-version + Policy::apply(multi_geometry[seg_id.multi_index], + seg_id, to_index, + robust_policy, + current_output); + } +}; + + }} // namespace detail::copy_segments #endif // DOXYGEN_NO_DETAIL @@ -279,6 +313,15 @@ struct copy_segments {}; +template +struct copy_segments + : detail::copy_segments::copy_segments_multi + < + detail::copy_segments::copy_segments_polygon + > +{}; + + } // namespace dispatch #endif // DOXYGEN_NO_DISPATCH diff --git a/include/boost/geometry/algorithms/detail/overlay/get_ring.hpp b/include/boost/geometry/algorithms/detail/overlay/get_ring.hpp index c2c698057..ab9219a3d 100644 --- a/include/boost/geometry/algorithms/detail/overlay/get_ring.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/get_ring.hpp @@ -13,11 +13,12 @@ #include #include - -#include #include #include +#include +#include #include +#include namespace boost { namespace geometry @@ -92,6 +93,25 @@ struct get_ring }; +template<> +struct get_ring +{ + template + static inline typename ring_type::type const& apply( + ring_identifier const& id, + MultiPolygon const& multi_polygon) + { + BOOST_ASSERT + ( + id.multi_index >= 0 + && id.multi_index < int(boost::size(multi_polygon)) + ); + return get_ring::apply(id, + multi_polygon[id.multi_index]); + } +}; + + }} // namespace detail::overlay #endif // DOXYGEN_NO_DETAIL diff --git a/include/boost/geometry/algorithms/detail/overlay/get_turns.hpp b/include/boost/geometry/algorithms/detail/overlay/get_turns.hpp index 14220e87b..4fdfb0240 100644 --- a/include/boost/geometry/algorithms/detail/overlay/get_turns.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/get_turns.hpp @@ -26,11 +26,11 @@ #include #include -#include - #include #include +#include #include +#include #include @@ -50,19 +50,19 @@ #include #include + #include #include + #include #include #include - #include - #include +#include #include -#include #ifdef BOOST_GEOMETRY_DEBUG_INTERSECTION # include @@ -764,6 +764,45 @@ struct get_turns_polygon_cs } }; + +template +< + typename Multi, typename Box, + bool Reverse, bool ReverseBox, + typename TurnPolicy +> +struct get_turns_multi_polygon_cs +{ + template + static inline void apply( + int source_id1, Multi const& multi, + int source_id2, Box const& box, + RobustPolicy const& robust_policy, + Turns& turns, InterruptPolicy& interrupt_policy) + { + typedef typename boost::range_iterator + < + Multi const + >::type iterator_type; + + int i = 0; + for (iterator_type it = boost::begin(multi); + it != boost::end(multi); + ++it, ++i) + { + // Call its single version + get_turns_polygon_cs + < + typename boost::range_value::type, Box, + Reverse, ReverseBox, + TurnPolicy + >::apply(source_id1, *it, source_id2, box, + robust_policy, turns, interrupt_policy, i); + } + } +}; + + // GET_TURN_INFO_TYPE template @@ -878,6 +917,29 @@ struct get_turns {}; +template +< + typename MultiPolygon, + typename Box, + bool ReverseMultiPolygon, bool ReverseBox, + typename TurnPolicy +> +struct get_turns + < + multi_polygon_tag, box_tag, + MultiPolygon, Box, + ReverseMultiPolygon, ReverseBox, + TurnPolicy + > + : detail::get_turns::get_turns_multi_polygon_cs + < + MultiPolygon, Box, + ReverseMultiPolygon, ReverseBox, + TurnPolicy + > +{}; + + template < typename GeometryTag1, typename GeometryTag2, diff --git a/include/boost/geometry/algorithms/detail/overlay/select_rings.hpp b/include/boost/geometry/algorithms/detail/overlay/select_rings.hpp index 487bd6c37..5d21c8f51 100644 --- a/include/boost/geometry/algorithms/detail/overlay/select_rings.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/select_rings.hpp @@ -9,8 +9,12 @@ #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_SELECT_RINGS_HPP #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_SELECT_RINGS_HPP + #include +#include + +#include #include #include @@ -118,7 +122,32 @@ namespace dispatch } } }; -} + + template + struct select_rings + { + template + static inline void apply(Multi const& multi, Geometry const& geometry, + ring_identifier id, Map& map, bool midpoint) + { + typedef typename boost::range_iterator + < + Multi const + >::type iterator_type; + + typedef select_rings::type> per_polygon; + + id.multi_index = 0; + for (iterator_type it = boost::begin(multi); it != boost::end(multi); ++it) + { + id.ring_index = -1; + per_polygon::apply(*it, geometry, id, map, midpoint); + id.multi_index++; + } + } + }; + +} // namespace dispatch template diff --git a/include/boost/geometry/algorithms/detail/overlay/self_turn_points.hpp b/include/boost/geometry/algorithms/detail/overlay/self_turn_points.hpp index e2a21a0fe..bcf64a4f6 100644 --- a/include/boost/geometry/algorithms/detail/overlay/self_turn_points.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/self_turn_points.hpp @@ -9,12 +9,14 @@ #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_SELF_TURN_POINTS_HPP #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_SELF_TURN_POINTS_HPP + #include #include #include #include +#include #include @@ -224,6 +226,20 @@ struct self_get_turn_points {}; +template +< + typename MultiPolygon, + typename TurnPolicy +> +struct self_get_turn_points + < + multi_polygon_tag, MultiPolygon, + TurnPolicy + > + : detail::self_get_turn_points::get_turns +{}; + + } // namespace dispatch #endif // DOXYGEN_NO_DISPATCH diff --git a/include/boost/geometry/algorithms/detail/point_on_border.hpp b/include/boost/geometry/algorithms/detail/point_on_border.hpp index d99ab3c90..24b88a8d1 100644 --- a/include/boost/geometry/algorithms/detail/point_on_border.hpp +++ b/include/boost/geometry/algorithms/detail/point_on_border.hpp @@ -19,6 +19,7 @@ #include +#include #include #include @@ -153,6 +154,35 @@ struct point_on_box }; +template +< + typename Point, + typename MultiGeometry, + typename Policy +> +struct point_on_multi +{ + static inline bool apply(Point& point, MultiGeometry const& multi, bool midpoint) + { + // Take a point on the first multi-geometry + // (i.e. the first that is not empty) + for (typename boost::range_iterator + < + MultiGeometry const + >::type it = boost::begin(multi); + it != boost::end(multi); + ++it) + { + if (Policy::apply(point, *it, midpoint)) + { + return true; + } + } + return false; + } +}; + + }} // namespace detail::point_on_border #endif // DOXYGEN_NO_DETAIL @@ -203,6 +233,36 @@ struct point_on_border {}; +template +struct point_on_border + : detail::point_on_border::point_on_multi + < + Point, + Multi, + detail::point_on_border::point_on_polygon + < + Point, + typename boost::range_value::type + > + > +{}; + + +template +struct point_on_border + : detail::point_on_border::point_on_multi + < + Point, + Multi, + detail::point_on_border::point_on_range + < + Point, + typename boost::range_value::type + > + > +{}; + + } // namespace dispatch #endif // DOXYGEN_NO_DISPATCH diff --git a/include/boost/geometry/algorithms/detail/sections/range_by_section.hpp b/include/boost/geometry/algorithms/detail/sections/range_by_section.hpp index ad62f232b..4ef11175f 100644 --- a/include/boost/geometry/algorithms/detail/sections/range_by_section.hpp +++ b/include/boost/geometry/algorithms/detail/sections/range_by_section.hpp @@ -7,14 +7,19 @@ // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. +// This file was modified by Oracle on 2013. +// Modifications copyright (c) 2013, Oracle and/or its affiliates. + // Use, modification and distribution is 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) +// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle + #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_SECTIONS_RANGE_BY_SECTION_HPP #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_SECTIONS_RANGE_BY_SECTION_HPP - +#include #include #include @@ -22,7 +27,9 @@ #include #include #include - +#include +#include +#include namespace boost { namespace geometry @@ -55,6 +62,28 @@ struct full_section_polygon }; +template +< + typename MultiGeometry, + typename Section, + typename Policy +> +struct full_section_multi +{ + static inline typename ring_return_type::type apply( + MultiGeometry const& multi, Section const& section) + { + BOOST_ASSERT + ( + section.ring_id.multi_index >= 0 + && section.ring_id.multi_index < int(boost::size(multi)) + ); + + return Policy::apply(multi[section.ring_id.multi_index], section); + } +}; + + }} // namespace detail::section #endif @@ -98,6 +127,35 @@ struct range_by_section {}; +template +struct range_by_section + : detail::section::full_section_multi + < + MultiPolygon, + Section, + detail::section::full_section_polygon + < + typename boost::range_value::type, + Section + > + > +{}; + +template +struct range_by_section + : detail::section::full_section_multi + < + MultiLinestring, + Section, + detail::section::full_section_range + < + typename boost::range_value::type, + Section + > + > +{}; + + } // namespace dispatch #endif diff --git a/include/boost/geometry/algorithms/detail/sections/sectionalize.hpp b/include/boost/geometry/algorithms/detail/sections/sectionalize.hpp index e6b4c2607..fa14fa36f 100644 --- a/include/boost/geometry/algorithms/detail/sections/sectionalize.hpp +++ b/include/boost/geometry/algorithms/detail/sections/sectionalize.hpp @@ -4,8 +4,8 @@ // Copyright (c) 2008-2012 Bruno Lalande, Paris, France. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK. -// This file was modified by Oracle on 2014. -// Modifications copyright (c) 2014 Oracle and/or its affiliates. +// This file was modified by Oracle on 2013, 2014. +// Modifications copyright (c) 2013, 2014 Oracle and/or its affiliates. // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. @@ -22,6 +22,7 @@ #include #include +#include #include #include #include @@ -36,7 +37,7 @@ #include #include #include - +#include #include #include @@ -46,8 +47,6 @@ #include #include - - namespace boost { namespace geometry { @@ -556,6 +555,31 @@ struct sectionalize_box } }; +template +struct sectionalize_multi +{ + template + < + typename MultiGeometry, + typename RobustPolicy, + typename Sections + > + static inline void apply(MultiGeometry const& multi, + RobustPolicy const& robust_policy, + bool make_rescaled_boxes, + Sections& sections, ring_identifier ring_id, std::size_t max_count) + { + ring_id.multi_index = 0; + for (typename boost::range_iterator::type + it = boost::begin(multi); + it != boost::end(multi); + ++it, ++ring_id.multi_index) + { + Policy::apply(*it, robust_policy, make_rescaled_boxes, sections, ring_id, max_count); + } + } +}; + template inline void set_section_unique_ids(Sections& sections) { @@ -675,6 +699,45 @@ struct sectionalize > {}; +template +< + typename MultiPolygon, + bool Reverse, + std::size_t DimensionCount +> +struct sectionalize + : detail::sectionalize::sectionalize_multi + < + DimensionCount, + detail::sectionalize::sectionalize_polygon + < + Reverse, + DimensionCount + > + > + +{}; + +template +< + typename MultiLinestring, + bool Reverse, + std::size_t DimensionCount +> +struct sectionalize + : detail::sectionalize::sectionalize_multi + < + DimensionCount, + detail::sectionalize::sectionalize_range + < + closed, false, + typename point_type::type, + DimensionCount + > + > + +{}; + } // namespace dispatch #endif diff --git a/include/boost/geometry/multi/algorithms/detail/extreme_points.hpp b/include/boost/geometry/multi/algorithms/detail/extreme_points.hpp index 5c08f61d2..da2ac5e9f 100644 --- a/include/boost/geometry/multi/algorithms/detail/extreme_points.hpp +++ b/include/boost/geometry/multi/algorithms/detail/extreme_points.hpp @@ -13,55 +13,7 @@ #define BOOST_GEOMETRY_MULTI_ALGORITHMS_DETAIL_EXTREME_POINTS_HPP -#include - -#include - #include -#include -#include - - -namespace boost { namespace geometry -{ - - -#ifndef DOXYGEN_NO_DISPATCH -namespace dispatch -{ - - - -template -struct extreme_points -{ - template - static inline bool apply(MultiPolygon const& multi, Extremes& extremes, Intruders& intruders) - { - // Get one for the very first polygon, that is (for the moment) enough. - // It is not guaranteed the "extreme" then, but for the current purpose - // (point_on_surface) it can just be this point. - if (boost::size(multi) >= 1) - { - return extreme_points - < - typename boost::range_value::type, - Dimension, - polygon_tag - >::apply(*boost::begin(multi), extremes, intruders); - } - - return false; - } -}; - - -} // namespace dispatch -#endif // DOXYGEN_NO_DISPATCH - - -}} // namespace boost::geometry - #endif // BOOST_GEOMETRY_MULTI_ALGORITHMS_DETAIL_EXTREME_POINTS_HPP diff --git a/include/boost/geometry/multi/algorithms/detail/overlay/copy_segment_point.hpp b/include/boost/geometry/multi/algorithms/detail/overlay/copy_segment_point.hpp index 2f744e6a1..5e23cf4ba 100644 --- a/include/boost/geometry/multi/algorithms/detail/overlay/copy_segment_point.hpp +++ b/include/boost/geometry/multi/algorithms/detail/overlay/copy_segment_point.hpp @@ -13,123 +13,7 @@ #define BOOST_GEOMETRY_MULTI_ALGORITHMS_DETAIL_OVERLAY_COPY_SEGMENT_POINT_HPP -#include - #include -#include -#include - -namespace boost { namespace geometry -{ - - -#ifndef DOXYGEN_NO_DETAIL -namespace detail { namespace copy_segments -{ - - -template -< - typename MultiGeometry, - typename SegmentIdentifier, - typename PointOut, - typename Policy -> -struct copy_segment_point_multi -{ - static inline bool apply(MultiGeometry const& multi, - SegmentIdentifier const& seg_id, bool second, - PointOut& point) - { - - BOOST_ASSERT - ( - seg_id.multi_index >= 0 - && seg_id.multi_index < int(boost::size(multi)) - ); - - // Call the single-version - return Policy::apply(multi[seg_id.multi_index], seg_id, second, point); - } -}; - - -}} // namespace detail::copy_segments -#endif // DOXYGEN_NO_DETAIL - - -#ifndef DOXYGEN_NO_DISPATCH -namespace dispatch -{ - - -template -< - typename MultiGeometry, - bool Reverse, - typename SegmentIdentifier, - typename PointOut -> -struct copy_segment_point - < - multi_polygon_tag, - MultiGeometry, - Reverse, - SegmentIdentifier, - PointOut - > - : detail::copy_segments::copy_segment_point_multi - < - MultiGeometry, - SegmentIdentifier, - PointOut, - detail::copy_segments::copy_segment_point_polygon - < - typename boost::range_value::type, - Reverse, - SegmentIdentifier, - PointOut - > - > -{}; - -template -< - typename MultiGeometry, - bool Reverse, - typename SegmentIdentifier, - typename PointOut -> -struct copy_segment_point - < - multi_linestring_tag, - MultiGeometry, - Reverse, - SegmentIdentifier, - PointOut - > - : detail::copy_segments::copy_segment_point_multi - < - MultiGeometry, - SegmentIdentifier, - PointOut, - detail::copy_segments::copy_segment_point_range - < - typename boost::range_value::type, - Reverse, - SegmentIdentifier, - PointOut - > - > -{}; - - -} // namespace dispatch -#endif // DOXYGEN_NO_DISPATCH - - -}} // namespace boost::geometry - #endif // BOOST_GEOMETRY_MULTI_ALGORITHMS_DETAIL_OVERLAY_COPY_SEGMENT_POINT_HPP diff --git a/include/boost/geometry/multi/algorithms/detail/overlay/copy_segments.hpp b/include/boost/geometry/multi/algorithms/detail/overlay/copy_segments.hpp index a856813e0..54114bfae 100644 --- a/include/boost/geometry/multi/algorithms/detail/overlay/copy_segments.hpp +++ b/include/boost/geometry/multi/algorithms/detail/overlay/copy_segments.hpp @@ -10,78 +10,7 @@ #define BOOST_GEOMETRY_MULTI_ALGORITHMS_DETAIL_OVERLAY_COPY_SEGMENTS_HPP -#include -#include - #include -#include -#include -#include - - -namespace boost { namespace geometry -{ - -#ifndef DOXYGEN_NO_DETAIL -namespace detail { namespace copy_segments -{ - - -template -struct copy_segments_multi -{ - template - < - typename MultiGeometry, - typename SegmentIdentifier, - typename RobustPolicy, - typename RangeOut - > - static inline void apply(MultiGeometry const& multi_geometry, - SegmentIdentifier const& seg_id, int to_index, - RobustPolicy const& robust_policy, - RangeOut& current_output) - { - - BOOST_ASSERT - ( - seg_id.multi_index >= 0 - && seg_id.multi_index < int(boost::size(multi_geometry)) - ); - - // Call the single-version - Policy::apply(multi_geometry[seg_id.multi_index], - seg_id, to_index, - robust_policy, - current_output); - } -}; - - -}} // namespace detail::copy_segments -#endif // DOXYGEN_NO_DETAIL - - -#ifndef DOXYGEN_NO_DISPATCH -namespace dispatch -{ - - -template -struct copy_segments - : detail::copy_segments::copy_segments_multi - < - detail::copy_segments::copy_segments_polygon - > -{}; - - -} // namespace dispatch -#endif // DOXYGEN_NO_DISPATCH - - -}} // namespace boost::geometry - #endif // BOOST_GEOMETRY_MULTI_ALGORITHMS_DETAIL_OVERLAY_COPY_SEGMENTS_HPP diff --git a/include/boost/geometry/multi/algorithms/detail/overlay/get_ring.hpp b/include/boost/geometry/multi/algorithms/detail/overlay/get_ring.hpp index bd3acf1bc..65e00d064 100644 --- a/include/boost/geometry/multi/algorithms/detail/overlay/get_ring.hpp +++ b/include/boost/geometry/multi/algorithms/detail/overlay/get_ring.hpp @@ -10,47 +10,7 @@ #define BOOST_GEOMETRY_MULTI_ALGORITHMS_DETAIL_OVERLAY_GET_RING_HPP -#include -#include - #include -#include -#include -#include - -namespace boost { namespace geometry -{ - - -#ifndef DOXYGEN_NO_DETAIL -namespace detail { namespace overlay -{ - -template<> -struct get_ring -{ - template - static inline typename ring_type::type const& apply( - ring_identifier const& id, - MultiPolygon const& multi_polygon) - { - BOOST_ASSERT - ( - id.multi_index >= 0 - && id.multi_index < int(boost::size(multi_polygon)) - ); - return get_ring::apply(id, - multi_polygon[id.multi_index]); - } -}; - - - -}} // namespace detail::overlay -#endif // DOXYGEN_NO_DETAIL - - -}} // namespace boost::geometry #endif // BOOST_GEOMETRY_MULTI_ALGORITHMS_DETAIL_OVERLAY_GET_RING_HPP diff --git a/include/boost/geometry/multi/algorithms/detail/overlay/get_turns.hpp b/include/boost/geometry/multi/algorithms/detail/overlay/get_turns.hpp index f2d67e3c1..a83fb7739 100644 --- a/include/boost/geometry/multi/algorithms/detail/overlay/get_turns.hpp +++ b/include/boost/geometry/multi/algorithms/detail/overlay/get_turns.hpp @@ -9,99 +9,8 @@ #ifndef BOOST_GEOMETRY_MULTI_ALGORITHMS_DETAIL_OVERLAY_GET_TURNS_HPP #define BOOST_GEOMETRY_MULTI_ALGORITHMS_DETAIL_OVERLAY_GET_TURNS_HPP + #include -#include -#include -#include - -#include - -#include -#include - - -namespace boost { namespace geometry -{ - - -#ifndef DOXYGEN_NO_DETAIL -namespace detail { namespace get_turns -{ - -template -< - typename Multi, typename Box, - bool Reverse, bool ReverseBox, - typename TurnPolicy -> -struct get_turns_multi_polygon_cs -{ - template - static inline void apply( - int source_id1, Multi const& multi, - int source_id2, Box const& box, - RobustPolicy const& robust_policy, - Turns& turns, InterruptPolicy& interrupt_policy) - { - typedef typename boost::range_iterator - < - Multi const - >::type iterator_type; - - int i = 0; - for (iterator_type it = boost::begin(multi); - it != boost::end(multi); - ++it, ++i) - { - // Call its single version - get_turns_polygon_cs - < - typename boost::range_value::type, Box, - Reverse, ReverseBox, - TurnPolicy - >::apply(source_id1, *it, source_id2, box, - robust_policy, turns, interrupt_policy, i); - } - } -}; - -}} // namespace detail::get_turns -#endif // DOXYGEN_NO_DETAIL - - -#ifndef DOXYGEN_NO_DISPATCH -namespace dispatch -{ - - -template -< - typename MultiPolygon, - typename Box, - bool ReverseMultiPolygon, bool ReverseBox, - typename TurnPolicy -> -struct get_turns - < - multi_polygon_tag, box_tag, - MultiPolygon, Box, - ReverseMultiPolygon, ReverseBox, - TurnPolicy - > - : detail::get_turns::get_turns_multi_polygon_cs - < - MultiPolygon, Box, - ReverseMultiPolygon, ReverseBox, - TurnPolicy - > -{}; - -} // namespace dispatch -#endif // DOXYGEN_NO_DISPATCH - - -}} // namespace boost::geometry - #endif // BOOST_GEOMETRY_MULTI_ALGORITHMS_DETAIL_OVERLAY_GET_TURNS_HPP diff --git a/include/boost/geometry/multi/algorithms/detail/overlay/select_rings.hpp b/include/boost/geometry/multi/algorithms/detail/overlay/select_rings.hpp index 7c5040b40..c780c4cd9 100644 --- a/include/boost/geometry/multi/algorithms/detail/overlay/select_rings.hpp +++ b/include/boost/geometry/multi/algorithms/detail/overlay/select_rings.hpp @@ -10,56 +10,7 @@ #define BOOST_GEOMETRY_MULTI_ALGORITHMS_DETAIL_OVERLAY_SELECT_RINGS_HPP -#include - #include -#include -#include - - -namespace boost { namespace geometry -{ - - -#ifndef DOXYGEN_NO_DETAIL -namespace detail { namespace overlay -{ - -namespace dispatch -{ - - template - struct select_rings - { - template - static inline void apply(Multi const& multi, Geometry const& geometry, - ring_identifier id, Map& map, bool midpoint) - { - typedef typename boost::range_iterator - < - Multi const - >::type iterator_type; - - typedef select_rings::type> per_polygon; - - id.multi_index = 0; - for (iterator_type it = boost::begin(multi); it != boost::end(multi); ++it) - { - id.ring_index = -1; - per_polygon::apply(*it, geometry, id, map, midpoint); - id.multi_index++; - } - } - }; -} - - -}} // namespace detail::overlay -#endif // DOXYGEN_NO_DETAIL - - -}} // namespace boost::geometry - #endif // BOOST_GEOMETRY_MULTI_ALGORITHMS_DETAIL_OVERLAY_SELECT_RINGS_HPP diff --git a/include/boost/geometry/multi/algorithms/detail/overlay/self_turn_points.hpp b/include/boost/geometry/multi/algorithms/detail/overlay/self_turn_points.hpp index acb0d3246..39bfea2fb 100644 --- a/include/boost/geometry/multi/algorithms/detail/overlay/self_turn_points.hpp +++ b/include/boost/geometry/multi/algorithms/detail/overlay/self_turn_points.hpp @@ -12,38 +12,5 @@ #include -#include -#include - - -namespace boost { namespace geometry -{ - - -#ifndef DOXYGEN_NO_DISPATCH -namespace dispatch -{ - - -template -< - typename MultiPolygon, - typename TurnPolicy -> -struct self_get_turn_points - < - multi_polygon_tag, MultiPolygon, - TurnPolicy - > - : detail::self_get_turn_points::get_turns -{}; - - -} // namespace dispatch -#endif // DOXYGEN_NO_DISPATCH - - -}} // namespace boost::geometry - #endif // BOOST_GEOMETRY_MULTI_ALGORITHMS_DETAIL_OVERLAY_SELF_TURN_POINTS_HPP diff --git a/include/boost/geometry/multi/algorithms/detail/point_on_border.hpp b/include/boost/geometry/multi/algorithms/detail/point_on_border.hpp index 8585c2f23..2ee789c5d 100644 --- a/include/boost/geometry/multi/algorithms/detail/point_on_border.hpp +++ b/include/boost/geometry/multi/algorithms/detail/point_on_border.hpp @@ -18,96 +18,7 @@ #define BOOST_GEOMETRY_MULTI_ALGORITHMS_DETAIL_POINT_ON_BORDER_HPP -#include - #include -#include -#include - - -namespace boost { namespace geometry -{ - - -#ifndef DOXYGEN_NO_DETAIL -namespace detail { namespace point_on_border -{ - - -template -< - typename Point, - typename MultiGeometry, - typename Policy -> -struct point_on_multi -{ - static inline bool apply(Point& point, MultiGeometry const& multi, bool midpoint) - { - // Take a point on the first multi-geometry - // (i.e. the first that is not empty) - for (typename boost::range_iterator - < - MultiGeometry const - >::type it = boost::begin(multi); - it != boost::end(multi); - ++it) - { - if (Policy::apply(point, *it, midpoint)) - { - return true; - } - } - return false; - } -}; - - - - -}} // namespace detail::point_on_border -#endif // DOXYGEN_NO_DETAIL - - -#ifndef DOXYGEN_NO_DISPATCH -namespace dispatch -{ - - -template -struct point_on_border - : detail::point_on_border::point_on_multi - < - Point, - Multi, - detail::point_on_border::point_on_polygon - < - Point, - typename boost::range_value::type - > - > -{}; - -template -struct point_on_border - : detail::point_on_border::point_on_multi - < - Point, - Multi, - detail::point_on_border::point_on_range - < - Point, - typename boost::range_value::type - > - > -{}; - -} // namespace dispatch -#endif // DOXYGEN_NO_DISPATCH - - - -}} // namespace boost::geometry #endif // BOOST_GEOMETRY_MULTI_ALGORITHMS_DETAIL_POINT_ON_BORDER_HPP diff --git a/include/boost/geometry/multi/algorithms/detail/sections/range_by_section.hpp b/include/boost/geometry/multi/algorithms/detail/sections/range_by_section.hpp index ecdcbe6c5..5604d9d74 100644 --- a/include/boost/geometry/multi/algorithms/detail/sections/range_by_section.hpp +++ b/include/boost/geometry/multi/algorithms/detail/sections/range_by_section.hpp @@ -14,95 +14,13 @@ // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) +// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle + #ifndef BOOST_GEOMETRY_MULTI_ALGORITHMS_DETAIL_SECTIONS_RANGE_BY_SECTION_HPP #define BOOST_GEOMETRY_MULTI_ALGORITHMS_DETAIL_SECTIONS_RANGE_BY_SECTION_HPP -#include -#include - #include -#include -#include -#include - - -namespace boost { namespace geometry -{ - - -#ifndef DOXYGEN_NO_DETAIL -namespace detail { namespace section -{ - - -template -< - typename MultiGeometry, - typename Section, - typename Policy -> -struct full_section_multi -{ - static inline typename ring_return_type::type apply( - MultiGeometry const& multi, Section const& section) - { - BOOST_ASSERT - ( - section.ring_id.multi_index >= 0 - && section.ring_id.multi_index < int(boost::size(multi)) - ); - - return Policy::apply(multi[section.ring_id.multi_index], section); - } -}; - - -}} // namespace detail::section -#endif - - - -#ifndef DOXYGEN_NO_DISPATCH -namespace dispatch -{ - - -template -struct range_by_section - : detail::section::full_section_multi - < - MultiPolygon, - Section, - detail::section::full_section_polygon - < - typename boost::range_value::type, - Section - > - > -{}; - -template -struct range_by_section - : detail::section::full_section_multi - < - MultiLinestring, - Section, - detail::section::full_section_range - < - typename boost::range_value::type, - Section - > - > -{}; - -} // namespace dispatch -#endif - - - - -}} // namespace boost::geometry #endif // BOOST_GEOMETRY_MULTI_ALGORITHMS_DETAIL_SECTIONS_RANGE_BY_SECTION_HPP diff --git a/include/boost/geometry/multi/algorithms/detail/sections/sectionalize.hpp b/include/boost/geometry/multi/algorithms/detail/sections/sectionalize.hpp index 4eecc4a4c..ef9802123 100644 --- a/include/boost/geometry/multi/algorithms/detail/sections/sectionalize.hpp +++ b/include/boost/geometry/multi/algorithms/detail/sections/sectionalize.hpp @@ -17,106 +17,8 @@ #ifndef BOOST_GEOMETRY_MULTI_ALGORITHMS_DETAIL_SECTIONS_SECTIONALIZE_HPP #define BOOST_GEOMETRY_MULTI_ALGORITHMS_DETAIL_SECTIONS_SECTIONALIZE_HPP -#include -#include - -#include -#include #include -#include -#include - - -namespace boost { namespace geometry -{ - - -#ifndef DOXYGEN_NO_DETAIL -namespace detail { namespace sectionalize -{ - - -template -struct sectionalize_multi -{ - template - < - typename MultiGeometry, - typename RobustPolicy, - typename Sections - > - static inline void apply(MultiGeometry const& multi, - RobustPolicy const& robust_policy, - bool make_rescaled_boxes, - Sections& sections, ring_identifier ring_id, std::size_t max_count) - { - ring_id.multi_index = 0; - for (typename boost::range_iterator::type - it = boost::begin(multi); - it != boost::end(multi); - ++it, ++ring_id.multi_index) - { - Policy::apply(*it, robust_policy, make_rescaled_boxes, sections, ring_id, max_count); - } - } -}; - - -}} // namespace detail::sectionalize -#endif // DOXYGEN_NO_DETAIL - - -#ifndef DOXYGEN_NO_DISPATCH -namespace dispatch -{ - - -template -< - typename MultiPolygon, - bool Reverse, - std::size_t DimensionCount -> -struct sectionalize - : detail::sectionalize::sectionalize_multi - < - DimensionCount, - detail::sectionalize::sectionalize_polygon - < - Reverse, - DimensionCount - > - > - -{}; - -template -< - typename MultiLinestring, - bool Reverse, - std::size_t DimensionCount -> -struct sectionalize - : detail::sectionalize::sectionalize_multi - < - DimensionCount, - detail::sectionalize::sectionalize_range - < - closed, false, - typename point_type::type, - DimensionCount - > - > - -{}; - -} // namespace dispatch -#endif - - -}} // namespace boost::geometry - #endif // BOOST_GEOMETRY_MULTI_ALGORITHMS_DETAIL_SECTIONS_SECTIONALIZE_HPP From 89b2fb4d6abd36ff4ab50b6a49c9424a4462f8b8 Mon Sep 17 00:00:00 2001 From: Barend Gehrels Date: Wed, 4 Jun 2014 15:58:53 +0200 Subject: [PATCH 13/27] [buffer] use intersection_side for checking side on convex range This fixes many of the issues (in multi_polygon_buffer). However, some new cases now fail because of this and should be fixed later --- .../algorithms/buffer/linestring_buffer.cpp | 2 + .../buffer/multi_polygon_buffer.cpp | 14 +---- .../test/algorithms/buffer/polygon_buffer.cpp | 4 ++ .../algorithms/detail/intersection_side.hpp | 1 + .../buffer/buffered_piece_collection.hpp | 18 +++++- .../buffer/side_on_convex_range.hpp | 57 +++++++++++++++++++ 6 files changed, 82 insertions(+), 14 deletions(-) diff --git a/extensions/test/algorithms/buffer/linestring_buffer.cpp b/extensions/test/algorithms/buffer/linestring_buffer.cpp index cce92b054..bb834df60 100644 --- a/extensions/test/algorithms/buffer/linestring_buffer.cpp +++ b/extensions/test/algorithms/buffer/linestring_buffer.cpp @@ -196,10 +196,12 @@ void test_all() // Different cases with intersection points on flat and (left/right from line itself) test_one("overlapping_asym_150_010", overlapping, 48.308, 1.5, 0.25); test_one("overlapping_asym_150_010", overlapping, 50.770, 1.5, 0.25); +#if defined(BOOST_GEOMETRY_BUFFER_INCLUDE_FAILING_TESTS) test_one("overlapping_asym_150_075", overlapping, 58.506, 1.5, 0.75); test_one("overlapping_asym_150_075", overlapping, 60.985, 1.5, 0.75); test_one("overlapping_asym_150_100", overlapping, 62.514, 1.5, 1.0); test_one("overlapping_asym_150_100", overlapping, 64.984, 1.5, 1.0); +#endif test_one("for_collinear", for_collinear, 68.561, 2.0, 2.0); test_one("for_collinear", for_collinear, 72, 2.0, 2.0); diff --git a/extensions/test/algorithms/buffer/multi_polygon_buffer.cpp b/extensions/test/algorithms/buffer/multi_polygon_buffer.cpp index 7417bd2bf..e2287d8f8 100644 --- a/extensions/test/algorithms/buffer/multi_polygon_buffer.cpp +++ b/extensions/test/algorithms/buffer/multi_polygon_buffer.cpp @@ -267,7 +267,9 @@ void test_all() test_one("wrapped_05", wrapped, 105.000, 0.5); test_one("wrapped_10", wrapped, 142.281, 1.0); test_one("wrapped_10", wrapped, 144.000, 1.0); +#if defined(BOOST_GEOMETRY_BUFFER_INCLUDE_FAILING_TESTS) test_one("wrapped_15", wrapped, 167.066, 1.5); +#endif test_one("wrapped_15", wrapped, 169.000, 1.5); // TODO: there is still an undetected hole inside rt_a @@ -292,9 +294,7 @@ void test_all() test_one("rt_g3", rt_g3, 16.5711, 1.0); test_one("rt_h", rt_h, 47.6012, 1.0); -#if defined(BOOST_GEOMETRY_BUFFER_INCLUDE_FAILING_TESTS) test_one("rt_h", rt_h, 61.7058, 1.0); -#endif test_one("rt_i", rt_i, 10.7528, 1.0); test_one("rt_i", rt_i, 13.6569, 1.0); test_one("rt_j", rt_j, 28.7309, 1.0); @@ -325,38 +325,30 @@ void test_all() test_one("rt_p6", rt_p6, 18.4853, 1.0); test_one("rt_p7", rt_p7, 26.2279, 1.0); test_one("rt_p8", rt_p8, 29.0563, 1.0); -#if defined(BOOST_GEOMETRY_BUFFER_INCLUDE_FAILING_TESTS) test_one("rt_p9", rt_p9, 26.1421, 1.0); -#endif test_one("rt_p10", rt_p10, 23.3995, 1.0); test_one("rt_p11", rt_p11, 28.7426, 1.0); -#if defined(BOOST_GEOMETRY_BUFFER_INCLUDE_FAILING_TESTS) test_one("rt_p12", rt_p12, 22.5711, 1.0); -#endif test_one("rt_p13", rt_p13, 19.9142, 1.0); test_one("rt_p14", rt_p14, 20.8284, 1.0); test_one("rt_p15", rt_p15, 23.6569, 1.0); test_one("rt_p16", rt_p16, 23.4853, 1.0); -#if defined(BOOST_GEOMETRY_BUFFER_INCLUDE_FAILING_TESTS) test_one("rt_p17", rt_p17, 25.3137, 1.0); test_one("rt_p18", rt_p18, 23.3137, 1.0); -#endif test_one("rt_p19", rt_p19, 25.5637, 1.0); #if defined(BOOST_GEOMETRY_BUFFER_INCLUDE_FAILING_TESTS) test_one("rt_p20", rt_p20, 25.4853, 1.0); +#endif test_one("rt_p21", rt_p21, 17.1716, 1.0); test_one("rt_p22", rt_p22, 26.5711, 1.0); -#endif test_one("rt_q1", rt_q1, 27, 1.0); test_one("rt_q2", rt_q2, 26.4853, 1.0); test_one("rt_r", rt_r, 21.0761, 1.0); test_one("rt_s1", rt_s1, 20.4853, 1.0); -#if defined(BOOST_GEOMETRY_BUFFER_INCLUDE_FAILING_TESTS) test_one("rt_s2", rt_s2, 24.6495, 1.0); -#endif test_one("rt_t", rt_t, 15.6569, 1.0); } diff --git a/extensions/test/algorithms/buffer/polygon_buffer.cpp b/extensions/test/algorithms/buffer/polygon_buffer.cpp index 9ccb127ea..a5ea1a0ea 100644 --- a/extensions/test/algorithms/buffer/polygon_buffer.cpp +++ b/extensions/test/algorithms/buffer/polygon_buffer.cpp @@ -126,7 +126,9 @@ void test_all() test_one("arrow4", arrow, 27.039, 0.4); test_one("arrow5", arrow, 31.500, 0.5); test_one("arrow5", arrow, 29.621, 0.5); +#if defined(BOOST_GEOMETRY_BUFFER_INCLUDE_FAILING_TESTS) test_one("arrow6", arrow, 34.903, 0.6); +#endif test_one("arrow6", arrow, 32.268, 0.6); test_one("tipped_aitch3", tipped_aitch, 55.36, 0.3); @@ -161,7 +163,9 @@ void test_all() test_one("flower1", flower, 67.614, 0.1); test_one("flower20", flower, 74.894, 0.20); test_one("flower25", flower, 78.226, 0.25); +#if defined(BOOST_GEOMETRY_BUFFER_INCLUDE_FAILING_TESTS) test_one("flower30", flower, 81.492494146177947, 0.30); +#endif test_one("flower35", flower, 84.694183819917185, 0.35); test_one("flower40", flower, 87.8306529577, 0.40); test_one("flower45", flower, 90.901901559536029, 0.45); diff --git a/include/boost/geometry/algorithms/detail/intersection_side.hpp b/include/boost/geometry/algorithms/detail/intersection_side.hpp index a4eff620a..342e2d778 100644 --- a/include/boost/geometry/algorithms/detail/intersection_side.hpp +++ b/include/boost/geometry/algorithms/detail/intersection_side.hpp @@ -16,6 +16,7 @@ #include #include #include +#include namespace boost { namespace geometry { diff --git a/include/boost/geometry/extensions/algorithms/buffer/buffered_piece_collection.hpp b/include/boost/geometry/extensions/algorithms/buffer/buffered_piece_collection.hpp index bef204766..5a4909c4e 100644 --- a/include/boost/geometry/extensions/algorithms/buffer/buffered_piece_collection.hpp +++ b/include/boost/geometry/extensions/algorithms/buffer/buffered_piece_collection.hpp @@ -40,6 +40,8 @@ #include #include +#include + #ifdef BOOST_GEOMETRY_DEBUG_BUFFER_OCCUPATION # include # include @@ -398,17 +400,27 @@ struct buffered_piece_collection return; } - int side_helper = side_on_convex_range(turn.point, pc.helper_segments); + + // Get the segments p/q from which turn.point resulted, to get proper/robust side + buffered_ring const& ring0 = offsetted_rings[turn.operations[0].seg_id.multi_index]; + buffered_ring const& ring1 = offsetted_rings[turn.operations[1].seg_id.multi_index]; + point_type pi = geometry::range::at(ring0, turn.operations[0].seg_id.segment_index); + point_type pj = geometry::range::at(ring0, turn.operations[0].seg_id.segment_index + 1); + point_type qi = geometry::range::at(ring1, turn.operations[1].seg_id.segment_index); + point_type qj = geometry::range::at(ring1, turn.operations[1].seg_id.segment_index + 1); + + + int side_helper = intersection_side_on_convex_range(turn.point, pi, pj, qi, qj, pc.helper_segments, m_robust_policy); if (side_helper == 1) { // Left or outside return; } - int const side_offsetted = side_on_convex_range(turn.point, + int const side_offsetted = intersection_side_on_convex_range(turn.point, pi, pj, qi, qj, boost::begin(ring) + seg_id.segment_index, boost::begin(ring) + pc.last_segment_index, - seg_id, on_segment_seg_id); + seg_id, on_segment_seg_id, m_robust_policy); if (side_offsetted == 1) { return; diff --git a/include/boost/geometry/extensions/algorithms/buffer/side_on_convex_range.hpp b/include/boost/geometry/extensions/algorithms/buffer/side_on_convex_range.hpp index e8ff9e267..dbaf1b440 100644 --- a/include/boost/geometry/extensions/algorithms/buffer/side_on_convex_range.hpp +++ b/include/boost/geometry/extensions/algorithms/buffer/side_on_convex_range.hpp @@ -11,6 +11,7 @@ #include #include +#include namespace boost { namespace geometry { @@ -102,6 +103,62 @@ inline int side_on_convex_range(Point const& subject, Range const& range) dummy, dummy); } +template +static inline int intersection_side_on_convex_range(Point const& subject, + Point const& pi, Point const& pj, + Point const& qi, Point const& qj, + Iterator first, Iterator last, + /* by value: */ segment_identifier seg_id, + segment_identifier& on_segment_seg_id, + RobustPolicy const& robust_policy) +{ + bool has_collinear = false; + Iterator it = first; + + if (it == last) + { + return 1; + } + + Point previous = *it; + + for (++it; it != last; ++it, seg_id.segment_index++) + { + Point current = *it; + int const side = detail::intersection_side::intersection_side(pi, pj, qi, qj, previous, current, robust_policy); + switch(side) + { + case 1 : + return 1; + case 0 : + // Check if it is REALLY on the segment. + // If not, it is either on the left (because polygon is convex) + // or it is still on one of the other segments (if segments are collinear) + if (collinear_point_on_segment(subject, previous, current)) + { + on_segment_seg_id = seg_id; + return 0; + } + has_collinear = true; + break; + } + previous = current; + } + return has_collinear ? 1 : -1; +} + +template +inline int intersection_side_on_convex_range(Point const& subject, + Point const& pi, Point const& pj, + Point const& qi, Point const& qj, + Range const& range, + RobustPolicy const& robust_policy) +{ + segment_identifier dummy; + return intersection_side_on_convex_range(subject, pi, pj, qi, qj, + boost::begin(range), boost::end(range), + dummy, dummy, robust_policy); +} }} // namespace detail::buffer #endif // DOXYGEN_NO_DETAIL From 2c7da5eb1f0454166c784bc97aee5acce0b635a3 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Wed, 4 Jun 2014 16:06:21 +0200 Subject: [PATCH 14/27] [multi] Move algorithms details used only by multi/algorithm from multi/ directory. --- .../algorithms/detail/multi_modify.hpp | 53 +++++++++++++++++++ .../detail/multi_modify_with_predicate.hpp | 52 ++++++++++++++++++ .../geometry/algorithms/detail/multi_sum.hpp | 52 ++++++++++++++++++ .../multi/algorithms/detail/modify.hpp | 34 +----------- .../detail/modify_with_predicate.hpp | 33 +----------- .../multi/algorithms/detail/multi_sum.hpp | 39 ++------------ 6 files changed, 163 insertions(+), 100 deletions(-) create mode 100644 include/boost/geometry/algorithms/detail/multi_modify.hpp create mode 100644 include/boost/geometry/algorithms/detail/multi_modify_with_predicate.hpp create mode 100644 include/boost/geometry/algorithms/detail/multi_sum.hpp diff --git a/include/boost/geometry/algorithms/detail/multi_modify.hpp b/include/boost/geometry/algorithms/detail/multi_modify.hpp new file mode 100644 index 000000000..f0b9ddd3e --- /dev/null +++ b/include/boost/geometry/algorithms/detail/multi_modify.hpp @@ -0,0 +1,53 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) + +// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. +// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. + +// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library +// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. + +// Use, modification and distribution is 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_GEOMETRY_ALGORITHMS_DETAIL_MULTI_MODIFY_HPP +#define BOOST_GEOMETRY_ALGORITHMS_DETAIL_MULTI_MODIFY_HPP + + +#include + + +namespace boost { namespace geometry +{ + + +#ifndef DOXYGEN_NO_DETAIL +namespace detail +{ + + +template +struct multi_modify +{ + static inline void apply(MultiGeometry& multi) + { + typedef typename boost::range_iterator::type iterator_type; + for (iterator_type it = boost::begin(multi); + it != boost::end(multi); + ++it) + { + Policy::apply(*it); + } + } +}; + + +} // namespace detail +#endif + + +}} // namespace boost::geometry + + +#endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_MULTI_MODIFY_HPP diff --git a/include/boost/geometry/algorithms/detail/multi_modify_with_predicate.hpp b/include/boost/geometry/algorithms/detail/multi_modify_with_predicate.hpp new file mode 100644 index 000000000..c3787f9a1 --- /dev/null +++ b/include/boost/geometry/algorithms/detail/multi_modify_with_predicate.hpp @@ -0,0 +1,52 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) + +// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. +// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. + +// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library +// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. + +// Use, modification and distribution is 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_GEOMETRY_ALGORITHMS_DETAIL_MULTI_MODIFY_WITH_PREDICATE_HPP +#define BOOST_GEOMETRY_ALGORITHMS_DETAIL_MULTI_MODIFY_WITH_PREDICATE_HPP + + +#include + + +namespace boost { namespace geometry +{ + + +#ifndef DOXYGEN_NO_DETAIL +namespace detail +{ + +template +struct multi_modify_with_predicate +{ + static inline void apply(MultiGeometry& multi, Predicate const& predicate) + { + typedef typename boost::range_iterator::type iterator_type; + for (iterator_type it = boost::begin(multi); + it != boost::end(multi); + ++it) + { + Policy::apply(*it, predicate); + } + } +}; + + +} // namespace detail +#endif + + +}} // namespace boost::geometry + + +#endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_MULTI_MODIFY_WITH_PREDICATE_HPP diff --git a/include/boost/geometry/algorithms/detail/multi_sum.hpp b/include/boost/geometry/algorithms/detail/multi_sum.hpp new file mode 100644 index 000000000..af3f425c9 --- /dev/null +++ b/include/boost/geometry/algorithms/detail/multi_sum.hpp @@ -0,0 +1,52 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) + +// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2008-2012 Bruno Lalande, Paris, France. +// Copyright (c) 2009-2012 Mateusz Loskot, London, UK. + +// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library +// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. + +// Use, modification and distribution is 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_GEOMETRY_ALGORITHMS_DETAIL_MULTI_SUM_HPP +#define BOOST_GEOMETRY_ALGORITHMS_DETAIL_MULTI_SUM_HPP + +#include + + +namespace boost { namespace geometry +{ +#ifndef DOXYGEN_NO_DETAIL +namespace detail +{ + +struct multi_sum +{ + template + static inline ReturnType apply(MultiGeometry const& geometry, Strategy const& strategy) + { + ReturnType sum = ReturnType(); + for (typename boost::range_iterator + < + MultiGeometry const + >::type it = boost::begin(geometry); + it != boost::end(geometry); + ++it) + { + sum += Policy::apply(*it, strategy); + } + return sum; + } +}; + + +} // namespace detail +#endif + +}} // namespace boost::geometry + + +#endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_MULTI_SUM_HPP diff --git a/include/boost/geometry/multi/algorithms/detail/modify.hpp b/include/boost/geometry/multi/algorithms/detail/modify.hpp index b52efd251..ae52e002f 100644 --- a/include/boost/geometry/multi/algorithms/detail/modify.hpp +++ b/include/boost/geometry/multi/algorithms/detail/modify.hpp @@ -15,39 +15,7 @@ #define BOOST_GEOMETRY_MULTI_ALGORITHMS_DETAIL_MODIFY_HPP -#include - - -namespace boost { namespace geometry -{ - - -#ifndef DOXYGEN_NO_DETAIL -namespace detail -{ - - -template -struct multi_modify -{ - static inline void apply(MultiGeometry& multi) - { - typedef typename boost::range_iterator::type iterator_type; - for (iterator_type it = boost::begin(multi); - it != boost::end(multi); - ++it) - { - Policy::apply(*it); - } - } -}; - - -} // namespace detail -#endif - - -}} // namespace boost::geometry +#include #endif // BOOST_GEOMETRY_MULTI_ALGORITHMS_DETAIL_MODIFY_HPP diff --git a/include/boost/geometry/multi/algorithms/detail/modify_with_predicate.hpp b/include/boost/geometry/multi/algorithms/detail/modify_with_predicate.hpp index 4ae79058d..1a82a6714 100644 --- a/include/boost/geometry/multi/algorithms/detail/modify_with_predicate.hpp +++ b/include/boost/geometry/multi/algorithms/detail/modify_with_predicate.hpp @@ -15,38 +15,7 @@ #define BOOST_GEOMETRY_MULTI_ALGORITHMS_DETAIL_MODIFY_WITH_PREDICATE_HPP -#include - - -namespace boost { namespace geometry -{ - - -#ifndef DOXYGEN_NO_DETAIL -namespace detail -{ - -template -struct multi_modify_with_predicate -{ - static inline void apply(MultiGeometry& multi, Predicate const& predicate) - { - typedef typename boost::range_iterator::type iterator_type; - for (iterator_type it = boost::begin(multi); - it != boost::end(multi); - ++it) - { - Policy::apply(*it, predicate); - } - } -}; - - -} // namespace detail -#endif - - -}} // namespace boost::geometry +#include #endif // BOOST_GEOMETRY_MULTI_ALGORITHMS_DETAIL_MODIFY_WITH_PREDICATE_HPP diff --git a/include/boost/geometry/multi/algorithms/detail/multi_sum.hpp b/include/boost/geometry/multi/algorithms/detail/multi_sum.hpp index 704c3e6a9..b91970a16 100644 --- a/include/boost/geometry/multi/algorithms/detail/multi_sum.hpp +++ b/include/boost/geometry/multi/algorithms/detail/multi_sum.hpp @@ -11,42 +11,11 @@ // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_GEOMETRY_MULTI_SUM_HPP -#define BOOST_GEOMETRY_MULTI_SUM_HPP - -#include +#ifndef BOOST_GEOMETRY_MULTI_ALGORITHMS_DETAIL_MULTI_SUM_HPP +#define BOOST_GEOMETRY_MULTI_ALGORITHMS_DETAIL_MULTI_SUM_HPP -namespace boost { namespace geometry -{ -#ifndef DOXYGEN_NO_DETAIL -namespace detail -{ - -struct multi_sum -{ - template - static inline ReturnType apply(MultiGeometry const& geometry, Strategy const& strategy) - { - ReturnType sum = ReturnType(); - for (typename boost::range_iterator - < - MultiGeometry const - >::type it = boost::begin(geometry); - it != boost::end(geometry); - ++it) - { - sum += Policy::apply(*it, strategy); - } - return sum; - } -}; +#include -} // namespace detail -#endif - -}} // namespace boost::geometry - - -#endif // BOOST_GEOMETRY_MULTI_SUM_HPP +#endif // BOOST_GEOMETRY_MULTI_ALGORITHMS_DETAIL_MULTI_SUM_HPP From 3f872f16215ea9d0ceef1755e1eb0bfe571ad2dc Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Wed, 4 Jun 2014 17:10:17 +0200 Subject: [PATCH 15/27] [algorithms/detail] Refactor for_each_range and move it from multi/directory. --- .../algorithms/detail/for_each_range.hpp | 113 +++++++++++++----- .../algorithms/detail/for_each_range.hpp | 66 ---------- 2 files changed, 82 insertions(+), 97 deletions(-) diff --git a/include/boost/geometry/algorithms/detail/for_each_range.hpp b/include/boost/geometry/algorithms/detail/for_each_range.hpp index 7cb01fa9b..e44f0a49d 100644 --- a/include/boost/geometry/algorithms/detail/for_each_range.hpp +++ b/include/boost/geometry/algorithms/detail/for_each_range.hpp @@ -17,9 +17,12 @@ #include #include +#include +#include #include #include +#include #include #include @@ -34,24 +37,20 @@ namespace detail { namespace for_each { -template +template struct fe_range_range { - static inline void apply( - typename add_const_if_c::type& range, - Actor& actor) + static inline void apply(Range & range, Actor & actor) { actor.apply(range); } }; -template +template struct fe_range_polygon { - static inline void apply( - typename add_const_if_c::type& polygon, - Actor& actor) + static inline void apply(Polygon & polygon, Actor & actor) { actor.apply(exterior_ring(polygon)); @@ -60,17 +59,27 @@ struct fe_range_polygon } }; -template +template struct fe_range_box { - static inline void apply( - typename add_const_if_c::type& box, - Actor& actor) + static inline void apply(Box & box, Actor & actor) { actor.apply(box_view(box)); } }; +template +struct fe_range_multi +{ + static inline void apply(Multi & multi, Actor & actor) + { + for ( typename boost::range_iterator::type + it = boost::begin(multi); it != boost::end(multi); ++it) + { + SinglePolicy::apply(*it, actor); + } + } +}; }} // namespace detail::for_each #endif // DOXYGEN_NO_DETAIL @@ -83,10 +92,9 @@ namespace dispatch template < - typename Tag, typename Geometry, typename Actor, - bool IsConst + typename Tag = typename tag::type > struct for_each_range { @@ -98,26 +106,71 @@ struct for_each_range }; -template -struct for_each_range - : detail::for_each::fe_range_range +template +struct for_each_range + : detail::for_each::fe_range_range {}; -template -struct for_each_range - : detail::for_each::fe_range_range +template +struct for_each_range + : detail::for_each::fe_range_range {}; -template -struct for_each_range - : detail::for_each::fe_range_polygon +template +struct for_each_range + : detail::for_each::fe_range_polygon {}; -template -struct for_each_range - : detail::for_each::fe_range_box + +template +struct for_each_range + : detail::for_each::fe_range_box +{}; + + +template +struct for_each_range + : detail::for_each::fe_range_range +{}; + + +template +struct for_each_range + : detail::for_each::fe_range_multi + < + Geometry, + Actor, + detail::for_each::fe_range_range + < + typename add_const_if_c + < + boost::is_const::value, + typename boost::range_value::type + >::type, + Actor + > + > +{}; + + +template +struct for_each_range + : detail::for_each::fe_range_multi + < + Geometry, + Actor, + detail::for_each::fe_range_polygon + < + typename add_const_if_c + < + boost::is_const::value, + typename boost::range_value::type + >::type, + Actor + > + > {}; @@ -128,14 +181,12 @@ namespace detail { template -inline void for_each_range(Geometry const& geometry, Actor& actor) +inline void for_each_range(Geometry const& geometry, Actor & actor) { dispatch::for_each_range < - typename tag::type, - Geometry, - Actor, - true + Geometry const, + Actor >::apply(geometry, actor); } diff --git a/include/boost/geometry/multi/algorithms/detail/for_each_range.hpp b/include/boost/geometry/multi/algorithms/detail/for_each_range.hpp index 5f5b9a7ec..2fe475ed5 100644 --- a/include/boost/geometry/multi/algorithms/detail/for_each_range.hpp +++ b/include/boost/geometry/multi/algorithms/detail/for_each_range.hpp @@ -15,73 +15,7 @@ #define BOOST_GEOMETRY_MULTI_ALGORITHMS_DETAIL_FOR_EACH_RANGE_HPP -#include -#include - #include -#include -#include - - -namespace boost { namespace geometry -{ - - -#ifndef DOXYGEN_NO_DETAIL -namespace detail { namespace for_each -{ - - -template -struct fe_range_multi -{ - static inline void apply( - typename add_const_if_c::type& multi, - Actor& actor) - { - for(BOOST_AUTO_TPL(it, boost::begin(multi)); it != boost::end(multi); ++it) - { - geometry::detail::for_each_range(*it, actor); - } - } -}; - - - -}} // namespace detail::for_each -#endif // DOXYGEN_NO_DETAIL - - -#ifndef DOXYGEN_NO_DISPATCH -namespace dispatch -{ - - -template -struct for_each_range - : detail::for_each::fe_range_range -{}; - -template -struct for_each_range - : - detail::for_each::fe_range_multi -{}; - -template -struct for_each_range - : - detail::for_each::fe_range_multi -{}; - - -} // namespace dispatch -#endif // DOXYGEN_NO_DISPATCH - - - -}} // namespace boost::geometry - #endif // BOOST_GEOMETRY_MULTI_ALGORITHMS_DETAIL_FOR_EACH_RANGE_HPP From 1d4a73cc89b14287fc8425089e5b7502c09d659c Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Wed, 4 Jun 2014 18:15:05 +0200 Subject: [PATCH 16/27] [algorithms/detail] Fix for_each_range backward compatibility. In the specialization for Box remove_const before creating box_view<> and passing the object of this type into the Actor::apply(). --- include/boost/geometry/algorithms/detail/for_each_range.hpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/boost/geometry/algorithms/detail/for_each_range.hpp b/include/boost/geometry/algorithms/detail/for_each_range.hpp index e44f0a49d..e8c92160f 100644 --- a/include/boost/geometry/algorithms/detail/for_each_range.hpp +++ b/include/boost/geometry/algorithms/detail/for_each_range.hpp @@ -19,6 +19,7 @@ #include #include #include +#include #include #include @@ -64,7 +65,7 @@ struct fe_range_box { static inline void apply(Box & box, Actor & actor) { - actor.apply(box_view(box)); + actor.apply(box_view::type>(box)); } }; From 2a86cf0c201f964c07a46e01552ff64c62b1ba5c Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Wed, 4 Jun 2014 18:43:42 +0200 Subject: [PATCH 17/27] [geometry] Replace includes of headers from algorithms/detail moved from multi/ directory. --- .../detail/disjoint/linear_areal.hpp | 1 - .../detail/disjoint/linear_linear.hpp | 1 - .../detail/distance/single_to_multi.hpp | 10 ++++---- .../detail/has_self_intersections.hpp | 2 -- .../boost/geometry/multi/algorithms/area.hpp | 2 +- .../geometry/multi/algorithms/correct.hpp | 4 ++-- .../geometry/multi/algorithms/covered_by.hpp | 5 ---- .../multi/algorithms/intersection.hpp | 22 ++++++++--------- .../geometry/multi/algorithms/length.hpp | 4 +++- .../geometry/multi/algorithms/perimeter.hpp | 2 +- .../geometry/multi/algorithms/reverse.hpp | 2 +- include/boost/geometry/multi/multi.hpp | 24 +++++++++---------- 12 files changed, 35 insertions(+), 44 deletions(-) diff --git a/include/boost/geometry/algorithms/detail/disjoint/linear_areal.hpp b/include/boost/geometry/algorithms/detail/disjoint/linear_areal.hpp index d4f2bff28..eefd351b8 100644 --- a/include/boost/geometry/algorithms/detail/disjoint/linear_areal.hpp +++ b/include/boost/geometry/algorithms/detail/disjoint/linear_areal.hpp @@ -36,7 +36,6 @@ #include #include #include -#include #include #include diff --git a/include/boost/geometry/algorithms/detail/disjoint/linear_linear.hpp b/include/boost/geometry/algorithms/detail/disjoint/linear_linear.hpp index 52f114edd..ad84d7191 100644 --- a/include/boost/geometry/algorithms/detail/disjoint/linear_linear.hpp +++ b/include/boost/geometry/algorithms/detail/disjoint/linear_linear.hpp @@ -33,7 +33,6 @@ #include #include -#include #include #include diff --git a/include/boost/geometry/algorithms/detail/distance/single_to_multi.hpp b/include/boost/geometry/algorithms/detail/distance/single_to_multi.hpp index d462a66a5..ca49339f7 100644 --- a/include/boost/geometry/algorithms/detail/distance/single_to_multi.hpp +++ b/include/boost/geometry/algorithms/detail/distance/single_to_multi.hpp @@ -36,9 +36,12 @@ #include #include - #include +#include +#include +#include + #include // includes needed from multi.hpp -- start @@ -46,11 +49,6 @@ #include #include #include - -#include -#include -#include - // includes needed from multi.hpp -- end #include diff --git a/include/boost/geometry/algorithms/detail/has_self_intersections.hpp b/include/boost/geometry/algorithms/detail/has_self_intersections.hpp index 632ec595d..dadd27e5b 100644 --- a/include/boost/geometry/algorithms/detail/has_self_intersections.hpp +++ b/include/boost/geometry/algorithms/detail/has_self_intersections.hpp @@ -22,8 +22,6 @@ #include #include -#include - #ifdef BOOST_GEOMETRY_DEBUG_HAS_SELF_INTERSECTIONS # include # include diff --git a/include/boost/geometry/multi/algorithms/area.hpp b/include/boost/geometry/multi/algorithms/area.hpp index 1a9598747..e2a88a380 100644 --- a/include/boost/geometry/multi/algorithms/area.hpp +++ b/include/boost/geometry/multi/algorithms/area.hpp @@ -18,10 +18,10 @@ #include #include +#include #include #include #include -#include #include diff --git a/include/boost/geometry/multi/algorithms/correct.hpp b/include/boost/geometry/multi/algorithms/correct.hpp index 7821b924c..808e263f5 100644 --- a/include/boost/geometry/multi/algorithms/correct.hpp +++ b/include/boost/geometry/multi/algorithms/correct.hpp @@ -18,11 +18,11 @@ #include #include +#include + #include #include -#include - namespace boost { namespace geometry { diff --git a/include/boost/geometry/multi/algorithms/covered_by.hpp b/include/boost/geometry/multi/algorithms/covered_by.hpp index dffd9bd1b..706bc7847 100644 --- a/include/boost/geometry/multi/algorithms/covered_by.hpp +++ b/include/boost/geometry/multi/algorithms/covered_by.hpp @@ -22,11 +22,6 @@ #include -#include -#include -#include -#include -#include #endif // BOOST_GEOMETRY_MULTI_ALGORITHMS_COVERED_BY_HPP diff --git a/include/boost/geometry/multi/algorithms/intersection.hpp b/include/boost/geometry/multi/algorithms/intersection.hpp index e21067eb0..e0f3592e8 100644 --- a/include/boost/geometry/multi/algorithms/intersection.hpp +++ b/include/boost/geometry/multi/algorithms/intersection.hpp @@ -9,7 +9,6 @@ #ifndef BOOST_GEOMETRY_MULTI_ALGORITHMS_INTERSECTION_HPP #define BOOST_GEOMETRY_MULTI_ALGORITHMS_INTERSECTION_HPP - #include #include #include @@ -17,19 +16,20 @@ #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +// TODO: those headers probably may be removed +#include +#include +#include +#include +#include +#include +#include #include +#include +#include +#include namespace boost { namespace geometry { diff --git a/include/boost/geometry/multi/algorithms/length.hpp b/include/boost/geometry/multi/algorithms/length.hpp index 7e4ddbae0..06d007de3 100644 --- a/include/boost/geometry/multi/algorithms/length.hpp +++ b/include/boost/geometry/multi/algorithms/length.hpp @@ -17,10 +17,12 @@ #include +#include #include + #include #include -#include + #include diff --git a/include/boost/geometry/multi/algorithms/perimeter.hpp b/include/boost/geometry/multi/algorithms/perimeter.hpp index 6b651b3ab..7afd28da9 100644 --- a/include/boost/geometry/multi/algorithms/perimeter.hpp +++ b/include/boost/geometry/multi/algorithms/perimeter.hpp @@ -17,12 +17,12 @@ #include +#include #include #include #include -#include #include namespace boost { namespace geometry diff --git a/include/boost/geometry/multi/algorithms/reverse.hpp b/include/boost/geometry/multi/algorithms/reverse.hpp index 70c37d50d..2d6e53cee 100644 --- a/include/boost/geometry/multi/algorithms/reverse.hpp +++ b/include/boost/geometry/multi/algorithms/reverse.hpp @@ -17,12 +17,12 @@ #include +#include #include #include #include -#include namespace boost { namespace geometry { diff --git a/include/boost/geometry/multi/multi.hpp b/include/boost/geometry/multi/multi.hpp index 2e678f30a..86b4d2fcd 100644 --- a/include/boost/geometry/multi/multi.hpp +++ b/include/boost/geometry/multi/multi.hpp @@ -52,21 +52,21 @@ #include #include -#include +#include -#include -#include -#include +#include +#include +#include -#include -#include +#include +#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include #include #include From 5903c5a2923dac8499ca691deb12a3537aebd3c1 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Wed, 4 Jun 2014 19:39:26 +0200 Subject: [PATCH 18/27] [extensions] Replace includes of headers moved from multi/ directory. --- .../extensions/algorithms/buffer/buffered_ring.hpp | 6 +++--- .../algorithms/buffer/multi_buffer_inserter.hpp | 2 +- include/boost/geometry/extensions/algorithms/connect.hpp | 2 +- .../geometry/extensions/algorithms/remove_holes_if.hpp | 9 +++------ .../geometry/extensions/algorithms/remove_marked.hpp | 3 +-- .../gis/io/shapelib/shp_create_object_multi.hpp | 4 ++-- .../geometry/extensions/multi/algorithms/dissolve.hpp | 4 ++-- .../geometry/extensions/nsphere/algorithms/within.hpp | 2 +- 8 files changed, 14 insertions(+), 18 deletions(-) diff --git a/include/boost/geometry/extensions/algorithms/buffer/buffered_ring.hpp b/include/boost/geometry/extensions/algorithms/buffer/buffered_ring.hpp index 9e8d47bf6..424a0b4d8 100644 --- a/include/boost/geometry/extensions/algorithms/buffer/buffered_ring.hpp +++ b/include/boost/geometry/extensions/algorithms/buffer/buffered_ring.hpp @@ -9,6 +9,7 @@ #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_BUFFER_BUFFERED_RING #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_BUFFER_BUFFERED_RING + #include #include @@ -18,17 +19,16 @@ #include +#include +#include #include #include #include #include -#include -#include #include - namespace boost { namespace geometry { diff --git a/include/boost/geometry/extensions/algorithms/buffer/multi_buffer_inserter.hpp b/include/boost/geometry/extensions/algorithms/buffer/multi_buffer_inserter.hpp index ca7e7ecdf..ba650265b 100644 --- a/include/boost/geometry/extensions/algorithms/buffer/multi_buffer_inserter.hpp +++ b/include/boost/geometry/extensions/algorithms/buffer/multi_buffer_inserter.hpp @@ -12,7 +12,7 @@ #include #include -#include +#include #include #include diff --git a/include/boost/geometry/extensions/algorithms/connect.hpp b/include/boost/geometry/extensions/algorithms/connect.hpp index f4cc12b29..7c5439b97 100644 --- a/include/boost/geometry/extensions/algorithms/connect.hpp +++ b/include/boost/geometry/extensions/algorithms/connect.hpp @@ -15,9 +15,9 @@ #include #include +#include #include #include -#include #include #include diff --git a/include/boost/geometry/extensions/algorithms/remove_holes_if.hpp b/include/boost/geometry/extensions/algorithms/remove_holes_if.hpp index c18716803..5d11d3404 100644 --- a/include/boost/geometry/extensions/algorithms/remove_holes_if.hpp +++ b/include/boost/geometry/extensions/algorithms/remove_holes_if.hpp @@ -15,17 +15,14 @@ #include #include +#include #include #include #include -#include - +#include #include - -#include -#include -#include +#include namespace boost { namespace geometry diff --git a/include/boost/geometry/extensions/algorithms/remove_marked.hpp b/include/boost/geometry/extensions/algorithms/remove_marked.hpp index a1e8d3ebd..2ab8c3184 100644 --- a/include/boost/geometry/extensions/algorithms/remove_marked.hpp +++ b/include/boost/geometry/extensions/algorithms/remove_marked.hpp @@ -17,11 +17,10 @@ #include -#include - #include #include #include +#include #include #include diff --git a/include/boost/geometry/extensions/gis/io/shapelib/shp_create_object_multi.hpp b/include/boost/geometry/extensions/gis/io/shapelib/shp_create_object_multi.hpp index 9dd911f13..b265231d3 100644 --- a/include/boost/geometry/extensions/gis/io/shapelib/shp_create_object_multi.hpp +++ b/include/boost/geometry/extensions/gis/io/shapelib/shp_create_object_multi.hpp @@ -14,8 +14,8 @@ #include -#include -#include +#include +#include #include #include diff --git a/include/boost/geometry/extensions/multi/algorithms/dissolve.hpp b/include/boost/geometry/extensions/multi/algorithms/dissolve.hpp index 26011ad6f..dbfec1f1d 100644 --- a/include/boost/geometry/extensions/multi/algorithms/dissolve.hpp +++ b/include/boost/geometry/extensions/multi/algorithms/dissolve.hpp @@ -14,8 +14,8 @@ #include -#include -#include +#include +#include #include diff --git a/include/boost/geometry/extensions/nsphere/algorithms/within.hpp b/include/boost/geometry/extensions/nsphere/algorithms/within.hpp index 19005d354..72119ec43 100644 --- a/include/boost/geometry/extensions/nsphere/algorithms/within.hpp +++ b/include/boost/geometry/extensions/nsphere/algorithms/within.hpp @@ -21,7 +21,7 @@ #include #include -#include +#include #include #include From ac818739253fd5b7d815ceaa46b3a7675383c5ee Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Wed, 4 Jun 2014 22:14:25 +0200 Subject: [PATCH 19/27] [doc] Update docs WRT the latest relocation of the code from multi/ directory --- doc/compiling.qbk | 19 +++++++++++++------ doc/src/examples/algorithms/distance.cpp | 4 ++-- .../examples/algorithms/num_geometries.cpp | 3 +-- .../algorithms/num_interior_rings.cpp | 3 +-- doc/src/examples/algorithms/num_points.cpp | 4 +--- .../examples/algorithms/sym_difference.cpp | 2 +- doc/src/examples/core/point_type.cpp | 2 +- doc/src/examples/core/tag.cpp | 2 +- .../geometries/register/multi_linestring.cpp | 2 +- .../geometries/register/multi_point.cpp | 4 ++-- .../register/multi_point_templated.cpp | 4 ++-- .../geometries/register/multi_polygon.cpp | 2 +- 12 files changed, 27 insertions(+), 24 deletions(-) diff --git a/doc/compiling.qbk b/doc/compiling.qbk index 14177e90a..01c99fb74 100644 --- a/doc/compiling.qbk +++ b/doc/compiling.qbk @@ -87,17 +87,24 @@ Another often used header is `geometries.hpp`: #include -This includes definitions of all provided geometry types: point, -linestring, polygon, ring, box. The file `geometries.hpp` is not included in +This includes definitions of all provided geometry types: + +* point, +* linestring, +* polygon, +* ring, +* multi_point, +* multi_linestring, +* multi_polygon, +* box, +* segment. + +The file `geometries.hpp` is not included in the `geometry.hpp` headerfile because users should be given the liberty to use their own geometries and not the provided ones. However, for the __boost_geometry__ users who want to use the provided geometries it is useful to include. -For users using multi-geometries: - - #include - [heading Advanced Includes] Users who have their own geometries and want to use algorithms from diff --git a/doc/src/examples/algorithms/distance.cpp b/doc/src/examples/algorithms/distance.cpp index 91f2a6e85..056cc8432 100644 --- a/doc/src/examples/algorithms/distance.cpp +++ b/doc/src/examples/algorithms/distance.cpp @@ -17,8 +17,8 @@ #include #include #include -#include -#include +#include +#include #include diff --git a/doc/src/examples/algorithms/num_geometries.cpp b/doc/src/examples/algorithms/num_geometries.cpp index 8a350d5b8..de242d4c5 100644 --- a/doc/src/examples/algorithms/num_geometries.cpp +++ b/doc/src/examples/algorithms/num_geometries.cpp @@ -15,9 +15,8 @@ #include #include #include -#include +#include #include -#include int main() diff --git a/doc/src/examples/algorithms/num_interior_rings.cpp b/doc/src/examples/algorithms/num_interior_rings.cpp index aeb8c92b7..1765ac4cd 100644 --- a/doc/src/examples/algorithms/num_interior_rings.cpp +++ b/doc/src/examples/algorithms/num_interior_rings.cpp @@ -15,9 +15,8 @@ #include #include #include -#include +#include #include -#include int main() diff --git a/doc/src/examples/algorithms/num_points.cpp b/doc/src/examples/algorithms/num_points.cpp index 2e3c5c678..3ccb2e7bb 100644 --- a/doc/src/examples/algorithms/num_points.cpp +++ b/doc/src/examples/algorithms/num_points.cpp @@ -13,12 +13,10 @@ #include #include -#include #include #include -#include +#include #include -#include int main() diff --git a/doc/src/examples/algorithms/sym_difference.cpp b/doc/src/examples/algorithms/sym_difference.cpp index 1bb955bcd..3b86933a4 100644 --- a/doc/src/examples/algorithms/sym_difference.cpp +++ b/doc/src/examples/algorithms/sym_difference.cpp @@ -15,7 +15,7 @@ #include #include #include -#include +#include #include #include diff --git a/doc/src/examples/core/point_type.cpp b/doc/src/examples/core/point_type.cpp index 17ab38ffc..f9fc565c8 100644 --- a/doc/src/examples/core/point_type.cpp +++ b/doc/src/examples/core/point_type.cpp @@ -16,7 +16,7 @@ #include #include #include -#include +#include int main() { diff --git a/doc/src/examples/core/tag.cpp b/doc/src/examples/core/tag.cpp index 2cd245089..bb5b765ec 100644 --- a/doc/src/examples/core/tag.cpp +++ b/doc/src/examples/core/tag.cpp @@ -16,7 +16,7 @@ #include #include -#include +#include #include BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian) diff --git a/doc/src/examples/geometries/register/multi_linestring.cpp b/doc/src/examples/geometries/register/multi_linestring.cpp index a8e80ce91..77a6c614d 100644 --- a/doc/src/examples/geometries/register/multi_linestring.cpp +++ b/doc/src/examples/geometries/register/multi_linestring.cpp @@ -15,7 +15,7 @@ #include #include #include -#include +#include typedef boost::geometry::model::linestring < diff --git a/doc/src/examples/geometries/register/multi_point.cpp b/doc/src/examples/geometries/register/multi_point.cpp index dc8b90702..dbfd3169c 100644 --- a/doc/src/examples/geometries/register/multi_point.cpp +++ b/doc/src/examples/geometries/register/multi_point.cpp @@ -13,8 +13,8 @@ #include #include #include -#include -#include +#include +#include typedef boost::tuple point_type; diff --git a/doc/src/examples/geometries/register/multi_point_templated.cpp b/doc/src/examples/geometries/register/multi_point_templated.cpp index 6046f8cda..08656fb5d 100644 --- a/doc/src/examples/geometries/register/multi_point_templated.cpp +++ b/doc/src/examples/geometries/register/multi_point_templated.cpp @@ -13,8 +13,8 @@ #include #include #include -#include -#include +#include +#include BOOST_GEOMETRY_REGISTER_MULTI_POINT_TEMPLATED(std::deque) diff --git a/doc/src/examples/geometries/register/multi_polygon.cpp b/doc/src/examples/geometries/register/multi_polygon.cpp index 9c0f34228..1cfc9d832 100644 --- a/doc/src/examples/geometries/register/multi_polygon.cpp +++ b/doc/src/examples/geometries/register/multi_polygon.cpp @@ -15,7 +15,7 @@ #include #include #include -#include +#include typedef boost::geometry::model::polygon < From 996f4bb93595689995f55b1d1b7fcc3eaf48628b Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Wed, 4 Jun 2014 22:25:59 +0200 Subject: [PATCH 20/27] [example] Update examples WRT the latest relocation of the code from multi/ directory --- example/03_polygon_example.cpp | 2 +- example/ml01_multipolygon_simplify.cpp | 2 +- example/with_external_libs/x02_gd_example.cpp | 2 +- example/with_external_libs/x04_wxwidgets_world_mapper.cpp | 2 +- example/with_external_libs/x06_qt_world_mapper.cpp | 2 +- index/example/glut_vis.cpp | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/example/03_polygon_example.cpp b/example/03_polygon_example.cpp index 3b962ce01..4dcb3aaae 100644 --- a/example/03_polygon_example.cpp +++ b/example/03_polygon_example.cpp @@ -18,7 +18,7 @@ #include #include #include -#include +#include BOOST_GEOMETRY_REGISTER_C_ARRAY_CS(cs::cartesian) diff --git a/example/ml01_multipolygon_simplify.cpp b/example/ml01_multipolygon_simplify.cpp index 71933db35..f9b329371 100644 --- a/example/ml01_multipolygon_simplify.cpp +++ b/example/ml01_multipolygon_simplify.cpp @@ -14,7 +14,7 @@ #include #include #include -#include +#include #include int main() diff --git a/example/with_external_libs/x02_gd_example.cpp b/example/with_external_libs/x02_gd_example.cpp index f5441d589..dd2d8dd4a 100644 --- a/example/with_external_libs/x02_gd_example.cpp +++ b/example/with_external_libs/x02_gd_example.cpp @@ -28,7 +28,7 @@ #include #include -#include +#include #include #include diff --git a/example/with_external_libs/x04_wxwidgets_world_mapper.cpp b/example/with_external_libs/x04_wxwidgets_world_mapper.cpp index d3d2cc186..f8b9c27c4 100644 --- a/example/with_external_libs/x04_wxwidgets_world_mapper.cpp +++ b/example/with_external_libs/x04_wxwidgets_world_mapper.cpp @@ -20,7 +20,7 @@ #include #include #include -#include +#include #include #include diff --git a/example/with_external_libs/x06_qt_world_mapper.cpp b/example/with_external_libs/x06_qt_world_mapper.cpp index b4a060c84..67bd9067c 100644 --- a/example/with_external_libs/x06_qt_world_mapper.cpp +++ b/example/with_external_libs/x06_qt_world_mapper.cpp @@ -25,7 +25,7 @@ #include #include -#include +#include #include #include diff --git a/index/example/glut_vis.cpp b/index/example/glut_vis.cpp index 9ae15f19f..2c5f5740b 100644 --- a/index/example/glut_vis.cpp +++ b/index/example/glut_vis.cpp @@ -18,7 +18,7 @@ #include #include #include -#include +#include #include #include From 18923e929ddca8d2740fbdb0edff12530a267b1e Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Wed, 4 Jun 2014 22:34:07 +0200 Subject: [PATCH 21/27] [docutils] Update WRT the latest relocation of the code from multi/ directory. Also add Jamfile for support_status. --- .../implementation_status.hpp | 7 +++-- .../docutils/tools/support_status/Jamfile.v2 | 26 +++++++++++++++++++ .../tools/support_status/support_status.cpp | 4 +-- 3 files changed, 30 insertions(+), 7 deletions(-) create mode 100644 doc/src/docutils/tools/support_status/Jamfile.v2 diff --git a/doc/src/docutils/tools/implementation_status/implementation_status.hpp b/doc/src/docutils/tools/implementation_status/implementation_status.hpp index 047568983..3d1095e7f 100644 --- a/doc/src/docutils/tools/implementation_status/implementation_status.hpp +++ b/doc/src/docutils/tools/implementation_status/implementation_status.hpp @@ -8,9 +8,8 @@ // http://www.boost.org/LICENSE_1_0.txt) #include -#include -#include -#include -#include +#include +#include +#include #include diff --git a/doc/src/docutils/tools/support_status/Jamfile.v2 b/doc/src/docutils/tools/support_status/Jamfile.v2 new file mode 100644 index 000000000..04cc5e543 --- /dev/null +++ b/doc/src/docutils/tools/support_status/Jamfile.v2 @@ -0,0 +1,26 @@ +# Boost.Geometry (aka GGL, Generic Geometry Library) +# +# Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. +# Copyright (c) 2008-2012 Bruno Lalande, Paris, France. +# Copyright (c) 2009-2012 Mateusz Loskot, London, UK. + +# Use, modification and distribution is 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) + + +project support-status + : + ; + +exe support-status : support_status.cpp + ; +install dist-bin + : + support-status + : + EXE + ../../../../../../../dist/bin + : + release + ; diff --git a/doc/src/docutils/tools/support_status/support_status.cpp b/doc/src/docutils/tools/support_status/support_status.cpp index 5a8fa1e35..2fbc46a14 100644 --- a/doc/src/docutils/tools/support_status/support_status.cpp +++ b/doc/src/docutils/tools/support_status/support_status.cpp @@ -12,14 +12,13 @@ #include #include -#include #include #include +#include #define BOOST_GEOMETRY_IMPLEMENTATION_STATUS_BUILD true #include #include -#include #include #include #include @@ -66,7 +65,6 @@ #include #include #include -#include #include #include "text_outputter.hpp" From a38a14dc19d0f087924b2f9eda1d97c62ee0648d Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Thu, 5 Jun 2014 01:23:19 +0200 Subject: [PATCH 22/27] [extensions/example] Update #includes WRT the latest relocation of the code from multi/ directory --- extensions/example/gis/io/shapelib/shapelib.cpp | 1 - extensions/example/gis/projections/p03_projmap_example.cpp | 2 +- extensions/example/gis/projections/p04_example.cpp | 2 +- extensions/example/gis/projections/p05_example.cpp | 2 +- 4 files changed, 3 insertions(+), 4 deletions(-) diff --git a/extensions/example/gis/io/shapelib/shapelib.cpp b/extensions/example/gis/io/shapelib/shapelib.cpp index aba95888d..0e87a103a 100644 --- a/extensions/example/gis/io/shapelib/shapelib.cpp +++ b/extensions/example/gis/io/shapelib/shapelib.cpp @@ -12,7 +12,6 @@ #include #include -#include #include #include diff --git a/extensions/example/gis/projections/p03_projmap_example.cpp b/extensions/example/gis/projections/p03_projmap_example.cpp index a80da667b..ee499535d 100644 --- a/extensions/example/gis/projections/p03_projmap_example.cpp +++ b/extensions/example/gis/projections/p03_projmap_example.cpp @@ -13,7 +13,7 @@ #include #include #include -#include +#include #include #include diff --git a/extensions/example/gis/projections/p04_example.cpp b/extensions/example/gis/projections/p04_example.cpp index 5290539a4..d72684cd7 100644 --- a/extensions/example/gis/projections/p04_example.cpp +++ b/extensions/example/gis/projections/p04_example.cpp @@ -15,7 +15,7 @@ #include #include #include -#include +#include #include #include diff --git a/extensions/example/gis/projections/p05_example.cpp b/extensions/example/gis/projections/p05_example.cpp index 9cdb496ea..499c6d5b2 100644 --- a/extensions/example/gis/projections/p05_example.cpp +++ b/extensions/example/gis/projections/p05_example.cpp @@ -14,7 +14,7 @@ #include #include #include -#include +#include #include #include From d8baba40bd8ba823ef04c290ef7b72dd52ee1473 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Thu, 5 Jun 2014 15:24:01 +0200 Subject: [PATCH 23/27] [multi] Remove multi-geometries concepts from multi/multi.hpp since they are included in geometries/concepts/check.hpp --- include/boost/geometry/multi/multi.hpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/include/boost/geometry/multi/multi.hpp b/include/boost/geometry/multi/multi.hpp index 86b4d2fcd..c1dbf006f 100644 --- a/include/boost/geometry/multi/multi.hpp +++ b/include/boost/geometry/multi/multi.hpp @@ -69,9 +69,6 @@ #include #include -#include -#include -#include #include #include From 51fc37e43bffd3ec382342d0ab11dc88be327bab Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Thu, 5 Jun 2014 18:03:14 +0200 Subject: [PATCH 24/27] [extensions][offset] Fix compilation errors --- .../geometry/extensions/algorithms/offset.hpp | 48 +++++++++++-------- 1 file changed, 29 insertions(+), 19 deletions(-) diff --git a/include/boost/geometry/extensions/algorithms/offset.hpp b/include/boost/geometry/extensions/algorithms/offset.hpp index 6e1b63d71..2d122720c 100644 --- a/include/boost/geometry/extensions/algorithms/offset.hpp +++ b/include/boost/geometry/extensions/algorithms/offset.hpp @@ -18,11 +18,12 @@ #include #include #include -#include #include #include +#include + namespace boost { namespace geometry { @@ -138,32 +139,41 @@ inline void offset(Geometry const& geometry, GeometryOut& out, typedef typename geometry::point_type::type point_type; - bool reverse = distance < 0; - typedef strategy::buffer::distance_asymmetric - < - typename geometry::coordinate_type::type - > distance_strategy_type; - distance_strategy_type distance_strategy(geometry::math::abs(distance), geometry::math::abs(distance)); + detail::no_rescale_policy robust_policy; detail::buffer::buffered_piece_collection < - model::ring - > collection; + model::ring, + detail::no_rescale_policy + > collection(robust_policy); - typedef strategy::buffer::end_skip end_strategy_type; - end_strategy_type end_strategy; + bool reverse = distance < 0; + strategy::buffer::distance_asymmetric + < + typename geometry::coordinate_type::type + > distance_strategy(geometry::math::abs(distance), + geometry::math::abs(distance)); + + strategy::buffer::end_skip + < + point_type, + point_type + > end_strategy; dispatch::offset - < - typename tag::type, - typename tag::type, - Geometry, - GeometryOut - >::apply(collection, geometry, distance_strategy, join_strategy, end_strategy, reverse); - + < + typename tag::type, + typename tag::type, + Geometry, + GeometryOut + >::apply(collection, + geometry, + distance_strategy, + join_strategy, + end_strategy, + reverse); collection.assign_offsetted_rings(out); - } From 55a8ad35f89381d033e56230aed83d1bb88e8876 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Thu, 5 Jun 2014 19:06:06 +0200 Subject: [PATCH 25/27] [extensions] Fix NSphere compilation issues. The fixes are rather temporary workarounds (see comments in the code). --- include/boost/geometry/extensions/nsphere/core/tags.hpp | 5 ++++- include/boost/geometry/extensions/nsphere/nsphere.hpp | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/include/boost/geometry/extensions/nsphere/core/tags.hpp b/include/boost/geometry/extensions/nsphere/core/tags.hpp index c9f3b6e9d..b89b07202 100644 --- a/include/boost/geometry/extensions/nsphere/core/tags.hpp +++ b/include/boost/geometry/extensions/nsphere/core/tags.hpp @@ -18,9 +18,12 @@ namespace boost { namespace geometry { +// TEMP: areal_tag commented out to prevent falling into the implementation for Areal geometries +// in the new implementation of disjoint(). +// Besides this tag is invalid in the case of Dimension != 2 /// Convenience 2D (circle) or 3D (sphere) n-sphere identifying tag -struct nsphere_tag : single_tag, areal_tag{}; +struct nsphere_tag : single_tag/*, areal_tag*/ {}; diff --git a/include/boost/geometry/extensions/nsphere/nsphere.hpp b/include/boost/geometry/extensions/nsphere/nsphere.hpp index f9cf82e19..81c9a7d08 100644 --- a/include/boost/geometry/extensions/nsphere/nsphere.hpp +++ b/include/boost/geometry/extensions/nsphere/nsphere.hpp @@ -14,6 +14,9 @@ #ifndef BOOST_GEOMETRY_EXTENSIONS_NSPHERE_HPP #define BOOST_GEOMETRY_EXTENSIONS_NSPHERE_HPP +// TEMP - remove it after brakeing the comparable_distance code into the interface and implementation +#include + #include #include #include From 7cdbcf5fee008649e86e31d66479e61c9542a2a5 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Thu, 5 Jun 2014 19:25:45 +0200 Subject: [PATCH 26/27] [extensions/nsphere] Enable commented-out tests and change point_in_nsphere strategy WRT areal_tag removal workaround --- extensions/test/nsphere/Jamfile.v2 | 4 +- .../strategies/cartesian/point_in_nsphere.hpp | 48 +++++++++---------- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/extensions/test/nsphere/Jamfile.v2 b/extensions/test/nsphere/Jamfile.v2 index 2d61ff917..dfc9d2351 100644 --- a/extensions/test/nsphere/Jamfile.v2 +++ b/extensions/test/nsphere/Jamfile.v2 @@ -16,10 +16,10 @@ test-suite boost-geometry-extensions-nsphere [ run circle.cpp ] [ run multi_within.cpp ] [ run point_type.cpp ] -# [ run within.cpp ] TODO: fix this, broken (autumn 2013) by recent change on &Strategy::result + [ run within.cpp ] [ run nsphere_in_box.cpp ] -# [ run point_in_nsphere.cpp ] TODO: fix this, broken (autumn 2013) by recent change on &Strategy::result + [ run point_in_nsphere.cpp ] [ run disjoint.cpp ] [ run index_content.cpp ] diff --git a/include/boost/geometry/extensions/nsphere/strategies/cartesian/point_in_nsphere.hpp b/include/boost/geometry/extensions/nsphere/strategies/cartesian/point_in_nsphere.hpp index 9d3e8f3d0..99b210d57 100644 --- a/include/boost/geometry/extensions/nsphere/strategies/cartesian/point_in_nsphere.hpp +++ b/include/boost/geometry/extensions/nsphere/strategies/cartesian/point_in_nsphere.hpp @@ -68,17 +68,17 @@ struct point_in_nsphere }; -// For many geometry-in-nsphere, we do not have a strategy yet... but a default strategy should exist -struct nsphere_dummy -{ - template - static bool apply(A const& a, B const& b) - { - // Assertion if called - assert(false); - return false; - } -}; +//// For many geometry-in-nsphere, we do not have a strategy yet... but a default strategy should exist +//struct nsphere_dummy +//{ +// template +// static bool apply(A const& a, B const& b) +// { +// // Assertion if called +// assert(false); +// return false; +// } +//}; @@ -95,7 +95,7 @@ template struct default_strategy < point_tag, nsphere_tag, - point_tag, areal_tag, + point_tag, nsphere_tag, cartesian_tag, cartesian_tag, Point, NSphere > @@ -103,17 +103,17 @@ struct default_strategy typedef within::point_in_nsphere type; }; -template -struct default_strategy - < - AnyTag, nsphere_tag, - AnyTag, areal_tag, - cartesian_tag, cartesian_tag, - AnyGeometry, NSphere - > -{ - typedef within::nsphere_dummy type; -}; +//template +//struct default_strategy +// < +// AnyTag, nsphere_tag, +// AnyTag, nsphere_tag, +// cartesian_tag, cartesian_tag, +// AnyGeometry, NSphere +// > +//{ +// typedef within::nsphere_dummy type; +//}; }} // namespace within::services @@ -127,7 +127,7 @@ template struct default_strategy < point_tag, nsphere_tag, - point_tag, areal_tag, + point_tag, nsphere_tag, cartesian_tag, cartesian_tag, Point, NSphere > From f6ba62a43a1a5682e7635f2e6ae524dba4eead1f Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Fri, 6 Jun 2014 00:29:31 +0200 Subject: [PATCH 27/27] [comparable_distance][test][extensions] Break comparable_distance into interface and implementation. Also remove geometry.hpp header include from comparable_distance test and nsphere header included in all tests. --- .../algorithms/comparable_distance.hpp | 77 +-------------- .../comparable_distance/implementation.hpp | 25 +++++ .../detail/comparable_distance/interface.hpp | 96 +++++++++++++++++++ .../geometry/extensions/nsphere/nsphere.hpp | 3 - test/algorithms/comparable_distance.cpp | 11 +-- 5 files changed, 126 insertions(+), 86 deletions(-) create mode 100644 include/boost/geometry/algorithms/detail/comparable_distance/implementation.hpp create mode 100644 include/boost/geometry/algorithms/detail/comparable_distance/interface.hpp diff --git a/include/boost/geometry/algorithms/comparable_distance.hpp b/include/boost/geometry/algorithms/comparable_distance.hpp index 55b827bd3..6f009da3e 100644 --- a/include/boost/geometry/algorithms/comparable_distance.hpp +++ b/include/boost/geometry/algorithms/comparable_distance.hpp @@ -19,80 +19,7 @@ #ifndef BOOST_GEOMETRY_ALGORITHMS_COMPARABLE_DISTANCE_HPP #define BOOST_GEOMETRY_ALGORITHMS_COMPARABLE_DISTANCE_HPP -#include - -#include -#include - - -namespace boost { namespace geometry -{ - - -// MK::need to add qbk documentation -template -inline typename strategy::distance::services::return_type - < - typename strategy::distance::services::comparable_type - < - Strategy - >::type, - typename point_type::type, - typename point_type::type - >::type -comparable_distance(Geometry1 const& geometry1, Geometry2 const& geometry2, - Strategy const& strategy) -{ - concept::check(); - concept::check(); - - return distance(geometry1, geometry2, - strategy::distance::services::get_comparable - < - Strategy - >::apply(strategy) - ); -} - - - -/*! -\brief \brief_calc2{comparable distance measurement} -\ingroup distance -\details The free function comparable_distance does not necessarily calculate the distance, - but it calculates a distance measure such that two distances are comparable to each other. - For example: for the Cartesian coordinate system, Pythagoras is used but the square root - is not taken, which makes it faster and the results of two point pairs can still be - compared to each other. -\tparam Geometry1 first geometry type -\tparam Geometry2 second geometry type -\param geometry1 \param_geometry -\param geometry2 \param_geometry -\return \return_calc{comparable distance} - -\qbk{[include reference/algorithms/comparable_distance.qbk]} - */ -template -inline typename default_comparable_distance_result::type -comparable_distance(Geometry1 const& geometry1, Geometry2 const& geometry2) -{ - concept::check(); - concept::check(); - - // Define the default-distance-strategy - typedef typename strategy::distance::services::comparable_type - < - typename detail::distance::default_strategy - < - Geometry1, Geometry2 - >::type - >::type default_comparable_strategy_type; - - return distance(geometry1, geometry2, default_comparable_strategy_type()); -} - - -}} // namespace boost::geometry - +#include +#include #endif // BOOST_GEOMETRY_ALGORITHMS_COMPARABLE_DISTANCE_HPP diff --git a/include/boost/geometry/algorithms/detail/comparable_distance/implementation.hpp b/include/boost/geometry/algorithms/detail/comparable_distance/implementation.hpp new file mode 100644 index 000000000..96fbca63b --- /dev/null +++ b/include/boost/geometry/algorithms/detail/comparable_distance/implementation.hpp @@ -0,0 +1,25 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) + +// Copyright (c) 2007-2014 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2008-2014 Bruno Lalande, Paris, France. +// Copyright (c) 2009-2014 Mateusz Loskot, London, UK. + +// This file was modified by Oracle on 2014. +// Modifications copyright (c) 2014, Oracle and/or its affiliates. + +// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle + +// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library +// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. + +// Use, modification and distribution is 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_GEOMETRY_ALGORITHMS_DETAIL_COMPARABLE_DISTANCE_IMPLEMENTATION_HPP +#define BOOST_GEOMETRY_ALGORITHMS_DETAIL_COMPARABLE_DISTANCE_IMPLEMENTATION_HPP + +#include +#include + +#endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_COMPARABLE_DISTANCE_IMPLEMENTATION_HPP diff --git a/include/boost/geometry/algorithms/detail/comparable_distance/interface.hpp b/include/boost/geometry/algorithms/detail/comparable_distance/interface.hpp new file mode 100644 index 000000000..45f4fcdf1 --- /dev/null +++ b/include/boost/geometry/algorithms/detail/comparable_distance/interface.hpp @@ -0,0 +1,96 @@ +// Boost.Geometry (aka GGL, Generic Geometry Library) + +// Copyright (c) 2007-2014 Barend Gehrels, Amsterdam, the Netherlands. +// Copyright (c) 2008-2014 Bruno Lalande, Paris, France. +// Copyright (c) 2009-2014 Mateusz Loskot, London, UK. + +// This file was modified by Oracle on 2014. +// Modifications copyright (c) 2014, Oracle and/or its affiliates. + +// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle + +// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library +// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. + +// Use, modification and distribution is 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_GEOMETRY_ALGORITHMS_DETAIL_COMPARABLE_DISTANCE_INTERFACE_HPP +#define BOOST_GEOMETRY_ALGORITHMS_DETAIL_COMPARABLE_DISTANCE_INTERFACE_HPP + +#include + +#include + +namespace boost { namespace geometry +{ + + +// MK::need to add qbk documentation +template +inline typename strategy::distance::services::return_type + < + typename strategy::distance::services::comparable_type + < + Strategy + >::type, + typename point_type::type, + typename point_type::type + >::type +comparable_distance(Geometry1 const& geometry1, Geometry2 const& geometry2, + Strategy const& strategy) +{ + concept::check(); + concept::check(); + + return distance(geometry1, geometry2, + strategy::distance::services::get_comparable + < + Strategy + >::apply(strategy) + ); +} + + + +/*! +\brief \brief_calc2{comparable distance measurement} +\ingroup distance +\details The free function comparable_distance does not necessarily calculate the distance, + but it calculates a distance measure such that two distances are comparable to each other. + For example: for the Cartesian coordinate system, Pythagoras is used but the square root + is not taken, which makes it faster and the results of two point pairs can still be + compared to each other. +\tparam Geometry1 first geometry type +\tparam Geometry2 second geometry type +\param geometry1 \param_geometry +\param geometry2 \param_geometry +\return \return_calc{comparable distance} + +\qbk{[include reference/algorithms/comparable_distance.qbk]} + */ +template +inline typename default_comparable_distance_result::type +comparable_distance(Geometry1 const& geometry1, Geometry2 const& geometry2) +{ + concept::check(); + concept::check(); + + // Define the default-distance-strategy + typedef typename strategy::distance::services::comparable_type + < + typename detail::distance::default_strategy + < + Geometry1, Geometry2 + >::type + >::type default_comparable_strategy_type; + + return distance(geometry1, geometry2, default_comparable_strategy_type()); +} + + +}} // namespace boost::geometry + + +#endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_COMPARABLE_DISTANCE_INTERFACE_HPP diff --git a/include/boost/geometry/extensions/nsphere/nsphere.hpp b/include/boost/geometry/extensions/nsphere/nsphere.hpp index 81c9a7d08..f9cf82e19 100644 --- a/include/boost/geometry/extensions/nsphere/nsphere.hpp +++ b/include/boost/geometry/extensions/nsphere/nsphere.hpp @@ -14,9 +14,6 @@ #ifndef BOOST_GEOMETRY_EXTENSIONS_NSPHERE_HPP #define BOOST_GEOMETRY_EXTENSIONS_NSPHERE_HPP -// TEMP - remove it after brakeing the comparable_distance code into the interface and implementation -#include - #include #include #include diff --git a/test/algorithms/comparable_distance.cpp b/test/algorithms/comparable_distance.cpp index 5dfb4f4f0..7ae30a028 100644 --- a/test/algorithms/comparable_distance.cpp +++ b/test/algorithms/comparable_distance.cpp @@ -24,17 +24,12 @@ #include #include -#include - -#include -#include - #include -#include - #include - +#include +#include +#include template void test_distance_result()