/** * 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; }
/** * 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; }
/** * 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 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); }
/** * 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; }
/** * 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(final 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; }
Point point = primitiveFactory.createPoint(getPreciseCoordinate(tokenizer)); nextToken = getNextCloserOrComma(tokenizer); while (nextToken.equals(COMMA)) { point = primitiveFactory.createPoint(getPreciseCoordinate(tokenizer));
Point point = primitiveFactory.createPoint(getPreciseCoordinate(tokenizer)); nextToken = getNextCloserOrComma(tokenizer); while (nextToken.equals(COMMA)) { point = primitiveFactory.createPoint(getPreciseCoordinate(tokenizer));
(com.vividsolutions.jts.geom.Point) jtsGeom; DirectPosition dp = pointToDirectPosition(jtsPoint, crs); Point result = pf.createPoint(dp); return result;
(com.vividsolutions.jts.geom.Point) jtsGeom; DirectPosition dp = pointToDirectPosition(jtsPoint, crs); Point result = pf.createPoint(dp); return result;
public Geometry transform(CoordinateReferenceSystem newCRS, MathTransform transform) throws MismatchedDimensionException, TransformException { PositionFactory newPositionFactory = new PositionFactoryImpl(newCRS, getPositionFactory().getPrecision()); PrimitiveFactory newPrimitiveFactory = new PrimitiveFactoryImpl(newCRS, newPositionFactory); DirectPosition dp1 = new DirectPositionImpl(newCRS); dp1 = transform.transform(((PointImpl)this).getPosition(), dp1); return newPrimitiveFactory.createPoint( dp1 ); } }
org.locationtech.jts.geom.Point candidate = (org.locationtech.jts.geom.Point) jtsGeom; DirectPosition dp = pointToDirectPosition(candidate, crs); return pf.createPoint(dp);