public LineString createLineString(List points) throws MismatchedReferenceSystemException, MismatchedDimensionException { return getGeometryFactory().createLineString(points); }
public LineString createLineString(PointArray points) throws MismatchedReferenceSystemException, MismatchedDimensionException { return getGeometryFactory().createLineString(points); }
/** * 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>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); }
private static LineString createLineString( final GeometryFactory geometryFactory, final DirectPosition[] points) { final LineString lineString = geometryFactory.createLineString(new ArrayList(Arrays.asList(points))); return lineString; }
private static LineString createLineString( final GeometryFactory geometryFactory, final DirectPosition[] points) { final LineString lineString = geometryFactory.createLineString(new ArrayList(Arrays.asList(points))); return lineString; }
private static LineString createLineString( final GeometryFactory geometryFactory, final DirectPosition[] points) { final LineString lineString = geometryFactory.createLineString(new ArrayList(Arrays.asList(points))); return lineString; }
/** * 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; }
/** * A helper method for creating a lineString from an array of DirectPositions * * @param points * @return <tt>LineString</tt> */ protected LineString createLineString(final DirectPosition[] points) { final LineString lineString = GEOMETRY_FACTORY.createLineString(new ArrayList(Arrays.asList(points))); return lineString; }
/** * 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(final StreamTokenizer tokenizer) throws IOException, ParseException { final List<Position> coordList = getCoordinates(tokenizer); final LineString lineString = geometryFactory.createLineString(coordList); final List<CurveSegment> curveSegmentList = Collections.singletonList((CurveSegment)lineString); return primitiveFactory.createCurve(curveSegmentList); }
/** * 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); }
/** * 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(final StreamTokenizer tokenizer) throws IOException, ParseException { List<Position> coordList = getCoordinates(tokenizer); LineString lineString = geometryFactory.createLineString(coordList); List<CurveSegment> curveSegmentList = Collections.singletonList((CurveSegment)lineString); return primitiveFactory.createCurve(curveSegmentList); }
public Geometry transform(CoordinateReferenceSystem newCRS, MathTransform transform) throws MismatchedDimensionException, TransformException { // loop through each point in this curve and transform it to the new CRS, then // use the new points to build a new curve and return that. PrimitiveFactory primitiveFactory = new PrimitiveFactoryImpl(newCRS, getPositionFactory()); GeometryFactory geometryFactory = new GeometryFactoryImpl(newCRS, getPositionFactory()); DirectPositionImpl dp1 = null; List<DirectPosition> currentpositions = asDirectPositions(); Iterator<DirectPosition> iter = currentpositions.iterator(); List<Position> newpositions = new ArrayList<Position>(); while (iter.hasNext()) { DirectPosition thispos = (DirectPosition) iter.next(); dp1 = new DirectPositionImpl(newCRS); dp1 = (DirectPositionImpl) transform.transform(thispos, dp1); newpositions.add(dp1); } // use the new positions list to build a new curve and return it LineString lineString = geometryFactory.createLineString(newpositions); List curveSegmentList = Collections.singletonList(lineString); CurveImpl newCurve = (CurveImpl) primitiveFactory.createCurve(curveSegmentList); return newCurve; }
LineString lineString = geometryFactory.createLineString(newpositions); List curveSegmentList = Collections.singletonList(lineString); CurveImpl newCurve = (CurveImpl) primitiveFactory.createCurve(curveSegmentList);
public static Ring linearRingToRing(final org.locationtech.jts.geom.LineString jtsLinearRing, final CoordinateReferenceSystem crs) { int numPoints = jtsLinearRing.getNumPoints(); if (numPoints != 0 && !jtsLinearRing.getCoordinateN(0).equals(jtsLinearRing.getCoordinateN(numPoints - 1))) { throw new IllegalArgumentException("LineString must be a ring"); } PrimitiveFactory pf = new JTSPrimitiveFactory(crs); //FactoryFinder.getPrimitiveFactory(hints); GeometryFactory gf = new JTSGeometryFactory(crs); //FactoryFinder.getGeometryFactory(hints); LineString ls = gf.createLineString(new ArrayList()); List pointList = ls.getControlPoints().positions(); for (int i = 0; i < numPoints; i++) { pointList.add(coordinateToDirectPosition(jtsLinearRing.getCoordinateN(i), crs)); } Curve curve = pf.createCurve(new ArrayList()); // Cast below can be removed when Types will be allowed to abandon Java 1.4 support. ((List) curve.getSegments()).add(ls); Ring result = pf.createRing(new ArrayList()); // Cast below can be removed when Types will be allowed to abandon Java 1.4 support. ((List) result.getGenerators()).add(curve); return result; }
public static Ring linearRingToRing(com.vividsolutions.jts.geom.LineString jtsLinearRing, CoordinateReferenceSystem crs) { int numPoints = jtsLinearRing.getNumPoints(); if (! jtsLinearRing.getCoordinateN(0).equals(jtsLinearRing.getCoordinateN(numPoints-1))) { throw new IllegalArgumentException("LineString must be a ring"); } Hints hints = new Hints( Hints.CRS, crs ); PrimitiveFactory pf = GeometryFactoryFinder.getPrimitiveFactory(hints); GeometryFactory gf = GeometryFactoryFinder.getGeometryFactory(hints); LineString ls = gf.createLineString(new ArrayList()); List pointList = ls.getControlPoints(); for (int i=0; i<numPoints; i++) { pointList.add(coordinateToDirectPosition(jtsLinearRing.getCoordinateN(i), crs)); } Curve curve = pf.createCurve(new ArrayList()); // Cast below can be removed when GeoAPI will be allowed to abandon Java 1.4 support. ((List) curve.getSegments()).add(ls); Ring result = pf.createRing(new ArrayList()); // Cast below can be removed when GeoAPI will be allowed to abandon Java 1.4 support. ((List) result.getGenerators()).add(curve); return result; }
public static Ring linearRingToRing(com.vividsolutions.jts.geom.LineString jtsLinearRing, CoordinateReferenceSystem crs) { int numPoints = jtsLinearRing.getNumPoints(); if (! jtsLinearRing.getCoordinateN(0).equals(jtsLinearRing.getCoordinateN(numPoints-1))) { throw new IllegalArgumentException("LineString must be a ring"); } Hints hints = new Hints( Hints.CRS, crs ); PrimitiveFactory pf = GeometryFactoryFinder.getPrimitiveFactory(hints); GeometryFactory gf = GeometryFactoryFinder.getGeometryFactory(hints); LineString ls = gf.createLineString(new ArrayList()); List pointList = ls.getControlPoints().positions(); for (int i=0; i<numPoints; i++) { pointList.add(coordinateToDirectPosition(jtsLinearRing.getCoordinateN(i), crs)); } Curve curve = pf.createCurve(new ArrayList()); curve.getSegments().add(ls); Ring result = pf.createRing(new ArrayList()); result.getGenerators().add(curve); return result; }
(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++) {
(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++) {
LineString ls = gf.createLineString(new ArrayList<Position>()); PointArray pointList = ls.getControlPoints(); for (int i = 0, n = candidate.getNumPoints(); i < n; i++) {