當前位置: 首頁>>代碼示例>>Java>>正文


Java GeometryFactory.createMultiPoint方法代碼示例

本文整理匯總了Java中com.vividsolutions.jts.geom.GeometryFactory.createMultiPoint方法的典型用法代碼示例。如果您正苦於以下問題:Java GeometryFactory.createMultiPoint方法的具體用法?Java GeometryFactory.createMultiPoint怎麽用?Java GeometryFactory.createMultiPoint使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.vividsolutions.jts.geom.GeometryFactory的用法示例。


在下文中一共展示了GeometryFactory.createMultiPoint方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: points

import com.vividsolutions.jts.geom.GeometryFactory; //導入方法依賴的package包/類
public static Geometry points(List<Coordinate> coordinates,
                              GeometryFactory factory) {
    if (coordinates.size() == 1) {
        return factory.createPoint(coordinates.get(0));
    }
    return factory.createMultiPoint(coordinates
            .toArray(new Coordinate[coordinates.size()]));
}
 
開發者ID:gegy1000,項目名稱:Earth,代碼行數:9,代碼來源:GeometryUtil.java

示例2: apply

import com.vividsolutions.jts.geom.GeometryFactory; //導入方法依賴的package包/類
@Override
public Geometry apply(@NonNull GeoHash geoHash, @NonNull GeometryFactory geometryFactory) {
	final BoundingBox boundingBox = geoHash.getBoundingBox();
	final Coordinate upperLeft = this.WGS84Point2coordinate.apply(boundingBox.getUpperLeft());
	final Coordinate lowerRight = this.WGS84Point2coordinate.apply(boundingBox.getLowerRight());
	final MultiPoint multiPoint = geometryFactory.createMultiPoint(new Coordinate[]{upperLeft, lowerRight});
	return multiPoint.getEnvelope();
}
 
開發者ID:adrianulbona,項目名稱:jts-discretizer,代碼行數:9,代碼來源:GeoHash2Geometry.java

示例3: readPoints

import com.vividsolutions.jts.geom.GeometryFactory; //導入方法依賴的package包/類
/**
 * Create {@link Point} or {@link MultiPoint} from MVT geometry drawing commands.
 *
 * @param geomFactory creates JTS geometry
 * @param geomCmds    contains MVT geometry commands
 * @param cursor      contains current MVT extent position
 * @return JTS geometry or null on failure
 */
private static Geometry readPoints(GeometryFactory geomFactory, List<Integer> geomCmds,
                                   Vec2d cursor) {

  // Guard: must have header
  if (geomCmds.isEmpty()) {
    return null;
  }

  /** Geometry command index. */
  int index = 0;

  // Read command header
  final int cmdHdr = geomCmds.get(index++);
  final int cmdLength = GeomCmdHdr.getCmdLength(cmdHdr);
  final GeomCmd cmd = GeomCmdHdr.getCmd(cmdHdr);

  // Guard: command type
  if (cmd != GeomCmd.MoveTo) {
    return null;
  }

  // Guard: minimum command length
  if (cmdLength < 1) {
    return null;
  }

  // Guard: header data unsupported by geometry command buffer
  //  (require header and at least 1 value * 2 params)
  if (cmdLength * GeomCmd.MoveTo.getParamCount() + 1 > geomCmds.size()) {
    return null;
  }

  final CoordinateSequence coordSeq = geomFactory.getCoordinateSequenceFactory()
      .create(cmdLength, 2);
  int coordIndex = 0;
  Coordinate nextCoord;

  while (index < geomCmds.size() - 1) {
    cursor.add(
        ZigZag.decode(geomCmds.get(index++)),
        ZigZag.decode(geomCmds.get(index++))
    );

    nextCoord = coordSeq.getCoordinate(coordIndex++);
    nextCoord.setOrdinate(0, cursor.x);
    nextCoord.setOrdinate(1, cursor.y);
  }

  if (coordSeq.size() == 1) {
    return geomFactory.createPoint(coordSeq);
  } else {
    return geomFactory.createMultiPoint(coordSeq);
  }
}
 
開發者ID:OrdnanceSurvey,項目名稱:vt-support,代碼行數:63,代碼來源:MvtReader.java

示例4: createMultiPoint

import com.vividsolutions.jts.geom.GeometryFactory; //導入方法依賴的package包/類
public static MultiPoint createMultiPoint(List<Coordinate> coordinates,
                                          GeometryFactory factory) {
    Coordinate[] coords = coordinates.toArray(new Coordinate[coordinates
            .size()]);
    return factory.createMultiPoint(coords);
}
 
開發者ID:gegy1000,項目名稱:Earth,代碼行數:7,代碼來源:GeometryUtil.java


注:本文中的com.vividsolutions.jts.geom.GeometryFactory.createMultiPoint方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。