public LineString createLineString(List points) throws MismatchedReferenceSystemException, MismatchedDimensionException { return getGeometryFactory().createLineString(points); }
/** * Parse a single coordinate from a <code>StreamTokenizer</code> * * @param tokenizer * @return a single DirectPosition * @throws IOException * @throws ParseException */ private DirectPosition getPreciseCoordinate(StreamTokenizer tokenizer) throws IOException, ParseException { DirectPosition pos = geometryFactory.createDirectPosition(); pos.setOrdinate(0, getNextNumber(tokenizer)); pos.setOrdinate(1, getNextNumber(tokenizer)); if (isNumberNext(tokenizer)) { pos.setOrdinate(1, getNextNumber(tokenizer)); } return pos; }
public MultiPrimitive createMultiPrimitive() { return getGeometryFactory().createMultiPrimitive(); }
(com.vividsolutions.jts.geom.LineString) jtsGeom; int numPoints = jtsLineString.getNumPoints(); LineString ls = gf.createLineString(new ArrayList()); List pointList = ls.getControlPoints(); for (int i=0; i<numPoints; i++) { Polygon polygon = gf.createPolygon(boundary); ArrayList patches = new ArrayList(); patches.add(polygon); PolyhedralSurface result = gf.createPolyhedralSurface(patches); return result; (com.vividsolutions.jts.geom.GeometryCollection) jtsGeom; int n = jtsCollection.getNumGeometries(); MultiPrimitive result = gf.createMultiPrimitive(); Set elements = result.getElements(); for (int i=0; i<n; i++) {
public static Envelope getWholeWorld() { if (WHOLE_WORLD == null) { CoordinateReferenceSystem crs = null; try { crs = org.geotools.referencing.CRS.decode("EPSG:4326"); } catch (Exception nsace){ getLog().warn("could not get crs for EPSG:4326"); } final BasicFactories commonFactory = BasicFactories.getDefault(); final GeometryFactory geometryFactory = commonFactory.getGeometryFactory(crs); final DirectPosition lowerCorner = geometryFactory.createDirectPosition(new double[] { -90, -180 }); final DirectPosition upperCorner = geometryFactory.createDirectPosition(new double[] { 90, 180 }); WHOLE_WORLD = geometryFactory.createEnvelope(lowerCorner, upperCorner); } return WHOLE_WORLD; }
public Polygon createPolygon(SurfaceBoundary boundary, Surface spanSurface) throws MismatchedReferenceSystemException, MismatchedDimensionException { return getGeometryFactory().createPolygon(boundary, spanSurface); }
LineString ls = gf.createLineString(new ArrayList<Position>()); PointArray pointList = ls.getControlPoints(); for (int i = 0, n = candidate.getNumPoints(); i < n; i++) { Polygon polygon = gf.createPolygon(boundary); return (JTSPolygon) polygon;
public PolyhedralSurface createPolyhedralSurface(List tiles) throws MismatchedReferenceSystemException, MismatchedDimensionException { return getGeometryFactory().createPolyhedralSurface(tiles); }
public Envelope createEnvelope(DirectPosition lowerCorner, DirectPosition upperCorner) throws MismatchedReferenceSystemException, MismatchedDimensionException { return getGeometryFactory().createEnvelope(lowerCorner, upperCorner); }
(com.vividsolutions.jts.geom.LineString) jtsGeom; int numPoints = jtsLineString.getNumPoints(); LineString ls = gf.createLineString(new ArrayList()); List pointList = ls.getControlPoints().positions(); for (int i=0; i<numPoints; i++) { Polygon polygon = gf.createPolygon(boundary); ArrayList patches = new ArrayList(); patches.add(polygon); PolyhedralSurface result = gf.createPolyhedralSurface(patches); return result; (com.vividsolutions.jts.geom.GeometryCollection) jtsGeom; int n = jtsCollection.getNumGeometries(); MultiPrimitive result = gf.createMultiPrimitive(); for (int i=0; i<n; i++) { result.getElements().add(jtsToGo1(jtsCollection.getGeometryN(i), crs));
public static Envelope getWholeWorld() { if (WHOLE_WORLD == null) { CoordinateReferenceSystem crs = null; try { crs = org.geotools.referencing.CRS.decode("EPSG:4326"); } catch (Exception nsace){ getLog().warn("could not get crs for EPSG:4326"); } final CommonFactory commonFactory = BasicFactories.getDefault(); final GeometryFactory geometryFactory = commonFactory.getGeometryFactory(crs); final DirectPosition lowerCorner = geometryFactory.createDirectPosition(new double[] { -90, -180 }); final DirectPosition upperCorner = geometryFactory.createDirectPosition(new double[] { 90, 180 }); WHOLE_WORLD = geometryFactory.createEnvelope(lowerCorner, upperCorner); } return WHOLE_WORLD; }
public Polygon createPolygon(SurfaceBoundary boundary) throws MismatchedReferenceSystemException, MismatchedDimensionException { return getGeometryFactory().createPolygon(boundary); }
public static PolyhedralSurface createPolyhedralSurface(final DirectPosition[][] patchPoints) { // get the crs and factories final CoordinateReferenceSystem crs = patchPoints[0][0].getCoordinateReferenceSystem(); final GeometryFactory geometryFactory = new JTSGeometryFactory(crs); // create polygons from each of the arrays of directPositions final List polygons = new ArrayList(patchPoints.length); for (int i = 0; i < patchPoints.length; i++) { final Polygon polygon = createPolygon(patchPoints[i]); polygons.add(polygon); } return geometryFactory.createPolyhedralSurface(polygons); }
public LineString createLineString(PointArray points) throws MismatchedReferenceSystemException, MismatchedDimensionException { return getGeometryFactory().createLineString(points); }
public static Envelope createCRSEnvelope( final CoordinateReferenceSystem crs, final double minx, final double miny, final double maxx, final double maxy) { final GeometryFactory geometryFactory = new JTSGeometryFactory(crs); final DirectPosition lowerCorner = geometryFactory.createDirectPosition(); lowerCorner.setOrdinate(0, minx); lowerCorner.setOrdinate(1, miny); final DirectPosition upperCorner = geometryFactory.createDirectPosition(); upperCorner.setOrdinate(0, maxx); upperCorner.setOrdinate(1, maxy); return geometryFactory.createEnvelope(lowerCorner, upperCorner); }
/** * Creates a {@code MultiPrimitive} out of a GEOMETRYCOLLECCTION specifier. * * @param tokenizer tokenizer on top of a stream of text in Well-known Text format. * @return a <code>MultiPrimitive</code> specified by the next tokens in the stream * @throws ParseException * @throws IOException if an I/O error occurs */ private MultiPrimitive readGeometryCollectionText(StreamTokenizer tokenizer) throws IOException, ParseException { String nextToken = getNextEmptyOrOpener(tokenizer); if (nextToken.equals(EMPTY)) { return null; } MultiPrimitive multi = geometryFactory.createMultiPrimitive(); Geometry geom = readGeometryTaggedText(tokenizer); // multi.getElements().add(geom); Set elements = multi.getElements(); elements.add(geom); nextToken = getNextCloserOrComma(tokenizer); while (nextToken.equals(COMMA)) { geom = readGeometryTaggedText(tokenizer); // multi.getElements().add(geom); elements.add(geom); nextToken = getNextCloserOrComma(tokenizer); } return multi; }
protected DirectPosition createDirectPosition(final double x, final double y) { double[] coords = new double[2]; coords[0] = x; coords[1] = y; return GEOMETRY_FACTORY.createDirectPosition(coords); }
/** * @inheritDoc * @see org.opengis.geometry.primitive.PrimitiveFactory#createSurface(org.opengis.geometry.primitive.SurfaceBoundary) */ public Surface createSurface(final SurfaceBoundary boundary) { // For now, our implementation has to assume that the boundary is a // polygon. Surface result = new SurfaceImpl(crs); Polygon poly = geomFact.createPolygon(boundary); // PENDING(jdc): the following line is 1.5 specific. // the result.getPatches() list is a generic list with a type of "? extends SurfacePatch" // we can compile without the generic if we cast down to List, but why do we need the cast? // Polygon extends SurfacePatch, so in theory this should work... //((List<SurfacePatch>) result.getPatches()).add(poly); ((List)result.getPatches()).add(poly); return result; }
public static PolyhedralSurface createPolyhedralSurface(final DirectPosition[][] patchPoints) { // get the crs and factories final CoordinateReferenceSystem crs = patchPoints[0][0].getCoordinateReferenceSystem(); final BasicFactories commonFactory = BasicFactories.getDefault(); final GeometryFactory geometryFactory = commonFactory.getGeometryFactory(crs); // create polygons from each of the arrays of directPositions final List polygons = new ArrayList(patchPoints.length); for (int i = 0; i < patchPoints.length; i++) { final Polygon polygon = createPolygon(patchPoints[i]); polygons.add(polygon); } return geometryFactory.createPolyhedralSurface(polygons); }
/** * Creates a <code>LineString</code> using the next token in the stream. * * @param tokenizer tokenizer over a stream of text in Well-known Text format. The next tokens * must form a <LineString Text>. * @return a <code>LineString</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 Curve readLineStringText(StreamTokenizer tokenizer) throws IOException, ParseException { List coordList = getCoordinates(tokenizer); LineString lineString = geometryFactory.createLineString(coordList); List curveSegmentList = Collections.singletonList(lineString); Curve curve = primitiveFactory.createCurve(curveSegmentList); return curve; }