@Override public void write(Object value, OutputStream output, Operation operation) throws IOException, ServiceException { Assert.isInstanceOf(RawMap.class, value); RawMap map = (RawMap) value; try { map.writeTo(output); output.flush(); } finally { map.dispose(); } } }
private String decode(RawMap map) throws IOException { ByteArrayOutputStream bos = new ByteArrayOutputStream(); map.writeTo(bos); bos.close(); String out = new String(bos.toByteArray(), "UTF-8"); return out; }
private String decode(RawMap map) throws IOException { ByteArrayOutputStream bos = new ByteArrayOutputStream(); map.writeTo(bos); bos.close(); String out = new String(bos.toByteArray(), "UTF-8"); return out; } }
String getAsHTMLOL3(WMSMapContent map) throws IOException { OpenLayers3MapOutputFormat mapProducer = GeoServerExtensions.extensions(OpenLayers3MapOutputFormat.class).get(0); RawMap rawMap = mapProducer.produceMap(map); ByteArrayOutputStream bos = new ByteArrayOutputStream(); rawMap.writeTo(bos); return new String(bos.toByteArray(), "UTF-8"); }
String getAsHTML(WMSMapContent map) throws IOException { OpenLayersMapOutputFormat mapProducer = GeoServerExtensions.extensions(OpenLayersMapOutputFormat.class).get(0); RawMap rawMap = mapProducer.produceMap(map); ByteArrayOutputStream bos = new ByteArrayOutputStream(); rawMap.writeTo(bos); return new String(bos.toByteArray(), "UTF-8"); }
private ListMultimap<String, Feature> decode(RawMap map) throws IOException { ArrayListMultimap<String, VectorTileDecoder.Feature> byLayer = ArrayListMultimap.create(); ByteArrayOutputStream bos = new ByteArrayOutputStream(); map.writeTo(bos); bos.close(); VectorTileDecoder decoder = new VectorTileDecoder(); decoder.setAutoScale(false); for (Feature feat : decoder.decode(bos.toByteArray())) { // System.out.println(feat.getLayerName() + ": "); // System.out.print(feat.getAttributes()); // System.out.println(feat.getGeometry()); byLayer.put(feat.getLayerName(), feat); } return byLayer; }
private ListMultimap<String, Feature> decode(RawMap map) throws IOException { ArrayListMultimap<String, VectorTileDecoder.Feature> byLayer = ArrayListMultimap.create(); ByteArrayOutputStream bos = new ByteArrayOutputStream(); map.writeTo(bos); bos.close(); VectorTileDecoder decoder = new VectorTileDecoder(); decoder.setAutoScale(false); for (Feature feat : decoder.decode(bos.toByteArray())) { // System.out.println(feat.getLayerName() + ": "); // System.out.print(feat.getAttributes()); // System.out.println(feat.getGeometry()); byLayer.put(feat.getLayerName(), feat); } return byLayer; }
@Test public void testInputStream() throws Exception { InputStream stream = createMock(InputStream.class); expect(stream.read((byte[]) anyObject())).andReturn(-1).once(); replay(stream); WMSMapContent map = createNiceMock(WMSMapContent.class); replay(map); new RawMap(map, stream, "text/plain").writeTo(null); verify(stream); } }
OutputStream outStream = target.getOutputStream(); try { ((RawMap) metaTileMap).writeTo(outStream); } finally { outStream.close();