[multi][algorithm/detail] Move most of the code of details from multi/ directory.

This commit doesn't move for_each_range.
Details used only by multi/algorithms aren't moved as well.
This commit is contained in:
Adam Wulkiewicz
2014-06-04 15:53:46 +02:00
parent 320f796b9d
commit 55e684c64c
20 changed files with 481 additions and 738 deletions

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

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

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

@@ -13,55 +13,7 @@
#define BOOST_GEOMETRY_MULTI_ALGORITHMS_DETAIL_EXTREME_POINTS_HPP
#include <cstddef>
#include <boost/range.hpp>
#include <boost/geometry/algorithms/detail/extreme_points.hpp>
#include <boost/geometry/core/tags.hpp>
#include <boost/geometry/geometries/concepts/check.hpp>
namespace boost { namespace geometry
{
#ifndef DOXYGEN_NO_DISPATCH
namespace dispatch
{
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
}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_MULTI_ALGORITHMS_DETAIL_EXTREME_POINTS_HPP

View File

@@ -13,123 +13,7 @@
#define BOOST_GEOMETRY_MULTI_ALGORITHMS_DETAIL_OVERLAY_COPY_SEGMENT_POINT_HPP
#include <boost/range.hpp>
#include <boost/geometry/algorithms/detail/overlay/copy_segment_point.hpp>
#include <boost/geometry/core/tags.hpp>
#include <boost/geometry/geometries/concepts/check.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 < int(boost::size(multi))
);
// Call the single-version
return Policy::apply(multi[seg_id.multi_index], seg_id, second, point);
}
};
}} // namespace detail::copy_segments
#endif // DOXYGEN_NO_DETAIL
#ifndef DOXYGEN_NO_DISPATCH
namespace dispatch
{
template
<
typename MultiGeometry,
bool Reverse,
typename SegmentIdentifier,
typename PointOut
>
struct copy_segment_point
<
multi_polygon_tag,
MultiGeometry,
Reverse,
SegmentIdentifier,
PointOut
>
: detail::copy_segments::copy_segment_point_multi
<
MultiGeometry,
SegmentIdentifier,
PointOut,
detail::copy_segments::copy_segment_point_polygon
<
typename boost::range_value<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
}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_MULTI_ALGORITHMS_DETAIL_OVERLAY_COPY_SEGMENT_POINT_HPP

View File

@@ -10,78 +10,7 @@
#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/core/ring_type.hpp>
#include <boost/geometry/core/tags.hpp>
#include <boost/geometry/geometries/concepts/check.hpp>
namespace boost { namespace geometry
{
#ifndef DOXYGEN_NO_DETAIL
namespace detail { namespace copy_segments
{
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
#ifndef DOXYGEN_NO_DISPATCH
namespace dispatch
{
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
}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_MULTI_ALGORITHMS_DETAIL_OVERLAY_COPY_SEGMENTS_HPP

View File

@@ -10,47 +10,7 @@
#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/core/ring_type.hpp>
#include <boost/geometry/core/tags.hpp>
#include <boost/geometry/geometries/concepts/check.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 < int(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

@@ -9,99 +9,8 @@
#ifndef BOOST_GEOMETRY_MULTI_ALGORITHMS_DETAIL_OVERLAY_GET_TURNS_HPP
#define BOOST_GEOMETRY_MULTI_ALGORITHMS_DETAIL_OVERLAY_GET_TURNS_HPP
#include <boost/geometry/algorithms/detail/overlay/get_turns.hpp>
#include <boost/geometry/core/ring_type.hpp>
#include <boost/geometry/core/tags.hpp>
#include <boost/geometry/geometries/concepts/check.hpp>
#include <boost/geometry/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 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);
}
}
};
}} // namespace detail::get_turns
#endif // DOXYGEN_NO_DETAIL
#ifndef DOXYGEN_NO_DISPATCH
namespace dispatch
{
template
<
typename MultiPolygon,
typename Box,
bool ReverseMultiPolygon, bool ReverseBox,
typename TurnPolicy
>
struct get_turns
<
multi_polygon_tag, box_tag,
MultiPolygon, Box,
ReverseMultiPolygon, ReverseBox,
TurnPolicy
>
: detail::get_turns::get_turns_multi_polygon_cs
<
MultiPolygon, Box,
ReverseMultiPolygon, ReverseBox,
TurnPolicy
>
{};
} // namespace dispatch
#endif // DOXYGEN_NO_DISPATCH
}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_MULTI_ALGORITHMS_DETAIL_OVERLAY_GET_TURNS_HPP

