Merge branch 'develop' of https://github.com/boostorg/geometry into feature/setops

This commit is contained in:
Menelaos Karavelas
2014-04-30 01:27:23 +03:00
5 changed files with 68 additions and 13 deletions

View File

@@ -82,10 +82,14 @@ public:
inline i_info_type const& i_info() const { return m_result.template get<0>(); }
inline d_info_type const& d_info() const { return m_result.template get<1>(); }
// TODO: not it's more like is_spike_ip_p
inline bool is_spike_p() const
{
if ( m_side_calc.pk_wrt_p1() == 0 )
{
if ( ! is_ip_j<0>() )
return false;
int const qk_p1 = m_side_calc.qk_wrt_p1();
int const qk_p2 = m_side_calc.qk_wrt_p2();
@@ -103,10 +107,14 @@ public:
return false;
}
// TODO: not it's more like is_spike_ip_q
inline bool is_spike_q() const
{
if ( m_side_calc.qk_wrt_q1() == 0 )
{
if ( ! is_ip_j<1>() )
return false;
int const pk_q1 = m_side_calc.pk_wrt_q1();
int const pk_q2 = m_side_calc.pk_wrt_q2();
@@ -143,6 +151,36 @@ private:
return result.template get<0>().count == 2;
}
template <std::size_t OpId>
bool is_ip_j() const
{
int arrival = d_info().arrival[OpId];
bool same_dirs = d_info().dir_a == 0 && d_info().dir_b == 0;
if ( same_dirs )
{
if ( i_info().count == 2 )
{
if ( ! d_info().opposite )
{
return arrival != -1;
}
else
{
return arrival != -1;
}
}
else
{
return arrival == 0;
}
}
else
{
return arrival == 1;
}
}
result_type m_result;
side_calculator_type m_side_calc;
RobustPolicy const& m_robust_policy;
@@ -472,7 +510,8 @@ struct get_turn_info_for_endpoint
// handle spikes
// P is spike and should be handled
if ( !is_p_last && ip_info.is_pj
if ( !is_p_last
&& ip_info.is_pj // this check is redundant (also in is_spike_p) but faster
&& inters.i_info().count == 2
&& inters.is_spike_p() )
{
@@ -482,7 +521,8 @@ struct get_turn_info_for_endpoint
p_pos, q_pos, tp_model, out);
}
// Q is spike and should be handled
else if ( !is_q_last && ip_info.is_qj
else if ( !is_q_last
&& ip_info.is_qj // this check is redundant (also in is_spike_q) but faster
&& inters.i_info().count == 2
&& inters.is_spike_q() )
{

View File

@@ -37,13 +37,13 @@ namespace boost { namespace geometry {
#ifndef DOXYGEN_NO_DETAIL
namespace detail { namespace within {
int check_result_type(int result)
inline int check_result_type(int result)
{
return result;
}
template <typename T>
void check_result_type(T result)
inline void check_result_type(T result)
{
BOOST_ASSERT(false);
}

View File

@@ -99,10 +99,13 @@ struct dissolve_ring_or_polygon
RescalePolicy const& rescale_policy,
OutputIterator out)
{
typedef typename point_type<Geometry>::type point_type;
// Get the self-intersection points, including turns
typedef detail::overlay::traversal_turn_info
<
typename point_type<Geometry>::type
point_type,
typename segment_ratio_type<point_type, RescalePolicy>::type
> turn_info;
std::vector<turn_info> turns;
@@ -212,6 +215,7 @@ template
typename GeometryOut
>
struct dissolve
: not_implemented<GeometryTag, GeometryOutTag>
{};

View File

@@ -16,6 +16,7 @@
#include <cstddef>
#include <boost/type_traits.hpp>
#include <boost/mpl/assert.hpp>
#include <boost/geometry/core/tag_cast.hpp>
@@ -211,14 +212,16 @@ struct rescale_policy_type
#endif
>
{
BOOST_STATIC_ASSERT
((
boost::is_same
<
typename geometry::tag<Point>::type,
geometry::point_tag
>::type::value
));
static const bool is_point
= boost::is_same
<
typename geometry::tag<Point>::type,
geometry::point_tag
>::type::value;
BOOST_MPL_ASSERT_MSG((is_point),
INVALID_INPUT_GEOMETRY,
(typename geometry::tag<Point>::type));
};

View File

@@ -237,6 +237,14 @@ void test_all()
test_geometry<ls, ls>("LINESTRING(2 2,5 -1,15 2,18 0,20 0)",
"LINESTRING(30 0,19 0,18 0,0 0)",
expected("iuu")("iuu")("tiu")("mxi"));
test_geometry<mls, mls>("MULTILINESTRING((0 0,10 0,5 0))",
"MULTILINESTRING((1 0,8 0,4 0))",
expected("mii")("mix")("mux")("mui")("mix")("mii")("mxu")("mxi"));
/*test_geometry<mls, mls>("MULTILINESTRING((0 0,10 0,5 0))",
"MULTILINESTRING((1 0,8 0,4 0),(2 0,9 0,5 0))",
expected("mii")("ccc")("ccc")("txx"));*/
}
int test_main(int, char* [])