本文整理匯總了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()]));
}
示例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();
}
示例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);
}
}
示例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);
}