View File

@@ -10,56 +10,7 @@
#define BOOST_GEOMETRY_MULTI_ALGORITHMS_DETAIL_OVERLAY_SELECT_RINGS_HPP
#include <boost/range.hpp>
#include <boost/geometry/algorithms/detail/overlay/select_rings.hpp>
#include <boost/geometry/core/tags.hpp>
#include <boost/geometry/geometries/concepts/check.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

@@ -12,38 +12,5 @@
#include <boost/geometry/algorithms/detail/overlay/self_turn_points.hpp>
#include <boost/geometry/core/tags.hpp>
#include <boost/geometry/geometries/concepts/check.hpp>
namespace boost { namespace geometry
{
#ifndef DOXYGEN_NO_DISPATCH
namespace dispatch
{
template
<
typename MultiPolygon,
typename TurnPolicy
>
struct self_get_turn_points
<
multi_polygon_tag, MultiPolygon,
TurnPolicy
>
: detail::self_get_turn_points::get_turns<TurnPolicy>
{};
} // namespace dispatch
#endif // DOXYGEN_NO_DISPATCH
}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_MULTI_ALGORITHMS_DETAIL_OVERLAY_SELF_TURN_POINTS_HPP

View File

@@ -18,96 +18,7 @@
#define BOOST_GEOMETRY_MULTI_ALGORITHMS_DETAIL_POINT_ON_BORDER_HPP
#include <boost/range.hpp>
#include <boost/geometry/algorithms/detail/point_on_border.hpp>
#include <boost/geometry/core/tags.hpp>
#include <boost/geometry/geometries/concepts/check.hpp>
namespace boost { namespace geometry
{
#ifndef DOXYGEN_NO_DETAIL
namespace detail { namespace point_on_border
{
template
<
typename Point,
typename MultiGeometry,
typename Policy
>
struct point_on_multi
{
static inline bool apply(Point& point, MultiGeometry const& multi, bool midpoint)
{
// Take a point on the first multi-geometry
// (i.e. the first that is not empty)
for (typename boost::range_iterator
<
MultiGeometry const
>::type it = boost::begin(multi);
it != boost::end(multi);
++it)
{
if (Policy::apply(point, *it, midpoint))
{
return true;
}
}
return false;
}
};
}} // namespace detail::point_on_border
#endif // DOXYGEN_NO_DETAIL
#ifndef DOXYGEN_NO_DISPATCH
namespace dispatch
{
template<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
}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_MULTI_ALGORITHMS_DETAIL_POINT_ON_BORDER_HPP

View File

@@ -14,95 +14,13 @@
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
#ifndef BOOST_GEOMETRY_MULTI_ALGORITHMS_DETAIL_SECTIONS_RANGE_BY_SECTION_HPP
#define BOOST_GEOMETRY_MULTI_ALGORITHMS_DETAIL_SECTIONS_RANGE_BY_SECTION_HPP
#include <boost/assert.hpp>
#include <boost/range.hpp>
#include <boost/geometry/algorithms/detail/sections/range_by_section.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
{
#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 < int(boost::size(multi))
);
return Policy::apply(multi[section.ring_id.multi_index], section);
}
};
}} // namespace detail::section
#endif
#ifndef DOXYGEN_NO_DISPATCH
namespace dispatch
{
template <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
}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_MULTI_ALGORITHMS_DETAIL_SECTIONS_RANGE_BY_SECTION_HPP

View File

@@ -17,106 +17,8 @@
#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>
#include <boost/geometry/core/tags.hpp>
#include <boost/geometry/geometries/concepts/check.hpp>
namespace boost { namespace geometry
{
#ifndef DOXYGEN_NO_DETAIL
namespace detail { namespace sectionalize
{
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);
}
}
};
}} // namespace detail::sectionalize
#endif // DOXYGEN_NO_DETAIL
#ifndef DOXYGEN_NO_DISPATCH
namespace dispatch
{
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
}} // namespace boost::geometry
#endif // BOOST_GEOMETRY_MULTI_ALGORITHMS_DETAIL_SECTIONS_SECTIONALIZE_HPP