Merge branch 'develop' of https://github.com/boostorg/geometry into feature/is_simple

This commit is contained in:
Menelaos Karavelas
2014-06-06 01:48:13 +03:00
176 changed files with 3107 additions and 2802 deletions

View File

@@ -87,17 +87,24 @@ Another often used header is `geometries.hpp`:
#include <boost/geometry/geometries/geometries.hpp>
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 <boost/geometry/multi/geometries/multi_geometries.hpp>
[heading Advanced Includes]
Users who have their own geometries and want to use algorithms from

View File

@@ -8,9 +8,8 @@
// http://www.boost.org/LICENSE_1_0.txt)
#include <boost/geometry/geometry.hpp>
#include <boost/geometry/multi/multi.hpp>
#include <boost/geometry/multi/geometries/multi_point.hpp>
#include <boost/geometry/multi/geometries/multi_linestring.hpp>
#include <boost/geometry/multi/geometries/multi_polygon.hpp>
#include <boost/geometry/geometries/multi_point.hpp>
#include <boost/geometry/geometries/multi_linestring.hpp>
#include <boost/geometry/geometries/multi_polygon.hpp>
#include <boost/geometry/io/wkt/wkt.hpp>

View File

@@ -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
:
<install-type>EXE
<location>../../../../../../../dist/bin
:
release
;

View File

@@ -12,14 +12,13 @@
#include <fstream>
#include <sstream>
#include <boost/type_traits/is_base_of.hpp>
#include <boost/mpl/for_each.hpp>
#include <boost/mpl/vector.hpp>
#include <boost/type_traits/is_base_of.hpp>
#define BOOST_GEOMETRY_IMPLEMENTATION_STATUS_BUILD true
#include <boost/geometry/core/cs.hpp>
#include <boost/geometry/geometries/geometries.hpp>
#include <boost/geometry/multi/geometries/multi_geometries.hpp>
#include <boost/geometry/algorithms/append.hpp>
#include <boost/geometry/algorithms/area.hpp>
#include <boost/geometry/algorithms/buffer.hpp>
@@ -66,7 +65,6 @@
#include <boost/geometry/multi/algorithms/simplify.hpp>
#include <boost/geometry/multi/algorithms/transform.hpp>
#include <boost/geometry/multi/algorithms/unique.hpp>
#include <boost/geometry/multi/io/wkt/wkt.hpp>
#include <boost/geometry/strategies/strategies.hpp>
#include "text_outputter.hpp"

View File

@@ -17,8 +17,8 @@
#include <boost/geometry/geometries/linestring.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
#include <boost/geometry/geometries/polygon.hpp>
#include <boost/geometry/multi/geometries/multi_point.hpp>
#include <boost/geometry/multi/geometries/multi_polygon.hpp>
#include <boost/geometry/geometries/multi_point.hpp>
#include <boost/geometry/geometries/multi_polygon.hpp>
#include <boost/geometry/io/wkt/wkt.hpp>

View File

@@ -15,9 +15,8 @@
#include <boost/geometry.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
#include <boost/geometry/geometries/polygon.hpp>
#include <boost/geometry/multi/geometries/multi_polygon.hpp>
#include <boost/geometry/geometries/multi_polygon.hpp>
#include <boost/geometry/io/wkt/wkt.hpp>
#include <boost/geometry/multi/io/wkt/wkt.hpp>
int main()

View File

@@ -15,9 +15,8 @@
#include <boost/geometry.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
#include <boost/geometry/geometries/polygon.hpp>
#include <boost/geometry/multi/geometries/multi_polygon.hpp>
#include <boost/geometry/geometries/multi_polygon.hpp>
#include <boost/geometry/io/wkt/wkt.hpp>
#include <boost/geometry/multi/io/wkt/wkt.hpp>
int main()

View File

@@ -13,12 +13,10 @@
#include <iostream>
#include <boost/geometry.hpp>
#include <boost/geometry/multi/multi.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
#include <boost/geometry/geometries/polygon.hpp>
#include <boost/geometry/multi/geometries/multi_polygon.hpp>
#include <boost/geometry/geometries/multi_polygon.hpp>
#include <boost/geometry/io/wkt/wkt.hpp>
#include <boost/geometry/multi/io/wkt/wkt.hpp>
int main()

View File

@@ -15,7 +15,7 @@
#include <boost/geometry.hpp>
#include <boost/geometry/geometries/polygon.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
#include <boost/geometry/multi/geometries/multi_polygon.hpp>
#include <boost/geometry/geometries/multi_polygon.hpp>
#include <boost/geometry/io/wkt/wkt.hpp>
#include <boost/foreach.hpp>

View File

@@ -16,7 +16,7 @@
#include <boost/geometry.hpp>
#include <boost/geometry/geometries/polygon.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
#include <boost/geometry/multi/geometries/multi_polygon.hpp>
#include <boost/geometry/geometries/multi_polygon.hpp>
int main()
{

View File

@@ -16,7 +16,7 @@
#include <boost/geometry.hpp>
#include <boost/geometry/geometries/polygon.hpp>
#include <boost/geometry/multi/geometries/multi_polygon.hpp>
#include <boost/geometry/geometries/multi_polygon.hpp>
#include <boost/geometry/geometries/adapted/boost_tuple.hpp>
BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian)

View File

@@ -15,7 +15,7 @@
#include <boost/geometry.hpp>
#include <boost/geometry/geometries/linestring.hpp>
#include <boost/geometry/geometries/adapted/boost_tuple.hpp>
#include <boost/geometry/multi/geometries/register/multi_linestring.hpp>
#include <boost/geometry/geometries/register/multi_linestring.hpp>
typedef boost::geometry::model::linestring
<

View File

@@ -13,8 +13,8 @@
#include <iostream>
#include <boost/geometry.hpp>
#include <boost/geometry/geometries/adapted/boost_tuple.hpp>
#include <boost/geometry/multi/geometries/register/multi_point.hpp>
#include <boost/geometry/multi/io/wkt/wkt.hpp>
#include <boost/geometry/geometries/register/multi_point.hpp>
#include <boost/geometry/io/wkt/wkt.hpp>
typedef boost::tuple<float, float> point_type;

View File

@@ -13,8 +13,8 @@
#include <iostream>
#include <boost/geometry.hpp>
#include <boost/geometry/geometries/adapted/boost_tuple.hpp>
#include <boost/geometry/multi/geometries/register/multi_point.hpp>
#include <boost/geometry/multi/io/wkt/wkt.hpp>
#include <boost/geometry/geometries/register/multi_point.hpp>
#include <boost/geometry/io/wkt/wkt.hpp>
BOOST_GEOMETRY_REGISTER_MULTI_POINT_TEMPLATED(std::deque)

View File

@@ -15,7 +15,7 @@
#include <boost/geometry.hpp>
#include <boost/geometry/geometries/polygon.hpp>
#include <boost/geometry/geometries/adapted/boost_tuple.hpp>
#include <boost/geometry/multi/geometries/register/multi_polygon.hpp>
#include <boost/geometry/geometries/register/multi_polygon.hpp>
typedef boost::geometry::model::polygon
<

View File

@@ -18,7 +18,7 @@
#include <boost/geometry/geometries/point_xy.hpp>
#include <boost/geometry/geometries/polygon.hpp>
#include <boost/geometry/geometries/adapted/c_array.hpp>
#include <boost/geometry/multi/geometries/multi_polygon.hpp>
#include <boost/geometry/geometries/multi_polygon.hpp>
BOOST_GEOMETRY_REGISTER_C_ARRAY_CS(cs::cartesian)

View File

@@ -14,7 +14,7 @@
#include <boost/geometry/geometries/point_xy.hpp>
#include <boost/geometry/geometries/polygon.hpp>
#include <boost/geometry/geometries/ring.hpp>
#include <boost/geometry/multi/geometries/multi_polygon.hpp>
#include <boost/geometry/geometries/multi_polygon.hpp>
#include <boost/foreach.hpp>
int main()

View File

@@ -28,7 +28,7 @@
#include <boost/foreach.hpp>
#include <boost/geometry.hpp>
#include <boost/geometry/multi/geometries/multi_polygon.hpp>
#include <boost/geometry/geometries/multi_polygon.hpp>
#include <boost/geometry/extensions/gis/latlong/latlong.hpp>
#include <boost/geometry/extensions/gis/geographic/strategies/area_huiller_earth.hpp>

View File

@@ -20,7 +20,7 @@
#include <boost/geometry/geometry.hpp>
#include <boost/geometry/geometries/geometries.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
#include <boost/geometry/multi/geometries/multi_geometries.hpp>
#include <boost/geometry/geometries/multi_geometries.hpp>
#include <boost/geometry/geometries/register/point.hpp>
#include <boost/geometry/geometries/register/ring.hpp>

View File

@@ -25,7 +25,7 @@
#include <boost/geometry/geometry.hpp>
#include <boost/geometry/geometries/geometries.hpp>
#include <boost/geometry/multi/geometries/multi_geometries.hpp>
#include <boost/geometry/geometries/multi_geometries.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
#include <boost/geometry/geometries/register/point.hpp>

View File

@@ -12,7 +12,6 @@
#include <boost/geometry.hpp>
#include <boost/geometry/geometries/geometries.hpp>
#include <boost/geometry/multi/geometries/multi_geometries.hpp>
#include <boost/geometry/extensions/gis/io/shapelib/shape_creator.hpp>
#include <boost/geometry/extensions/gis/io/shapelib/shp_create_object.hpp>

View File

@@ -13,7 +13,7 @@
#include <boost/geometry.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
#include <boost/geometry/geometries/register/point.hpp>
#include <boost/geometry/multi/geometries/multi_polygon.hpp>
#include <boost/geometry/geometries/multi_polygon.hpp>
#include <boost/geometry/io/svg/write_svg.hpp>
#include <boost/geometry/extensions/gis/latlong/latlong.hpp>

View File

@@ -15,7 +15,7 @@
#include <boost/geometry.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
#include <boost/geometry/geometries/register/point.hpp>
#include <boost/geometry/multi/geometries/multi_polygon.hpp>
#include <boost/geometry/geometries/multi_polygon.hpp>
#include <boost/geometry/io/svg/svg_mapper.hpp>
#include <boost/geometry/extensions/gis/latlong/latlong.hpp>

