@Test public void testEqualityND() { Geometry g1 = liteGF.createPolygon( liteGF.createLinearRing( liteCSF.create( new double[] { 1, 1, 100, 2, 1, 99, 2, 2, 98, 1, 2, 97, 1, 1, 100 }, 3)), null); Geometry g2 = liteGF.createPolygon( liteGF.createLinearRing( liteCSF.create(new double[] {1, 1, 2, 1, 2, 2, 1, 2, 1, 1}, 2)), null); Geometry g3 = liteGF.createPolygon( liteGF.createLinearRing( liteCSF.create( new double[] { 1, 1, 200, 2, 1, 199, 2, 2, 198, 1, 2, 197, 1, 1, 200 }, 3)), null); Geometry g4 = liteGF.createPolygon( liteGF.createLinearRing( liteCSF.create( new double[] { 1, 1, 100, 2, 1, 99, 2, 2, 98, 1, 2, 97, 1, 1, 100 }, 3)), null); assertTrue(CoordinateSequences.equalsND(g1, g4)); assertFalse(CoordinateSequences.equalsND(g1, g2)); assertFalse(CoordinateSequences.equalsND(g1, g3)); }
public static boolean equalsND(Geometry g1, Geometry g2) { if (!g1.equals(g2)) { return false; } int dim1 = coordinateDimension(g1); int dim2 = coordinateDimension(g2); if (dim1 != dim2) { return false; } if (dim1 == 2) { return true; } List<CoordinateSequence> sequences1 = CoordinateSequenceCollector.find(g1); List<CoordinateSequence> sequences2 = CoordinateSequenceCollector.find(g2); if (sequences1.size() != sequences2.size()) { return false; } CoordinateSequenceComparator comparator = new CoordinateSequenceComparator(); for (int i = 0; i < sequences1.size(); i++) { CoordinateSequence cs1 = sequences1.get(i); CoordinateSequence cs2 = sequences2.get(i); if (comparator.compare(cs1, cs2) != 0) { return false; } } return true; }
CoordinateSequences extends org.locationtech.jts.geom.CoordinateSequences { public static boolean equalsND(Geometry g1, Geometry g2) { if (!g1.equals(g2)) { return false; } int dim1 = coordinateDimension(g1); int dim2 = coordinateDimension(g2); if (dim1 != dim2) { return false; } if (dim1 == 2) { return true; } List<CoordinateSequence> sequences1 = CoordinateSequenceCollector.find(g1); List<CoordinateSequence> sequences2 = CoordinateSequenceCollector.find(g2); if (sequences1.size() != sequences2.size()) { return false; } CoordinateSequenceComparator comparator = new CoordinateSequenceComparator(); for (int i = 0; i < sequences1.size(); i++) { CoordinateSequence cs1 = sequences1.get(i); CoordinateSequence cs2 = sequences2.get(i); if (comparator.compare(cs1, cs2) != 0) { return false; } } return true; } }
CoordinateSequences extends org.locationtech.jts.geom.CoordinateSequences { public static boolean equalsND(Geometry g1, Geometry g2) { if (!g1.equals(g2)) { return false; } int dim1 = coordinateDimension(g1); int dim2 = coordinateDimension(g2); if (dim1 != dim2) { return false; } if (dim1 == 2) { return true; } List<CoordinateSequence> sequences1 = CoordinateSequenceCollector.find(g1); List<CoordinateSequence> sequences2 = CoordinateSequenceCollector.find(g2); if (sequences1.size() != sequences2.size()) { return false; } CoordinateSequenceComparator comparator = new CoordinateSequenceComparator(); for (int i = 0; i < sequences1.size(); i++) { CoordinateSequence cs1 = sequences1.get(i); CoordinateSequence cs2 = sequences2.get(i); if (comparator.compare(cs1, cs2) != 0) { return false; } } return true; }  }
CoordinateSequences extends org.locationtech.jts.geom.CoordinateSequences { public static boolean equalsND(Geometry g1, Geometry g2) { if (!g1.equals(g2)) { return false; } int dim1 = coordinateDimension(g1); int dim2 = coordinateDimension(g2); if (dim1 != dim2) { return false; } if (dim1 == 2) { return true; } List<CoordinateSequence> sequences1 = CoordinateSequenceCollector.find(g1); List<CoordinateSequence> sequences2 = CoordinateSequenceCollector.find(g2); if (sequences1.size() != sequences2.size()) { return false; } CoordinateSequenceComparator comparator = new CoordinateSequenceComparator(); for (int i = 0; i < sequences1.size(); i++) { CoordinateSequence cs1 = sequences1.get(i); CoordinateSequence cs2 = sequences2.get(i); if (comparator.compare(cs1, cs2) != 0) { return false; } } return true; }  static boolean isCCW(CoordinateSequence ring); static int computeOrientation(CoordinateSequence cs, int p1, int p2, int q); static int coordinateDimension(Geometry g); static int coordinateDimension(CoordinateSequence seq); static boolean equalsND(Geometry g1, Geometry g2); }
CoordinateSequences extends org.locationtech.jts.geom.CoordinateSequences { public static boolean equalsND(Geometry g1, Geometry g2) { if (!g1.equals(g2)) { return false; } int dim1 = coordinateDimension(g1); int dim2 = coordinateDimension(g2); if (dim1 != dim2) { return false; } if (dim1 == 2) { return true; } List<CoordinateSequence> sequences1 = CoordinateSequenceCollector.find(g1); List<CoordinateSequence> sequences2 = CoordinateSequenceCollector.find(g2); if (sequences1.size() != sequences2.size()) { return false; } CoordinateSequenceComparator comparator = new CoordinateSequenceComparator(); for (int i = 0; i < sequences1.size(); i++) { CoordinateSequence cs1 = sequences1.get(i); CoordinateSequence cs2 = sequences2.get(i); if (comparator.compare(cs1, cs2) != 0) { return false; } } return true; }  static boolean isCCW(CoordinateSequence ring); static int computeOrientation(CoordinateSequence cs, int p1, int p2, int q); static int coordinateDimension(Geometry g); static int coordinateDimension(CoordinateSequence seq); static boolean equalsND(Geometry g1, Geometry g2);  }