@Override public Points getControlPoints() { List<Points> pointsList = new ArrayList<Points>( memberCurves.size() ); for ( Curve curve : memberCurves ) { pointsList.add( curve.getControlPoints() ); } return new PointsPoints( pointsList ); } }
@Override public Points getControlPoints() { return getReferencedObject().getControlPoints(); }
/** * @param curve * @throws XMLStreamException * @throws UnknownCRSException * @throws TransformationException */ public void exportLineString( Curve curve ) throws XMLStreamException, TransformationException, UnknownCRSException { startGeometry( "LineString", curve ); exportCoordinates( curve.getControlPoints() ); writer.writeEndElement(); // </gml:LineString> }
/** * Writes a CURVE * * @param geometry * @param writer * @throws IOException */ public void writeCurveGeometry( Curve geometry, Writer writer ) throws IOException { if ( flags.contains( WKTFlag.USE_DKT ) ) { writer.append( "CURVE " ); appendObjectProps( writer, geometry ); writer.append( '(' ); writeCurveSegments( geometry, writer ); writer.append( ')' ); } else if ( flags.contains( WKTFlag.USE_SQL_MM ) ) { // s.append( "COMPOUNDCURVE(" ); throw new UnsupportedOperationException( "Handling curves within 'SQL-MM Part 3' is not implemented yet." ); } else { CurveLinearizer cl = new CurveLinearizer( new GeometryFactory() ); LinearizationCriterion crit = new NumPointsCriterion( linearizedControlPoints ); Curve c = cl.linearize( geometry, crit ); LineString ls = new DefaultLineString( c.getId(), c.getCoordinateSystem(), c.getPrecision(), c.getControlPoints() ); writeLineString( ls, writer ); } }
/** * Writes the CURVE without the 'CURVE()'-specific envelope. <br/> * It writes just the CURVE-coordinates. * * @param geometry * @param writer * @throws IOException */ private void writeCurveGeometryWithoutPrefix( Curve geometry, Writer writer ) throws IOException { if ( flags.contains( WKTFlag.USE_SQL_MM ) ) { throw new UnsupportedOperationException( "Handling curves within 'SQL-MM Part 3' is not implemented yet." ); } CurveLinearizer cl = new CurveLinearizer( new GeometryFactory() ); LinearizationCriterion crit = new NumPointsCriterion( linearizedControlPoints ); Curve c = cl.linearize( geometry, crit ); LineString ls = new DefaultLineString( c.getId(), c.getCoordinateSystem(), c.getPrecision(), c.getControlPoints() ); writer.append( '(' ); writeLineStringWithoutPrefix( ls, writer ); writer.append( ')' ); }
Double fromCurve( Curve curve, boolean close ) { Double line = new Double(); // TODO use error criterion ICRS crs = curve.getCoordinateSystem(); curve = linearizer.linearize( curve, new NumPointsCriterion( 100 ) ); curve.setCoordinateSystem( crs ); Points points = curve.getControlPoints(); Iterator<Point> iter = points.iterator(); Point p = iter.next(); double x = p.get0(), y = p.get1(); line.moveTo( x, y ); while ( iter.hasNext() ) { p = iter.next(); if ( iter.hasNext() ) { line.lineTo( p.get0(), p.get1() ); } else { if ( close && isZero( x - p.get0() ) && isZero( y - p.get1() ) ) { line.closePath(); } else { line.lineTo( p.get0(), p.get1() ); } } } line.transform( worldToScreen ); return line; }