/** * Create a wkt writer with the given flags and formatter. * * @param flags * signaling the capabilities of this writer, if <code>null</code> only some geometries can be exported * (all dialects are disabled). * @param formatter * to use, if <code>null</code> the default decimal formatter with 5 decimals is used. */ public WKTWriter( Set<WKTFlag> flags, CoordinateFormatter formatter ) { this.flags = flags; if ( this.flags == null ) { this.flags = new HashSet<WKTFlag>(); } if ( formatter == null ) { this.formatter = new DecimalCoordinateFormatter(); } else { this.formatter = formatter; } }
private static GMLStreamWriter createGml32StreamWriter( XMLStreamWriter writer ) throws XMLStreamException { GMLStreamWriter gmlWriter = GMLOutputFactory.createGMLStreamWriter( GML_32, writer ); gmlWriter.setCoordinateFormatter( new DecimalCoordinateFormatter( 3 ) ); Map<String, String> bindings = new HashMap<String, String>(); bindings.put( GML_PREFIX, GML3_2_NS ); writer.writeNamespace( GML_PREFIX, GML3_2_NS ); gmlWriter.setNamespaceBindings( bindings ); return gmlWriter; }
/** * Creates a new {@link GML2GeometryWriter} instance. * * @param gmlStream * gml stream writer, must not be <code>null</code> */ public GML2GeometryWriter( GMLStreamWriter gmlStream ) { super( gmlStream ); this.outputCRS = gmlStream.getOutputCrs(); this.simplifier = gmlStream.getGeometrySimplifier(); IUnit crsUnits = null; if ( outputCRS != null ) { try { ICRS crs = outputCRS; crsUnits = crs.getAxis()[0].getUnits(); transformer = new CoordinateTransformer( crs ); transformedOrdinates = new double[crs.getDimension()]; // geoTransformer = new GeometryTransformer( crs ); } catch ( Exception e ) { LOG.debug( "Could not create transformer for CRS '" + outputCRS + "': " + e.getMessage() + ". Encoding will fail if a transformation is actually necessary." ); } } formatter = gmlStream.getCoordinateFormatter(); if ( formatter == null ) { formatter = new DecimalCoordinateFormatter( crsUnits ); } }
/** * Creates a new {@link GML3GeometryWriter} instance. * * @param gmlStreamWriter * gml stream writer, must not be <code>null</code> */ public GML3GeometryWriter( GMLStreamWriter gmlStreamWriter ) { super( gmlStreamWriter ); this.outputCRS = gmlStreamWriter.getOutputCrs(); this.simplifier = gmlStreamWriter.getGeometrySimplifier(); IUnit crsUnits = null; if ( outputCRS != null ) { try { ICRS crs = outputCRS; crsUnits = crs.getAxis()[0].getUnits(); transformer = new CoordinateTransformer( crs ); transformedOrdinates = new double[crs.getDimension()]; geoTransformer = new GeometryTransformer( crs ); } catch ( Exception e ) { LOG.debug( "Could not create transformer for CRS '" + outputCRS + "': " + e.getMessage() + ". Encoding will fail if a transformation is actually necessary." ); } } formatter = gmlStreamWriter.getCoordinateFormatter(); if ( formatter == null ) { formatter = new DecimalCoordinateFormatter( crsUnits ); } }
final CoordinateFormatter formatter = new DecimalCoordinateFormatter( 8 ); try { latlon = CRSManager.lookup( "CRS:84" );
LOG.info( "Setting up configured DecimalCoordinateFormatter." ); org.deegree.services.jaxb.wfs.DecimalCoordinateFormatter decimalFormatterConf = (org.deegree.services.jaxb.wfs.DecimalCoordinateFormatter) formatterConf; formatter = new DecimalCoordinateFormatter( decimalFormatterConf.getPlaces().intValue() ); } else if ( formatterConf instanceof org.deegree.services.jaxb.wfs.CustomCoordinateFormatter ) { LOG.info( "Setting up CustomCoordinateFormatter." );
gmlWriter.setCoordinateFormatter( new DecimalCoordinateFormatter( 3 ) ); Map<String, String> bindings = new HashMap<String, String>(); bindings.put( "gml", GML_31.getNamespace() );
public static void writeSrsAndEnvelope( XMLStreamWriter writer, List<ICRS> crsList, Envelope layerEnv ) throws XMLStreamException { writeSrs( crsList, writer ); final CoordinateFormatter formatter = new DecimalCoordinateFormatter( 8 ); ICRS latlon; try {