[buffer] fix MYSQL testcase 25662426
This commit is contained in:
parent
96272b1636
commit
f6808f8277
@ -977,7 +977,8 @@ inline void buffer_inserter(GeometryInput const& geometry_input, OutputIterator
|
||||
robust_policy, intersection_strategy.get_side_strategy());
|
||||
|
||||
collection.get_turns();
|
||||
collection.classify_turns(linear);
|
||||
collection.classify_turns(linear
|
||||
&& end_strategy.get_piece_type() == strategy::buffer::buffered_flat_end);
|
||||
if (BOOST_GEOMETRY_CONDITION(areal))
|
||||
{
|
||||
collection.check_remaining_points(distance_strategy);
|
||||
|
@ -499,7 +499,7 @@ struct buffered_piece_collection
|
||||
}
|
||||
}
|
||||
|
||||
inline void classify_turns(bool linear)
|
||||
inline void classify_turns(bool linear_flat_end)
|
||||
{
|
||||
for (typename boost::range_iterator<turn_vector_type>::type it =
|
||||
boost::begin(m_turns); it != boost::end(m_turns); ++it)
|
||||
@ -508,7 +508,7 @@ struct buffered_piece_collection
|
||||
{
|
||||
it->location = inside_buffer;
|
||||
}
|
||||
if (it->count_on_original_boundary > 0 && ! linear)
|
||||
if (it->count_on_original_boundary > 0 && ! linear_flat_end)
|
||||
{
|
||||
it->location = inside_buffer;
|
||||
}
|
||||
|
@ -311,7 +311,7 @@ class analyse_turn_wrt_piece
|
||||
template <typename Point, typename Turn>
|
||||
static inline analyse_result check_helper_segment(Point const& s1,
|
||||
Point const& s2, Turn const& turn,
|
||||
bool is_original,
|
||||
bool , // is on original, to be reused
|
||||
Point const& offsetted)
|
||||
{
|
||||
boost::ignore_unused(offsetted);
|
||||
@ -340,11 +340,9 @@ class analyse_turn_wrt_piece
|
||||
|
||||
if (geometry::covered_by(turn.robust_point, box))
|
||||
{
|
||||
// Points on helper-segments are considered as within
|
||||
// Points on original boundary are processed differently
|
||||
return is_original
|
||||
? analyse_on_original_boundary
|
||||
: analyse_within;
|
||||
// Points on helper-segments (and not on its corners)
|
||||
// are considered as within
|
||||
return analyse_within;
|
||||
}
|
||||
|
||||
// It is collinear but not on the segment. Because these
|
||||
@ -449,6 +447,9 @@ class analyse_turn_wrt_piece
|
||||
}
|
||||
if (comparator(point, points[1]) || comparator(point, points[2]))
|
||||
{
|
||||
// It lies on the corner of a helper segment. For linear buffer,
|
||||
// on flat and, this point should not be deleted.
|
||||
// But if it is NOT on a flat end it might be discarded
|
||||
return analyse_on_original_boundary;
|
||||
}
|
||||
|
||||
|
@ -104,6 +104,7 @@ static std::string const mysql_report_2015_09_08c = "LINESTRING(-5 -8, 2 8, 2.16
|
||||
static std::string const mysql_23023665 = "LINESTRING(0 0, 0 5, 5 5, 5 0, 0 0)";
|
||||
|
||||
static std::string const mysql_25662426 = "LINESTRING(170 4756, 168 4756, 168 4759, 168 4764, 171 4764, 171 4700)";
|
||||
static std::string const mysql_25662426a = "LINESTRING(170 4756, 168 4756, 168 4759, 168 4764, 171 4764, 171 4750)";
|
||||
|
||||
template <bool Clockwise, typename P>
|
||||
void test_all()
|
||||
@ -292,9 +293,32 @@ void test_all()
|
||||
test_one<linestring, polygon>("mysql_23023665_1", mysql_23023665, join_round32, end_flat, 459.1051, 10);
|
||||
test_one<linestring, polygon>("mysql_23023665_2", mysql_23023665, join_round32, end_flat, 6877.7097, 50);
|
||||
|
||||
test_one<linestring, polygon>("mysql_25662426", mysql_25662426, join_round32, end_round32, 1, 0, 1660.6673, 10);
|
||||
|
||||
// Test behaviour with different buffer sizes, generating internally turns on different locations
|
||||
test_one<linestring, polygon>("mysql_25662426a_1", mysql_25662426a, join_round32, end_round32, 54.9018, 1.0);
|
||||
test_one<linestring, polygon>("mysql_25662426a_2", mysql_25662426a, join_round32, end_round32, 103.6072, 2.0);
|
||||
test_one<linestring, polygon>("mysql_25662426a_3", mysql_25662426a, join_round32, end_round32, 152.1163, 3.0);
|
||||
test_one<linestring, polygon>("mysql_25662426a_4", mysql_25662426a, join_round32, end_round32, 206.4831, 4.0);
|
||||
test_one<linestring, polygon>("mysql_25662426a_5", mysql_25662426a, join_round32, end_round32, 266.8505, 5.0);
|
||||
test_one<linestring, polygon>("mysql_25662426a_10", mysql_25662426a, join_round32, end_round32, 660.7355, 10.0);
|
||||
|
||||
#if defined(BOOST_GEOMETRY_BUFFER_INCLUDE_FAILING_TESTS)
|
||||
// TODO: correct area
|
||||
test_one<linestring, polygon>("mysql_25662426", mysql_25662426, join_round32, end_round32, 1, 0, 111.0, 10);
|
||||
// Left
|
||||
test_one<linestring, polygon>("mysql_25662426a_1", mysql_25662426a, join_round32, end_round32, 54.9018, 1.0, 0.0);
|
||||
test_one<linestring, polygon>("mysql_25662426a_2", mysql_25662426a, join_round32, end_round32, 103.6072, 2.0, 0.0);
|
||||
test_one<linestring, polygon>("mysql_25662426a_3", mysql_25662426a, join_round32, end_round32, 152.1163, 3.0, 0.0);
|
||||
test_one<linestring, polygon>("mysql_25662426a_4", mysql_25662426a, join_round32, end_round32, 206.4831, 4.0, 0.0);
|
||||
test_one<linestring, polygon>("mysql_25662426a_5", mysql_25662426a, join_round32, end_round32, 266.8505, 5.0, 0.0);
|
||||
test_one<linestring, polygon>("mysql_25662426a_10", mysql_25662426a, join_round32, end_round32, 660.7355, 10.0, 0.0);
|
||||
|
||||
// Right
|
||||
test_one<linestring, polygon>("mysql_25662426a_1", mysql_25662426a, join_round32, end_round32, 54.9018, 0.0, 1.0);
|
||||
test_one<linestring, polygon>("mysql_25662426a_2", mysql_25662426a, join_round32, end_round32, 103.6072, 0.0, 2.0);
|
||||
test_one<linestring, polygon>("mysql_25662426a_3", mysql_25662426a, join_round32, end_round32, 152.1163, 0.0, 3.0);
|
||||
test_one<linestring, polygon>("mysql_25662426a_4", mysql_25662426a, join_round32, end_round32, 206.4831, 0.0, 4.0);
|
||||
test_one<linestring, polygon>("mysql_25662426a_5", mysql_25662426a, join_round32, end_round32, 266.8505, 0.0, 5.0);
|
||||
test_one<linestring, polygon>("mysql_25662426a_10", mysql_25662426a, join_round32, end_round32, 660.7355, 0.0, 10.0);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user