@Override protected int compareToSameClass(Object other, CoordinateSequenceComparator comp) { Envelope env = (Envelope) other; Envelope mbr = this.MBR; // compare based on numerical ordering of ordinates if (mbr.getMinX() < env.getMinX()) return -1; if (mbr.getMinX() > env.getMinX()) return 1; if (mbr.getMinY() < env.getMinY()) return -1; if (mbr.getMinY() > env.getMinY()) return 1; if (mbr.getMaxX() < env.getMaxX()) return -1; if (mbr.getMaxX() > env.getMaxX()) return 1; if (mbr.getMaxY() < env.getMaxY()) return -1; if (mbr.getMaxY() > env.getMaxY()) return 1; return 0; }
void runGeometry(Geometry g, int dimension, int byteOrder, boolean toHex, int srid) throws IOException, ParseException { boolean includeSRID = false; if (srid >= 0) { includeSRID = true; g.setSRID(srid); } WKBWriter wkbWriter = new WKBWriter(dimension, byteOrder, includeSRID); byte[] wkb = wkbWriter.write(g); String wkbHex = null; if (toHex) wkbHex = WKBWriter.toHex(wkb); if (toHex) wkb = WKBReader.hexToBytes(wkbHex); Geometry g2 = wkbReader.read(wkb); CoordinateSequenceComparator comp = (dimension == 2) ? comp2 : comp3; boolean isEqual = (g.compareTo(g2, comp) == 0); assertTrue(isEqual); if (includeSRID) { boolean isSRIDEqual = g.getSRID() == g2.getSRID(); assertTrue(isSRIDEqual); } }
@Override protected int compareToSameClass(final Object o, final CoordinateSequenceComparator comp) { final DynamicLineString line = (DynamicLineString) o; return comp.compare(getCoordinateSequence(), line.getCoordinateSequence()); }