本文整理了Java中org.locationtech.jts.geom.Geometry.compareTo()
方法的一些代码示例,展示了Geometry.compareTo()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Geometry.compareTo()
方法的具体详情如下:
包路径:org.locationtech.jts.geom.Geometry
类名称:Geometry
方法名:compareTo
[英]Returns whether this Geometry
is greater than, equal to, or less than another Geometry
.
If their classes are different, they are compared using the following ordering:
Geometry
s have the same class, their first elements are compared. If those are the same, the second elements are compared, etc.Geometry
是否大于、等于或小于另一个Geometry
。Geometry
具有相同的类,则比较它们的第一个元素。如果这些元素相同,则比较第二个元素,以此类推。代码示例来源:origin: com.h2database/h2
@Override
protected int compareSecure(Value v, CompareMode mode) {
Geometry g = ((ValueGeometry) v).getGeometryNoCopy();
return getGeometryNoCopy().compareTo(g);
}
代码示例来源:origin: geotools/geotools
public int compareTo(Object o, CoordinateSequenceComparator comp) {
return geometry.compareTo(o, comp);
}
代码示例来源:origin: geotools/geotools
public int compareTo(Object o) {
return geometry.compareTo(o);
}
代码示例来源:origin: locationtech/jts
public int compare(Object obj0, Object obj1) {
EdgeRing r0 = (EdgeRing) obj0;
EdgeRing r1 = (EdgeRing) obj1;
return r0.getRing().getEnvelope().compareTo(r1.getRing().getEnvelope());
}
代码示例来源:origin: locationtech/jts
private void checkWKBGeometry(String wkbHex, String expectedWKT) throws ParseException
{
WKBReader wkbReader = new WKBReader(geomFactory);
byte[] wkb = WKBReader.hexToBytes(wkbHex);
Geometry g2 = wkbReader.read(wkb);
WKTReader useRdr = rdr;
if (expectedWKT.contains("ZM"))
useRdr = rdrM;
else if (expectedWKT.contains("M(") || expectedWKT.contains("M ("))
useRdr = rdrM;
Geometry expected = useRdr.read(expectedWKT);
boolean isEqual = (expected.compareTo(g2, comp2) == 0);
if (!isEqual) {System.out.println(g2);System.out.println(expected);}
assertTrue(isEqual);
}
}
代码示例来源:origin: locationtech/jts
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);
}
}
}
内容来源于网络,如有侵权,请联系作者删除!