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

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

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

GeometryFactory.createMultiPoint介绍

[英]Creates a MultiPoint using the points in the given CoordinateSequence. A null or empty CoordinateSequence creates an empty MultiPoint.
[中]使用给定坐标序列中的点创建多点。null或空坐标序列创建空多点。

代码示例

代码示例来源:origin: prestodb/presto

private static Geometry readMultiPoint(SliceInput input)
{
  skipEsriType(input);
  skipEnvelope(input);
  int pointCount = input.readInt();
  Point[] points = new Point[pointCount];
  for (int i = 0; i < pointCount; i++) {
    points[i] = readPoint(input);
  }
  return GEOMETRY_FACTORY.createMultiPoint(points);
}

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

private Object createNull() {
  Coordinate[] c = null;
  return geometryFactory.createMultiPoint(c);
}

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

public MultiPoint createMultiPoint(Point[] point) {
  return delegate.createMultiPoint(point);
}

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

public MultiPoint createMultiPoint(Coordinate[] coordinates) {
  return delegate.createMultiPoint(coordinates);
}

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

public MultiPoint createMultiPoint(CoordinateSequence coordinates) {
  return delegate.createMultiPoint(coordinates);
}

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

MultiPoint getMultiPoint() {
    Coordinate[] coorArray =
        (Coordinate[]) coordinates.toArray(new Coordinate[coordinates.size()]);
    return new GeometryFactory().createMultiPoint(coorArray);
  }
}

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

@Override
  public boolean endObject() throws ParseException, IOException {
    if (coordinates != null) {
      value = factory.createMultiPoint(coordinates(coordinates));
      coordinates = null;
    }
    return true;
  }
}

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

@Override
protected Geometry getEmpty() {
  if (EMPTY == null) {
    EMPTY = new GeometryFactory().createMultiPoint((Point[]) null);
  }
  return EMPTY;
}

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

public MultiPoint toMultiPoint(List<?> list) {
  List<Point> points = new ArrayList<Point>();
  for (Object o : list) {
    points.add(toPoint((List<?>) o));
  }
  return geometryFactory.createMultiPoint(points.toArray(new Point[points.size()]));
}

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

@Override
  protected Geometry newGeometry(
      final double[][][] coords, final GeometryFactory geometryFactory)
      throws DataSourceException {
    int nPoints = coords.length;
    Coordinate[] points = new Coordinate[nPoints];
    for (int i = 0; i < nPoints; i++) {
      double x = coords[i][0][0];
      double y = coords[i][0][1];
      points[i] = new Coordinate(x, y);
    }
    return geometryFactory.createMultiPoint(points);
  }
}

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

/** Builds a {@link MultiPoint} using the point nodes presents in the stack of result */
  @Override
  public Geometry build(int pointNode) throws CQLException {

    List<Geometry> pointList = popGeometry(pointNode);

    int pointListSize = pointList.size();
    Point[] arrayOfPoint = pointList.toArray(new Point[pointListSize]);

    MultiPoint multiPoint = getGeometryFactory().createMultiPoint(arrayOfPoint);

    return multiPoint;
  }
}

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

/**
 * Creates a MultiPoint with 2 2D Points.
 *
 * @param x1 the X ordinate of the first point
 * @param y1 the Y ordinate of the first point
 * @param x2 the X ordinate of the second point
 * @param y2 the Y ordinate of the second point
 * @return A MultiPoint
 */
public MultiPoint multiPoint(double x1, double y1, double x2, double y2) {
  return geomFact.createMultiPoint(new Point[] {point(x1, y1), point(x2, y2)});
}

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

@Override
 public Shape build() {
  return makeShape(geometryFactory.createMultiPoint(getCoordsArray()));
 }
}

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

/**
 * Creates a MultiPoint with 2 3D Points.
 *
 * @param x1 the X ordinate of the first point
 * @param y1 the Y ordinate of the first point
 * @param z1 the Z ordinate of the first point
 * @param x2 the X ordinate of the second point
 * @param y2 the Y ordinate of the second point
 * @param z2 the Z ordinate of the second point
 * @return A 3D MultiPoint
 */
