summaryrefslogtreecommitdiff
path: root/boost/geometry/algorithms/detail/is_valid/multipolygon.hpp
diff options
context:
space:
mode:
authorDongHun Kwak <dh0128.kwak@samsung.com>2017-09-13 11:24:46 +0900
committerDongHun Kwak <dh0128.kwak@samsung.com>2017-09-13 11:25:39 +0900
commit4fadd968fa12130524c8380f33fcfe25d4de79e5 (patch)
treefd26a490cd15388d42fc6652b3c5c13012e7f93e /boost/geometry/algorithms/detail/is_valid/multipolygon.hpp
parentb5c87084afaef42b2d058f68091be31988a6a874 (diff)
downloadboost-upstream/1.65.0.tar.gz
boost-upstream/1.65.0.tar.bz2
boost-upstream/1.65.0.zip
Imported Upstream version 1.65.0upstream/1.65.0
Change-Id: Icf8400b375482cb11bcf77440a6934ba360d6ba4 Signed-off-by: DongHun Kwak <dh0128.kwak@samsung.com>
Diffstat (limited to 'boost/geometry/algorithms/detail/is_valid/multipolygon.hpp')
-rw-r--r--boost/geometry/algorithms/detail/is_valid/multipolygon.hpp75
1 files changed, 53 insertions, 22 deletions
diff --git a/boost/geometry/algorithms/detail/is_valid/multipolygon.hpp b/boost/geometry/algorithms/detail/is_valid/multipolygon.hpp
index 84dacc57f1..ed24b13810 100644
--- a/boost/geometry/algorithms/detail/is_valid/multipolygon.hpp
+++ b/boost/geometry/algorithms/detail/is_valid/multipolygon.hpp
@@ -76,45 +76,66 @@ private:
<
typename PolygonIterator,
typename TurnIterator,
- typename VisitPolicy
+ typename VisitPolicy,
+ typename Strategy
>
static inline
bool are_polygon_interiors_disjoint(PolygonIterator polygons_first,
PolygonIterator polygons_beyond,
TurnIterator turns_first,
TurnIterator turns_beyond,
- VisitPolicy& visitor)
+ VisitPolicy& visitor,
+ Strategy const& strategy)
{
boost::ignore_unused(visitor);
- // collect all polygons that have turns
+ // collect all polygons that have crossing turns
std::set<signed_size_type> multi_indices;
for (TurnIterator tit = turns_first; tit != turns_beyond; ++tit)
{
- multi_indices.insert(tit->operations[0].seg_id.multi_index);
- multi_indices.insert(tit->operations[1].seg_id.multi_index);
+ if (! tit->touch_only)
+ {
+ multi_indices.insert(tit->operations[0].seg_id.multi_index);
+ multi_indices.insert(tit->operations[1].seg_id.multi_index);
+ }
}
+ typedef geometry::model::box<typename point_type<MultiPolygon>::type> box_type;
+ typedef typename base::template partition_item<PolygonIterator, box_type> item_type;
+
// put polygon iterators without turns in a vector
- std::vector<PolygonIterator> polygon_iterators;
+ std::vector<item_type> polygon_iterators;
signed_size_type multi_index = 0;
for (PolygonIterator it = polygons_first; it != polygons_beyond;
++it, ++multi_index)
{
if (multi_indices.find(multi_index) == multi_indices.end())
{
- polygon_iterators.push_back(it);
+ polygon_iterators.push_back(item_type(it));
}
}
- typename base::item_visitor_type item_visitor;
+ // prepare strategies
+ typedef typename std::iterator_traits<PolygonIterator>::value_type polygon_type;
+ typedef typename Strategy::template point_in_geometry_strategy
+ <
+ polygon_type, polygon_type
+ >::type within_strategy_type;
+ within_strategy_type const within_strategy
+ = strategy.template get_point_in_geometry_strategy<polygon_type, polygon_type>();
+ typedef typename Strategy::envelope_strategy_type envelope_strategy_type;
+ envelope_strategy_type const envelope_strategy
+ = strategy.get_envelope_strategy();
+
+ // call partition to check if polygons are disjoint from each other
+ typename base::template item_visitor_type<within_strategy_type> item_visitor(within_strategy);
geometry::partition
<
geometry::model::box<typename point_type<MultiPolygon>::type>
>::apply(polygon_iterators, item_visitor,
- typename base::expand_box(),
- typename base::overlaps_box());
+ typename base::template expand_box<envelope_strategy_type>(envelope_strategy),
+ typename base::template overlaps_box<envelope_strategy_type>(envelope_strategy));
if (item_visitor.items_overlap)
{
@@ -155,13 +176,15 @@ private:
<
typename PolygonIterator,
typename TurnIterator,
- typename VisitPolicy
+ typename VisitPolicy,
+ typename Strategy
>
static inline bool apply(PolygonIterator polygons_first,
PolygonIterator polygons_beyond,
TurnIterator turns_first,
TurnIterator turns_beyond,
- VisitPolicy& visitor)
+ VisitPolicy& visitor,
+ Strategy const& strategy)
{
signed_size_type multi_index = 0;
for (PolygonIterator it = polygons_first; it != polygons_beyond;
@@ -185,7 +208,8 @@ private:
if (! Predicate::apply(*it,
filtered_turns_first,
filtered_turns_beyond,
- visitor))
+ visitor,
+ strategy))
{
return false;
}
@@ -200,19 +224,21 @@ private:
<
typename PolygonIterator,
typename TurnIterator,
- typename VisitPolicy
+ typename VisitPolicy,
+ typename Strategy
>
static inline bool have_holes_inside(PolygonIterator polygons_first,
PolygonIterator polygons_beyond,
TurnIterator turns_first,
TurnIterator turns_beyond,
- VisitPolicy& visitor)
+ VisitPolicy& visitor,
+ Strategy const& strategy)
{
return has_property_per_polygon
<
typename base::has_holes_inside
>::apply(polygons_first, polygons_beyond,
- turns_first, turns_beyond, visitor);
+ turns_first, turns_beyond, visitor, strategy);
}
@@ -221,19 +247,21 @@ private:
<
typename PolygonIterator,
typename TurnIterator,
- typename VisitPolicy
+ typename VisitPolicy,
+ typename Strategy
>
static inline bool have_connected_interior(PolygonIterator polygons_first,
PolygonIterator polygons_beyond,
TurnIterator turns_first,
TurnIterator turns_beyond,
- VisitPolicy& visitor)
+ VisitPolicy& visitor,
+ Strategy const& strategy)
{
return has_property_per_polygon
<
typename base::has_connected_interior
>::apply(polygons_first, polygons_beyond,
- turns_first, turns_beyond, visitor);
+ turns_first, turns_beyond, visitor, strategy);
}
@@ -307,7 +335,8 @@ public:
boost::end(multipolygon),
turns.begin(),
turns.end(),
- visitor))
+ visitor,
+ strategy))
{
return false;
}
@@ -320,7 +349,8 @@ public:
boost::end(multipolygon),
turns.begin(),
turns.end(),
- visitor))
+ visitor,
+ strategy))
{
return false;
}
@@ -332,7 +362,8 @@ public:
boost::end(multipolygon),
turns.begin(),
turns.end(),
- visitor);
+ visitor,
+ strategy);
}
};