Fix OverlayNG handling of flat interior line
continuous-integration/drone/push Build is passing Details

3.9
mdavis 2021-02-08 17:15:58 -08:00
parent 4bbcd9cecf
commit acefb04aac
3 changed files with 52 additions and 0 deletions

View File

@ -48,6 +48,10 @@ OverlayUtil::safeExpandDistance(const Envelope* env, const PrecisionModel* pm)
if (isFloating(pm)) {
// if PM is FLOAT then there is no scale factor, so add 10%
double minSize = std::min(env->getHeight(), env->getWidth());
// heuristic to ensure zero-width envelopes don't cause total clipping
if (minSize <= 0.0) {
minSize = std::max(env->getHeight(), env->getWidth());
}
envExpandDist = SAFE_ENV_BUFFER_FACTOR * minSize;
}
else {

View File

@ -553,10 +553,33 @@ template<>
template<>
void object::test<43> ()
{
set_test_name("testPolygonLineIntersectionOrder");
std::string a = "POLYGON ((1 1, 1 9, 9 9, 9 7, 3 7, 3 3, 9 3, 9 1, 1 1))";
std::string b = "MULTILINESTRING ((2 10, 2 0), (4 10, 4 0))";
std::string exp = "MULTILINESTRING ((2 9, 2 1), (4 9, 4 7), (4 3, 4 1))";
testOverlay(a, b, exp, OverlayNG::INTERSECTION, 0);
}
template<>
template<>
void object::test<44> ()
{
set_test_name("testPolygonLineVerticalntersection");
std::string a = "POLYGON ((-200 -200, 200 -200, 200 200, -200 200, -200 -200))";
std::string b = "LINESTRING (-100 100, -100 -100)";
std::string exp = "LINESTRING (-100 100, -100 -100)";
testOverlay(a, b, exp, OverlayNG::INTERSECTION, 0);
}
template<>
template<>
void object::test<45> ()
{
set_test_name("testPolygonLineHorizontalIntersection");
std::string a = "POLYGON ((10 90, 90 90, 90 10, 10 10, 10 90))";
std::string b = "LINESTRING (20 50, 80 50)";
std::string exp = "LINESTRING (20 50, 80 50)";
testOverlay(a, b, exp, OverlayNG::INTERSECTION, 0);
}
} // namespace tut

View File

@ -204,6 +204,31 @@ MULTILINESTRING ((150 150, 200 200, 300 300, 400 200), (100 100, 150 150), (190
</op></test>
</case>
<case>
<desc>LA - vertical Line</desc>
<a>
LINESTRING (50 50, 50 20)
</a>
<b>
POLYGON ((10 60, 90 60, 90 10, 10 10, 10 60))
</b>
<test> <op name="intersectionNG" arg1="A" arg2="B">
LINESTRING (50 50, 50 20)
</op></test>
<test> <op name="unionNG" arg1="A" arg2="B">
POLYGON ((90 60, 90 10, 10 10, 10 60, 90 60))
</op></test>
<test> <op name="differenceNG" arg1="A" arg2="B">
LINESTRING EMPTY
</op></test>
<test> <op name="differenceNG" arg1="B" arg2="A">
POLYGON ((90 60, 90 10, 10 10, 10 60, 90 60))
</op></test>
<test> <op name="symdifferenceNG" arg1="A" arg2="B">
POLYGON ((90 60, 90 10, 10 10, 10 60, 90 60))
</op></test>
</case>
<case>
<desc>mLmA - disjoint and overlaps in lines and points</desc>
<a>