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

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

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

GeometryFactory.toLinearRingArray介绍

[英]Converts the List to an array.
[中]将List转换为数组。

代码示例

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

private LinearRing[] getHoles(int n, double originX, double originY, double width) 
{
  List holeList = new ArrayList();
  
  addHoles(n, originX, originY, width, holeList );
  
  return GeometryFactory.toLinearRingArray(holeList);
}

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

seqIndex++;
LinearRing[] holeArray = GeometryFactory.toLinearRingArray(holes);
polys.add(geometryFactory.createPolygon(shell, holeArray));

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

private LinearRing[] getHoles(int n, double originX, double originY, double width) 
{
  List holeList = new ArrayList();
  
  addHoles(n, originX, originY, width, holeList );
  
  return GeometryFactory.toLinearRingArray(holeList);
}

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

seqIndex++;
LinearRing[] holeArray = GeometryFactory.toLinearRingArray(holes);
polys.add(geometryFactory.createPolygon(shell, holeArray));

代码示例来源:origin: DataSystemsLab/GeoSpark

Polygon polygon = geometryFactory.createPolygon(shell, GeometryFactory.toLinearRingArray(holes));
    polygons.add(polygon);
Polygon polygon = geometryFactory.createPolygon(shell, GeometryFactory.toLinearRingArray(holes));
polygons.add(polygon);

代码示例来源:origin: org.datasyslab/geospark

Polygon polygon = geometryFactory.createPolygon(shell, GeometryFactory.toLinearRingArray(holes));
    polygons.add(polygon);
Polygon polygon = geometryFactory.createPolygon(shell, GeometryFactory.toLinearRingArray(holes));
polygons.add(polygon);

代码示例来源:origin: mapplus/spatial_statistics_for_geotools_udig

private Geometry removeSmallHoles(Polygon polygon, double areaTolerance) {
    GeometryFactory factory = polygon.getFactory();
    LineString exteriorRing = polygon.getExteriorRing();
    // check interior rings
    List<LinearRing> interiorRingList = new ArrayList<LinearRing>();
    for (int index = 0; index < polygon.getNumInteriorRing(); index++) {
      LineString interiorRing = polygon.getInteriorRingN(index);
      if (interiorRing.isRing()) {
        if (Math.abs(interiorRing.getArea()) >= areaTolerance) {
          interiorRingList.add((LinearRing) interiorRing);
        }
      }
    }
    LinearRing[] holes = null;
    if (interiorRingList.size() > 0) {
      holes = GeometryFactory.toLinearRingArray(interiorRingList);
    }
    Geometry finalGeom = factory.createPolygon((LinearRing) exteriorRing, holes);
    finalGeom.setUserData(polygon.getUserData());
    return finalGeom;
  }
}

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

/**
 * Removes duplicated coordinates within a Polygon.
 * @param poly 
 * @return
 */
public static Polygon removeDuplicateCoordinates(Polygon poly) {
    Coordinate[] shellCoords = CoordinateArrays.removeRepeatedPoints(poly.getExteriorRing().getCoordinates());
    LinearRing shell = FACTORY.createLinearRing(shellCoords);
    ArrayList<LinearRing> holes = new ArrayList<LinearRing>();
    for (int i = 0; i < poly.getNumInteriorRing(); i++) {
        Coordinate[] holeCoords = CoordinateArrays.removeRepeatedPoints(poly.getInteriorRingN(i).getCoordinates());
        holes.add(FACTORY.createLinearRing(holeCoords));
    }
    return FACTORY.createPolygon(shell, GeometryFactory.toLinearRingArray(holes));
}

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

/**
 * Removes duplicated coordinates within a Polygon.
 *
 * @param polygon the input polygon
 * @param tolerance to delete the coordinates
 * @return
 * @throws java.sql.SQLException
 */