View File

@@ -14,7 +14,7 @@
#include <boost/geometry.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
#include <boost/geometry/geometries/register/point.hpp>
#include <boost/geometry/multi/geometries/multi_polygon.hpp>
#include <boost/geometry/geometries/multi_polygon.hpp>
#include <boost/geometry/io/svg/svg_mapper.hpp>
#include <boost/geometry/extensions/gis/latlong/latlong.hpp>

View File

@@ -196,10 +196,12 @@ void test_all()
// Different cases with intersection points on flat and (left/right from line itself)
test_one<linestring, buf::join_round, buf::end_flat, polygon>("overlapping_asym_150_010", overlapping, 48.308, 1.5, 0.25);
test_one<linestring, buf::join_miter, buf::end_flat, polygon>("overlapping_asym_150_010", overlapping, 50.770, 1.5, 0.25);
#if defined(BOOST_GEOMETRY_BUFFER_INCLUDE_FAILING_TESTS)
test_one<linestring, buf::join_round, buf::end_flat, polygon>("overlapping_asym_150_075", overlapping, 58.506, 1.5, 0.75);
test_one<linestring, buf::join_miter, buf::end_flat, polygon>("overlapping_asym_150_075", overlapping, 60.985, 1.5, 0.75);
test_one<linestring, buf::join_round, buf::end_flat, polygon>("overlapping_asym_150_100", overlapping, 62.514, 1.5, 1.0);
test_one<linestring, buf::join_miter, buf::end_flat, polygon>("overlapping_asym_150_100", overlapping, 64.984, 1.5, 1.0);
#endif
test_one<linestring, buf::join_round, buf::end_flat, polygon>("for_collinear", for_collinear, 68.561, 2.0, 2.0);
test_one<linestring, buf::join_miter, buf::end_flat, polygon>("for_collinear", for_collinear, 72, 2.0, 2.0);

View File

@@ -267,7 +267,9 @@ void test_all()
test_one<multi_polygon_type, buf::join_miter, buf::end_skip, polygon_type>("wrapped_05", wrapped, 105.000, 0.5);
test_one<multi_polygon_type, buf::join_round, buf::end_skip, polygon_type>("wrapped_10", wrapped, 142.281, 1.0);
test_one<multi_polygon_type, buf::join_miter, buf::end_skip, polygon_type>("wrapped_10", wrapped, 144.000, 1.0);
#if defined(BOOST_GEOMETRY_BUFFER_INCLUDE_FAILING_TESTS)
test_one<multi_polygon_type, buf::join_round, buf::end_skip, polygon_type>("wrapped_15", wrapped, 167.066, 1.5);
#endif
test_one<multi_polygon_type, buf::join_miter, buf::end_skip, polygon_type>("wrapped_15", wrapped, 169.000, 1.5);
// TODO: there is still an undetected hole inside rt_a
@@ -327,17 +329,13 @@ void test_all()
test_one<multi_polygon_type, buf::join_miter, buf::end_skip, polygon_type>("rt_p10", rt_p10, 23.3995, 1.0);
test_one<multi_polygon_type, buf::join_miter, buf::end_skip, polygon_type>("rt_p11", rt_p11, 28.7426, 1.0);
#if defined(BOOST_GEOMETRY_BUFFER_INCLUDE_FAILING_TESTS)
test_one<multi_polygon_type, buf::join_miter, buf::end_skip, polygon_type>("rt_p12", rt_p12, 22.5711, 1.0);
#endif
test_one<multi_polygon_type, buf::join_miter, buf::end_skip, polygon_type>("rt_p13", rt_p13, 19.9142, 1.0);
test_one<multi_polygon_type, buf::join_miter, buf::end_skip, polygon_type>("rt_p14", rt_p14, 20.8284, 1.0);
test_one<multi_polygon_type, buf::join_miter, buf::end_skip, polygon_type>("rt_p15", rt_p15, 23.6569, 1.0);
test_one<multi_polygon_type, buf::join_miter, buf::end_skip, polygon_type>("rt_p16", rt_p16, 23.4853, 1.0);
test_one<multi_polygon_type, buf::join_miter, buf::end_skip, polygon_type>("rt_p17", rt_p17, 25.3137, 1.0);
#if defined(BOOST_GEOMETRY_BUFFER_INCLUDE_FAILING_TESTS)
test_one<multi_polygon_type, buf::join_miter, buf::end_skip, polygon_type>("rt_p18", rt_p18, 23.3137, 1.0);
#endif
test_one<multi_polygon_type, buf::join_miter, buf::end_skip, polygon_type>("rt_p19", rt_p19, 25.5637, 1.0);
#if defined(BOOST_GEOMETRY_BUFFER_INCLUDE_FAILING_TESTS)
test_one<multi_polygon_type, buf::join_miter, buf::end_skip, polygon_type>("rt_p20", rt_p20, 25.4853, 1.0);

View File

@@ -126,7 +126,9 @@ void test_all()
test_one<polygon_type, buf::join_round, buf::end_skip, polygon_type>("arrow4", arrow, 27.039, 0.4);
test_one<polygon_type, buf::join_miter, buf::end_skip, polygon_type>("arrow5", arrow, 31.500, 0.5);
test_one<polygon_type, buf::join_round, buf::end_skip, polygon_type>("arrow5", arrow, 29.621, 0.5);
#if defined(BOOST_GEOMETRY_BUFFER_INCLUDE_FAILING_TESTS)
test_one<polygon_type, buf::join_miter, buf::end_skip, polygon_type>("arrow6", arrow, 34.903, 0.6);
#endif
test_one<polygon_type, buf::join_round, buf::end_skip, polygon_type>("arrow6", arrow, 32.268, 0.6);
test_one<polygon_type, buf::join_miter, buf::end_skip, polygon_type>("tipped_aitch3", tipped_aitch, 55.36, 0.3);
@@ -161,7 +163,9 @@ void test_all()
test_one<polygon_type, buf::join_miter, buf::end_skip, polygon_type>("flower1", flower, 67.614, 0.1);
test_one<polygon_type, buf::join_miter, buf::end_skip, polygon_type>("flower20", flower, 74.894, 0.20);
test_one<polygon_type, buf::join_miter, buf::end_skip, polygon_type>("flower25", flower, 78.226, 0.25);
#if defined(BOOST_GEOMETRY_BUFFER_INCLUDE_FAILING_TESTS)
test_one<polygon_type, buf::join_miter, buf::end_skip, polygon_type>("flower30", flower, 81.492494146177947, 0.30);
#endif
test_one<polygon_type, buf::join_miter, buf::end_skip, polygon_type>("flower35", flower, 84.694183819917185, 0.35);
test_one<polygon_type, buf::join_miter, buf::end_skip, polygon_type>("flower40", flower, 87.8306529577, 0.40);
test_one<polygon_type, buf::join_miter, buf::end_skip, polygon_type>("flower45", flower, 90.901901559536029, 0.45);

View File

@@ -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 ]

View File

