intersection now includes isolated intersection points; exact behavior depends on the definition of related macros;

updated unit test to test for isolated intersection points as well;
This commit is contained in:
Menelaos Karavelas
2014-02-23 11:47:13 +02:00
parent 0cd6e23494
commit e11dcd9bbf
4 changed files with 258 additions and 6 deletions

View File

@@ -1,11 +1,16 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2007-2014 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2014.
// Modifications copyright (c) 2014 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 Menelaos Karavelas, on behalf of Oracle
#ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_FOLLOW_HPP
#define BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_FOLLOW_HPP
@@ -191,6 +196,30 @@ struct action_selector<overlay_intersection>
geometry::clear(current_piece);
}
template
<
typename OutputIterator,
typename LineStringOut,
typename LineString,
typename Point,
typename Operation
>
static inline void isolated_point(LineStringOut&,
LineString const&,
segment_identifier&,
int, Point const& point,
Operation const& , OutputIterator& out)
{
LineStringOut isolated_point_ls;
geometry::append(isolated_point_ls, point);
#ifndef BOOST_GEOMETRY_ALLOW_ONE_POINT_LINESTRINGS
geometry::append(isolated_point_ls, point);
#endif // BOOST_GEOMETRY_ALLOW_ONE_POINT_LINESTRINGS
*out++ = isolated_point_ls;
}
static inline bool is_entered(bool entered)
{
return entered;
@@ -246,6 +275,22 @@ struct action_selector<overlay_difference>
point, operation, out);
}
template
<
typename OutputIterator,
typename LineStringOut,
typename LineString,
typename Point,
typename Operation
>
static inline void isolated_point(LineStringOut&,
LineString const&,
segment_identifier&,
int, Point const&,
Operation const&, OutputIterator&)
{
}
static inline bool is_entered(bool entered)
{
return ! normal_action::is_entered(entered);

View File

@@ -10,6 +10,8 @@
#ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_DIFFERENCE_FOLLOW_LINEAR_LINEAR_HPP
#define BOOST_GEOMETRY_ALGORITHMS_DETAIL_DIFFERENCE_FOLLOW_LINEAR_LINEAR_HPP
#include <boost/geometry/algorithms/detail/overlay/follow.hpp>
namespace boost { namespace geometry
{
@@ -215,13 +217,18 @@ protected:
it->point, *iit, oit);
}
}
#ifndef BOOST_GEOMETRY_INTERSECTION_DO_NOT_INCLUDE_ISOLATED_POINTS
else if ( is_isolated_point(*it, *iit, *iit_r, entered) )
{
#ifdef GEOMETRY_TEST_DEBUG
detail::overlay::debug_traverse(*it, *iit,
"-> Isolated point");
detail::overlay::debug_traverse(*it, *iit, "-> Isolated point");
#endif
action::isolated_point(current_piece, ls1, current_segment_id,
iit->seg_id.segment_index,
it->point, *iit, oit);
}
#endif
first = false;
return oit;
}