private AttachmentPart createAttachment( GetMap getMap, ByteArrayOutputStream stream, SOAPMessage message, String contentId ) { DataSource ds = new ByteArrayDataSource( stream.toByteArray() ); DataHandler dataHandler = new DataHandler( ds ); AttachmentPart attachmentPart = message.createAttachmentPart( dataHandler ); attachmentPart.setContentId( contentId ); attachmentPart.setContentType( getMap.getFormat() ); return attachmentPart; }
private LinkedList<String> doGetMap( GetMap getMap, Map<String, String> map, Version version, OutputStream stream ) throws OWSException, IOException { checkGetMap( version, getMap ); RenderingInfo info = new RenderingInfo( getMap.getFormat(), getMap.getWidth(), getMap.getHeight(), getMap.getTransparent(), getMap.getBgColor(), getMap.getBoundingBox(), getMap.getPixelSize(), map, imageSerializers.get( getMap.getFormat() ) ); RenderContext ctx = ouputFormatProvider.getRenderers( info, stream ); LinkedList<String> headers = new LinkedList<String>(); service.getMap( getMap, headers, ctx ); ctx.close(); return headers; }
private void doGetMap( Map<String, String> map, HttpResponseBuffer response, Version version, GetMap gm ) throws OWSException, IOException { LinkedList<String> headers = doGetMap( gm, map, version, response.getOutputStream() ); response.setContentType( gm.getFormat() ); addHeaders( response, headers ); }
/** * @param hardParameters * parameters to override in the request, may be null * @throws IOException */ public Pair<BufferedImage, String> getMap( GetMap getMap, Map<String, String> hardParameters, int timeout, boolean errorsInImage ) throws IOException { if ( VERSION_111.equals( wmsVersion ) ) { Worker worker = new Worker( getMap.getLayers(), getMap.getStyles(), getMap.getWidth(), getMap.getHeight(), getMap.getBoundingBox(), getMap.getCoordinateSystem(), getMap.getFormat(), getMap.getTransparent(), errorsInImage, false, null, hardParameters ); Pair<BufferedImage, String> result; try { if ( timeout == -1 ) { result = worker.call(); } else { result = Executor.getInstance().performSynchronously( worker, timeout * 1000 ); } } catch ( Throwable e ) { throw new IOException( e.getMessage(), e ); } return result; } throw new IllegalArgumentException( "GetMap request for other versions than 1.1.1 are not supported yet." ); }