@@ -19,80 +19,7 @@
#ifndef BOOST_GEOMETRY_ALGORITHMS_COMPARABLE_DISTANCE_HPP
#define BOOST_GEOMETRY_ALGORITHMS_COMPARABLE_DISTANCE_HPP
#include <boost/geometry/strategies/default_comparable_distance_result.hpp>
#include <boost/geometry/algorithms/distance.hpp>
#include <boost/geometry/algorithms/detail/distance/default_strategies.hpp>
namespace boost { namespace geometry
{
// MK::need to add qbk documentation
template <typename Geometry1, typename Geometry2, typename Strategy>
inline typename strategy::distance::services::return_type
<
typename strategy::distance::services::comparable_type
<
Strategy
>::type,
typename point_type<Geometry1>::type,
typename point_type<Geometry2>::type
>::type
comparable_distance(Geometry1 const& geometry1, Geometry2 const& geometry2,
Strategy const& strategy)
{
concept::check<Geometry1 const>();
concept::check<Geometry2 const>();
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 <typename Geometry1, typename Geometry2>
inline typename default_comparable_distance_result<Geometry1, Geometry2>::type
comparable_distance(Geometry1 const& geometry1, Geometry2 const& geometry2)
{
concept::check<Geometry1 const>();
concept::check<Geometry2 const>();
// 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 <boost/geometry/algorithms/detail/comparable_distance/interface.hpp>
#include <boost/geometry/algorithms/detail/comparable_distance/implementation.hpp>
#endif // BOOST_GEOMETRY_ALGORITHMS_COMPARABLE_DISTANCE_HPP

View File

@@ -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 <boost/geometry/algorithms/detail/distance/implementation.hpp>
#include <boost/geometry/algorithms/detail/distance/default_strategies.hpp>
#endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_COMPARABLE_DISTANCE_IMPLEMENTATION_HPP

View File

@@ -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 <boost/geometry/strategies/default_comparable_distance_result.hpp>
#include <boost/geometry/algorithms/detail/distance/interface.hpp>
namespace boost { namespace geometry
{
// MK::need to add qbk documentation
template <typename Geometry1, typename Geometry2, typename Strategy>
inline typename strategy::distance::services::return_type
<
typename strategy::distance::services::comparable_type
<
Strategy
>::type,
typename point_type<Geometry1>::type,
typename point_type<Geometry2>::type
>::type
comparable_distance(Geometry1 const& geometry1, Geometry2 const& geometry2,
Strategy const& strategy)
{
concept::check<Geometry1 const>();
concept::check<Geometry2 const>();
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 <typename Geometry1, typename Geometry2>
inline typename default_comparable_distance_result<Geometry1, Geometry2>::type
comparable_distance(Geometry1 const& geometry1, Geometry2 const& geometry2)
{
concept::check<Geometry1 const>();
concept::check<Geometry2 const>();
// 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

View File

@@ -22,7 +22,6 @@
#define BOOST_GEOMETRY_ALGORITHMS_DETAIL_DISJOINT_AREAL_AREAL_HPP
#include <boost/geometry/core/point_type.hpp>
#include <boost/geometry/multi/core/point_type.hpp>
#include <boost/geometry/algorithms/within.hpp>
#include <boost/geometry/algorithms/detail/for_each_range.hpp>

View File

@@ -32,12 +32,10 @@
#include <boost/geometry/core/interior_rings.hpp>
#include <boost/geometry/core/tag.hpp>
#include <boost/geometry/core/tags.hpp>
#include <boost/geometry/multi/core/tags.hpp>
#include <boost/geometry/algorithms/covered_by.hpp>
#include <boost/geometry/algorithms/not_implemented.hpp>
#include <boost/geometry/algorithms/detail/point_on_border.hpp>
#include <boost/geometry/multi/algorithms/detail/point_on_border.hpp>
#include <boost/geometry/algorithms/detail/assign_indexed_point.hpp>
#include <boost/geometry/algorithms/detail/disjoint/point_box.hpp>

View File

@@ -30,11 +30,9 @@
#include <boost/geometry/core/point_type.hpp>
#include <boost/geometry/core/tag.hpp>
#include <boost/geometry/core/tags.hpp>
#include <boost/geometry/multi/core/tags.hpp>
#include <boost/geometry/algorithms/detail/overlay/turn_info.hpp>
#include <boost/geometry/algorithms/detail/overlay/get_turns.hpp>
#include <boost/geometry/multi/algorithms/detail/overlay/get_turns.hpp>
#include <boost/geometry/algorithms/detail/overlay/do_reverse.hpp>
#include <boost/geometry/policies/disjoint_interrupt_policy.hpp>

View File

@@ -25,7 +25,6 @@
#include <boost/geometry/core/closure.hpp>
#include <boost/geometry/core/point_type.hpp>
#include <boost/geometry/core/tags.hpp>
#include <boost/geometry/multi/core/tags.hpp>
#include <boost/geometry/strategies/distance.hpp>
#include <boost/geometry/strategies/tags.hpp>

View File

@@ -12,7 +12,6 @@
#include <boost/geometry/core/point_type.hpp>
#include <boost/geometry/core/tags.hpp>
#include <boost/geometry/multi/core/tags.hpp>
#include <boost/geometry/strategies/distance.hpp>
#include <boost/geometry/strategies/tags.hpp>

View File

@@ -19,7 +19,6 @@
#include <boost/geometry/core/tag.hpp>
#include <boost/geometry/core/tags.hpp>
#include <boost/geometry/multi/core/tags.hpp>
#include <boost/geometry/iterators/point_iterator.hpp>
#include <boost/geometry/iterators/has_one_element.hpp>

View File

@@ -24,7 +24,6 @@
#include <boost/concept_check.hpp>
#include <boost/geometry/core/point_type.hpp>
#include <boost/geometry/multi/core/point_type.hpp>
#include <boost/geometry/algorithms/num_points.hpp>
#include <boost/geometry/multi/algorithms/num_points.hpp>
@@ -32,7 +31,6 @@
#include <boost/geometry/algorithms/detail/throw_on_empty_input.hpp>
#include <boost/geometry/geometries/concepts/check.hpp>
#include <boost/geometry/multi/geometries/concepts/check.hpp>
#include <boost/geometry/strategies/distance.hpp>
#include <boost/geometry/strategies/default_distance_result.hpp>

View File

@@ -24,7 +24,6 @@
#include <boost/geometry/core/point_type.hpp>
#include <boost/geometry/core/tag.hpp>
#include <boost/geometry/core/tags.hpp>
#include <boost/geometry/multi/core/tags.hpp>
#include <boost/geometry/strategies/distance.hpp>
#include <boost/geometry/strategies/distance_comparable_to_regular.hpp>

View File

@@ -12,9 +12,8 @@
#include <boost/range.hpp>
#include <boost/geometry/multi/core/tags.hpp>
#include <boost/geometry/multi/core/point_type.hpp>
#include <boost/geometry/multi/geometries/concepts/check.hpp>
#include <boost/geometry/core/tags.hpp>
#include <boost/geometry/core/point_type.hpp>
#include <boost/geometry/algorithms/dispatch/distance.hpp>
@@ -22,6 +21,8 @@
#include <boost/geometry/algorithms/detail/distance/multi_to_multi.hpp>
#include <boost/geometry/algorithms/detail/distance/geometry_to_geometry_rtree.hpp>
#include <boost/geometry/geometries/concepts/check.hpp>
#include <boost/geometry/iterators/point_iterator.hpp>

View File

@@ -16,7 +16,6 @@
#include <boost/geometry/core/closure.hpp>
#include <boost/geometry/core/point_type.hpp>
#include <boost/geometry/multi/core/point_type.hpp>
#include <boost/geometry/core/reverse_dispatch.hpp>
#include <boost/geometry/core/tag.hpp>
#include <boost/geometry/core/tags.hpp>

View File

@@ -23,36 +23,32 @@
#include <boost/range.hpp>
#include <boost/geometry/core/point_type.hpp>
#include <boost/geometry/core/geometry_id.hpp>
#include <boost/geometry/core/tag.hpp>
#include <boost/geometry/core/tags.hpp>
#include <boost/geometry/geometries/concepts/check.hpp>
#include <boost/geometry/strategies/distance.hpp>
#include <boost/geometry/strategies/tags.hpp>
#include <boost/geometry/multi/core/tags.hpp>
#include <boost/geometry/multi/core/geometry_id.hpp>
#include <boost/geometry/multi/core/point_type.hpp>
#include <boost/geometry/multi/geometries/concepts/check.hpp>
#include <boost/geometry/util/select_coordinate_type.hpp>
#include <boost/geometry/util/math.hpp>
#include <boost/geometry/algorithms/not_implemented.hpp>
#include <boost/geometry/algorithms/dispatch/distance.hpp>
#include <boost/geometry/algorithms/detail/for_each_range.hpp>
#include <boost/geometry/algorithms/detail/sections/range_by_section.hpp>
#include <boost/geometry/algorithms/detail/sections/sectionalize.hpp>
#include <boost/geometry/views/detail/range_type.hpp>
// includes needed from multi.hpp -- start
#include <boost/geometry/multi/algorithms/covered_by.hpp>
#include <boost/geometry/multi/algorithms/disjoint.hpp>
#include <boost/geometry/multi/algorithms/for_each.hpp>
#include <boost/geometry/multi/algorithms/within.hpp>
#include <boost/geometry/multi/algorithms/detail/for_each_range.hpp>
#include <boost/geometry/multi/algorithms/detail/sections/range_by_section.hpp>
#include <boost/geometry/multi/algorithms/detail/sections/sectionalize.hpp>
#include <boost/geometry/multi/views/detail/range_type.hpp>
// includes needed from multi.hpp -- end
#include <boost/geometry/algorithms/detail/distance/geometry_to_geometry_rtree.hpp>

View File

@@ -20,10 +20,10 @@
#include <boost/range.hpp>
#include <boost/typeof/typeof.hpp>
#include <boost/geometry/multi/core/tags.hpp>
#include <boost/geometry/core/cs.hpp>
#include <boost/geometry/core/interior_rings.hpp>
#include <boost/geometry/core/tags.hpp>
#include <boost/geometry/geometries/concepts/check.hpp>
#include <boost/geometry/util/math.hpp>

View File

@@ -21,6 +21,7 @@
#include <boost/geometry/core/cs.hpp>
#include <boost/geometry/core/point_type.hpp>
#include <boost/geometry/core/ring_type.hpp>
#include <boost/geometry/core/tags.hpp>
#include <boost/geometry/geometries/concepts/check.hpp>
#include <boost/geometry/iterators/ever_circling_iterator.hpp>
@@ -451,6 +452,29 @@ struct extreme_points<Box, 0, box_tag>
}
};
template<typename MultiPolygon, std::size_t Dimension>
struct extreme_points<MultiPolygon, Dimension, multi_polygon_tag>
{
template <typename Extremes, typename Intruders>
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<MultiPolygon const>::type,
Dimension,
polygon_tag
>::apply(*boost::begin(multi), extremes, intruders);
}
return false;
}
};
} // namespace dispatch
#endif // DOXYGEN_NO_DISPATCH

View File

@@ -17,9 +17,13 @@
#include <boost/mpl/assert.hpp>
#include <boost/concept/requires.hpp>
#include <boost/range.hpp>
#include <boost/type_traits/is_const.hpp>
#include <boost/type_traits/remove_const.hpp>
#include <boost/geometry/core/tag.hpp>
#include <boost/geometry/core/tag_cast.hpp>
#include <boost/geometry/core/tags.hpp>
#include <boost/geometry/util/add_const_if_c.hpp>
#include <boost/geometry/views/box_view.hpp>
@@ -34,24 +38,20 @@ namespace detail { namespace for_each
{
template <typename Range, typename Actor, bool IsConst>
template <typename Range, typename Actor>
struct fe_range_range
{
static inline void apply(
typename add_const_if_c<IsConst, Range>::type& range,
Actor& actor)
static inline void apply(Range & range, Actor & actor)
{
actor.apply(range);
}
};
template <typename Polygon, typename Actor, bool IsConst>
template <typename Polygon, typename Actor>
struct fe_range_polygon
{
static inline void apply(
typename add_const_if_c<IsConst, Polygon>::type& polygon,
Actor& actor)
static inline void apply(Polygon & polygon, Actor & actor)
{
actor.apply(exterior_ring(polygon));
@@ -60,17 +60,27 @@ struct fe_range_polygon
}
};
template <typename Box, typename Actor, bool IsConst>
template <typename Box, typename Actor>
struct fe_range_box
{
static inline void apply(
typename add_const_if_c<IsConst, Box>::type& box,
Actor& actor)
static inline void apply(Box & box, Actor & actor)
{
actor.apply(box_view<Box>(box));
actor.apply(box_view<typename boost::remove_const<Box>::type>(box));
}
};
template <typename Multi, typename Actor, typename SinglePolicy>
struct fe_range_multi
{
static inline void apply(Multi & multi, Actor & actor)
{
for ( typename boost::range_iterator<Multi>::type
it = boost::begin(multi); it != boost::end(multi); ++it)
{
SinglePolicy::apply(*it, actor);
}
}
};
}} // namespace detail::for_each
#endif // DOXYGEN_NO_DETAIL
@@ -83,10 +93,9 @@ namespace dispatch
template
<
typename Tag,
typename Geometry,
typename Actor,
bool IsConst
typename Tag = typename tag<Geometry>::type
>
struct for_each_range
{
@@ -98,26 +107,71 @@ struct for_each_range
};
template <typename Linestring, typename Actor, bool IsConst>
struct for_each_range<linestring_tag, Linestring, Actor, IsConst>
: detail::for_each::fe_range_range<Linestring, Actor, IsConst>
template <typename Linestring, typename Actor>
struct for_each_range<Linestring, Actor, linestring_tag>
: detail::for_each::fe_range_range<Linestring, Actor>
{};
template <typename Ring, typename Actor, bool IsConst>
struct for_each_range<ring_tag, Ring, Actor, IsConst>
: detail::for_each::fe_range_range<Ring, Actor, IsConst>
template <typename Ring, typename Actor>
struct for_each_range<Ring, Actor, ring_tag>
: detail::for_each::fe_range_range<Ring, Actor>
{};
template <typename Polygon, typename Actor, bool IsConst>
struct for_each_range<polygon_tag, Polygon, Actor, IsConst>
: detail::for_each::fe_range_polygon<Polygon, Actor, IsConst>
template <typename Polygon, typename Actor>
struct for_each_range<Polygon, Actor, polygon_tag>
: detail::for_each::fe_range_polygon<Polygon, Actor>
{};
template <typename Box, typename Actor, bool IsConst>
struct for_each_range<box_tag, Box, Actor, IsConst>
: detail::for_each::fe_range_box<Box, Actor, IsConst>
template <typename Box, typename Actor>
struct for_each_range<Box, Actor, box_tag>
: detail::for_each::fe_range_box<Box, Actor>
{};
template <typename MultiPoint, typename Actor>
struct for_each_range<MultiPoint, Actor, multi_point_tag>
: detail::for_each::fe_range_range<MultiPoint, Actor>
{};
template <typename Geometry, typename Actor>
struct for_each_range<Geometry, Actor, multi_linestring_tag>
: detail::for_each::fe_range_multi
<
Geometry,
Actor,
detail::for_each::fe_range_range
<
typename add_const_if_c
<
boost::is_const<Geometry>::value,
typename boost::range_value<Geometry>::type
>::type,
Actor
>
>
{};
template <typename Geometry, typename Actor>
struct for_each_range<Geometry, Actor, multi_polygon_tag>
: detail::for_each::fe_range_multi
<
Geometry,
Actor,
detail::for_each::fe_range_polygon
<
typename add_const_if_c
<
boost::is_const<Geometry>::value,
typename boost::range_value<Geometry>::type
>::type,
Actor
>
>
{};
@@ -128,14 +182,12 @@ namespace detail
{
template <typename Geometry, typename Actor>
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<Geometry>::type,
Geometry,
Actor,
true
Geometry const,
Actor
>::apply(geometry, actor);
}

View File

@@ -22,8 +22,6 @@
#include <boost/geometry/policies/robustness/segment_ratio_type.hpp>
#include <boost/geometry/policies/robustness/get_rescale_policy.hpp>
#include <boost/geometry/multi/algorithms/detail/overlay/self_turn_points.hpp>
#ifdef BOOST_GEOMETRY_DEBUG_HAS_SELF_INTERSECTIONS
# include <boost/geometry/algorithms/detail/overlay/debug_turn_info.hpp>
# include <boost/geometry/io/dsv/write.hpp>

View File

@@ -16,6 +16,7 @@
#include <boost/geometry/strategies/side.hpp>
#include <boost/geometry/strategies/cartesian/cart_intersect.hpp>
#include <boost/geometry/policies/robustness/segment_ratio_type.hpp>
#include <boost/geometry/policies/relate/intersection_ratios.hpp>
namespace boost { namespace geometry
{

View File

@@ -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 <boost/range.hpp>
namespace boost { namespace geometry
{
#ifndef DOXYGEN_NO_DETAIL
namespace detail
{
template <typename MultiGeometry, typename Policy>
struct multi_modify
{
static inline void apply(MultiGeometry& multi)
{
typedef typename boost::range_iterator<MultiGeometry>::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

View File

@@ -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 <boost/range.hpp>
namespace boost { namespace geometry
{
#ifndef DOXYGEN_NO_DETAIL
namespace detail
{
template <typename MultiGeometry, typename Predicate, typename Policy>
struct multi_modify_with_predicate
{
static inline void apply(MultiGeometry& multi, Predicate const& predicate)
{
typedef typename boost::range_iterator<MultiGeometry>::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

View File

@@ -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 <boost/range.hpp>
namespace boost { namespace geometry
{
#ifndef DOXYGEN_NO_DETAIL
namespace detail
{
struct multi_sum
{
template <typename ReturnType, typename Policy, typename MultiGeometry, typename Strategy>
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

View File

@@ -17,6 +17,7 @@
#include <boost/geometry/core/ring_type.hpp>
#include <boost/geometry/core/exterior_ring.hpp>
#include <boost/geometry/core/interior_rings.hpp>
#include <boost/geometry/core/tags.hpp>
#include <boost/geometry/algorithms/convert.hpp>
#include <boost/geometry/geometries/concepts/check.hpp>
#include <boost/geometry/views/closeable_view.hpp>
@@ -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<box_tag, Box, Reverse, SegmentIdentifier, PointOut>
{};
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<MultiGeometry>::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<MultiGeometry>::type,
Reverse,
SegmentIdentifier,
PointOut
>
>
{};
} // namespace dispatch
#endif // DOXYGEN_NO_DISPATCH

View File

@@ -15,19 +15,21 @@
#define BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_COPY_SEGMENTS_HPP
#include <boost/array.hpp>
#include <boost/mpl/assert.hpp>
#include <boost/type_traits/integral_constant.hpp>
#include <vector>
#include <boost/array.hpp>
#include <boost/assert.hpp>
#include <boost/mpl/assert.hpp>
#include <boost/range.hpp>
#include <boost/type_traits/integral_constant.hpp>
#include <boost/geometry/core/tags.hpp>
#include <boost/geometry/core/ring_type.hpp>
#include <boost/geometry/core/exterior_ring.hpp>
#include <boost/geometry/core/interior_rings.hpp>
#include <boost/geometry/core/ring_type.hpp>
#include <boost/geometry/core/tags.hpp>
#include <boost/geometry/algorithms/not_implemented.hpp>
#include <boost/geometry/geometries/concepts/check.hpp>
#include <boost/geometry/iterators/ever_circling_iterator.hpp>
@@ -37,6 +39,7 @@
#include <boost/geometry/algorithms/detail/overlay/append_no_duplicates.hpp>
#include <boost/geometry/algorithms/detail/overlay/append_no_dups_or_spikes.hpp>
namespace boost { namespace geometry
{
@@ -239,6 +242,37 @@ struct copy_segments_box
};
template<typename Policy>
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<box_tag, Reverse>
{};
template<bool Reverse>
struct copy_segments<multi_polygon_tag, Reverse>
: detail::copy_segments::copy_segments_multi
<
detail::copy_segments::copy_segments_polygon<Reverse>
>
{};
} // namespace dispatch
#endif // DOXYGEN_NO_DISPATCH

View File

@@ -19,7 +19,6 @@
#include <boost/geometry/core/tag.hpp>
#include <boost/geometry/core/tags.hpp>
#include <boost/geometry/multi/core/tags.hpp>
#include <boost/geometry/algorithms/detail/overlay/copy_segments.hpp>
#include <boost/geometry/algorithms/detail/overlay/follow.hpp>

View File

@@ -13,11 +13,12 @@
#include <boost/assert.hpp>
#include <boost/range.hpp>
#include <boost/geometry/core/tags.hpp>
#include <boost/geometry/core/exterior_ring.hpp>
#include <boost/geometry/core/interior_rings.hpp>
#include <boost/geometry/core/ring_type.hpp>
#include <boost/geometry/core/tags.hpp>
#include <boost/geometry/algorithms/detail/ring_identifier.hpp>
#include <boost/geometry/geometries/concepts/check.hpp>
namespace boost { namespace geometry
@@ -92,6 +93,25 @@ struct get_ring<polygon_tag>
};
template<>
struct get_ring<multi_polygon_tag>
{
template<typename MultiPolygon>
static inline typename ring_type<MultiPolygon>::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<polygon_tag>::apply(id,
multi_polygon[id.multi_index]);
}
};
}} // namespace detail::overlay
#endif // DOXYGEN_NO_DETAIL

View File

@@ -26,11 +26,11 @@
#include <boost/geometry/core/access.hpp>
#include <boost/geometry/core/coordinate_dimension.hpp>
#include <boost/geometry/core/reverse_dispatch.hpp>
#include <boost/geometry/core/exterior_ring.hpp>
#include <boost/geometry/core/interior_rings.hpp>
#include <boost/geometry/core/reverse_dispatch.hpp>
#include <boost/geometry/core/ring_type.hpp>
#include <boost/geometry/core/tags.hpp>
#include <boost/geometry/geometries/concepts/check.hpp>
@@ -50,19 +50,19 @@
#include <boost/geometry/algorithms/detail/disjoint/box_box.hpp>
#include <boost/geometry/algorithms/detail/disjoint/point_point.hpp>
#include <boost/geometry/algorithms/detail/partition.hpp>
#include <boost/geometry/algorithms/detail/recalculate.hpp>
#include <boost/geometry/algorithms/detail/overlay/get_turn_info.hpp>
#include <boost/geometry/algorithms/detail/overlay/get_turn_info_ll.hpp>
#include <boost/geometry/algorithms/detail/overlay/get_turn_info_la.hpp>
#include <boost/geometry/algorithms/detail/overlay/segment_identifier.hpp>
#include <boost/geometry/algorithms/detail/sections/range_by_section.hpp>
#include <boost/geometry/algorithms/detail/sections/sectionalize.hpp>
#include <boost/geometry/algorithms/expand.hpp>
#include <boost/geometry/algorithms/detail/sections/sectionalize.hpp>
#ifdef BOOST_GEOMETRY_DEBUG_INTERSECTION
# include <sstream>
@@ -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 <typename RobustPolicy, typename Turns, typename InterruptPolicy>
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<Multi>::type, Box,
Reverse, ReverseBox,
TurnPolicy
>::apply(source_id1, *it, source_id2, box,
robust_policy, turns, interrupt_policy, i);
}
}
};
// GET_TURN_INFO_TYPE
template <typename Geometry>
@@ -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,

View File

@@ -18,7 +18,6 @@
#include <boost/geometry/core/tag.hpp>
#include <boost/geometry/core/tags.hpp>
#include <boost/geometry/multi/core/tags.hpp>
#include <boost/geometry/algorithms/detail/relate/turns.hpp>

View File

@@ -17,10 +17,9 @@
#include <boost/assert.hpp>
#include <boost/range.hpp>
#include <boost/geometry/core/point_type.hpp>
#include <boost/geometry/core/tag.hpp>
#include <boost/geometry/core/tags.hpp>
#include <boost/geometry/multi/core/tags.hpp>
#include <boost/geometry/core/point_type.hpp>
#include <boost/geometry/algorithms/convert.hpp>
#include <boost/geometry/algorithms/not_implemented.hpp>

View File

@@ -9,8 +9,12 @@
#ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_SELECT_RINGS_HPP
#define BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_SELECT_RINGS_HPP
#include <map>
#include <boost/range.hpp>
#include <boost/geometry/core/tags.hpp>
#include <boost/geometry/algorithms/area.hpp>
#include <boost/geometry/algorithms/within.hpp>
@@ -118,7 +122,32 @@ namespace dispatch
}
}
};
}
template <typename Multi>
struct select_rings<multi_polygon_tag, Multi>
{
template <typename Geometry, typename Map>
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<polygon_tag, typename boost::range_value<Multi>::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<overlay_type OverlayType>

View File

@@ -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 <cstddef>
#include <boost/range.hpp>
#include <boost/geometry/core/access.hpp>
#include <boost/geometry/core/coordinate_dimension.hpp>
#include <boost/geometry/core/tags.hpp>
#include <boost/geometry/geometries/concepts/check.hpp>
@@ -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<TurnPolicy>
{};
} // namespace dispatch
#endif // DOXYGEN_NO_DISPATCH

View File

@@ -19,6 +19,7 @@
#include <boost/range.hpp>
#include <boost/geometry/core/tags.hpp>
#include <boost/geometry/core/point_type.hpp>
#include <boost/geometry/core/ring_type.hpp>
@@ -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<box_tag, Point, Box>
{};
template<typename Point, typename Multi>
struct point_on_border<multi_polygon_tag, Point, Multi>
: detail::point_on_border::point_on_multi
<
Point,
Multi,
detail::point_on_border::point_on_polygon
<
Point,
typename boost::range_value<Multi>::type
>
>
{};
template<typename Point, typename Multi>
struct point_on_border<multi_linestring_tag, Point, Multi>
: detail::point_on_border::point_on_multi
<
Point,
Multi,
detail::point_on_border::point_on_range
<
Point,
typename boost::range_value<Multi>::type
>
>
{};
} // namespace dispatch
#endif // DOXYGEN_NO_DISPATCH

View File

@@ -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 <boost/assert.hpp>
#include <boost/mpl/assert.hpp>
#include <boost/range.hpp>
@@ -22,7 +27,9 @@
#include <boost/geometry/core/closure.hpp>
#include <boost/geometry/core/exterior_ring.hpp>
#include <boost/geometry/core/interior_rings.hpp>
#include <boost/geometry/core/ring_type.hpp>
#include <boost/geometry/core/tags.hpp>
#include <boost/geometry/geometries/concepts/check.hpp>
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<MultiGeometry const>::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<polygon_tag, Polygon, Section>
{};
template <typename MultiPolygon, typename Section>
struct range_by_section<multi_polygon_tag, MultiPolygon, Section>
: detail::section::full_section_multi
<
MultiPolygon,
Section,
detail::section::full_section_polygon
<
typename boost::range_value<MultiPolygon>::type,
Section
>
>
{};
template <typename MultiLinestring, typename Section>
struct range_by_section<multi_linestring_tag, MultiLinestring, Section>
: detail::section::full_section_multi
<
MultiLinestring,
Section,
detail::section::full_section_range
<
typename boost::range_value<MultiLinestring>::type,
Section
>
>
{};
} // namespace dispatch
#endif

View File

@@ -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 <cstddef>
#include <vector>
#include <boost/concept/requires.hpp>
#include <boost/mpl/assert.hpp>
#include <boost/range.hpp>
#include <boost/typeof/typeof.hpp>
@@ -36,7 +37,7 @@
#include <boost/geometry/core/closure.hpp>
#include <boost/geometry/core/exterior_ring.hpp>
#include <boost/geometry/core/point_order.hpp>
#include <boost/geometry/core/tags.hpp>
#include <boost/geometry/geometries/concepts/check.hpp>
#include <boost/geometry/util/math.hpp>
@@ -46,8 +47,6 @@
#include <boost/geometry/views/reversible_view.hpp>
#include <boost/geometry/geometries/segment.hpp>
namespace boost { namespace geometry
{
@@ -556,6 +555,31 @@ struct sectionalize_box
}
};
template <std::size_t DimensionCount, typename Policy>
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<MultiGeometry const>::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 <typename Sections>
inline void set_section_unique_ids(Sections& sections)
{
@@ -675,6 +699,45 @@ struct sectionalize<polygon_tag, Polygon, Reverse, DimensionCount>
>
{};
template
<
typename MultiPolygon,
bool Reverse,
std::size_t DimensionCount
>
struct sectionalize<multi_polygon_tag, MultiPolygon, Reverse, DimensionCount>
: detail::sectionalize::sectionalize_multi
<
DimensionCount,
detail::sectionalize::sectionalize_polygon
<
Reverse,
DimensionCount
>
>
{};
template
<
typename MultiLinestring,
bool Reverse,
std::size_t DimensionCount
>
struct sectionalize<multi_linestring_tag, MultiLinestring, Reverse, DimensionCount>
: detail::sectionalize::sectionalize_multi
<
DimensionCount,
detail::sectionalize::sectionalize_range
<
closed, false,
typename point_type<MultiLinestring>::type,
DimensionCount
>
>
{};
} // namespace dispatch
#endif

View File

@@ -134,8 +134,6 @@ struct within_no_turns<Geometry1, Geometry2, polygon_tag, polygon_tag>
}
};
// TODO: later move it to directory boost/geometry/multi/algorithms/detail/within
template <typename Geometry1,
typename Geometry2,
typename Tag1 = typename geometry::tag<Geometry1>::type,

View File

@@ -18,7 +18,6 @@
#include <boost/mpl/assert.hpp>
#include <boost/geometry/core/tags.hpp>
#include <boost/geometry/multi/core/tags.hpp>
namespace boost { namespace geometry

View File

@@ -14,10 +14,9 @@
#ifndef BOOST_GEOMETRY_CORE_CLOSURE_HPP
#define BOOST_GEOMETRY_CORE_CLOSURE_HPP
#include <boost/mpl/assert.hpp>
#include <boost/mpl/size_t.hpp>
#include <boost/range.hpp>
#include <boost/range/value_type.hpp>
#include <boost/type_traits/remove_const.hpp>
#include <boost/geometry/core/ring_type.hpp>
@@ -139,7 +138,7 @@ struct closure<ring_tag, Ring>
= geometry::traits::closure<Ring>::value;
};
// Specialization for polygon: the closure is the closure of its rings
// Specialization for Polygon: the closure is the closure of its rings
template <typename Polygon>
struct closure<polygon_tag, Polygon>
{
@@ -150,6 +149,24 @@ struct closure<polygon_tag, Polygon>
>::value ;
};
template <typename MultiPoint>
struct closure<multi_point_tag, MultiPoint>
: public core_detail::closure::closed {};
template <typename MultiLinestring>
struct closure<multi_linestring_tag, MultiLinestring>
: public core_detail::closure::closed {};
// Specialization for MultiPolygon: the closure is the closure of Polygon's rings
template <typename MultiPolygon>
struct closure<multi_polygon_tag, MultiPolygon>
{
static const closure_selector value = core_dispatch::closure
<
polygon_tag,
typename boost::range_value<MultiPolygon>::type
>::value ;
};
} // namespace core_dispatch
#endif // DOXYGEN_NO_DISPATCH

View File

@@ -18,8 +18,6 @@
#include <boost/mpl/assert.hpp>
#include <boost/mpl/int.hpp>
#include <boost/type_traits.hpp>
#include <boost/geometry/core/tag.hpp>
#include <boost/geometry/core/tags.hpp>
@@ -45,29 +43,40 @@ struct geometry_id
template <>
struct geometry_id<point_tag> : boost::mpl::int_<1> {};
struct geometry_id<point_tag> : boost::mpl::int_<1> {};
template <>
struct geometry_id<linestring_tag> : boost::mpl::int_<2> {};
struct geometry_id<linestring_tag> : boost::mpl::int_<2> {};
template <>
struct geometry_id<polygon_tag> : boost::mpl::int_<3> {};
struct geometry_id<polygon_tag> : boost::mpl::int_<3> {};
template <>
struct geometry_id<segment_tag> : boost::mpl::int_<92> {};
struct geometry_id<multi_point_tag> : boost::mpl::int_<4> {};
template <>
struct geometry_id<ring_tag> : boost::mpl::int_<93> {};
struct geometry_id<multi_linestring_tag> : boost::mpl::int_<5> {};
template <>
struct geometry_id<box_tag> : boost::mpl::int_<94> {};
struct geometry_id<multi_polygon_tag> : boost::mpl::int_<6> {};
template <>
struct geometry_id<segment_tag> : boost::mpl::int_<92> {};
template <>
struct geometry_id<ring_tag> : boost::mpl::int_<93> {};
template <>
struct geometry_id<box_tag> : boost::mpl::int_<94> {};
} // namespace core_dispatch
#endif

View File

@@ -17,7 +17,7 @@
#include <cstddef>
#include <boost/mpl/assert.hpp>
#include <boost/range.hpp>
#include <boost/range/value_type.hpp>
#include <boost/type_traits/remove_const.hpp>
#include <boost/geometry/core/tag.hpp>
@@ -85,6 +85,17 @@ struct interior_rings<polygon_tag, Polygon>
};
template <typename MultiPolygon>
struct interior_type<multi_polygon_tag, MultiPolygon>
{
typedef typename core_dispatch::interior_type
<
polygon_tag,
typename boost::range_value<MultiPolygon>::type
>::type type;
};
} // namespace core_dispatch
#endif

