summaryrefslogtreecommitdiff
path: root/boost/geometry/algorithms/detail/relate/boundary_checker.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'boost/geometry/algorithms/detail/relate/boundary_checker.hpp')
-rw-r--r--boost/geometry/algorithms/detail/relate/boundary_checker.hpp40
1 files changed, 33 insertions, 7 deletions
diff --git a/boost/geometry/algorithms/detail/relate/boundary_checker.hpp b/boost/geometry/algorithms/detail/relate/boundary_checker.hpp
index 9de1bacb7d..1a9a5a8fd7 100644
--- a/boost/geometry/algorithms/detail/relate/boundary_checker.hpp
+++ b/boost/geometry/algorithms/detail/relate/boundary_checker.hpp
@@ -17,6 +17,8 @@
#include <boost/geometry/algorithms/detail/equals/point_point.hpp>
+#include <boost/geometry/util/has_nan_coordinate.hpp>
+
namespace boost { namespace geometry
{
@@ -90,19 +92,43 @@ public:
for ( multi_iterator it = boost::begin(geometry) ;
it != boost::end(geometry) ; ++ it )
{
+ typename boost::range_reference<Geometry const>::type
+ ls = *it;
+
// empty or point - no boundary
- if ( boost::size(*it) < 2 )
+ if (boost::size(ls) < 2)
+ {
continue;
+ }
- // linear ring or point - no boundary
- if ( equals::equals_point_point(range::front(*it), range::back(*it)) )
- continue;
+ typedef typename boost::range_reference
+ <
+ typename boost::range_value<Geometry const>::type const
+ >::type point_reference;
+
+ point_reference front_pt = range::front(ls);
+ point_reference back_pt = range::back(ls);
- boundary_points.push_back(range::front(*it));
- boundary_points.push_back(range::back(*it));
+ // linear ring or point - no boundary
+ if (! equals::equals_point_point(front_pt, back_pt))
+ {
+ // do not add points containing NaN coordinates
+ // because they cannot be reasonably compared, e.g. with MSVC
+ // an assertion failure is reported in std::equal_range()
+ if (! geometry::has_nan_coordinate(front_pt))
+ {
+ boundary_points.push_back(front_pt);
+ }
+ if (! geometry::has_nan_coordinate(back_pt))
+ {
+ boundary_points.push_back(back_pt);
+ }
+ }
}
- std::sort(boundary_points.begin(), boundary_points.end(), geometry::less<point_type>());
+ std::sort(boundary_points.begin(),
+ boundary_points.end(),
+ geometry::less<point_type>());
is_filled = true;
}