Skip to content

Commit 5ffa97d

Browse files
authored
Fix OffsetCurve simplifyFactor parameter handling (#1151)
1 parent 2c85e14 commit 5ffa97d

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

modules/core/src/main/java/org/locationtech/jts/operation/buffer/OffsetCurve.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ public OffsetCurve(Geometry geom, double distance, BufferParameters bufParams) {
182182
bufferParams.setQuadrantSegments(quadSegs);
183183
bufferParams.setJoinStyle(bufParams.getJoinStyle());
184184
bufferParams.setMitreLimit(bufParams.getMitreLimit());
185+
bufferParams.setSimplifyFactor(bufParams.getSimplifyFactor());
185186
}
186187
}
187188

modules/core/src/test/java/org/locationtech/jts/operation/buffer/OffsetCurveTest.java

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,18 @@ public void testPolygonJoinMitre() {
397397
);
398398

399399
}
400+
401+
//---------------------------------------
402+
403+
// see https://github.com/locationtech/jts/issues/1147
404+
public void testSimplifyFactor() {
405+
checkOffsetCurveSimplify("LINESTRING (-74.10825983114643 205.2512862651522, -61.59032155710979 183.66416102497575, -56.17516937041343 177.39645645603244, -45.87664216572637 163.28009296700202, -32.80606824944878 140.06145723770865)",
406+
-70, 0.0001,
407+
"LINESTRING (-134.66360133032907 170.13646580544648, -122.14566305629245 148.54934056527003, -114.55900733787851 137.9004382015626, -111.02744383471095 133.81287132602836, -104.85483126202604 125.3519680316891, -93.80502418590495 105.72303306503763)",
408+
0.00001);
409+
}
410+
411+
400412
//=======================================
401413

402414
private static final double EQUALS_TOL = 0.05;
@@ -450,4 +462,16 @@ private void checkOffsetCurve(String wkt, double distance,
450462
checkEqual(expected, result, tolerance);
451463
}
452464

465+
private void checkOffsetCurveSimplify(String wkt,
466+
double distance, double simplifyFactor,
467+
String wktExpected, double tolerance) {
468+
Geometry geom = read(wkt);
469+
BufferParameters params = new BufferParameters();
470+
params.setSimplifyFactor(simplifyFactor);
471+
OffsetCurve oc = new OffsetCurve(geom, distance, params);
472+
Geometry result = oc.getCurve();
473+
474+
Geometry expected = read(wktExpected);
475+
checkEqual(expected, result, tolerance);
476+
}
453477
}

0 commit comments

Comments
 (0)