View File

@@ -16,8 +16,7 @@
#define BOOST_GEOMETRY_CORE_IS_AREAL_HPP
#include <boost/type_traits.hpp>
#include <boost/type_traits/integral_constant.hpp>
#include <boost/geometry/core/tag.hpp>
#include <boost/geometry/core/tags.hpp>
@@ -36,7 +35,7 @@ template <typename GeometryTag> struct is_areal : boost::false_type {};
template <> struct is_areal<ring_tag> : boost::true_type {};
template <> struct is_areal<box_tag> : boost::true_type {};
template <> struct is_areal<polygon_tag> : boost::true_type {};
template <> struct is_areal<multi_polygon_tag> : boost::true_type {};
} // namespace core_dispatch
#endif

View File

@@ -16,7 +16,7 @@
#include <boost/mpl/assert.hpp>
#include <boost/range.hpp>
#include <boost/range/value_type.hpp>
#include <boost/type_traits/remove_const.hpp>
#include <boost/geometry/core/ring_type.hpp>
@@ -135,6 +135,26 @@ struct point_order<polygon_tag, Polygon>
>::value ;
};
template <typename MultiPoint>
struct point_order<multi_point_tag, MultiPoint>
: public detail::point_order::clockwise {};
template <typename MultiLinestring>
struct point_order<multi_linestring_tag, MultiLinestring>
: public detail::point_order::clockwise {};
// Specialization for multi_polygon: the order is the order of its polygons
template <typename MultiPolygon>
struct point_order<multi_polygon_tag, MultiPolygon>
{
static const order_selector value = core_dispatch::point_order
<
polygon_tag,
typename boost::range_value<MultiPolygon>::type
>::value ;
};
} // namespace core_dispatch
#endif // DOXYGEN_NO_DISPATCH

