/** * This method will read a LineString, CircularString or CompoundCurve and return the result as * a LinearRing. * * @return LinearRing * <p>This method expects either "EMPTY", "(", "CIRCULARSTRING", or "COMPOIUNDCURVE" to * start out with. * @throws IOException * @throws ParseException */ private LinearRing readCurvedLinearRingText() throws IOException, ParseException { String nextWord = getNextWord(); if (nextWord.equals(L_PAREN)) { List<Coordinate> coords = getCoordinateList(false); return new LinearRing( new CoordinateArraySequence(coords.toArray(new Coordinate[coords.size()])), geometryFactory); } else if (nextWord.equalsIgnoreCase("CIRCULARSTRING")) { return (LinearRing) readCircularStringText(); } else if (nextWord.equalsIgnoreCase("COMPOUNDCURVE")) { return (LinearRing) readCompoundCurveText(); } else { parseError(L_PAREN + ", CIRCULARSTRING or COMPOUNDCURVE"); return null; } }
private Polygon createPolygon(float... coords) { LinearRing shell = new LinearRing(new LiteCoordinateSequence(coords), geometryFactory); return new Polygon(shell, null, geometryFactory); }
/** * Creates a {@link LinearRing} using the given {@link CoordinateSequence}. * A null or empty array creates an empty LinearRing. * The points must form a closed and simple linestring. * * @param coordinates a CoordinateSequence (possibly empty), or null * @return the created LinearRing * @throws IllegalArgumentException if the ring is not closed, or has too few points */ public LinearRing createLinearRing(CoordinateSequence coordinates) { return new LinearRing(coordinates, this); }
ls = new CompoundRing(cc.getComponents(), cc.getFactory(), cc.getTolerance()); } else { ls = new LinearRing(ls.getCoordinateSequence(), ls.getFactory());
int h = referenceImage.getHeight(); LinearRing shell = new LinearRing( new LiteCoordinateSequence(0, 0, 0, h, w, h, w, 0, 0, 0), GEOMETRY_FACTORY); Polygon polygon = new Polygon(shell, null, GEOMETRY_FACTORY);
protected LinearRing copyInternal() { return new LinearRing(points.copy(), factory); }
private CurvePolygon buildCurvePolygon() { double[] circleControlPoints = new double[] {-10, 0, 0, 10, 10, 0, 0, -10, -10, 0}; CircularRing shell = new CircularRing(circleControlPoints, GEOMETRY_FACTORY, Double.MAX_VALUE); LinearRing hole = new LinearRing( new CoordinateArraySequence( new Coordinate[] { new Coordinate(-1, -1), new Coordinate(-1, 1), new Coordinate(1, 1), new Coordinate(1, -1), new Coordinate(-1, -1) }), GEOMETRY_FACTORY); CurvePolygon curved = new CurvePolygon( shell, new LinearRing[] {hole}, GEOMETRY_FACTORY, Double.MAX_VALUE); return curved; }
new LinearRing( new CoordinateArraySequence( new Coordinate[] { GEOMETRY_FACTORY); LinearRing hole = new LinearRing( new CoordinateArraySequence( new Coordinate[] {