public Geometry getConvexHull() { if (newVertexAdded) { MultiPoint mp = gf.createMultiPoint(vertexCoords.toArray(new Coordinate[0])); newVertexAdded = false; mp.convexHull(); } return convexHullAsGeom; } }
return coordSeq.size() == 1 ? geomFactory.createPoint(coordSeq) : geomFactory.createMultiPoint(coordSeq);
geometryJSON.write(gf.createMultiPoint(coords), sw); LOG.debug("done"); } else if (output.equals(SIsochrone.RESULT_TYPE_SHED)) {
private MultiPoint getEmptyMultiPoint() { return geomFact.createMultiPoint((CoordinateSequence) null); }
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); } }
/** * 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); }
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; } });
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); }
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); }
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); }
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));
/** * 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); }
return factory.createMultiPoint((Point[]) geometries.toArray( new Point[] { }));
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); }
ptComp = geomFact.createMultiPoint(coords);
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() }); } }
return createMultiPoint(toPointArray(geomList));
return geomFactory.createMultiPoint(pts);
@Override public boolean endObject() throws ParseException, IOException { if (coordinates != null) { value = factory.createMultiPoint(coordinates(coordinates)); coordinates = null; } return true; } }
/** * 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())); }