View File

@@ -16,7 +16,7 @@
#include <boost/mpl/assert.hpp>
#include <boost/range.hpp>
#include <boost/range/value_type.hpp>
#include <boost/type_traits/remove_const.hpp>
#include <boost/geometry/core/ring_type.hpp>
@@ -102,6 +102,38 @@ struct point_type<polygon_tag, Polygon>
};
template <typename MultiPoint>
struct point_type<multi_point_tag, MultiPoint>
{
typedef typename boost::range_value
<
MultiPoint
>::type type;
};
template <typename MultiLinestring>
struct point_type<multi_linestring_tag, MultiLinestring>
{
typedef typename point_type
<
linestring_tag,
typename boost::range_value<MultiLinestring>::type
>::type type;
};
template <typename MultiPolygon>
struct point_type<multi_polygon_tag, MultiPolygon>
{
typedef typename point_type
<
polygon_tag,
typename boost::range_value<MultiPolygon>::type
>::type type;
};
} // namespace core_dispatch
#endif // DOXYGEN_NO_DISPATCH

View File

@@ -18,8 +18,10 @@
#include <boost/mpl/assert.hpp>
#include <boost/mpl/if.hpp>
#include <boost/range/value_type.hpp>
#include <boost/type_traits/is_const.hpp>
#include <boost/type_traits/remove_const.hpp>
#include <boost/type_traits/remove_reference.hpp>
#include <boost/geometry/core/tag.hpp>
#include <boost/geometry/core/tags.hpp>
@@ -102,6 +104,38 @@ struct ring_return_type<polygon_tag, Polygon>
};
template <typename MultiLinestring>
struct ring_return_type<multi_linestring_tag, MultiLinestring>
{
typedef typename ring_return_type
<
linestring_tag,
typename mpl::if_
<
boost::is_const<MultiLinestring>,
typename boost::range_value<MultiLinestring>::type const,
typename boost::range_value<MultiLinestring>::type
>::type
>::type type;
};
template <typename MultiPolygon>
struct ring_return_type<multi_polygon_tag, MultiPolygon>
{
typedef typename ring_return_type
<
polygon_tag,
typename mpl::if_
<
boost::is_const<MultiPolygon>,
typename boost::range_value<MultiPolygon>::type const,
typename boost::range_value<MultiPolygon>::type
>::type
>::type type;
};
template <typename GeometryTag, typename Geometry>
struct ring_type
{};
@@ -124,8 +158,25 @@ struct ring_type<polygon_tag, Polygon>
};
template <typename MultiLinestring>
struct ring_type<multi_linestring_tag, MultiLinestring>
{
typedef typename boost::remove_reference
<
typename ring_return_type<multi_linestring_tag, MultiLinestring>::type
>::type type;
};
template <typename MultiPolygon>
struct ring_type<multi_polygon_tag, MultiPolygon>
{
typedef typename boost::remove_reference
<
typename ring_return_type<multi_polygon_tag, MultiPolygon>::type
>::type type;
};
} // namespace core_dispatch
#endif

