Skip to content

Commit 873d073

Browse files
committed
fix a typo in disjoint and a test
1 parent c47a0e4 commit 873d073

2 files changed

Lines changed: 15 additions & 1 deletion

File tree

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,7 @@ public boolean disjoint(OGCGeometry another) {
581581
for (int i = 0, n1 = flattened1.numGeometries(); i < n1; ++i) {
582582
OGCGeometry g1 = flattened1.geometryN(i);
583583
for (int j = 0, n2 = flattened2.numGeometries(); j < n2; ++j) {
584-
OGCGeometry g2 = flattened2.geometryN(i);
584+
OGCGeometry g2 = flattened2.geometryN(j);
585585
if (!g1.disjoint(g2))
586586
return false;
587587
}

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,4 +203,18 @@ private void assertContains(String wkt, String otherWkt) {
203203
Assert.assertTrue(geometry.contains(otherGeometry));
204204
Assert.assertTrue(otherGeometry.within(geometry));
205205
}
206+
207+
@Test
208+
public void testGeometryCollectionDisjoint() {
209+
assertDisjoint("GEOMETRYCOLLECTION (POINT (0 0), LINESTRING (0 1, 5 1))",
210+
"GEOMETRYCOLLECTION (MULTIPOINT (10 0, 21 1), LINESTRING (30 0, 31 1), POLYGON ((40 0, 41 1, 40 1, 40 0)))");
211+
}
212+
213+
private void assertDisjoint(String wkt, String otherWkt) {
214+
OGCGeometry geometry = OGCGeometry.fromText(wkt);
215+
OGCGeometry otherGeometry = OGCGeometry.fromText(otherWkt);
216+
Assert.assertTrue(geometry.disjoint(otherGeometry));
217+
Assert.assertTrue(otherGeometry.disjoint(geometry));
218+
}
219+
206220
}

0 commit comments

Comments
 (0)