Added boost header

This commit is contained in:
Christophe Riccio
2012-01-08 01:26:07 +00:00
parent 9c3faaca40
commit c7d752cdf8
8946 changed files with 1732316 additions and 0 deletions

View File

@@ -0,0 +1,56 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2007-2011 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2011 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2011 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_MULTI_ALGORITHMS_AREA_HPP
#define BOOST_GEOMETRY_MULTI_ALGORITHMS_AREA_HPP
#include <boost/range/metafunctions.hpp>
#include <boost/geometry/algorithms/area.hpp>
#include <boost/geometry/multi/core/point_type.hpp>
#include <boost/geometry/multi/algorithms/detail/multi_sum.hpp>
namespace boost { namespace geometry
{
#ifndef DOXYGEN_NO_DISPATCH
namespace dispatch
{
template <typename MultiGeometry, typename Strategy>
struct area<multi_polygon_tag, MultiGeometry, Strategy>
: detail::multi_sum
<
typename Strategy::return_type,
MultiGeometry,
Strategy,
area
<
polygon_tag,
typename boost::range_value<MultiGeometry>::type,
Strategy
>
>
{};
} // namespace dispatch
#endif
}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_MULTI_ALGORITHMS_AREA_HPP

View File

@@ -0,0 +1,178 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2007-2011 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2011 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2011 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_MULTI_ALGORITHMS_CENTROID_HPP
#define BOOST_GEOMETRY_MULTI_ALGORITHMS_CENTROID_HPP
#include <boost/range.hpp>
#include <boost/geometry/algorithms/centroid.hpp>
#include <boost/geometry/algorithms/num_points.hpp>
#include <boost/geometry/multi/core/point_type.hpp>
#include <boost/geometry/multi/algorithms/detail/multi_sum.hpp>
#include <boost/geometry/multi/algorithms/num_points.hpp>
namespace boost { namespace geometry
{
#ifndef DOXYGEN_NO_DETAIL
namespace detail { namespace centroid
{
/*!
\brief Building block of a multi-point, to be used as Policy in the
more generec centroid_multi
*/
template
<
typename Point,
typename Strategy
>
struct centroid_multi_point_state
{
static inline void apply(Point const& point,
Strategy const& strategy, typename Strategy::state_type& state)
{
strategy.apply(point, state);
}
};
/*!
\brief Generic implementation which calls a policy to calculate the
centroid of the total of its single-geometries
\details The Policy is, in general, the single-version, with state. So
detail::centroid::centroid_polygon_state is used as a policy for this
detail::centroid::centroid_multi
*/
template
<
typename Multi,
typename Point,
typename Strategy,
typename Policy
>
struct centroid_multi
{
static inline void apply(Multi const& multi, Point& centroid,
Strategy const& strategy)
{
// If there is nothing in any of the ranges, it is not possible
// to calculate the centroid
if (geometry::num_points(multi) == 0)
{
throw centroid_exception();
}
typename Strategy::state_type state;
for (typename boost::range_iterator<Multi const>::type
it = boost::begin(multi);
it != boost::end(multi);
++it)
{
Policy::apply(*it, strategy, state);
}
Strategy::result(state, centroid);
}
};
}} // namespace detail::centroid
#endif // DOXYGEN_NO_DETAIL
#ifndef DOXYGEN_NO_DISPATCH
namespace dispatch
{
template
<
typename MultiLinestring,
typename Point,
typename Strategy
>
struct centroid<multi_linestring_tag, MultiLinestring, Point, Strategy>
: detail::centroid::centroid_multi
<
MultiLinestring,
Point,
Strategy,
detail::centroid::centroid_range_state
<
typename boost::range_value<MultiLinestring>::type,
closed,
Strategy
>
>
{};
template
<
typename MultiPolygon,
typename Point,
typename Strategy
>
struct centroid<multi_polygon_tag, MultiPolygon, Point, Strategy>
: detail::centroid::centroid_multi
<
MultiPolygon,
Point,
Strategy,
detail::centroid::centroid_polygon_state
<
typename boost::range_value<MultiPolygon>::type,
Strategy
>
>
{};
template
<
typename MultiPoint,
typename Point,
typename Strategy
>
struct centroid<multi_point_tag, MultiPoint, Point, Strategy>
: detail::centroid::centroid_multi
<
MultiPoint,
Point,
Strategy,
detail::centroid::centroid_multi_point_state
<
typename boost::range_value<MultiPoint>::type,
Strategy
>
>
{};
} // namespace dispatch
#endif
}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_MULTI_ALGORITHMS_CENTROID_HPP

View File

@@ -0,0 +1,43 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2007-2011 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2011 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2011 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_MULTI_ALGORITHMS_CLEAR_HPP
#define BOOST_GEOMETRY_MULTI_ALGORITHMS_CLEAR_HPP
#include <boost/geometry/multi/core/tags.hpp>
#include <boost/geometry/algorithms/clear.hpp>
namespace boost { namespace geometry
{
#ifndef DOXYGEN_NO_DISPATCH
namespace dispatch
{
template <typename Geometry>
struct clear<multi_tag, Geometry>
: detail::clear::collection_clear<Geometry>
{};
} // namespace dispatch
#endif
}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_MULTI_ALGORITHMS_CLEAR_HPP

View File

@@ -0,0 +1,133 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2007-2011 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2011 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2011 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_MULTI_ALGORITHMS_CONVERT_HPP
#define BOOST_GEOMETRY_MULTI_ALGORITHMS_CONVERT_HPP
#include <boost/range/metafunctions.hpp>
#include <boost/geometry/algorithms/convert.hpp>
#include <boost/geometry/multi/core/tags.hpp>
namespace boost { namespace geometry
{
#ifndef DOXYGEN_NO_DETAIL
namespace detail { namespace conversion
{
template <typename Single, typename Multi, typename Policy>
struct single_to_multi
{
static inline void apply(Single const& single, Multi& multi)
{
traits::resize<Multi>::apply(multi, 1);
Policy::apply(single, *boost::begin(multi));
}
};
template <typename Multi1, typename Multi2, typename Policy>
struct multi_to_multi
{
static inline void apply(Multi1 const& multi1, Multi2& multi2)
{
traits::resize<Multi2>::apply(multi2, boost::size(multi1));
typename boost::range_iterator<Multi1 const>::type it1
= boost::begin(multi1);
typename boost::range_iterator<Multi2>::type it2
= boost::begin(multi2);
for (; it1 != boost::end(multi1); ++it1, ++it2)
{
Policy::apply(*it1, *it2);
}
}
};
}} // namespace detail::convert
#endif // DOXYGEN_NO_DETAIL
#ifndef DOXYGEN_NO_DISPATCH
namespace dispatch
{
// Dispatch for multi <-> multi, specifying their single-version as policy.
// Note that, even if the multi-types are mutually different, their single
// version types might be the same and therefore we call boost::is_same again
template <std::size_t DimensionCount, typename Multi1, typename Multi2>
struct convert<false, multi_tag, multi_tag, DimensionCount, Multi1, Multi2>
: detail::conversion::multi_to_multi
<
Multi1,
Multi2,
convert
<
boost::is_same
<
typename boost::range_value<Multi1>::type,
typename boost::range_value<Multi2>::type
>::value,
typename single_tag_of
<
typename tag<Multi1>::type
>::type,
typename single_tag_of
<
typename tag<Multi2>::type
>::type,
DimensionCount,
typename boost::range_value<Multi1>::type,
typename boost::range_value<Multi2>::type
>
>
{};
template <std::size_t DimensionCount, typename SingleTag, typename Single, typename Multi>
struct convert<false, SingleTag, multi_tag, DimensionCount, Single, Multi>
: detail::conversion::single_to_multi
<
Single,
Multi,
convert
<
false,
typename tag<Single>::type,
typename single_tag_of
<
typename tag<Multi>::type
>::type,
DimensionCount,
Single,
typename boost::range_value<Multi>::type
>
>
{};
} // namespace dispatch
#endif // DOXYGEN_NO_DISPATCH
}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_MULTI_ALGORITHMS_CONVERT_HPP

View File

@@ -0,0 +1,66 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2007-2011 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2011 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2011 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_MULTI_ALGORITHMS_CORRECT_HPP
#define BOOST_GEOMETRY_MULTI_ALGORITHMS_CORRECT_HPP
#include <boost/range/metafunctions.hpp>
#include <boost/geometry/algorithms/correct.hpp>
#include <boost/geometry/multi/algorithms/detail/modify.hpp>
#include <boost/geometry/multi/core/tags.hpp>
namespace boost { namespace geometry
{
#ifndef DOXYGEN_NO_DISPATCH
namespace dispatch
{
template <typename MultiPoint>
struct correct<multi_point_tag, MultiPoint>
: detail::correct::correct_nop<MultiPoint>
{};
template <typename MultiLineString>
struct correct<multi_linestring_tag, MultiLineString>
: detail::correct::correct_nop<MultiLineString>
{};
template <typename Geometry>
struct correct<multi_polygon_tag, Geometry>
: detail::multi_modify
<
Geometry,
detail::correct::correct_polygon
<
typename boost::range_value<Geometry>::type
>
>
{};
} // namespace dispatch
#endif // DOXYGEN_NO_DISPATCH
}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_MULTI_ALGORITHMS_CORRECT_HPP

View File

@@ -0,0 +1,68 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2007-2011 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2011 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2011 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_MULTI_ALGORITHMS_COVERED_BY_HPP
#define BOOST_GEOMETRY_MULTI_ALGORITHMS_COVERED_BY_HPP
#include <boost/geometry/multi/core/closure.hpp>
#include <boost/geometry/multi/core/point_order.hpp>
#include <boost/geometry/multi/core/tags.hpp>
#include <boost/geometry/multi/algorithms/within.hpp>
namespace boost { namespace geometry
{
#ifndef DOXYGEN_NO_DISPATCH
namespace dispatch
{
template <typename Point, typename MultiPolygon, typename Strategy>
struct covered_by<point_tag, multi_polygon_tag, Point, MultiPolygon, Strategy>
{
static inline bool apply(Point const& point,
MultiPolygon const& multi_polygon, Strategy const& strategy)
{
return detail::within::geometry_multi_within_code
<
Point,
MultiPolygon,
Strategy,
detail::within::point_in_polygon
<
Point,
typename boost::range_value<MultiPolygon>::type,
order_as_direction
<
geometry::point_order<MultiPolygon>::value
>::value,
geometry::closure<MultiPolygon>::value,
Strategy
>
>::apply(point, multi_polygon, strategy) >= 0;
}
};
} // namespace dispatch
#endif // DOXYGEN_NO_DISPATCH
}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_MULTI_ALGORITHMS_COVERED_BY_HPP

View File

@@ -0,0 +1,86 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2007-2011 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2011 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2011 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_MULTI_ALGORITHMS_DETAIL_FOR_EACH_RANGE_HPP
#define BOOST_GEOMETRY_MULTI_ALGORITHMS_DETAIL_FOR_EACH_RANGE_HPP
#include <boost/range.hpp>
#include <boost/typeof/typeof.hpp>
#include <boost/geometry/algorithms/detail/for_each_range.hpp>
#include <boost/geometry/multi/core/tags.hpp>
namespace boost { namespace geometry
{
#ifndef DOXYGEN_NO_DETAIL
namespace detail { namespace for_each
{
template <typename Multi, typename Actor, bool IsConst>
struct fe_range_multi
{
static inline void apply(
typename add_const_if_c<IsConst, Multi>::type& multi,
Actor& actor)
{
for(BOOST_AUTO_TPL(it, boost::begin(multi)); it != boost::end(multi); ++it)
{
geometry::detail::for_each_range(*it, actor);
}
}
};
}} // namespace detail::for_each
#endif // DOXYGEN_NO_DETAIL
#ifndef DOXYGEN_NO_DISPATCH
namespace dispatch
{
template <typename MultiPoint, typename Actor, bool IsConst>
struct for_each_range<multi_point_tag, MultiPoint, Actor, IsConst>
: detail::for_each::fe_range_range<MultiPoint, Actor, IsConst>
{};
template <typename Geometry, typename Actor, bool IsConst>
struct for_each_range<multi_linestring_tag, Geometry, Actor, IsConst>
:
detail::for_each::fe_range_multi<Geometry, Actor, IsConst>
{};
template <typename Geometry, typename Actor, bool IsConst>
struct for_each_range<multi_polygon_tag, Geometry, Actor, IsConst>
:
detail::for_each::fe_range_multi<Geometry, Actor, IsConst>
{};
} // namespace dispatch
#endif // DOXYGEN_NO_DISPATCH
}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_MULTI_ALGORITHMS_DETAIL_FOR_EACH_RANGE_HPP

View File

@@ -0,0 +1,53 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2007-2011 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2011 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2011 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_MULTI_ALGORITHMS_DETAIL_MODIFY_HPP
#define BOOST_GEOMETRY_MULTI_ALGORITHMS_DETAIL_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_MULTI_ALGORITHMS_DETAIL_MODIFY_HPP

View File

@@ -0,0 +1,52 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2007-2011 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2011 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2011 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_MULTI_ALGORITHMS_DETAIL_MODIFY_WITH_PREDICATE_HPP
#define BOOST_GEOMETRY_MULTI_ALGORITHMS_DETAIL_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_MULTI_ALGORITHMS_DETAIL_MODIFY_WITH_PREDICATE_HPP

View File

@@ -0,0 +1,58 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2007-2011 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2011 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2011 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_MULTI_SUM_HPP
#define BOOST_GEOMETRY_MULTI_SUM_HPP
#include <boost/range.hpp>
namespace boost { namespace geometry
{
#ifndef DOXYGEN_NO_DETAIL
namespace detail
{
template
<
typename ReturnType,
typename MultiGeometry,
typename Strategy,
typename Policy
>
struct multi_sum
{
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_MULTI_SUM_HPP

View File

@@ -0,0 +1,101 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2007-2011 Barend Gehrels, 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_MULTI_ALGORITHMS_DETAIL_OVERLAY_COPY_SEGMENT_POINT_HPP
#define BOOST_GEOMETRY_MULTI_ALGORITHMS_DETAIL_OVERLAY_COPY_SEGMENT_POINT_HPP
#include <boost/range.hpp>
#include <boost/geometry/multi/core/tags.hpp>
#include <boost/geometry/algorithms/detail/overlay/copy_segment_point.hpp>
namespace boost { namespace geometry
{
#ifndef DOXYGEN_NO_DETAIL
namespace detail { namespace copy_segments
{
template
<
typename MultiGeometry,
typename SegmentIdentifier,
typename PointOut,
typename Policy
>
struct copy_segment_point_multi
{
static inline bool apply(MultiGeometry const& multi,
SegmentIdentifier const& seg_id, bool second,
PointOut& point)
{
BOOST_ASSERT
(
seg_id.multi_index >= 0
&& seg_id.multi_index < boost::size(multi)
);
// Call the single-version
return Policy::apply(multi[seg_id.multi_index], seg_id, second, point);
}
};
}} // namespace detail::copy_segments
#endif // DOXYGEN_NO_DETAIL
#ifndef DOXYGEN_NO_DISPATCH
namespace dispatch
{
template
<
typename MultiGeometry,
bool Reverse,
typename SegmentIdentifier,
typename PointOut
>
struct copy_segment_point
<
multi_polygon_tag,
MultiGeometry,
Reverse,
SegmentIdentifier,
PointOut
>
: detail::copy_segments::copy_segment_point_multi
<
MultiGeometry,
SegmentIdentifier,
PointOut,
detail::copy_segments::copy_segment_point_polygon
<
typename boost::range_value<MultiGeometry>::type,
Reverse,
SegmentIdentifier,
PointOut
>
>
{};
} // namespace dispatch
#endif // DOXYGEN_NO_DISPATCH
}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_MULTI_ALGORITHMS_DETAIL_OVERLAY_COPY_SEGMENT_POINT_HPP

View File

@@ -0,0 +1,104 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2007-2011 Barend Gehrels, 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_MULTI_ALGORITHMS_DETAIL_OVERLAY_COPY_SEGMENTS_HPP
#define BOOST_GEOMETRY_MULTI_ALGORITHMS_DETAIL_OVERLAY_COPY_SEGMENTS_HPP
#include <boost/assert.hpp>
#include <boost/range.hpp>
#include <boost/geometry/algorithms/detail/overlay/copy_segments.hpp>
#include <boost/geometry/multi/core/ring_type.hpp>
#include <boost/geometry/multi/core/tags.hpp>
namespace boost { namespace geometry
{
#ifndef DOXYGEN_NO_DETAIL
namespace detail { namespace copy_segments
{
template
<
typename MultiGeometry,
typename SegmentIdentifier,
typename RangeOut,
typename Policy
>
struct copy_segments_multi
{
static inline void apply(MultiGeometry const& multi_geometry,
SegmentIdentifier const& seg_id, int to_index,
RangeOut& current_output)
{
BOOST_ASSERT
(
seg_id.multi_index >= 0
&& seg_id.multi_index < boost::size(multi_geometry)
);
// Call the single-version
Policy::apply(multi_geometry[seg_id.multi_index],
seg_id, to_index, current_output);
}
};
}} // namespace detail::copy_segments
#endif // DOXYGEN_NO_DETAIL
#ifndef DOXYGEN_NO_DISPATCH
namespace dispatch
{
template
<
typename MultiPolygon,
bool Reverse,
typename SegmentIdentifier,
typename RangeOut
>
struct copy_segments
<
multi_polygon_tag,
MultiPolygon,
Reverse,
SegmentIdentifier,
RangeOut
>
: detail::copy_segments::copy_segments_multi
<
MultiPolygon,
SegmentIdentifier,
RangeOut,
detail::copy_segments::copy_segments_polygon
<
typename boost::range_value<MultiPolygon>::type,
Reverse,
SegmentIdentifier,
RangeOut
>
>
{};
} // namespace dispatch
#endif // DOXYGEN_NO_DISPATCH
}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_MULTI_ALGORITHMS_DETAIL_OVERLAY_COPY_SEGMENTS_HPP

View File

@@ -0,0 +1,54 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2007-2011 Barend Gehrels, 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_MULTI_ALGORITHMS_DETAIL_OVERLAY_GET_RING_HPP
#define BOOST_GEOMETRY_MULTI_ALGORITHMS_DETAIL_OVERLAY_GET_RING_HPP
#include <boost/assert.hpp>
#include <boost/range.hpp>
#include <boost/geometry/algorithms/detail/overlay/get_ring.hpp>
#include <boost/geometry/multi/core/ring_type.hpp>
namespace boost { namespace geometry
{
#ifndef DOXYGEN_NO_DETAIL
namespace detail { namespace overlay
{
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 < boost::size(multi_polygon)
);
return get_ring<polygon_tag>::apply(id,
multi_polygon[id.multi_index]);
}
};
}} // namespace detail::overlay
#endif // DOXYGEN_NO_DETAIL
}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_MULTI_ALGORITHMS_DETAIL_OVERLAY_GET_RING_HPP

View File

@@ -0,0 +1,111 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2007-2011 Barend Gehrels, 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_MULTI_ALGORITHMS_DETAIL_OVERLAY_GET_TURNS_HPP
#define BOOST_GEOMETRY_MULTI_ALGORITHMS_DETAIL_OVERLAY_GET_TURNS_HPP
#include <boost/geometry/multi/core/ring_type.hpp>
#include <boost/geometry/algorithms/detail/overlay/get_turns.hpp>
#include <boost/geometry/multi/algorithms/distance.hpp>
#include <boost/geometry/multi/views/detail/range_type.hpp>
#include <boost/geometry/multi/algorithms/detail/sections/range_by_section.hpp>
#include <boost/geometry/multi/algorithms/detail/sections/sectionalize.hpp>
namespace boost { namespace geometry
{
#ifndef DOXYGEN_NO_DETAIL
namespace detail { namespace get_turns
{
template
<
typename Multi, typename Box,
bool Reverse, bool ReverseBox,
typename Turns,
typename TurnPolicy,
typename InterruptPolicy
>
struct get_turns_multi_polygon_cs
{
static inline void apply(
int source_id1, Multi const& multi,
int source_id2, Box const& box,
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,
Turns, TurnPolicy, InterruptPolicy
>::apply(source_id1, *it, source_id2, box,
turns, interrupt_policy, i);
}
}
};
}} // namespace detail::get_turns
#endif // DOXYGEN_NO_DETAIL
#ifndef DOXYGEN_NO_DISPATCH
namespace dispatch
{
template
<
typename MultiPolygon,
typename Box,
bool ReverseMultiPolygon, bool ReverseBox,
typename Turns,
typename TurnPolicy,
typename InterruptPolicy
>
struct get_turns
<
multi_polygon_tag, box_tag,
MultiPolygon, Box,
ReverseMultiPolygon, ReverseBox,
Turns,
TurnPolicy, InterruptPolicy
>
: detail::get_turns::get_turns_multi_polygon_cs
<
MultiPolygon, Box,
ReverseMultiPolygon, ReverseBox,
Turns,
TurnPolicy, InterruptPolicy
>
{};
} // namespace dispatch
#endif // DOXYGEN_NO_DISPATCH
}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_MULTI_ALGORITHMS_DETAIL_OVERLAY_GET_TURNS_HPP

View File

@@ -0,0 +1,62 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2007-2011 Barend Gehrels, 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_MULTI_ALGORITHMS_DETAIL_OVERLAY_SELECT_RINGS_HPP
#define BOOST_GEOMETRY_MULTI_ALGORITHMS_DETAIL_OVERLAY_SELECT_RINGS_HPP
#include <boost/range.hpp>
#include <boost/geometry/algorithms/detail/overlay/select_rings.hpp>
namespace boost { namespace geometry
{
#ifndef DOXYGEN_NO_DETAIL
namespace detail { namespace overlay
{
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 detail::overlay
#endif // DOXYGEN_NO_DETAIL
}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_MULTI_ALGORITHMS_DETAIL_OVERLAY_SELECT_RINGS_HPP

View File

@@ -0,0 +1,56 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2007-2011 Barend Gehrels, 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_MULTI_ALGORITHMS_DETAIL_OVERLAY_SELF_TURN_POINTS_HPP
#define BOOST_GEOMETRY_MULTI_ALGORITHMS_DETAIL_OVERLAY_SELF_TURN_POINTS_HPP
#include <boost/geometry/multi/core/tags.hpp>
#include <boost/geometry/algorithms/detail/overlay/self_turn_points.hpp>
namespace boost { namespace geometry
{
#ifndef DOXYGEN_NO_DISPATCH
namespace dispatch
{
template
<
typename MultiPolygon,
typename Turns,
typename TurnPolicy,
typename InterruptPolicy
>
struct self_get_turn_points
<
multi_polygon_tag, MultiPolygon,
Turns,
TurnPolicy, InterruptPolicy
>
: detail::self_get_turn_points::get_turns
<
MultiPolygon,
Turns,
TurnPolicy,
InterruptPolicy
>
{};
} // namespace dispatch
#endif // DOXYGEN_NO_DISPATCH
}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_MULTI_ALGORITHMS_DETAIL_OVERLAY_SELF_TURN_POINTS_HPP

View File

@@ -0,0 +1,95 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2007-2011 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2011 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2011 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_MULTI_ALGORITHMS_DETAIL_POINT_ON_BORDER_HPP
#define BOOST_GEOMETRY_MULTI_ALGORITHMS_DETAIL_POINT_ON_BORDER_HPP
#include <boost/range.hpp>
#include <boost/geometry/multi/core/tags.hpp>
#include <boost/geometry/algorithms/detail/point_on_border.hpp>
namespace boost { namespace geometry
{
#ifndef DOXYGEN_NO_DETAIL
namespace detail { namespace point_on_border
{
template
<
typename MultiGeometry,
typename Point,
typename Policy
>
struct point_on_multi
{
static inline bool apply(MultiGeometry const& multi, Point& point)
{
// 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(*it, point))
{
return true;
}
}
return false;
}
};
}} // namespace detail::point_on_border
#endif // DOXYGEN_NO_DETAIL
#ifndef DOXYGEN_NO_DISPATCH
namespace dispatch
{
template<typename Multi, typename Point>
struct point_on_border<multi_polygon_tag, Multi, Point>
: detail::point_on_border::point_on_multi
<
Multi,
Point,
detail::point_on_border::point_on_polygon
<
typename boost::range_value<Multi>::type,
Point
>
>
{};
} // namespace dispatch
#endif // DOXYGEN_NO_DISPATCH
}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_MULTI_ALGORITHMS_DETAIL_POINT_ON_BORDER_HPP

View File

@@ -0,0 +1,90 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2007-2011 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2011 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2011 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_MULTI_ALGORITHMS_DETAIL_SECTIONS_RANGE_BY_SECTION_HPP
#define BOOST_GEOMETRY_MULTI_ALGORITHMS_DETAIL_SECTIONS_RANGE_BY_SECTION_HPP
#include <boost/assert.hpp>
#include <boost/range.hpp>
#include <boost/geometry/multi/core/tags.hpp>
#include <boost/geometry/multi/core/ring_type.hpp>
#include <boost/geometry/algorithms/detail/sections/range_by_section.hpp>
namespace boost { namespace geometry
{
#ifndef DOXYGEN_NO_DETAIL
namespace detail { namespace section
{
template
<
typename MultiGeometry,
typename Section,
typename Policy
>
struct full_section_multi
{
static inline typename ring_return_type<MultiGeometry const>::type apply(
MultiGeometry const& multi, Section const& section)
{
BOOST_ASSERT
(
section.ring_id.multi_index >= 0
&& section.ring_id.multi_index < boost::size(multi)
);
return Policy::apply(multi[section.ring_id.multi_index], section);
}
};
}} // namespace detail::section
#endif
#ifndef DOXYGEN_NO_DISPATCH
namespace dispatch
{
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
>
>
{};
} // namespace dispatch
#endif
}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_MULTI_ALGORITHMS_DETAIL_SECTIONS_RANGE_BY_SECTION_HPP

View File

@@ -0,0 +1,95 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2007-2011 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2011 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2011 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_MULTI_ALGORITHMS_DETAIL_SECTIONS_SECTIONALIZE_HPP
#define BOOST_GEOMETRY_MULTI_ALGORITHMS_DETAIL_SECTIONS_SECTIONALIZE_HPP
#include <cstddef>
#include <vector>
#include <boost/concept/requires.hpp>
#include <boost/range.hpp>
#include <boost/geometry/algorithms/detail/sections/sectionalize.hpp>
namespace boost { namespace geometry
{
#ifndef DOXYGEN_NO_DETAIL
namespace detail { namespace sectionalize
{
template <typename MultiGeometry, typename Sections, std::size_t DimensionCount, typename Policy>
struct sectionalize_multi
{
static inline void apply(MultiGeometry const& multi, Sections& sections, ring_identifier ring_id)
{
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, sections, ring_id);
}
}
};
}} // namespace detail::sectionalize
#endif // DOXYGEN_NO_DETAIL
#ifndef DOXYGEN_NO_DISPATCH
namespace dispatch
{
template
<
typename MultiPolygon,
bool Reverse,
typename Sections,
std::size_t DimensionCount,
std::size_t MaxCount
>
struct sectionalize<multi_polygon_tag, MultiPolygon, Reverse, Sections, DimensionCount, MaxCount>
: detail::sectionalize::sectionalize_multi
<
MultiPolygon,
Sections,
DimensionCount,
detail::sectionalize::sectionalize_polygon
<
typename boost::range_value<MultiPolygon>::type,
Reverse,
Sections,
DimensionCount,
MaxCount
>
>
{};
} // namespace dispatch
#endif
}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_MULTI_ALGORITHMS_DETAIL_SECTIONS_SECTIONALIZE_HPP

View File

@@ -0,0 +1,130 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2007-2011 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2011 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2011 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_MULTI_ALGORITHMS_DISTANCE_HPP
#define BOOST_GEOMETRY_MULTI_ALGORITHMS_DISTANCE_HPP
#include <boost/numeric/conversion/bounds.hpp>
#include <boost/range.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/algorithms/distance.hpp>
#include <boost/geometry/util/select_coordinate_type.hpp>
namespace boost { namespace geometry
{
#ifndef DOXYGEN_NO_DETAIL
namespace detail { namespace distance
{
template<typename Geometry, typename MultiGeometry, typename Strategy>
struct distance_single_to_multi
{
typedef typename strategy::distance::services::return_type<Strategy>::type return_type;
static inline return_type apply(Geometry const& geometry,
MultiGeometry const& multi,
Strategy const& strategy)
{
bool first = true;
return_type mindist;
for(typename range_iterator<MultiGeometry const>::type it = boost::begin(multi);
it != boost::end(multi);
++it)
{
return_type dist = geometry::distance(geometry, *it);
if (first || dist < mindist)
{
mindist = dist;
}
first = false;
}
return mindist;
}
};
template<typename Multi1, typename Multi2, typename Strategy>
struct distance_multi_to_multi
{
typedef typename strategy::distance::services::return_type<Strategy>::type return_type;
static inline return_type apply(Multi1 const& multi1,
Multi2 const& multi2, Strategy const& strategy)
{
bool first = true;
return_type mindist;
for(typename range_iterator<Multi1 const>::type it = boost::begin(multi1);
it != boost::end(multi1);
++it)
{
return_type dist = distance_single_to_multi
<
typename range_value<Multi1>::type,
Multi2,
Strategy
>::apply(*it, multi2, strategy);
if (first || dist < mindist)
{
mindist = dist;
}
first = false;
}
return mindist;
}
};
}} // namespace detail::distance
#endif
#ifndef DOXYGEN_NO_DISPATCH
namespace dispatch
{
template
<
typename SingleGeometryTag,
typename G1,
typename G2,
typename Strategy
>
struct distance<SingleGeometryTag, multi_tag, G1, G2, strategy_tag_distance_point_point, Strategy>
: detail::distance::distance_single_to_multi<G1, G2, Strategy>
{};
template <typename G1, typename G2, typename Strategy>
struct distance<multi_tag, multi_tag, G1, G2, strategy_tag_distance_point_point, Strategy>
: detail::distance::distance_multi_to_multi<G1, G2, Strategy>
{};
} // namespace dispatch
#endif
}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_MULTI_ALGORITHMS_DISTANCE_HPP

View File

@@ -0,0 +1,117 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2007-2011 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2011 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2011 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_MULTI_ALGORITHMS_ENVELOPE_HPP
#define BOOST_GEOMETRY_MULTI_ALGORITHMS_ENVELOPE_HPP
#include <vector>
#include <boost/range/metafunctions.hpp>
#include <boost/geometry/core/exterior_ring.hpp>
#include <boost/geometry/algorithms/envelope.hpp>
#include <boost/geometry/multi/core/point_type.hpp>
namespace boost { namespace geometry
{
#ifndef DOXYGEN_NO_DETAIL
namespace detail { namespace envelope
{
template<typename MultiLinestring, typename Box>
struct envelope_multi_linestring
{
static inline void apply(MultiLinestring const& mp, Box& mbr)
{
assign_inverse(mbr);
for (typename boost::range_iterator<MultiLinestring const>::type
it = mp.begin();
it != mp.end();
++it)
{
envelope_range_additional(*it, mbr);
}
}
};
// version for multi_polygon: outer ring's of all polygons
template<typename MultiPolygon, typename Box>
struct envelope_multi_polygon
{
static inline void apply(MultiPolygon const& mp, Box& mbr)
{
assign_inverse(mbr);
for (typename boost::range_const_iterator<MultiPolygon>::type
it = mp.begin();
it != mp.end();
++it)
{
envelope_range_additional(exterior_ring(*it), mbr);
}
}
};
}} // namespace detail::envelope
#endif
#ifndef DOXYGEN_NO_DISPATCH
namespace dispatch
{
template
<
typename Multi, typename Box,
typename StrategyLess, typename StrategyGreater
>
struct envelope<multi_point_tag, box_tag, Multi, Box, StrategyLess, StrategyGreater>
: detail::envelope::envelope_range<Multi, Box>
{};
template
<
typename Multi, typename Box,
typename StrategyLess, typename StrategyGreater
>
struct envelope<multi_linestring_tag, box_tag, Multi, Box, StrategyLess, StrategyGreater>
: detail::envelope::envelope_multi_linestring<Multi, Box>
{};
template
<
typename Multi, typename Box,
typename StrategyLess, typename StrategyGreater
>
struct envelope<multi_polygon_tag, box_tag, Multi, Box, StrategyLess, StrategyGreater>
: detail::envelope::envelope_multi_polygon<Multi, Box>
{};
} // namespace dispatch
#endif
}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_MULTI_ALGORITHMS_ENVELOPE_HPP

View File

@@ -0,0 +1,70 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2007-2011 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2011 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2011 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_MULTI_ALGORITHMS_EQUALS_HPP
#define BOOST_GEOMETRY_MULTI_ALGORITHMS_EQUALS_HPP
#include <boost/geometry/multi/core/tags.hpp>
#include <boost/geometry/multi/core/geometry_id.hpp>
#include <boost/geometry/algorithms/equals.hpp>
namespace boost { namespace geometry
{
#ifndef DOXYGEN_NO_DISPATCH
namespace dispatch
{
template <typename MultiPolygon1, typename MultiPolygon2>
struct equals
<
multi_polygon_tag, multi_polygon_tag,
MultiPolygon1, MultiPolygon2,
2
>
: detail::equals::equals_by_collection
<
MultiPolygon1, MultiPolygon2,
detail::equals::area_check
>
{};
template <typename Polygon, typename MultiPolygon>
struct equals
<
polygon_tag, multi_polygon_tag,
Polygon, MultiPolygon,
2
>
: detail::equals::equals_by_collection
<
Polygon, MultiPolygon,
detail::equals::area_check
>
{};
} // namespace dispatch
#endif // DOXYGEN_NO_DISPATCH
}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_MULTI_ALGORITHMS_EQUALS_HPP

View File

@@ -0,0 +1,129 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2007-2011 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2011 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2011 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_MULTI_ALGORITHMS_FOR_EACH_HPP
#define BOOST_GEOMETRY_MULTI_ALGORITHMS_FOR_EACH_HPP
#include <boost/range.hpp>
#include <boost/typeof/typeof.hpp>
#include <boost/geometry/multi/core/tags.hpp>
#include <boost/geometry/multi/core/point_type.hpp>
#include <boost/geometry/algorithms/for_each.hpp>
namespace boost { namespace geometry
{
#ifndef DOXYGEN_NO_DETAIL
namespace detail { namespace for_each
{
// Implementation of multi, for both point and segment,
// just calling the single version.
template
<
typename MultiGeometry,
typename Functor,
bool IsConst,
typename Policy
>
struct for_each_multi
{
static inline Functor apply(
typename add_const_if_c<IsConst, MultiGeometry>::type& multi,
Functor f)
{
for(BOOST_AUTO_TPL(it, boost::begin(multi)); it != boost::end(multi); ++it)
{
f = Policy::apply(*it, f);
}
return f;
}
};
}} // namespace detail::for_each
#endif // DOXYGEN_NO_DETAIL
#ifndef DOXYGEN_NO_DISPATCH
namespace dispatch
{
template
<
typename MultiGeometry,
typename Functor,
bool IsConst
>
struct for_each_point<multi_tag, MultiGeometry, Functor, IsConst>
: detail::for_each::for_each_multi
<
MultiGeometry,
Functor,
IsConst,
// Specify the dispatch of the single-version as policy
for_each_point
<
typename single_tag_of
<
typename tag<MultiGeometry>::type
>::type,
typename boost::range_value<MultiGeometry>::type,
Functor,
IsConst
>
>
{};
template
<
typename MultiGeometry,
typename Functor,
bool IsConst
>
struct for_each_segment<multi_tag, MultiGeometry, Functor, IsConst>
: detail::for_each::for_each_multi
<
MultiGeometry,
Functor,
IsConst,
// Specify the dispatch of the single-version as policy
for_each_segment
<
typename single_tag_of
<
typename tag<MultiGeometry>::type
>::type,
typename boost::range_value<MultiGeometry>::type,
Functor,
IsConst
>
>
{};
} // namespace dispatch
#endif // DOXYGEN_NO_DISPATCH
}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_MULTI_ALGORITHMS_FOR_EACH_HPP

View File

@@ -0,0 +1,232 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2007-2011 Barend Gehrels, 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_MULTI_ALGORITHMS_INTERSECTION_HPP
#define BOOST_GEOMETRY_MULTI_ALGORITHMS_INTERSECTION_HPP
#include <boost/geometry/multi/core/closure.hpp>
#include <boost/geometry/multi/core/geometry_id.hpp>
#include <boost/geometry/multi/core/is_areal.hpp>
#include <boost/geometry/multi/core/point_order.hpp>
#include <boost/geometry/multi/algorithms/envelope.hpp>
#include <boost/geometry/multi/algorithms/num_points.hpp>
#include <boost/geometry/multi/algorithms/detail/overlay/get_ring.hpp>
#include <boost/geometry/multi/algorithms/detail/overlay/get_turns.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/detail/overlay/select_rings.hpp>
#include <boost/geometry/multi/algorithms/detail/sections/range_by_section.hpp>
#include <boost/geometry/multi/algorithms/detail/sections/sectionalize.hpp>
#include <boost/geometry/algorithms/intersection.hpp>
namespace boost { namespace geometry
{
#ifndef DOXYGEN_NO_DETAIL
namespace detail { namespace intersection
{
template
<
typename MultiLinestring1, typename MultiLinestring2,
typename OutputIterator, typename PointOut,
typename Strategy
>
struct intersection_multi_linestring_multi_linestring_point
{
static inline OutputIterator apply(MultiLinestring1 const& ml1,
MultiLinestring2 const& ml2, OutputIterator out,
Strategy const& strategy)
{
// Note, this loop is quadratic w.r.t. number of linestrings per input.
// Future Enhancement: first do the sections of each, then intersect.
for (typename boost::range_iterator
<
MultiLinestring1 const
>::type it1 = boost::begin(ml1);
it1 != boost::end(ml1);
++it1)
{
for (typename boost::range_iterator
<
MultiLinestring2 const
>::type it2 = boost::begin(ml2);
it2 != boost::end(ml2);
++it2)
{
out = intersection_linestring_linestring_point
<
typename boost::range_value<MultiLinestring1>::type,
typename boost::range_value<MultiLinestring2>::type,
OutputIterator, PointOut, Strategy
>::apply(*it1, *it2, out, strategy);
}
}
return out;
}
};
template
<
typename Linestring, typename MultiLinestring,
typename OutputIterator, typename PointOut,
typename Strategy
>
struct intersection_linestring_multi_linestring_point
{
static inline OutputIterator apply(Linestring const& linestring,
MultiLinestring const& ml, OutputIterator out,
Strategy const& strategy)
{
for (typename boost::range_iterator
<
MultiLinestring const
>::type it = boost::begin(ml);
it != boost::end(ml);
++it)
{
out = intersection_linestring_linestring_point
<
Linestring,
typename boost::range_value<MultiLinestring>::type,
OutputIterator, PointOut, Strategy
>::apply(linestring, *it, out, strategy);
}
return out;
}
};
template
<
typename MultiLinestring, typename Box,
typename OutputIterator, typename LinestringOut,
typename Strategy
>
struct clip_multi_linestring
{
static inline OutputIterator apply(MultiLinestring const& multi_linestring,
Box const& box, OutputIterator out, Strategy const& strategy)
{
typedef typename point_type<LinestringOut>::type point_type;
strategy::intersection::liang_barsky<Box, point_type> lb_strategy;
for (typename boost::range_iterator<MultiLinestring const>::type it
= boost::begin(multi_linestring);
it != boost::end(multi_linestring); ++it)
{
out = detail::intersection::clip_range_with_box
<LinestringOut>(box, *it, out, lb_strategy);
}
return out;
}
};
}} // namespace detail::intersection
#endif // DOXYGEN_NO_DETAIL
#ifndef DOXYGEN_NO_DISPATCH
namespace dispatch
{
// Linear
template
<
typename MultiLinestring1, typename MultiLinestring2,
bool Reverse1, bool Reverse2, bool ReverseOut,
typename OutputIterator, typename GeometryOut,
overlay_type OverlayType,
typename Strategy
>
struct intersection_insert
<
multi_linestring_tag, multi_linestring_tag, point_tag,
false, false, false,
MultiLinestring1, MultiLinestring2,
Reverse1, Reverse2, ReverseOut,
OutputIterator, GeometryOut,
OverlayType,
Strategy
> : detail::intersection::intersection_multi_linestring_multi_linestring_point
<
MultiLinestring1, MultiLinestring2,
OutputIterator, GeometryOut,
Strategy
>
{};
template
<
typename Linestring, typename MultiLinestring,
typename OutputIterator, typename GeometryOut,
bool Reverse1, bool Reverse2, bool ReverseOut,
overlay_type OverlayType,
typename Strategy
>
struct intersection_insert
<
linestring_tag, multi_linestring_tag, point_tag,
false, false, false,
Linestring, MultiLinestring,
Reverse1, Reverse2, ReverseOut,
OutputIterator, GeometryOut,
OverlayType,
Strategy
> : detail::intersection::intersection_linestring_multi_linestring_point
<
Linestring, MultiLinestring,
OutputIterator, GeometryOut,
Strategy
>
{};
template
<
typename MultiLinestring, typename Box,
bool Reverse1, bool Reverse2, bool ReverseOut,
typename OutputIterator, typename GeometryOut,
overlay_type OverlayType,
typename Strategy
>
struct intersection_insert
<
multi_linestring_tag, box_tag, linestring_tag,
false, true, false,
MultiLinestring, Box,
Reverse1, Reverse2, ReverseOut,
OutputIterator, GeometryOut,
OverlayType,
Strategy
> : detail::intersection::clip_multi_linestring
<
MultiLinestring, Box,
OutputIterator, GeometryOut,
Strategy
>
{};
} // namespace dispatch
#endif
}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_MULTI_ALGORITHMS_INTERSECTION_HPP

View File

@@ -0,0 +1,56 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2007-2011 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2011 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2011 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_MULTI_ALGORITHMS_LENGTH_HPP
#define BOOST_GEOMETRY_MULTI_ALGORITHMS_LENGTH_HPP
#include <boost/range/metafunctions.hpp>
#include <boost/geometry/algorithms/length.hpp>
#include <boost/geometry/multi/core/tags.hpp>
#include <boost/geometry/multi/algorithms/detail/multi_sum.hpp>
namespace boost { namespace geometry
{
#ifndef DOXYGEN_NO_DISPATCH
namespace dispatch
{
template <typename MultiLinestring, typename Strategy>
struct length<multi_linestring_tag, MultiLinestring, Strategy>
: detail::multi_sum
<
typename default_length_result<MultiLinestring>::type,
MultiLinestring,
Strategy,
detail::length::range_length
<
typename boost::range_value<MultiLinestring>::type,
Strategy,
closed // no need to close it explicitly
>
>
{};
} // namespace dispatch
#endif
}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_MULTI_ALGORITHMS_LENGTH_HPP

View File

@@ -0,0 +1,51 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2007-2011 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2011 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2011 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_MULTI_ALGORITHMS_NUM_GEOMETRIES_HPP
#define BOOST_GEOMETRY_MULTI_ALGORITHMS_NUM_GEOMETRIES_HPP
#include <cstddef>
#include <boost/range.hpp>
#include <boost/geometry/algorithms/num_geometries.hpp>
namespace boost { namespace geometry
{
#ifndef DOXYGEN_NO_DISPATCH
namespace dispatch
{
template <typename MultiGeometry>
struct num_geometries<multi_tag, MultiGeometry>
{
static inline std::size_t apply(MultiGeometry const& multi_geometry)
{
return boost::size(multi_geometry);
}
};
} // namespace dispatch
#endif
}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_MULTI_ALGORITHMS_NUM_GEOMETRIES_HPP

View File

@@ -0,0 +1,61 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2007-2011 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2011 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2011 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_MULTI_ALGORITHMS_NUM_INTERIOR_RINGS_HPP
#define BOOST_GEOMETRY_MULTI_ALGORITHMS_NUM_INTERIOR_RINGS_HPP
#include <cstddef>
#include <boost/range.hpp>
#include <boost/geometry/core/tag.hpp>
#include <boost/geometry/core/tags.hpp>
#include <boost/geometry/multi/core/tags.hpp>
#include <boost/geometry/algorithms/num_interior_rings.hpp>
namespace boost { namespace geometry
{
#ifndef DOXYGEN_NO_DISPATCH
namespace dispatch
{
template <typename MultiPolygon>
struct num_interior_rings<multi_polygon_tag, MultiPolygon>
{
static inline std::size_t apply(MultiPolygon const& multi_polygon)
{
std::size_t n = 0;
for (typename boost::range_iterator<MultiPolygon const>::type
it = boost::begin(multi_polygon);
it != boost::end(multi_polygon);
++it)
{
n += geometry::num_interior_rings(*it);
}
return n;
}
};
} // namespace dispatch
#endif
}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_MULTI_ALGORITHMS_NUM_INTERIOR_RINGS_HPP

View File

@@ -0,0 +1,81 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2007-2011 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2011 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2011 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_MULTI_ALGORITHMS_NUM_POINTS_HPP
#define BOOST_GEOMETRY_MULTI_ALGORITHMS_NUM_POINTS_HPP
#include <boost/range.hpp>
#include <boost/geometry/multi/core/tags.hpp>
#include <boost/geometry/algorithms/num_points.hpp>
namespace boost { namespace geometry
{
#ifndef DOXYGEN_NO_DETAIL
namespace detail { namespace num_points
{
template <typename MultiGeometry>
struct multi_count
{
static inline size_t apply(MultiGeometry const& geometry, bool add_for_open)
{
typedef typename boost::range_value<MultiGeometry>::type geometry_type;
typedef typename boost::range_iterator
<
MultiGeometry const
>::type iterator_type;
std::size_t n = 0;
for (iterator_type it = boost::begin(geometry);
it != boost::end(geometry);
++it)
{
n += dispatch::num_points
<
typename tag<geometry_type>::type,
geometry_type
>::apply(*it, add_for_open);
}
return n;
}
};
}} // namespace detail::num_points
#endif
#ifndef DOXYGEN_NO_DISPATCH
namespace dispatch
{
template <typename Geometry>
struct num_points<multi_tag, Geometry>
: detail::num_points::multi_count<Geometry> {};
} // namespace dispatch
#endif
}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_MULTI_ALGORITHMS_NUM_POINTS_HPP

View File

@@ -0,0 +1,55 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2007-2011 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2011 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2011 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_MULTI_ALGORITHMS_PERIMETER_HPP
#define BOOST_GEOMETRY_MULTI_ALGORITHMS_PERIMETER_HPP
#include <boost/range/metafunctions.hpp>
#include <boost/geometry/algorithms/perimeter.hpp>
#include <boost/geometry/multi/core/tags.hpp>
#include <boost/geometry/multi/algorithms/detail/multi_sum.hpp>
namespace boost { namespace geometry
{
#ifndef DOXYGEN_NO_DISPATCH
namespace dispatch
{
template <typename MultiPolygon, typename Strategy>
struct perimeter<multi_polygon_tag, MultiPolygon, Strategy>
: detail::multi_sum
<
typename default_length_result<MultiPolygon>::type,
MultiPolygon,
Strategy,
perimeter
<
polygon_tag,
typename boost::range_value<MultiPolygon>::type,
Strategy
>
>
{};
} // namespace dispatch
#endif
}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_MULTI_ALGORITHMS_PERIMETER_HPP

View File

@@ -0,0 +1,69 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2007-2011 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2011 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2011 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_MULTI_ALGORITHMS_REVERSE_HPP
#define BOOST_GEOMETRY_MULTI_ALGORITHMS_REVERSE_HPP
#include <boost/range/metafunctions.hpp>
#include <boost/geometry/algorithms/reverse.hpp>
#include <boost/geometry/multi/algorithms/detail/modify.hpp>
#include <boost/geometry/multi/core/tags.hpp>
namespace boost { namespace geometry
{
#ifndef DOXYGEN_NO_DISPATCH
namespace dispatch
{
template <typename Geometry>
struct reverse<multi_linestring_tag, Geometry>
: detail::multi_modify
<
Geometry,
detail::reverse::range_reverse
<
typename boost::range_value<Geometry>::type
>
>
{};
template <typename Geometry>
struct reverse<multi_polygon_tag, Geometry>
: detail::multi_modify
<
Geometry,
detail::reverse::polygon_reverse
<
typename boost::range_value<Geometry>::type
>
>
{};
} // namespace dispatch
#endif // DOXYGEN_NO_DISPATCH
}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_MULTI_ALGORITHMS_REVERSE_HPP

View File

@@ -0,0 +1,117 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2007-2011 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2011 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2011 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_MULTI_ALGORITHMS_SIMPLIFY_HPP
#define BOOST_GEOMETRY_MULTI_ALGORITHMS_SIMPLIFY_HPP
#include <boost/range.hpp>
#include <boost/geometry/core/mutable_range.hpp>
#include <boost/geometry/multi/core/tags.hpp>
#include <boost/geometry/multi/algorithms/clear.hpp>
#include <boost/geometry/algorithms/simplify.hpp>
namespace boost { namespace geometry
{
#ifndef DOXYGEN_NO_DETAIL
namespace detail { namespace simplify
{
template<typename MultiGeometry, typename Strategy, typename Policy>
struct simplify_multi
{
static inline void apply(MultiGeometry const& multi, MultiGeometry& out,
double max_distance, Strategy const& strategy)
{
traits::resize<MultiGeometry>::apply(out, boost::size(multi));
typename boost::range_iterator<MultiGeometry>::type it_out
= boost::begin(out);
for (typename boost::range_iterator<MultiGeometry const>::type it_in
= boost::begin(multi);
it_in != boost::end(multi);
++it_in, ++it_out)
{
Policy::apply(*it_in, *it_out, max_distance, strategy);
}
}
};
}} // namespace detail::simplify
#endif // DOXYGEN_NO_DETAIL
#ifndef DOXYGEN_NO_DISPATCH
namespace dispatch
{
template <typename MultiPoint, typename Strategy>
struct simplify<multi_point_tag, MultiPoint, Strategy>
: detail::simplify::simplify_copy
<
MultiPoint,
Strategy
>
{};
template <typename MultiLinestring, typename Strategy>
struct simplify<multi_linestring_tag, MultiLinestring, Strategy>
: detail::simplify::simplify_multi
<
MultiLinestring,
Strategy,
detail::simplify::simplify_range
<
typename boost::range_value<MultiLinestring>::type,
Strategy,
2
>
>
{};
template <typename MultiPolygon, typename Strategy>
struct simplify<multi_polygon_tag, MultiPolygon, Strategy>
: detail::simplify::simplify_multi
<
MultiPolygon,
Strategy,
detail::simplify::simplify_polygon
<
typename boost::range_value<MultiPolygon>::type,
Strategy
>
>
{};
} // namespace dispatch
#endif // DOXYGEN_NO_DISPATCH
}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_MULTI_ALGORITHMS_SIMPLIFY_HPP

View File

@@ -0,0 +1,102 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2007-2011 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2011 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2011 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_MULTI_ALGORITHMS_TRANSFORM_HPP
#define BOOST_GEOMETRY_MULTI_ALGORITHMS_TRANSFORM_HPP
#include <boost/range.hpp>
#include <boost/geometry/core/mutable_range.hpp>
#include <boost/geometry/algorithms/transform.hpp>
#include <boost/geometry/multi/core/tags.hpp>
namespace boost { namespace geometry
{
#ifndef DOXYGEN_NO_DETAIL
namespace detail { namespace transform
{
/*!
\brief Is able to transform any multi-geometry, calling the single-version as policy
*/
template <typename Multi1, typename Multi2, typename Policy>
struct transform_multi
{
template <typename S>
static inline bool apply(Multi1 const& multi1, Multi2& multi2, S const& strategy)
{
traits::resize<Multi2>::apply(multi2, boost::size(multi1));
typename boost::range_iterator<Multi1 const>::type it1
= boost::begin(multi1);
typename boost::range_iterator<Multi2>::type it2
= boost::begin(multi2);
for (; it1 != boost::end(multi1); ++it1, ++it2)
{
if (! Policy::apply(*it1, *it2, strategy))
{
return false;
}
}
return true;
}
};
}} // namespace detail::transform
#endif // DOXYGEN_NO_DETAIL
#ifndef DOXYGEN_NO_DISPATCH
namespace dispatch
{
template <typename Multi1, typename Multi2, typename Strategy>
struct transform
<
multi_tag, multi_tag,
Multi1, Multi2,
Strategy
>
: detail::transform::transform_multi
<
Multi1,
Multi2,
transform
<
typename single_tag_of
<
typename tag<Multi1>::type
>::type,
typename single_tag_of
<
typename tag<Multi2>::type
>::type,
typename boost::range_value<Multi1>::type,
typename boost::range_value<Multi2>::type,
Strategy
>
>
{};
} // namespace dispatch
#endif // DOXYGEN_NO_DISPATCH
}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_MULTI_ALGORITHMS_TRANSFORM_HPP

View File

@@ -0,0 +1,102 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2007-2011 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2011 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2011 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_MULTI_ALGORITHMS_UNIQUE_HPP
#define BOOST_GEOMETRY_MULTI_ALGORITHMS_UNIQUE_HPP
#include <boost/range.hpp>
#include <boost/geometry/algorithms/unique.hpp>
#include <boost/geometry/multi/core/tags.hpp>
namespace boost { namespace geometry
{
#ifndef DOXYGEN_NO_DETAIL
namespace detail { namespace unique
{
template <typename MultiGeometry, typename ComparePolicy, typename Policy>
struct multi_unique
{
static inline void apply(MultiGeometry& multi, ComparePolicy const& compare)
{
for (typename boost::range_iterator<MultiGeometry>::type
it = boost::begin(multi);
it != boost::end(multi);
++it)
{
Policy::apply(*it, compare);
}
}
};
}} // namespace detail::unique
#endif // DOXYGEN_NO_DETAIL
#ifndef DOXYGEN_NO_DISPATCH
namespace dispatch
{
// For points, unique is not applicable and does nothing
// (Note that it is not "spatially unique" but that it removes duplicate coordinates,
// like std::unique does). Spatially unique is "dissolve" which can (or will be)
// possible for multi-points as well, removing points at the same location.
template <typename MultiLineString, typename ComparePolicy>
struct unique<multi_linestring_tag, MultiLineString, ComparePolicy>
: detail::unique::multi_unique
<
MultiLineString,
ComparePolicy,
detail::unique::range_unique
<
typename boost::range_value<MultiLineString>::type,
ComparePolicy
>
>
{};
template <typename MultiPolygon, typename ComparePolicy>
struct unique<multi_polygon_tag, MultiPolygon, ComparePolicy>
: detail::unique::multi_unique
<
MultiPolygon,
ComparePolicy,
detail::unique::polygon_unique
<
typename boost::range_value<MultiPolygon>::type,
ComparePolicy
>
>
{};
} // namespace dispatch
#endif
}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_MULTI_ALGORITHMS_UNIQUE_HPP

View File

@@ -0,0 +1,103 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2007-2011 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2011 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2011 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_MULTI_ALGORITHMS_WITHIN_HPP
#define BOOST_GEOMETRY_MULTI_ALGORITHMS_WITHIN_HPP
#include <boost/range.hpp>
#include <boost/geometry/algorithms/within.hpp>
#include <boost/geometry/multi/core/closure.hpp>
#include <boost/geometry/multi/core/point_order.hpp>
#include <boost/geometry/multi/core/tags.hpp>
namespace boost { namespace geometry
{
#ifndef DOXYGEN_NO_DETAIL
namespace detail { namespace within
{
template
<
typename Geometry,
typename MultiGeometry,
typename Strategy,
typename Policy
>
struct geometry_multi_within_code
{
static inline int apply(Geometry const& geometry,
MultiGeometry const& multi,
Strategy const& strategy)
{
for (typename boost::range_iterator<MultiGeometry const>::type it
= boost::begin(multi);
it != boost::end(multi);
++it)
{
// Geometry coding on multi: 1 (within) if within one of them;
// 0 (touch) if on border of one of them
int const code = Policy::apply(geometry, *it, strategy);
if (code != -1)
{
return code;
}
}
return -1;
}
};
}} // namespace detail::within
#endif // DOXYGEN_NO_DETAIL
#ifndef DOXYGEN_NO_DISPATCH
namespace dispatch
{
template <typename Point, typename MultiPolygon, typename Strategy>
struct within<point_tag, multi_polygon_tag, Point, MultiPolygon, Strategy>
{
static inline bool apply(Point const& point,
MultiPolygon const& multi_polygon, Strategy const& strategy)
{
return detail::within::geometry_multi_within_code
<
Point,
MultiPolygon,
Strategy,
detail::within::point_in_polygon
<
Point,
typename boost::range_value<MultiPolygon>::type,
order_as_direction
<
geometry::point_order<MultiPolygon>::value
>::value,
geometry::closure<MultiPolygon>::value,
Strategy
>
>::apply(point, multi_polygon, strategy) == 1;
}
};
} // namespace dispatch
#endif // DOXYGEN_NO_DISPATCH
}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_MULTI_ALGORITHMS_WITHIN_HPP