org.locationtech.jts.geom.GeometryFactory.toPointArray()方法的使用及代码示例

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

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

GeometryFactory.toPointArray介绍

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

代码示例

代码示例来源:origin: geotools/geotools

Point[] pointArray = geometryFactory.toPointArray(geometries);
MultiPoint multiPoint = geometryFactory.createMultiPoint(pointArray);
multiPoint.setUserData(getSRS());

代码示例来源:origin: locationtech/jts

public Geometry createCollection(Geometry[] geometries) {
    return geometryFactory.createMultiPoint(GeometryFactory.toPointArray(
        Arrays.asList(geometries)));
  }
};

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

/**
 * Adds a Point into a MultiPoint geometry.
 *
 * @param g
 * @param vertexPoint
 * @return
 */
private static Geometry insertVertexInMultipoint(Geometry g, Point vertexPoint) {
  ArrayList<Point> geoms = new ArrayList<Point>();
  for (int i = 0; i < g.getNumGeometries(); i++) {
    Point geom = (Point) g.getGeometryN(i);
    geoms.add(geom);
  }
  geoms.add(FACTORY.createPoint(new Coordinate(vertexPoint.getX(), vertexPoint.getY())));
  return FACTORY.createMultiPoint(GeometryFactory.toPointArray(geoms));
}

代码示例来源:origin: locationtech/jts

return createMultiPoint(toPointArray(geomList));

代码示例来源:origin: locationtech/jts

public void testToPointArray() {
 ArrayList list = new ArrayList();
 list.add(geometryFactory.createPoint(new Coordinate(0, 0)));
 list.add(geometryFactory.createPoint(new Coordinate(10, 0)));
 list.add(geometryFactory.createPoint(new Coordinate(10, 10)));
 list.add(geometryFactory.createPoint(new Coordinate(0, 10)));
 list.add(geometryFactory.createPoint(new Coordinate(0, 0)));
 Point[] points = GeometryFactory.toPointArray(list);
 assertEquals(10, points[1].getX(), 1E-1);
 assertEquals(0, points[1].getY(), 1E-1);
}

相关文章