Merge branch 'develop' into bg-prepare

This commit is contained in:
Barend Gehrels
2015-01-27 19:35:07 +01:00
6 changed files with 65 additions and 3 deletions

View File

@@ -19,6 +19,8 @@
[*Additional functionality]
* New algorithm num_segments, returning the number of segments of a geometry
[*Improvements]
* Buffer now supports flat-ends for linestrings with a bend close to the start (such that buffered segment crosses flat-end).

View File

@@ -354,7 +354,8 @@ struct get_turn_info_linear_areal
AssignPolicy
>::apply(pi, pj, pk, qi, qj, qk,
tp, out, inters.i_info(), inters.d_info(),
inters.sides(), transformer);
inters.sides(), transformer,
!is_p_last, true); // qk is always valid
}
}
}

View File

@@ -250,6 +250,7 @@ struct linear_linear
: m_previous_turn_ptr(NULL)
, m_previous_operation(overlay::operation_none)
, m_degenerated_turn_ptr(NULL)
, m_collinear_spike_exit(false)
{}
template <typename Result,
@@ -383,7 +384,8 @@ struct linear_linear
// if we didn't enter in the past, we were outside
if ( was_outside
&& ! fake_enter_detected
&& it->operations[op_id].position != overlay::position_front )
&& it->operations[op_id].position != overlay::position_front
&& ! m_collinear_spike_exit )
{
update<interior, exterior, '1', transpose_result>(res);
@@ -402,6 +404,8 @@ struct linear_linear
}
}
}
m_collinear_spike_exit = false;
}
// u/i, u/u, u/x, x/i, x/u, x/x
else if ( op == overlay::operation_union || op == overlay::operation_blocked )
@@ -418,6 +422,11 @@ struct linear_linear
if ( !was_outside && is_collinear )
{
m_exit_watcher.exit(*it, false);
// if the position is not set to back it must be a spike
if ( it->operations[op_id].position != overlay::position_back )
{
m_collinear_spike_exit = true;
}
}
bool const op_blocked = op == overlay::operation_blocked;
@@ -456,6 +465,7 @@ struct linear_linear
// if we are truly outside
if ( was_outside
&& it->operations[op_id].position != overlay::position_front
&& ! m_collinear_spike_exit
/*&& !is_collinear*/ )
{
update<interior, exterior, '1', transpose_result>(res);
@@ -526,6 +536,7 @@ struct linear_linear
&& ( !this_b || op_blocked )
&& was_outside
&& it->operations[op_id].position != overlay::position_front
&& ! m_collinear_spike_exit
/*&& !is_collinear*/ )
{
bool const front_b = is_endpoint_on_boundary<boundary_front>(
@@ -607,6 +618,10 @@ struct linear_linear
m_previous_turn_ptr = NULL;
m_previous_operation = overlay::operation_none;
m_degenerated_turn_ptr = NULL;
// actually if this is set to true here there is some error
// in get_turns_ll or relate_ll, an assert could be checked here
m_collinear_spike_exit = false;
}
template <typename Result,
@@ -724,6 +739,7 @@ struct linear_linear
const TurnInfo * m_previous_turn_ptr;
overlay::operation_type m_previous_operation;
const TurnInfo * m_degenerated_turn_ptr;
bool m_collinear_spike_exit;
};
template <typename Result,

View File

@@ -207,6 +207,15 @@ void test_all()
test_geometry<ls, poly>("LINESTRING(7 8, 6 10, 11 0)",
"POLYGON((0 0,0 10,10 10,10 0,0 0))",
expected("miu+")("iuu+"));
// 25.01.2015
test_geometry<ls, poly>("LINESTRING(2 3, 4 5, 0 6, 5 6)",
"POLYGON((0 0,0 10,10 10,10 0,0 0),(4 4,6 4,6 6,4 6,4 4))",
expected("miu+")("miu+")("mcu+")("mxc="));
test_geometry<ls, poly>("LINESTRING(0 6, 5 6)",
"POLYGON((0 0,0 10,10 10,10 0,0 0),(4 4,6 4,6 6,4 6,4 4))",
expected("miu+")("mcu+")("mxc="));
}
int test_main(int, char* [])

View File

@@ -264,6 +264,17 @@ void test_linestring_polygon()
test_geometry<ls, poly>("LINESTRING(0 0, 7 7)",
"POLYGON((5 5,5 15,15 15,15 5,5 5))",
"1010F0212");
// 25.01.2015
test_geometry<ls, poly>("LINESTRING(4 5, 0 6, 5 6)",
"POLYGON((0 0,0 10,10 10,10 0,0 0),(4 4,6 4,6 6,4 6,4 4))",
"11FF0F212");
test_geometry<ls, poly>("LINESTRING(2 3, 4 5, 0 6, 5 6)",
"POLYGON((0 0,0 10,10 10,10 0,0 0),(4 4,6 4,6 6,4 6,4 4))",
"11F00F212");
test_geometry<ls, poly>("LINESTRING(2 9, 1 1, 10 1, 10 10, 1 10, 0 6, 5 6)",
"POLYGON((0 0,0 10,10 10,10 0,0 0),(4 4,4 6,6 6,6 4,4 4))",
"11F00F212");
}
template <typename P>

View File

@@ -333,9 +333,32 @@ void test_linestring_multi_linestring()
"10FF0F102"); // |
// |
// 22.01 2015
// 22.01.2015
// inspired by L/A and A/A
test_geometry<ls, mls>("LINESTRING(1 1,2 2)", "MULTILINESTRING((0 0,1 1),(1 1,3 3))", "1FF0FF102");
// 25.01.2015
test_geometry<ls, mls>("LINESTRING(1 1, 5 5, 4 4)",
"MULTILINESTRING((2 5, 7 5, 8 3, 6 3, 4 0),(0 0,10 10))",
"1FF0FF102");
test_geometry<ls, mls>("LINESTRING(4 1, 4 5, 4 4)",
"MULTILINESTRING((2 5, 7 5, 8 3, 6 3, 4 0),(4 0, 4 8, 0 4))",
"1FF0FF102");
test_geometry<ls, mls>("LINESTRING(1 1,5 5,4 4)",
"MULTILINESTRING((5 0,5 5,5 10),(0 0,10 10))",
"1FF0FF102");
test_geometry<ls, mls>("LINESTRING(1 1,5 5,1 0)",
"MULTILINESTRING((5 0,5 5,5 10),(0 0,5 5,1 0))",
"1FF00F102");
test_geometry<ls, mls>("LINESTRING(5 5,4 4)",
"MULTILINESTRING((5 0,5 5,5 10),(0 0,10 10))",
"1FF0FF102");
test_geometry<ls, mls>("LINESTRING(6 6,5 5,4 4)",
"MULTILINESTRING((5 0,5 5,5 10),(0 0,10 10))",
"1FF0FF102");
test_geometry<ls, mls>("LINESTRING(5 5,4 4)",
"MULTILINESTRING((5 0,5 5,5 10))",
"FF10F0102");
}
template <typename P>