Skip to content

Commit 43fbcaa

Browse files
authored
rename equals to Equals (#143)
1 parent b0bc20e commit 43fbcaa

File tree

5 files changed

+32
-18
lines changed

5 files changed

+32
-18
lines changed

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
package com.esri.core.geometry.ogc;
2626

2727
import com.esri.core.geometry.MultiPoint;
28-
import com.esri.core.geometry.Point;
2928

3029
public abstract class OGCCurve extends OGCGeometry {
3130
public abstract double length();

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

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424

2525
package com.esri.core.geometry.ogc;
2626

27-
import java.io.IOException;
2827
import java.nio.ByteBuffer;
2928
import java.util.ArrayList;
3029
import java.util.Arrays;
@@ -205,16 +204,27 @@ public boolean isMeasured() {
205204
abstract public OGCGeometry boundary();
206205

207206
/**
208-
* OGC equals
209-
*
207+
* OGC equals. Performs topological comparison with tolerance.
208+
* This is different from equals(Object), that uses exact comparison.
210209
*/
211-
public boolean equals(OGCGeometry another) {
210+
public boolean Equals(OGCGeometry another) {
211+
if (this == another)
212+
return true;
213+
214+
if (another == null)
215+
return false;
216+
212217
com.esri.core.geometry.Geometry geom1 = getEsriGeometry();
213218
com.esri.core.geometry.Geometry geom2 = another.getEsriGeometry();
214219
return com.esri.core.geometry.GeometryEngine.equals(geom1, geom2,
215220
getEsriSpatialReference());
216221
}
217222

223+
@Deprecated
224+
public boolean equals(OGCGeometry another) {
225+
return Equals(another);
226+
}
227+
218228
public boolean disjoint(OGCGeometry another) {
219229
com.esri.core.geometry.Geometry geom1 = getEsriGeometry();
220230
com.esri.core.geometry.Geometry geom2 = another.getEsriGeometry();

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,11 @@
2727
import java.nio.ByteBuffer;
2828

2929
import com.esri.core.geometry.Geometry;
30-
import com.esri.core.geometry.GeometryCursor;
3130
import com.esri.core.geometry.GeometryEngine;
3231
import com.esri.core.geometry.MultiPoint;
3332
import com.esri.core.geometry.Operator;
3433
import com.esri.core.geometry.OperatorExportToWkb;
3534
import com.esri.core.geometry.OperatorFactoryLocal;
36-
import com.esri.core.geometry.OperatorUnion;
3735
import com.esri.core.geometry.Point;
3836
import com.esri.core.geometry.SpatialReference;
3937
import com.esri.core.geometry.WkbExportFlags;

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626

2727
import java.nio.ByteBuffer;
2828

29-
import com.esri.core.geometry.GeometryCursor;
3029
import com.esri.core.geometry.GeometryEngine;
3130
import com.esri.core.geometry.MultiPoint;
3231
import com.esri.core.geometry.Operator;

src/test/java/com/esri/core/geometry/TestOGC.java

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -82,28 +82,36 @@ public void testPolygon() throws Exception {
8282
OGCLineString ls = p.exteriorRing();
8383
// assertTrue(ls.pointN(1).equals(OGCGeometry.fromText("POINT(10 -10)")));
8484
boolean b = ls
85-
.equals(OGCGeometry
85+
.Equals(OGCGeometry
8686
.fromText("LINESTRING(-10 -10, 10 -10, 10 10, -10 10, -10 -10)"));
8787
assertTrue(b);
8888
OGCLineString lsi = p.interiorRingN(0);
89-
b = lsi.equals(OGCGeometry
89+
b = lsi.Equals(OGCGeometry
9090
.fromText("LINESTRING(-5 -5, -5 5, 5 5, 5 -5, -5 -5)"));
9191
assertTrue(b);
9292
b = lsi.equals((Object)OGCGeometry
9393
.fromText("LINESTRING(-5 -5, -5 5, 5 5, 5 -5, -5 -5)"));
94-
assertTrue(!lsi.equals(ls));
94+
assertTrue(!lsi.Equals(ls));
9595
OGCMultiCurve boundary = p.boundary();
9696
String s = boundary.asText();
9797
assertTrue(s.equals("MULTILINESTRING ((-10 -10, 10 -10, 10 10, -10 10, -10 -10), (-5 -5, -5 5, 5 5, 5 -5, -5 -5))"));
9898

9999
{
100-
OGCGeometry g2 = OGCGeometry.fromGeoJson("{\"type\": \"Polygon\", \"coordinates\": [[[1.00000001,1.00000001], [4.00000001,1.00000001], [4.00000001,4.00000001], [1.00000001,4.00000001]]]}");
101-
OGCGeometry.fromGeoJson("{\"type\": \"LineString\", \"coordinates\": [[1.00000001,1.00000001], [7.00000001,8.00000001]]}").intersects(g2);
102-
OGCGeometry.fromGeoJson("{\"type\": \"LineString\", \"coordinates\": [[2.449,4.865], [7.00000001,8.00000001]]}").intersects(g2);
103-
104-
OGCGeometry g3 = OGCGeometry.fromGeoJson("{\"type\": \"Polygon\", \"coordinates\": [[[1.00000001,1.00000001], [4.00000001,1.00000001], [4.00000001,4.00000001], [1.00000001,4.00000001]]]}");
105-
boolean bb = g2.equals((Object)g3);
106-
assertTrue(bb);
100+
OGCGeometry g2 = OGCGeometry.fromGeoJson(
101+
"{\"type\": \"Polygon\", \"coordinates\": [[[1.00000001,1.00000001], [4.00000001,1.00000001], [4.00000001,4.00000001], [1.00000001,4.00000001]]]}");
102+
OGCGeometry
103+
.fromGeoJson(
104+
"{\"type\": \"LineString\", \"coordinates\": [[1.00000001,1.00000001], [7.00000001,8.00000001]]}")
105+
.intersects(g2);
106+
OGCGeometry
107+
.fromGeoJson(
108+
"{\"type\": \"LineString\", \"coordinates\": [[2.449,4.865], [7.00000001,8.00000001]]}")
109+
.intersects(g2);
110+
111+
OGCGeometry g3 = OGCGeometry.fromGeoJson(
112+
"{\"type\": \"Polygon\", \"coordinates\": [[[1.00000001,1.00000001], [4.00000001,1.00000001], [4.00000001,4.00000001], [1.00000001,4.00000001]]]}");
113+
boolean bb = g2.equals((Object) g3);
114+
assertTrue(bb);
107115
}
108116
}
109117

0 commit comments

Comments
 (0)