public static Polygon removeDuplicateCoordinates(Polygon polygon, double tolerance) throws SQLException {
  Coordinate[] shellCoords = CoordinateUtils.removeRepeatedCoordinates(polygon.getExteriorRing().getCoordinates(),tolerance,true);
  LinearRing shell = FACTORY.createLinearRing(shellCoords);
  ArrayList<LinearRing> holes = new ArrayList<LinearRing>();
  for (int i = 0; i < polygon.getNumInteriorRing(); i++) {
    Coordinate[] holeCoords = CoordinateUtils.removeRepeatedCoordinates(polygon.getInteriorRingN(i).getCoordinates(), tolerance, true);
    if (holeCoords.length < 4) {
      throw new SQLException("Not enough coordinates to build a new LinearRing.\n Please adjust the tolerance");
    }
    holes.add(FACTORY.createLinearRing(holeCoords));
  }
  return FACTORY.createPolygon(shell, GeometryFactory.toLinearRingArray(holes));
}

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

/**
 * Removes duplicated coordinates within a Polygon.
 *
 * @param polygon the input polygon
 * @param tolerance to delete the coordinates
 * @return
 * @throws java.sql.SQLException
 */
public static Polygon removeDuplicateCoordinates(Polygon polygon, double tolerance) throws SQLException {
  Coordinate[] shellCoords = CoordinateUtils.removeRepeatedCoordinates(polygon.getExteriorRing().getCoordinates(),tolerance,true);
  LinearRing shell = FACTORY.createLinearRing(shellCoords);
  ArrayList<LinearRing> holes = new ArrayList<LinearRing>();
  for (int i = 0; i < polygon.getNumInteriorRing(); i++) {
    Coordinate[] holeCoords = CoordinateUtils.removeRepeatedCoordinates(polygon.getInteriorRingN(i).getCoordinates(), tolerance, true);
    if (holeCoords.length < 4) {
      throw new SQLException("Not enough coordinates to build a new LinearRing.\n Please adjust the tolerance");
    }
    holes.add(FACTORY.createLinearRing(holeCoords));
  }
  return FACTORY.createPolygon(shell, GeometryFactory.toLinearRingArray(holes));
}

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

/**
 * Removes duplicated coordinates within a Polygon.
 *
 * @param poly
 * @return
 */
public static Polygon removeCoordinates(Polygon poly) {
  Coordinate[] shellCoords = CoordinateUtils.removeDuplicatedCoordinates(poly.getExteriorRing().getCoordinates(),true);
  LinearRing shell = FACTORY.createLinearRing(shellCoords);
  ArrayList<LinearRing> holes = new ArrayList<LinearRing>();
  for (int i = 0; i < poly.getNumInteriorRing(); i++) {
    Coordinate[] holeCoords = CoordinateUtils.removeDuplicatedCoordinates(poly.getInteriorRingN(i).getCoordinates(),true);
    holes.add(FACTORY.createLinearRing(holeCoords));
  }
  return FACTORY.createPolygon(shell, GeometryFactory.toLinearRingArray(holes));
}

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

/**
 * Removes duplicated coordinates within a Polygon.
 *
 * @param poly
 * @return
 */
public static Polygon removeCoordinates(Polygon poly) {
  Coordinate[] shellCoords = CoordinateUtils.removeDuplicatedCoordinates(poly.getExteriorRing().getCoordinates(),true);
  LinearRing shell = FACTORY.createLinearRing(shellCoords);
  ArrayList<LinearRing> holes = new ArrayList<LinearRing>();
  for (int i = 0; i < poly.getNumInteriorRing(); i++) {
    Coordinate[] holeCoords = CoordinateUtils.removeDuplicatedCoordinates(poly.getInteriorRingN(i).getCoordinates(),true);
    holes.add(FACTORY.createLinearRing(holeCoords));
  }
  return FACTORY.createPolygon(shell, GeometryFactory.toLinearRingArray(holes));
}

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

GeometryFactory.toLinearRingArray(holeRings));
return poly;

相关文章