View File

@@ -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 <typename Tag>
struct single_tag_of
{};
#ifndef DOXYGEN_NO_DETAIL
template <>
struct single_tag_of<multi_point_tag>
{
typedef point_tag type;
};
template <>
struct single_tag_of<multi_linestring_tag>
{
typedef linestring_tag type;
};
template <>
struct single_tag_of<multi_polygon_tag>
{
typedef polygon_tag type;
};
#endif
}} // namespace boost::geometry

View File

@@ -49,10 +49,12 @@ struct top_dim<segment_tag> : boost::mpl::int_<1> {};
// ring: topological dimension of two, but some people say: 1 !!
// NOTE: This is not OGC LinearRing!
template <>
struct top_dim<ring_tag> : boost::mpl::int_<2> {};
// TODO: This is wrong! Boxes may have various topological dimensions
template <>
struct top_dim<box_tag> : boost::mpl::int_<2> {};
@@ -61,6 +63,17 @@ template <>
struct top_dim<polygon_tag> : boost::mpl::int_<2> {};
template <>
struct top_dim<multi_point_tag> : boost::mpl::int_<0> {};
template <>
struct top_dim<multi_linestring_tag> : boost::mpl::int_<1> {};
template <>
struct top_dim<multi_polygon_tag> : boost::mpl::int_<2> {};
} // namespace core_dispatch
#endif

View File

@@ -40,6 +40,8 @@
#include <boost/geometry/algorithms/detail/occupation_info.hpp>
#include <boost/geometry/algorithms/detail/partition.hpp>
#include <boost/geometry/util/range.hpp>
#ifdef BOOST_GEOMETRY_DEBUG_BUFFER_OCCUPATION
# include <boost/geometry/algorithms/detail/overlay/debug_turn_info.hpp>
# include <boost/geometry/io/wkt/wkt.hpp>
@@ -389,7 +391,7 @@ struct buffered_piece_collection
int const side_wrt_circle = side_on_convex_range<side_strategy>(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,14 +400,24 @@ struct buffered_piece_collection
return;
}
int side_helper = side_on_convex_range<side_strategy>(turn.point, pc.helper_segments, m_robust_policy);
// Get the segments p/q from which turn.point resulted, to get proper/robust side
buffered_ring<Ring> const& ring0 = offsetted_rings[turn.operations[0].seg_id.multi_index];
buffered_ring<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<side_strategy>(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<side_strategy>(turn.point,
int const side_offsetted = intersection_side_on_convex_range<side_strategy>(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, m_robust_policy);

View File

@@ -9,6 +9,7 @@
#ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_BUFFER_BUFFERED_RING
#define BOOST_GEOMETRY_ALGORITHMS_DETAIL_BUFFER_BUFFERED_RING
#include <cstddef>
#include <boost/range.hpp>
@@ -18,17 +19,16 @@
#include <boost/geometry/extensions/strategies/buffer_side.hpp>
#include <boost/geometry/algorithms/detail/overlay/copy_segments.hpp>
#include <boost/geometry/algorithms/detail/overlay/copy_segment_point.hpp>
#include <boost/geometry/algorithms/detail/overlay/enrichment_info.hpp>
#include <boost/geometry/algorithms/detail/overlay/get_ring.hpp>
#include <boost/geometry/algorithms/detail/overlay/traversal_info.hpp>
#include <boost/geometry/algorithms/detail/overlay/turn_info.hpp>
#include <boost/geometry/multi/algorithms/detail/overlay/copy_segments.hpp>
#include <boost/geometry/multi/algorithms/detail/overlay/copy_segment_point.hpp>
#include <boost/geometry/multi/algorithms/within.hpp>
namespace boost { namespace geometry
{

View File

@@ -12,7 +12,7 @@
#include <boost/range.hpp>
#include <boost/typeof/typeof.hpp>
#include <boost/geometry/multi/core/point_type.hpp>
#include <boost/geometry/core/point_type.hpp>
#include <boost/geometry/multi/algorithms/distance.hpp>
#include <boost/geometry/extensions/algorithms/buffer/buffer_inserter.hpp>

View File

@@ -11,6 +11,7 @@
#include <boost/range.hpp>
#include <boost/geometry/algorithms/detail/overlay/segment_identifier.hpp>
#include <boost/geometry/algorithms/detail/intersection_side.hpp>
namespace boost { namespace geometry
{
@@ -52,72 +53,12 @@ inline bool collinear_point_on_segment(P0 const& subject, P1 const& p1, P2 const
}
template <typename SideStrategy, typename Point, typename Range, typename RobustPolicy>
inline int side_on_convex_range(Point const& subject,
Range const& range, RobustPolicy const& robust_policy)
{
// TODO merge this implementation with next function with same name
if (boost::empty(range))
{
return 1;
}
bool has_collinear = false;
typedef typename geometry::robust_point_type
<
Point,
RobustPolicy
>::type robust_point_type;
typedef typename boost::range_iterator<Range const>::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);
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);
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_rob, previous_rob, current_rob))
{
return 0;
}
has_collinear = true;
break;
}
previous_rob = current_rob;
}
return has_collinear ? 1 : -1;
}
template <typename SideStrategy, typename Point, typename Iterator, typename RobustPolicy>
template <typename SideStrategy, typename Point, typename Iterator>
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 +67,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 +81,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,11 +89,77 @@ 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;
}
template <typename SideStrategy, typename Point, typename Range>
inline int side_on_convex_range(Point const& subject, Range const& range)
{
segment_identifier dummy;
return side_on_convex_range<SideStrategy>(subject,
boost::begin(range), boost::end(range),
dummy, dummy);
}
template <typename SideStrategy, typename Point, typename Iterator, typename RobustPolicy>
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 <typename SideStrategy, typename Point, typename Range, typename RobustPolicy>
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<SideStrategy>(subject, pi, pj, qi, qj,
boost::begin(range), boost::end(range),
dummy, dummy, robust_policy);
}
}} // namespace detail::buffer
#endif // DOXYGEN_NO_DETAIL

