本文整理了Java中com.vividsolutions.jts.geom.GeometryFactory.createMultiPoint()
方法的一些代码示例,展示了GeometryFactory.createMultiPoint()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。GeometryFactory.createMultiPoint()
方法的具体详情如下:
包路径:com.vividsolutions.jts.geom.GeometryFactory
类名称:GeometryFactory
方法名:createMultiPoint
[英]Creates a MultiPoint using the points in the given CoordinateSequence. A null
or empty CoordinateSequence creates an empty MultiPoint.
[中]使用给定坐标序列中的点创建多点。null
或空坐标序列创建空多点。
代码示例来源:origin: opentripplanner/OpenTripPlanner
public Geometry getConvexHull() {
if (newVertexAdded) {
MultiPoint mp = gf.createMultiPoint(vertexCoords.toArray(new Coordinate[0]));
newVertexAdded = false;
mp.convexHull();
}
return convexHullAsGeom;
}
}
代码示例来源:origin: osmandapp/Osmand
return coordSeq.size() == 1 ? geomFactory.createPoint(coordSeq) : geomFactory.createMultiPoint(coordSeq);
代码示例来源:origin: opentripplanner/OpenTripPlanner
geometryJSON.write(gf.createMultiPoint(coords), sw);
LOG.debug("done");
} else if (output.equals(SIsochrone.RESULT_TYPE_SHED)) {
代码示例来源:origin: com.vividsolutions/jts
private MultiPoint getEmptyMultiPoint()
{
return geomFact.createMultiPoint((CoordinateSequence) null);
}
代码示例来源:origin: com.vividsolutions/jts
public static void main(String[] args)
throws Exception
{
// create a factory using default values (e.g. floating precision)
GeometryFactory fact = new GeometryFactory();
Point p1 = fact.createPoint(new Coordinate(0,0));
System.out.println(p1);
Point p2 = fact.createPoint(new Coordinate(1,1));
System.out.println(p2);
MultiPoint mpt = fact.createMultiPoint(new Coordinate[] { new Coordinate(0,0), new Coordinate(1,1) } );
System.out.println(mpt);
}
}
代码示例来源:origin: com.vividsolutions/jts
/**
* Creates a {@link MultiPoint} using the given {@link Coordinate}s.
* A null or empty array will create an empty MultiPoint.
*
* @param coordinates an array (without null elements), or an empty array, or <code>null</code>
* @return a MultiPoint object
*/
public MultiPoint createMultiPoint(Coordinate[] coordinates) {
return createMultiPoint(coordinates != null
? getCoordinateSequenceFactory().create(coordinates)
: null);
}
代码示例来源:origin: com.vividsolutions/jts
public Object parse(Handler arg, GeometryFactory gf) throws SAXException {
// one child, either a coord
// or a coordinate sequence
if(arg.children.size()<1)
throw new SAXException("Cannot create a multi-point without atleast one point");
int srid = getSrid(arg.attrs,gf.getSRID());
Point[] pts = (Point[]) arg.children.toArray(new Point[arg.children.size()]);
MultiPoint mp = gf.createMultiPoint(pts);
if(mp.getSRID()!=srid)
mp.setSRID(srid);
return mp;
}
});
代码示例来源:origin: com.vividsolutions/jts
private Geometry boundaryMultiLineString(MultiLineString mLine)
{
if (geom.isEmpty()) {
return getEmptyMultiPoint();
}
Coordinate[] bdyPts = computeBoundaryCoordinates(mLine);
// return Point or MultiPoint
if (bdyPts.length == 1) {
return geomFact.createPoint(bdyPts[0]);
}
// this handles 0 points case as well
return geomFact.createMultiPoint(bdyPts);
}
代码示例来源:origin: com.vividsolutions/jts
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: com.vividsolutions/jts
public Geometry getGeometry()
{
Coordinate[] pts = new Coordinate[numPts];
int i = 0;
while (i < numPts) {
Coordinate p = createRandomCoord(getExtent());
if (extentLocator != null && ! isInExtent(p))
continue;
pts[i++] = p;
}
return geomFactory.createMultiPoint(pts);
}
代码示例来源:origin: com.vividsolutions/jts
return geometryFactory.createMultiPoint(new Point[0]);
String nextWord = lookaheadWord();
if (nextWord != L_PAREN) {
return geometryFactory.createMultiPoint(toPoints(getCoordinatesNoLeftParen()));
return geometryFactory.createMultiPoint((Point[]) points.toArray(array));
代码示例来源:origin: com.vividsolutions/jts
/**
* Creates a {@link MultiPoint} using the
* points in the given {@link CoordinateSequence}.
* A <code>null</code> or empty CoordinateSequence creates an empty MultiPoint.
*
* @param coordinates a CoordinateSequence (possibly empty), or <code>null</code>
* @return a MultiPoint geometry
*/
public MultiPoint createMultiPoint(CoordinateSequence coordinates) {
if (coordinates == null) {
return createMultiPoint(new Point[0]);
}
Point[] points = new Point[coordinates.size()];
for (int i = 0; i < coordinates.size(); i++) {
CoordinateSequence ptSeq = getCoordinateSequenceFactory()
.create(1, coordinates.getDimension());
CoordinateSequences.copy(coordinates, i, ptSeq, 0, 1);
points[i] = createPoint(ptSeq);
}
return createMultiPoint(points);
}
代码示例来源:origin: com.vividsolutions/jts
return factory.createMultiPoint((Point[]) geometries.toArray(
new Point[] { }));
代码示例来源:origin: com.vividsolutions/jts
public static Geometry getEndPoints(Geometry g)
{
List endPtList = new ArrayList();
if (g instanceof LineString) {
LineString line = (LineString) g;
endPtList.add(line.getCoordinateN(0));
endPtList.add(line.getCoordinateN(line.getNumPoints() - 1));
}
else if (g instanceof MultiLineString) {
MultiLineString mls = (MultiLineString) g;
for (int i = 0; i < mls.getNumGeometries(); i++) {
LineString line = (LineString) mls.getGeometryN(i);
endPtList.add(line.getCoordinateN(0));
endPtList.add(line.getCoordinateN(line.getNumPoints() - 1));
}
}
Coordinate[] endPts = CoordinateArrays.toCoordinateArray(endPtList);
return (new GeometryFactory()).createMultiPoint(endPts);
}
代码示例来源:origin: com.vividsolutions/jts
ptComp = geomFact.createMultiPoint(coords);
代码示例来源:origin: com.vividsolutions/jts
private Geometry boundaryLineString(LineString line)
{
if (geom.isEmpty()) {
return getEmptyMultiPoint();
}
if (line.isClosed()) {
// check whether endpoints of valence 2 are on the boundary or not
boolean closedEndpointOnBoundary = bnRule.isInBoundary(2);
if (closedEndpointOnBoundary) {
return line.getStartPoint();
}
else {
return geomFact.createMultiPoint((Coordinate[]) null);
}
}
return geomFact.createMultiPoint(new Point[]{
line.getStartPoint(),
line.getEndPoint()
});
}
}
代码示例来源:origin: com.vividsolutions/jts
return createMultiPoint(toPointArray(geomList));
代码示例来源:origin: com.vividsolutions/jts
return geomFactory.createMultiPoint(pts);
代码示例来源:origin: org.geotools/gt-geojson
@Override
public boolean endObject() throws ParseException, IOException {
if (coordinates != null) {
value = factory.createMultiPoint(coordinates(coordinates));
coordinates = null;
}
return true;
}
}
代码示例来源:origin: org.geotools/gt-main
/**
* Creates a <code>MultiPoint</code> using the next token in the stream.
*
*@return a <code>MultiPoint</code> specified by the next token in the stream
*@throws IOException
* if an I/O error occurs
*@throws ParseException
* if an unexpected token was encountered
*/
private MultiPoint readMultiPointText() throws IOException, ParseException {
return geometryFactory.createMultiPoint(toPoints(getCoordinates()));
}
内容来源于网络,如有侵权,请联系作者删除!