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

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

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

Geometry.normalize介绍

[英]Converts this Geometry to normal form (or canonical form ). Normal form is a unique representation for Geometry s. It can be used to test whether two Geometrys are equal in a way that is independent of the ordering of the coordinates within them. Normal form equality is a stronger condition than topological equality, but weaker than pointwise equality. The definitions for normal form use the standard lexicographical ordering for coordinates. "Sorted in order of coordinates" means the obvious extension of this ordering to sequences of coordinates.

NOTE that this method mutates the value of this geometry in-place. If this is not safe and/or wanted, the geometry should be cloned prior to normalization.
[中]将此Geometry转换为正常形式(或规范形式)。范式是Geometrys的唯一表示形式。它可用于测试两个Geometrys是否相等,其方式与它们内部坐标的顺序无关。正规形式等式是比拓扑等式更强的条件,但比逐点等式弱。标准形式的定义使用坐标的标准词典顺序。“按坐标顺序排序”是指这种排序对坐标顺序的明显扩展。
请注意,此方法会原地更改此几何图形的值。如果这不安全和/或不需要,则应在标准化之前克隆几何体。

代码示例

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

public void normalize() {
 for (int i = 0; i < geometries.length; i++) {
  geometries[i].normalize();
 }
 Arrays.sort(geometries);
}

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

/**
 * Creates a new Geometry which is a normalized
 * copy of this Geometry. 
 * 
 * @return a normalized copy of this geometry.
 * @see #normalize()
 */
public Geometry norm()
{
 Geometry copy = (Geometry) clone();
 copy.normalize();
 return copy;
}

代码示例来源:origin: org.orbisgis/h2gis

/**
   * Converts this Geometry to normal form (canonical form).
   * 
   * @param geometry
   * @return 
   */
  public static Geometry normalize(Geometry geometry) {
    if(geometry == null){
      return null;
    }
    geometry.normalize();
    return geometry;
  }
}

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

public void normalize() {
  geometry.normalize();
}

代码示例来源:origin: org.orbisgis/h2gis-functions

/**
   * Converts this Geometry to normal form (canonical form).
   * 
   * @param geometry
   * @return 
   */
  public static Geometry normalize(Geometry geometry) {
    if(geometry == null){
      return null;
    }
    geometry.normalize();
    return geometry;
  }
}

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

public void normalize() {
 for (int i = 0; i < geometries.length; i++) {
  geometries[i].normalize();
 }
 Arrays.sort(geometries);
}

代码示例来源:origin: org.locationtech.geogig/geogig-core

Geometry normalizeIfNeeded(Geometry value) {
  if (value instanceof Polygon) {
    value.normalize();
  } else if (value instanceof MultiPolygon
      || GeometryCollection.class.equals(value.getClass())) {// ignore
                                  // multipoint/linestring
    normalize((GeometryCollection) value);
  }
  return value;
}

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

/**
 * Creates a new Geometry which is a normalized
 * copy of this Geometry. 
 * 
 * @return a normalized copy of this geometry.
 * @see #normalize()
 */
public Geometry norm()
{
 Geometry copy = (Geometry) clone();
 copy.normalize();
 return copy;
}

代码示例来源:origin: stackoverflow.com

if(geom instanceof Polygon){
  if(geom.isValid()){
    geom.normalize(); // validate does not pick up rings in the wrong order - this will fix that
    return geom; // If the polygon is valid just return it
}else if(geom instanceof MultiPolygon){
  if(geom.isValid()){
    geom.normalize(); // validate does not pick up rings in the wrong order - this will fix that
    return geom; // If the multipolygon is valid just return it

代码示例来源:origin: com.googlecode.jaitools/jt-utils

PRECISION.makePrecise(cc1);
  cloned.normalize();
} else {
  geomFactory = new GeometryFactory();

相关文章