View File

@@ -15,9 +15,9 @@
#include <boost/range.hpp>
#include <boost/geometry/core/point_type.hpp>
#include <boost/geometry/core/tags.hpp>
#include <boost/geometry/algorithms/distance.hpp>
#include <boost/geometry/algorithms/comparable_distance.hpp>
#include <boost/geometry/multi/core/tags.hpp>
#include <boost/geometry/strategies/default_distance_result.hpp>
#include <boost/geometry/policies/compare.hpp>

View File

@@ -18,11 +18,12 @@
#include <boost/geometry/extensions/strategies/buffer.hpp>
#include <boost/geometry/extensions/strategies/buffer_distance_asymmetric.hpp>
#include <boost/geometry/extensions/strategies/buffer_end_skip.hpp>
#include <boost/geometry/algorithms/detail/disjoint.hpp>
#include <boost/geometry/geometries/concepts/check.hpp>
#include <boost/geometry/geometries/segment.hpp>
#include <boost/geometry/policies/robustness/no_rescale_policy.hpp>
namespace boost { namespace geometry
{
@@ -138,32 +139,41 @@ inline void offset(Geometry const& geometry, GeometryOut& out,
typedef typename geometry::point_type<Geometry>::type point_type;
bool reverse = distance < 0;
typedef strategy::buffer::distance_asymmetric
<
typename geometry::coordinate_type<Geometry>::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<point_type>
> collection;
model::ring<point_type>,
detail::no_rescale_policy
> collection(robust_policy);
typedef strategy::buffer::end_skip<point_type, point_type> end_strategy_type;
end_strategy_type end_strategy;
bool reverse = distance < 0;
strategy::buffer::distance_asymmetric
<
typename geometry::coordinate_type<Geometry>::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<Geometry>::type,
typename tag<GeometryOut>::type,
Geometry,
GeometryOut
>::apply(collection, geometry, distance_strategy, join_strategy, end_strategy, reverse);
<
typename tag<Geometry>::type,
typename tag<GeometryOut>::type,
Geometry,
GeometryOut
>::apply(collection,
geometry,
distance_strategy,
join_strategy,
end_strategy,
reverse);
collection.assign_offsetted_rings(out);
}

View File

@@ -15,17 +15,14 @@
#include <algorithm>
#include <boost/geometry/algorithms/area.hpp>
#include <boost/geometry/algorithms/detail/multi_modify_with_predicate.hpp>
#include <boost/geometry/algorithms/perimeter.hpp>
#include <boost/geometry/core/closure.hpp>
#include <boost/geometry/core/interior_rings.hpp>
#include <boost/geometry/util/math.hpp>
#include <boost/geometry/core/tags.hpp>
#include <boost/geometry/geometries/concepts/check.hpp>
#include <boost/geometry/multi/core/closure.hpp>
#include <boost/geometry/multi/core/tags.hpp>
#include <boost/geometry/multi/algorithms/detail/modify_with_predicate.hpp>
#include <boost/geometry/util/math.hpp>
namespace boost { namespace geometry

View File

@@ -17,11 +17,10 @@
#include <boost/range.hpp>
#include <boost/geometry/multi/core/tags.hpp>
#include <boost/geometry/core/coordinate_type.hpp>
#include <boost/geometry/core/cs.hpp>
#include <boost/geometry/core/interior_rings.hpp>
#include <boost/geometry/core/tags.hpp>
#include <boost/geometry/geometries/concepts/check.hpp>
#include <boost/geometry/util/math.hpp>

View File

@@ -14,8 +14,8 @@
#include <boost/scoped_array.hpp>
#include <boost/geometry/multi/core/tags.hpp>
#include <boost/geometry/multi/core/point_type.hpp>
#include <boost/geometry/core/tags.hpp>
#include <boost/geometry/core/point_type.hpp>
#include <boost/geometry/multi/algorithms/num_interior_rings.hpp>
#include <boost/geometry/extensions/gis/io/shapelib/shp_create_object.hpp>

View File

@@ -14,8 +14,8 @@
#include <boost/range.hpp>
#include <boost/geometry/multi/core/tags.hpp>
#include <boost/geometry/multi/core/point_type.hpp>
#include <boost/geometry/core/point_type.hpp>
#include <boost/geometry/core/tags.hpp>
#include <boost/geometry/algorithms/union.hpp>

View File

@@ -21,7 +21,7 @@
#include <boost/geometry/algorithms/within.hpp>
#include <boost/geometry/strategies/distance.hpp>
#include <boost/geometry/multi/core/tags.hpp>
#include <boost/geometry/core/tags.hpp>
#include <boost/geometry/extensions/nsphere/core/access.hpp>
#include <boost/geometry/extensions/nsphere/core/radius.hpp>

View File

@@ -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*/ {};

View File

@@ -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 <typename A, typename B>
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 <typename A, typename B>
// static bool apply(A const& a, B const& b)
// {
// // Assertion if called
// assert(false);
// return false;
// }
//};
@@ -95,7 +95,7 @@ template <typename Point, typename NSphere>
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<Point, NSphere, within::point_nsphere_within_comparable_distance> type;
};
template <typename AnyTag, typename AnyGeometry, typename NSphere>
struct default_strategy
<
AnyTag, nsphere_tag,
AnyTag, areal_tag,
cartesian_tag, cartesian_tag,
AnyGeometry, NSphere
>
{
typedef within::nsphere_dummy type;
};
//template <typename AnyTag, typename AnyGeometry, typename NSphere>
//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 <typename Point, typename NSphere>
struct default_strategy
<
point_tag, nsphere_tag,
point_tag, areal_tag,
point_tag, nsphere_tag,
cartesian_tag, cartesian_tag,
Point, NSphere
>

View File

@@ -18,13 +18,17 @@
#include <boost/concept_check.hpp>
#include <boost/concept/requires.hpp>
#include <boost/type_traits/is_const.hpp>
#include <boost/variant/variant_fwd.hpp>
#include <boost/geometry/core/tag.hpp>
#include <boost/geometry/core/tags.hpp>
#include <boost/geometry/geometries/concepts/box_concept.hpp>
#include <boost/geometry/geometries/concepts/linestring_concept.hpp>
#include <boost/geometry/geometries/concepts/multi_point_concept.hpp>
#include <boost/geometry/geometries/concepts/multi_linestring_concept.hpp>
#include <boost/geometry/geometries/concepts/multi_polygon_concept.hpp>
#include <boost/geometry/geometries/concepts/point_concept.hpp>
#include <boost/geometry/geometries/concepts/polygon_concept.hpp>
#include <boost/geometry/geometries/concepts/ring_concept.hpp>
@@ -32,8 +36,6 @@
#include <boost/geometry/algorithms/not_implemented.hpp>
#include <boost/variant/variant_fwd.hpp>
namespace boost { namespace geometry
{
@@ -138,6 +140,42 @@ struct check<Geometry, segment_tag, false>
{};
template <typename Geometry>
struct check<Geometry, multi_point_tag, true>
: detail::concept_check::check<concept::ConstMultiPoint<Geometry> >
{};
template <typename Geometry>
struct check<Geometry, multi_point_tag, false>
: detail::concept_check::check<concept::MultiPoint<Geometry> >
{};
template <typename Geometry>
struct check<Geometry, multi_linestring_tag, true>
: detail::concept_check::check<concept::ConstMultiLinestring<Geometry> >
{};
template <typename Geometry>
struct check<Geometry, multi_linestring_tag, false>
: detail::concept_check::check<concept::MultiLinestring<Geometry> >
{};
template <typename Geometry>
struct check<Geometry, multi_polygon_tag, true>
: detail::concept_check::check<concept::ConstMultiPolygon<Geometry> >
{};
template <typename Geometry>
struct check<Geometry, multi_polygon_tag, false>
: detail::concept_check::check<concept::MultiPolygon<Geometry> >
{};
} // namespace dispatch
#endif

View File

@@ -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 <boost/concept_check.hpp>
#include <boost/range/concepts.hpp>
#include <boost/range/metafunctions.hpp>
#include <boost/geometry/geometries/concepts/linestring_concept.hpp>
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 <typename Geometry>
class MultiLinestring
{
#ifndef DOXYGEN_NO_CONCEPT_MEMBERS
typedef typename boost::range_value<Geometry>::type linestring_type;
BOOST_CONCEPT_ASSERT( (concept::Linestring<linestring_type>) );
BOOST_CONCEPT_ASSERT( (boost::RandomAccessRangeConcept<Geometry>) );
public :
BOOST_CONCEPT_USAGE(MultiLinestring)
{
Geometry* mls = 0;
traits::clear<Geometry>::apply(*mls);
traits::resize<Geometry>::apply(*mls, 0);
linestring_type* ls = 0;
traits::push_back<Geometry>::apply(*mls, *ls);
}
#endif
};
/*!
\brief concept for multi-linestring (const version)
\ingroup const_concepts
*/
template <typename Geometry>
class ConstMultiLinestring
{
#ifndef DOXYGEN_NO_CONCEPT_MEMBERS
typedef typename boost::range_value<Geometry>::type linestring_type;
BOOST_CONCEPT_ASSERT( (concept::ConstLinestring<linestring_type>) );
BOOST_CONCEPT_ASSERT( (boost::RandomAccessRangeConcept<Geometry>) );
public :
BOOST_CONCEPT_USAGE(ConstMultiLinestring)
{
}
#endif
};
}}} // namespace boost::geometry::concept
#endif // BOOST_GEOMETRY_GEOMETRIES_CONCEPTS_MULTI_LINESTRING_CONCEPT_HPP

