/** * Returns the surface interpolation that matches the given string, or returns a new one if none * match it. * * @param code The name of the code to fetch or to create. * @return A code matching the given name. */ public static SurfaceInterpolation valueOf(String code) { return valueOf(SurfaceInterpolation.class, code); } }
/** * Returns the curve interpolation that matches the given string, or returns a new one if none * match it. * * @param code The name of the code to fetch or to create. * @return A code matching the given name. */ public static CurveInterpolation valueOf(String code) { return valueOf(CurveInterpolation.class, code); } }
/** Returns the list of enumerations of the same kind than this enum. */ public SurfaceInterpolation[] family() { return values(); }
Ring shell = primitiveFactory.createRing(curveList); Curve holecurve = readLinearRingText(tokenizer); List holeList = Collections.singletonList(holecurve); Ring hole = primitiveFactory.createRing(holeList); SurfaceBoundary sb = primitiveFactory.createSurfaceBoundary(shell, holes); return primitiveFactory.createSurface(sb);
public Curve createCurve(List segments) throws MismatchedReferenceSystemException, MismatchedDimensionException { if (segments == null) throw new NullPointerException("Segments are required to create a curve"); // A curve will be created // - The curve will be set as parent curves for the Curve segments // - Start and end params for the CurveSegments will be set return getPrimitiveFactory().createCurve(segments); }
/** * Creates a <code>Point</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 <Point Text>. * @return a <code>Point</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 Point readPointText(StreamTokenizer tokenizer) throws IOException, ParseException { String nextToken = getNextEmptyOrOpener(tokenizer); if (nextToken.equals(EMPTY)) { return primitiveFactory.createPoint(new double[2]); } Point point = primitiveFactory.createPoint(getPreciseCoordinate(tokenizer)); getNextCloser(tokenizer); return point; }
public Ring createRing(List<OrientableCurve> orientableCurves) throws MismatchedReferenceSystemException, MismatchedDimensionException { /** * Creates a Ring from triple Array of DirectPositions (Array of arrays, which each * represent a future Curve. Each array contain an array of positions, which each represent * a future lineString) */ return getPrimitiveFactory().createRing(orientableCurves); }
public SurfaceBoundary createSurfaceBoundary(Ring exterior, List interiors) throws MismatchedReferenceSystemException, MismatchedDimensionException { return getPrimitiveFactory().createSurfaceBoundary(exterior, interiors); }
public Surface createSurface(SurfaceBoundary boundary) throws MismatchedReferenceSystemException, MismatchedDimensionException { return getPrimitiveFactory().createSurface(boundary); }
public void testPoint1() throws Exception { String WKT = "POINT (80 340)"; Object geometry = parser.parse(WKT); assertNotNull(geometry); assertTrue(geometry instanceof Point); Point point = (Point) geometry; assertNotNull(point.getDirectPosition()); assertEquals(80, point.getDirectPosition().getOrdinate(0), 0.0); assertEquals(340, point.getDirectPosition().getOrdinate(1), 0.0); }
/** Returns the list of enumerations of the same kind than this enum. */ public CurveInterpolation[] family() { return values(); }
public Solid createSolid(SolidBoundary boundary) throws MismatchedReferenceSystemException, MismatchedDimensionException { return getPrimitiveFactory().createSolid(boundary); }
/** * 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; }
/** * Creates a {@code MultiPrimitive} using the next token in the stream. * * @param tokenizer tokenizer on top of a stream of text in Well-known Text format. The next * tokens must form a <Point Text>. * @return a <code>MultiPrimitive</code> specified by the next token in the stream * @throws ParseException if the coordinates used to create the <code>Polygon</code> shell and * holes do not form closed linestrings, or if an unexpected token was encountered. * @throws IOException if an I/O error occurs */ private MultiPrimitive readMultiPointText(StreamTokenizer tokenizer) throws IOException, ParseException { String nextToken = getNextEmptyOrOpener(tokenizer); if (nextToken.equals(EMPTY)) { return null; } MultiPrimitive multi = geometryFactory.createMultiPrimitive(); Point point = primitiveFactory.createPoint(getPreciseCoordinate(tokenizer)); // multi.getElements().add(point); Set elements = multi.getElements(); elements.add(point); nextToken = getNextCloserOrComma(tokenizer); while (nextToken.equals(COMMA)) { point = primitiveFactory.createPoint(getPreciseCoordinate(tokenizer)); // multi.getElements().add(point); elements.add(point); nextToken = getNextCloserOrComma(tokenizer); } return multi; }
public Surface createSurface(List surfaces) throws MismatchedReferenceSystemException, MismatchedDimensionException { return getPrimitiveFactory().createSurface(surfaces); }
public void testPoint2() throws Exception { String WKT = "POINT (320.324 180.234)"; Object geometry = parser.parse(WKT); assertNotNull(geometry); assertTrue(geometry instanceof Point); Point point = (Point) geometry; assertEquals(320.324, point.getDirectPosition().getOrdinate(0), 0.0); assertEquals(180.234, point.getDirectPosition().getOrdinate(1), 0.0); }
/** * Creates a <code>Curve</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>Curve</code> specified by the next token in the stream * @throws IOException if an I/O error occurs * @throws ParseException if the coordinates used to create the <code>Curve</code> do not form a * closed linestring, or if an unexpected token was encountered */ private Curve readLinearRingText(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; // List curveList = Collections.singletonList(curve); // return primitiveFactory.createRing(curveList); }
/** * Create a point with the provided ordinates * * @param ordinates * @return getPrimitiveFactory().createPoint(coordinates) * @throws MismatchedDimensionException */ public Point createPoint(double[] ordinates) throws MismatchedDimensionException { if (ordinates == null) throw new NullPointerException("Ordinates required to create a point"); int dimension = this.getCoordinateReferenceSystem().getCoordinateSystem().getDimension(); if (ordinates.length != dimension) throw new MismatchedDimensionException( "Create point requires " + dimension + " ordinates (" + ordinates.length + " provided"); return getPrimitiveFactory().createPoint(ordinates); }
public void testPoint3() throws Exception { String WKT = "POINT (260.01 -360.55)"; Object geometry = parser.parse(WKT); assertNotNull(geometry); assertTrue(geometry instanceof Point); Point point = (Point) geometry; assertEquals(260.01, point.getDirectPosition().getOrdinate(0), 0.0); assertEquals(-360.55, point.getDirectPosition().getOrdinate(1), 0.0); }
public Point createPoint(Position position) throws MismatchedReferenceSystemException, MismatchedDimensionException { if (position == null) { throw new NullPointerException(); } setCoordinateReferenceSystem(position.getDirectPosition().getCoordinateReferenceSystem()); DirectPosition copy = (DirectPosition) getPositionFactory() .createDirectPosition(position.getDirectPosition().getCoordinate()); return getPrimitiveFactory().createPoint(copy); }