public MultiPoint multiPointZ(
    double x1, double y1, double z1, double x2, double y2, double z2) {
  return geomFact.createMultiPoint(new Point[] {pointZ(x1, y1, z1), pointZ(x2, y2, z2)});
}

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

/**
 *
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 *
 * @generated modifiable
 */
public Object parse(ElementInstance instance, Node node, Object value) throws Exception {
  ArrayList points = new ArrayList();
  if (node.hasChild(Point.class)) {
    points.addAll(node.getChildValues(Point.class));
  }
  if (node.hasChild(Point[].class)) {
    Point[] p = (Point[]) node.getChildValue(Point[].class);
    for (int i = 0; i < p.length; i++) points.add(p[i]);
  }
  return gFactory.createMultiPoint((Point[]) points.toArray(new Point[points.size()]));
}

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

private MultiPoint readMultiPoint() throws IOException, ParseException {
  int numGeom = dis.readInt();
  Point[] geoms = new Point[numGeom];
  for (int i = 0; i < numGeom; i++) {
    Geometry g = readGeometry();
    if (!(g instanceof Point))
      throw new ParseException(INVALID_GEOM_TYPE_MSG + "MultiPoint");
    geoms[i] = (Point) g;
  }
  return factory.createMultiPoint(geoms);
}

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

private Geometry decodeMultiPoint(int shapeIndex) {
  Collection<Geometry> points = new ArrayList<Geometry>();
  for (int i = shapeIndex; i < binary.getShapes().length; i++) {
    if (binary.getShape(i).getParentOffset() == shapeIndex) {
      points.add(
          gf.createPoint(binary.getSequence(binary.getShape(i).getFigureOffset())));
    }
  }
  return gf.createMultiPoint(points.toArray(new Point[points.size()]));
}

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

private GeometryCollection wrap(Geometry geometry) {
    if (geometry instanceof Point) {
      return geometry.getFactory().createMultiPoint(new Point[] {(Point) geometry});
    } else if (geometry instanceof LineString) {
      return geometry.getFactory()
          .createMultiLineString(new LineString[] {(LineString) geometry});
    } else if (geometry instanceof Polygon) {
      return geometry.getFactory().createMultiPolygon(new Polygon[] {(Polygon) geometry});
    }

    throw new IllegalArgumentException("Unable to create multi geometry from " + geometry);
  }
}

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

@Test
public void testModify() throws Exception {
  final Query queryAll = new Query(RENAMED);
  SimpleFeatureStore store;
  store = (SimpleFeatureStore) rts.getFeatureSource(RENAMED);
  SimpleFeature original = store.getFeatures(fidFilter).features().next();
  // test a non mapped attribute
  String newDescription = ((String) original.getAttribute("description")) + " xxx";
  store.modifyFeatures(
      original.getFeatureType().getDescriptor("description"), newDescription, fidFilter);
  SimpleFeature modified = store.getFeatures(fidFilter).features().next();
  assertEquals(newDescription, modified.getAttribute("description"));
  // test a mapped attribute
  MultiPoint mpo = (MultiPoint) original.getAttribute("pointProperty");
  MultiPoint mpm =
      mpo.getFactory().createMultiPoint(new Coordinate[] {new Coordinate(10, 12)});
  store.modifyFeatures(
      original.getFeatureType().getDescriptor("pointProperty"), mpm, fidFilter);
  modified = store.getFeatures(fidFilter).features().next();
  assertTrue(mpm.equalsExact((Geometry) modified.getAttribute("pointProperty")));
}

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

@Test
public void smoothMultiPointReturnsSameObject() {
  Coordinate[] coords = getLineCoords();
  MultiPoint mpoint = factory.createMultiPoint(coords);
  Geometry smoothed = JTS.smooth(mpoint, 0);
  assertTrue(smoothed == mpoint);
}

相关文章