View File

@@ -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 <boost/concept_check.hpp>
#include <boost/range/concepts.hpp>
#include <boost/range/metafunctions.hpp>
#include <boost/geometry/geometries/concepts/point_concept.hpp>
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 <typename Geometry>
class MultiPoint
{
#ifndef DOXYGEN_NO_CONCEPT_MEMBERS
typedef typename boost::range_value<Geometry>::type point_type;
BOOST_CONCEPT_ASSERT( (concept::Point<point_type>) );
BOOST_CONCEPT_ASSERT( (boost::RandomAccessRangeConcept<Geometry>) );
public :
BOOST_CONCEPT_USAGE(MultiPoint)
{
Geometry* mp = 0;
traits::clear<Geometry>::apply(*mp);
traits::resize<Geometry>::apply(*mp, 0);
point_type* point = 0;
traits::push_back<Geometry>::apply(*mp, *point);
}
#endif
};
/*!
\brief concept for multi-point (const version)
\ingroup const_concepts
*/
template <typename Geometry>
class ConstMultiPoint
{
#ifndef DOXYGEN_NO_CONCEPT_MEMBERS
typedef typename boost::range_value<Geometry>::type point_type;
BOOST_CONCEPT_ASSERT( (concept::ConstPoint<point_type>) );
BOOST_CONCEPT_ASSERT( (boost::RandomAccessRangeConcept<Geometry>) );
public :
BOOST_CONCEPT_USAGE(ConstMultiPoint)
{
}
#endif
};
}}} // namespace boost::geometry::concept
#endif // BOOST_GEOMETRY_GEOMETRIES_CONCEPTS_MULTI_POINT_CONCEPT_HPP

View File

@@ -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 <boost/concept_check.hpp>
#include <boost/range/concepts.hpp>
#include <boost/range/metafunctions.hpp>
#include <boost/geometry/geometries/concepts/polygon_concept.hpp>
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 <typename Geometry>
class MultiPolygon
{
#ifndef DOXYGEN_NO_CONCEPT_MEMBERS
typedef typename boost::range_value<Geometry>::type polygon_type;
BOOST_CONCEPT_ASSERT( (concept::Polygon<polygon_type>) );
BOOST_CONCEPT_ASSERT( (boost::RandomAccessRangeConcept<Geometry>) );
public :
BOOST_CONCEPT_USAGE(MultiPolygon)
{
Geometry* mp = 0;
traits::clear<Geometry>::apply(*mp);
traits::resize<Geometry>::apply(*mp, 0);
polygon_type* poly = 0;
traits::push_back<Geometry>::apply(*mp, *poly);
}
#endif
};
/*!
\brief concept for multi-polygon (const version)
\ingroup const_concepts
*/
template <typename Geometry>
class ConstMultiPolygon
{
#ifndef DOXYGEN_NO_CONCEPT_MEMBERS
typedef typename boost::range_value<Geometry>::type polygon_type;
BOOST_CONCEPT_ASSERT( (concept::ConstPolygon<polygon_type>) );
BOOST_CONCEPT_ASSERT( (boost::RandomAccessRangeConcept<Geometry>) );
public :
BOOST_CONCEPT_USAGE(ConstMultiPolygon)
{
}
#endif
};
}}} // namespace boost::geometry::concept
#endif // BOOST_GEOMETRY_GEOMETRIES_CONCEPTS_MULTI_POLYGON_CONCEPT_HPP

View File

@@ -18,6 +18,10 @@
#include <boost/geometry/geometries/linestring.hpp>
#include <boost/geometry/geometries/polygon.hpp>
#include <boost/geometry/geometries/multi_point.hpp>
#include <boost/geometry/geometries/multi_linestring.hpp>
#include <boost/geometry/geometries/multi_polygon.hpp>
#include <boost/geometry/geometries/box.hpp>
#include <boost/geometry/geometries/ring.hpp>
#include <boost/geometry/geometries/segment.hpp>

View File

@@ -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 <memory>
#include <vector>
#include <boost/concept/requires.hpp>
#include <boost/geometry/core/tags.hpp>
#include <boost/geometry/geometries/concepts/linestring_concept.hpp>
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<typename, typename> class Container = std::vector,
template<typename> class Allocator = std::allocator
>
class multi_linestring : public Container<LineString, Allocator<LineString> >
{
BOOST_CONCEPT_ASSERT( (concept::Linestring<LineString>) );
};
} // namespace model
#ifndef DOXYGEN_NO_TRAITS_SPECIALIZATIONS
namespace traits
{
template
<
typename LineString,
template<typename, typename> class Container,
template<typename> class Allocator
>
struct tag< model::multi_linestring<LineString, Container, Allocator> >
{
typedef multi_linestring_tag type;
};
} // namespace traits
#endif // DOXYGEN_NO_TRAITS_SPECIALIZATIONS
}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_GEOMETRIES_MULTI_LINESTRING_HPP

View File

@@ -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 <memory>
#include <vector>
#include <boost/concept/requires.hpp>
#include <boost/geometry/core/tags.hpp>
#include <boost/geometry/geometries/concepts/point_concept.hpp>
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<typename, typename> class Container = std::vector,
template<typename> class Allocator = std::allocator
>
class multi_point : public Container<Point, Allocator<Point> >
{
BOOST_CONCEPT_ASSERT( (concept::Point<Point>) );
typedef Container<Point, Allocator<Point> > base_type;
public :
/// \constructor_default{multi_point}
inline multi_point()
: base_type()
{}
/// \constructor_begin_end{multi_point}
template <typename Iterator>
inline multi_point(Iterator begin, Iterator end)
: base_type(begin, end)
{}
};
} // namespace model
#ifndef DOXYGEN_NO_TRAITS_SPECIALIZATIONS
namespace traits
{
template
<
typename Point,
template<typename, typename> class Container,
template<typename> class Allocator
>
struct tag< model::multi_point<Point, Container, Allocator> >
{
typedef multi_point_tag type;
};
} // namespace traits
#endif // DOXYGEN_NO_TRAITS_SPECIALIZATIONS
}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_GEOMETRIES_MULTI_POINT_HPP

View File

@@ -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 <memory>
#include <vector>
#include <boost/concept/requires.hpp>
#include <boost/geometry/core/tags.hpp>
#include <boost/geometry/geometries/concepts/polygon_concept.hpp>
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<typename, typename> class Container = std::vector,
template<typename> class Allocator = std::allocator
>
class multi_polygon : public Container<Polygon, Allocator<Polygon> >
{
BOOST_CONCEPT_ASSERT( (concept::Polygon<Polygon>) );
};
} // namespace model
#ifndef DOXYGEN_NO_TRAITS_SPECIALIZATIONS
namespace traits
{
template
<
typename Polygon,
template<typename, typename> class Container,
template<typename> class Allocator
>
struct tag< model::multi_polygon<Polygon, Container, Allocator> >
{
typedef multi_polygon_tag type;
};
} // namespace traits
#endif // DOXYGEN_NO_TRAITS_SPECIALIZATIONS
}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_GEOMETRIES_MULTI_POLYGON_HPP

View File

@@ -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 <boost/geometry/core/tag.hpp>
#include <boost/geometry/core/tags.hpp>
/*!
\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<MultiLineString> { 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<typename LineString> struct tag< MultiLineString<LineString> > { typedef multi_linestring_tag type; }; \
}}}
#endif // BOOST_GEOMETRY_GEOMETRIES_REGISTER_MULTI_LINESTRING_HPP

View File

@@ -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 <boost/geometry/core/tag.hpp>
#include <boost/geometry/core/tags.hpp>
/*!
\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<MultiPoint> { 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<typename Point> struct tag< MultiPoint<Point> > { typedef multi_point_tag type; }; \
}}}
#endif // BOOST_GEOMETRY_GEOMETRIES_REGISTER_MULTI_POINT_HPP

View File

@@ -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 <boost/geometry/core/tag.hpp>
#include <boost/geometry/core/tags.hpp>
/*!
\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<MultiPolygon> { 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<typename Polygon> struct tag< MultiPolygon<Polygon> > { typedef multi_polygon_tag type; }; \
}}}
#endif // BOOST_GEOMETRY_GEOMETRIES_REGISTER_MULTI_POLYGON_HPP

View File

@@ -26,6 +26,7 @@
#include <boost/geometry/core/interior_rings.hpp>
#include <boost/geometry/core/ring_type.hpp>
#include <boost/geometry/core/tag_cast.hpp>
#include <boost/geometry/core/tags.hpp>
#include <boost/geometry/geometries/concepts/check.hpp>
@@ -339,9 +340,61 @@ private:
dsv_settings m_settings;
};
template <typename MultiGeometry>
struct dsv_multi
{
typedef dispatch::dsv
<
typename single_tag_of
<
typename tag<MultiGeometry>::type
>::type,
typename boost::range_value<MultiGeometry>::type
> dispatch_one;
typedef typename boost::range_iterator
<
MultiGeometry const
>::type iterator;
template <typename Char, typename Traits>
static inline void apply(std::basic_ostream<Char, Traits>& 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 <typename Geometry>
struct dsv<multi_tag, Geometry>
: detail::dsv::dsv_multi<Geometry>
{};
} // namespace dispatch
#endif // DOXYGEN_NO_DISPATCH
/*!
\brief Main DSV-streaming function
\details DSV stands for Delimiter Separated Values. Geometries can be streamed

View File

@@ -37,7 +37,6 @@
#include <boost/geometry/strategies/transform/map_transformer.hpp>
#include <boost/geometry/views/segment_view.hpp>
#include <boost/geometry/multi/core/tags.hpp>
#include <boost/geometry/multi/algorithms/envelope.hpp>
#include <boost/geometry/multi/algorithms/num_points.hpp>

View File

@@ -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

Some files were not shown because too many files have changed in this diff Show More