/** * Writes the POLYGON * * @param geometry * @param writer * @throws IOException */ public void writePolygon( Polygon geometry, Writer writer ) throws IOException { writer.append( "POLYGON " ); if ( flags.contains( WKTFlag.USE_DKT ) ) { appendObjectProps( writer, geometry ); } writePolygonWithoutPrefix( geometry, writer ); }
/** * Writes the POINT * * @param geometry * @param writer * @throws IOException */ public void writePoint( Point geometry, Writer writer ) throws IOException { writer.append( "POINT " ); if ( flags.contains( WKTFlag.USE_DKT ) ) { appendObjectProps( writer, geometry ); } writer.append( '(' ); writePointWithoutPrefix( geometry, writer ); writer.append( ')' ); }
/** * Writes a LineString. * * @param geometry * @param writer * @throws IOException */ public void writeLineString( LineString geometry, Writer writer ) throws IOException { writer.append( "LINESTRING " ); if ( flags.contains( WKTFlag.USE_DKT ) ) { appendObjectProps( writer, geometry ); } writer.append( '(' ); writeLineStringWithoutPrefix( geometry, writer ); writer.append( ')' ); }
appendObjectProps( writer, geometry ); writer.append( '(' );
/** * Writes a multiCurve. * * @param geometry * @param writer * @throws IOException */ public void writeMultiCurve( MultiCurve<Curve> geometry, Writer writer ) throws IOException { writer.append( "MULTILINESTRING " ); if ( flags.contains( WKTFlag.USE_DKT ) ) { appendObjectProps( writer, geometry ); } writer.append( '(' ); for ( int i = 0; i < geometry.size(); i++ ) { writeCurveGeometryWithoutPrefix( geometry.get( i ), writer ); if ( i < geometry.size() - 1 ) { writer.append( ',' ); } } writer.append( ')' ); }
/** * Writes the multiLineString. * * @param geometry * @param writer * @throws IOException */ public void writeMultiLineString( MultiLineString geometry, Writer writer ) throws IOException { writer.append( "MULTILINESTRING " ); if ( flags.contains( WKTFlag.USE_DKT ) ) { appendObjectProps( writer, geometry ); } writer.append( '(' ); for ( int i = 0; i < geometry.size(); i++ ) { writer.append( '(' ); writeLineStringWithoutPrefix( geometry.get( i ), writer ); if ( i < geometry.size() - 1 ) { writer.append( ',' ); } writer.append( ')' ); } writer.append( ')' ); }
/** * Writes the multiPolygon. * * @param geometry * @param writer * @throws IOException */ public void writeMultiPolygon( MultiPolygon geometry, Writer writer ) throws IOException { writer.append( "MULTIPOLYGON " ); if ( flags.contains( WKTFlag.USE_DKT ) ) { appendObjectProps( writer, geometry ); } writer.append( '(' ); for ( int i = 0; i < geometry.size(); i++ ) { writePolygonWithoutPrefix( geometry.get( i ), writer ); if ( i < geometry.size() - 1 ) { writer.append( ',' ); } } writer.append( ')' ); }
/** * Writes a multiSurface. * * @param geometry * @param writer * @throws IOException */ public void writeMultiSurface( MultiSurface<Surface> geometry, Writer writer ) throws IOException { writer.append( "MULTIPOLYGON " ); if ( flags.contains( WKTFlag.USE_DKT ) ) { appendObjectProps( writer, geometry ); } writer.append( '(' ); for ( int i = 0; i < geometry.size(); i++ ) { writePolygonWithoutPrefix( geometry.get( i ), writer ); if ( i < geometry.size() - 1 ) { writer.append( ',' ); } } writer.append( ')' ); }
/** * Writes the multiPoint. * * @param geometry * @param writer * @throws IOException */ public void writeMultiPoint( MultiPoint geometry, Writer writer ) throws IOException { writer.append( "MULTIPOINT " ); if ( flags.contains( WKTFlag.USE_DKT ) ) { appendObjectProps( writer, geometry ); } writer.append( '(' ); for ( int i = 0; i < geometry.size(); i++ ) { writePointWithoutPrefix( geometry.get( i ), writer ); if ( i < geometry.size() - 1 ) { writer.append( ',' ); } } writer.append( ')' ); }
/** * * * @param geometry * @param writer * @throws IOException */ public void writeSurfaceGeometry( Surface geometry, Writer writer ) throws IOException { if ( flags.contains( WKTFlag.USE_DKT ) ) { writer.append( "SURFACE " ); appendObjectProps( writer, geometry ); writer.append( '(' ); writeSurfacePatch( geometry, writer ); } else if ( flags.contains( WKTFlag.USE_SQL_MM ) ) { throw new UnsupportedOperationException( "Handling SQL MM Part 3 is not implemented yet." ); } else { writer.append( "MULTIPOLYGON (" ); SurfaceLinearizer cl = new SurfaceLinearizer( new GeometryFactory() ); LinearizationCriterion crit = new NumPointsCriterion( linearizedControlPoints ); Surface surface = cl.linearize( geometry, crit ); writeSurfacePatch( surface, writer ); } writer.append( ')' ); }
/** * 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 ); } }
appendObjectProps( writer, envelope ); writer.append( '(' ); writer.append( formatter.format( pMinX ) + ' ' + formatter.format( pMinY ) + ',' );
/** * Writes a linearRing. * * @param geometry * @param writer * @throws IOException */ public void writeLinearRing( LinearRing geometry, Writer writer ) throws IOException { if ( flags.contains( WKTFlag.USE_DKT ) ) { writer.append( "LINEARRING " ); appendObjectProps( writer, geometry ); LineString ls = new DefaultLineString( geometry.getId(), geometry.getCoordinateSystem(), geometry.getPrecision(), geometry.getControlPoints() ); writer.append( '(' ); writeLineStringWithoutPrefix( ls, writer ); writer.append( ')' ); } else if ( flags.contains( WKTFlag.USE_LINEARRING ) ) { writer.append( "LINEARRING " ); LineString ls = new DefaultLineString( geometry.getId(), geometry.getCoordinateSystem(), geometry.getPrecision(), geometry.getControlPoints() ); writer.append( '(' ); writeLineStringWithoutPrefix( ls, writer ); writer.append( ')' ); } else { LineString ls = new DefaultLineString( geometry.getId(), geometry.getCoordinateSystem(), geometry.getPrecision(), geometry.getControlPoints() ); writeLineString( ls, writer ); } }