com.vividsolutions.jts.geom.Geometry.compareTo()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(2.4k)|赞(0)|评价(0)|浏览(107)

本文整理了Java中com.vividsolutions.jts.geom.Geometry.compareTo()方法的一些代码示例,展示了Geometry.compareTo()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Geometry.compareTo()方法的具体详情如下:
包路径:com.vividsolutions.jts.geom.Geometry
类名称:Geometry
方法名:compareTo

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:

  • Point (lowest)
  • MultiPoint
  • LineString
  • LinearRing
  • MultiLineString
  • Polygon
  • MultiPolygon
  • GeometryCollection (highest)
    If the two Geometrys have the same class, their first elements are compared. If those are the same, the second elements are compared, etc.
    [中]返回此Geometry是否大于、等于或小于另一个Geometry
    如果它们的类别不同,则使用以下顺序对它们进行比较:
    *点(最低)
    *多点
    *线绳
    *线性化
    *多重限制
    *多边形
    *多边形
    *几何收集(最高)
    如果两个Geometry具有相同的类,则比较它们的第一个元素。如果这些元素相同,则比较第二个元素,以此类推。

代码示例

代码示例来源:origin: org.geotools/gt-render

public int compareTo(Object o) {
  return geometry.compareTo(o);
}

代码示例来源:origin: org.geotools/gt-render

public int compareTo(Object o, CoordinateSequenceComparator comp) {
  return geometry.compareTo(o, comp);
}

代码示例来源:origin: NationalSecurityAgency/datawave

@Override
public int compareTo(Geometry other) {
  int cmp;
  if (geometry == null) {
    if (other == null || other.geometry == null) {
      cmp = 0;
    }
    cmp = -1;
  }
  cmp = geometry.compareTo(other.geometry);
  if (0 == cmp) {
    return compareMetadata(other);
  }
  
  return cmp;
}

代码示例来源:origin: org.wowtools/h2

@Override
protected int compareSecure(Value v, CompareMode mode) {
  Geometry g = ((ValueGeometry) v).getGeometryNoCopy();
  return getGeometryNoCopy().compareTo(g);
}

代码示例来源:origin: com.eventsourcing/h2

@Override
protected int compareSecure(Value v, CompareMode mode) {
  Geometry g = ((ValueGeometry) v).getGeometryNoCopy();
  return getGeometryNoCopy().compareTo(g);
}

代码示例来源:origin: com.vividsolutions/jts-core

public int compare(Object obj0, Object obj1) {
 EdgeRing r0 = (EdgeRing) obj0;
 EdgeRing r1 = (EdgeRing) obj1;
 return r0.getRing().getEnvelope().compareTo(r1.getRing().getEnvelope());
}

代码示例来源:origin: org.fudaa.framework.ctulu/ctulu-gis

/**
 * Recopie de GeometryCollection.
 */
protected int compareToSameClass(final Object _o, final CoordinateSequenceComparator _comp) {
 final GISCollection gc = (GISCollection) _o;
 final int n1 = getNumGeometries();
 final int n2 = gc.getNumGeometries();
 int i = 0;
 while (i < n1 && i < n2) {
  final Geometry thisGeom = getGeometryN(i);
  final Geometry otherGeom = gc.getGeometryN(i);
  final int holeComp = thisGeom.compareTo(otherGeom, _comp);
  if (holeComp != 0) {
   return holeComp;
  }
  i++;
 }
 if (i < n1) {
  return 1;
 }
 if (i < n2) {
  return -1;
 }
 return 0;
}

相关文章