Skip to content

Commit 020a1a9

Browse files
authored
Merge pull request #319 from fabian-maysen/addMaxVertices
Ability to pass the number of vertices in the execute method of OperatorBuffer.
2 parents 5ec245c + 81eddaa commit 020a1a9

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

src/main/java/com/esri/core/geometry/OperatorBuffer.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public abstract Geometry execute(Geometry inputGeometry,
8181
*Note that max_deviation can be exceeded because geometry is generalized with 0.25 * real_deviation, also input segments closer than 0.25 * real_deviation are
8282
*snapped to a point.
8383
*/
84-
abstract GeometryCursor execute(GeometryCursor input_geometries, SpatialReference sr, double[] distances, double max_deviation, int max_vertices_in_full_circle, boolean b_union, ProgressTracker progress_tracker);
84+
public abstract GeometryCursor execute(GeometryCursor input_geometries, SpatialReference sr, double[] distances, double max_deviation, int max_vertices_in_full_circle, boolean b_union, ProgressTracker progress_tracker);
8585

8686
public static OperatorBuffer local() {
8787
return (OperatorBuffer) OperatorFactoryLocal.getInstance().getOperator(

src/main/java/com/esri/core/geometry/ogc/OGCGeometry.java

+15
Original file line numberDiff line numberDiff line change
@@ -466,6 +466,21 @@ public OGCGeometry buffer(double distance) {
466466
return OGCGeometry.createFromEsriGeometry(cursor.next(), esriSR);
467467
}
468468

469+
public OGCGeometry buffer(double distance, int max_vertices_in_full_circle, double max_deviation) {
470+
OperatorBuffer op = (OperatorBuffer) OperatorFactoryLocal.getInstance()
471+
.getOperator(Operator.Type.Buffer);
472+
if (distance == 0) {// when distance is 0, return self (maybe we should
473+
// create a copy instead).
474+
return this;
475+
}
476+
477+
double d[] = { distance };
478+
com.esri.core.geometry.GeometryCursor cursor = op.execute(
479+
getEsriGeometryCursor(), getEsriSpatialReference(), d, max_deviation, max_vertices_in_full_circle, true,
480+
null);
481+
return OGCGeometry.createFromEsriGeometry(cursor.next(), esriSR);
482+
}
483+
469484
public OGCGeometry centroid() {
470485
OperatorCentroid2D op = (OperatorCentroid2D) OperatorFactoryLocal.getInstance()
471486
.getOperator(Operator.Type.Centroid2D);

0 commit comments

Comments
 (0)