Skip to content

Commit c47a0e4

Browse files
committed
reflect review comments. fix formatting in a test
1 parent b06e579 commit c47a0e4

3 files changed

Lines changed: 188 additions & 198 deletions

File tree

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

Lines changed: 1 addition & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,6 @@ static Geometry difference(Geometry geometry_a, Geometry geometry_b,
8181
if (!env_a_inflated.isIntersecting(env_b))
8282
return geometry_a;
8383

84-
/*if (dimension_a == 1 && dimension_b == 2)
85-
return polylineMinusArea_(geometry_a, geometry_b, type_b,
86-
spatial_reference, progress_tracker);*/
87-
8884
if (type_a == Geometry.GeometryType.Point) {
8985
Geometry geometry_b_;
9086
if (MultiPath.isSegment(type_b)) {
@@ -357,38 +353,5 @@ static Geometry multiPointMinusPoint_(MultiPoint multi_point, Point point,
357353

358354
return new_multipoint;
359355
}
360-
361-
/*
362-
This optimization causes a bug when polyline segments are on the boundary.
363-
static Geometry polylineMinusArea_(Geometry geometry, Geometry area,
364-
int area_type, SpatialReference sr, ProgressTracker progress_tracker) {
365-
// construct the complement of the Polygon (or Envelope)
366-
Envelope envelope = new Envelope();
367-
geometry.queryEnvelope(envelope);
368-
Envelope2D env_2D = new Envelope2D();
369-
area.queryEnvelope2D(env_2D);
370-
envelope.merge(env_2D);
371-
double dw = 0.1 * envelope.getWidth();
372-
double dh = 0.1 * envelope.getHeight();
373-
envelope.inflate(dw, dh);
374-
375-
Polygon complement = new Polygon();
376-
complement.addEnvelope(envelope, false);
377-
378-
MultiPathImpl complementImpl = (MultiPathImpl) (complement._getImpl());
379-
380-
if (area_type == Geometry.GeometryType.Polygon) {
381-
MultiPathImpl polygonImpl = (MultiPathImpl) (area._getImpl());
382-
complementImpl.add(polygonImpl, true);
383-
} else
384-
complementImpl.addEnvelope((Envelope) (area), true);
385-
386-
OperatorFactoryLocal projEnv = OperatorFactoryLocal.getInstance();
387-
OperatorIntersection operatorIntersection = (OperatorIntersection) projEnv
388-
.getOperator(Operator.Type.Intersection);
389-
Geometry difference = operatorIntersection.execute(geometry,
390-
complement, sr, progress_tracker);
391-
return difference;
392-
}*/
393-
394356
}
357+

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

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -598,33 +598,7 @@ public boolean contains(OGCGeometry another) {
598598
if (this == another)
599599
return true;
600600

601-
//TODO: a simple envelope test
602-
603-
OGCConcreteGeometryCollection flattened1 = flatten();
604-
if (flattened1.isEmpty())
605-
return true;
606-
OGCConcreteGeometryCollection otherCol = new OGCConcreteGeometryCollection(another, esriSR);
607-
OGCConcreteGeometryCollection flattened2 = otherCol.flatten();
608-
if (flattened2.isEmpty())
609-
return true;
610-
611-
for (int i = 0, n2 = flattened2.numGeometries(); i < n2; ++i) {
612-
OGCGeometry g2 = flattened2.geometryN(i);
613-
boolean good = false;
614-
for (int j = 0, n1 = flattened1.numGeometries(); j < n1; ++j) {
615-
OGCGeometry g1 = flattened1.geometryN(i);
616-
if (g1.contains(g2)) {
617-
good = true;
618-
break;
619-
}
620-
}
621-
622-
if (!good)
623-
return false;
624-
}
625-
626-
//each geometry of another is contained in a geometry from this.
627-
return true;
601+
return another.difference(this).isEmpty();
628602
}
629603

630604
@Override

0 commit comments

Comments
 (0)