/** @see org.geoserver.wms.GetMapOutputFormat#produceMap(org.geoserver.wms.WMSMapContent) */ public RawMap produceMap(WMSMapContent mapContent) throws ServiceException, IOException { if (isOL3Enabled(mapContent) && ol3Format.browserSupportsOL3(mapContent)) { return ol3Format.produceMap(mapContent); } else { return ol2Format.produceMap(mapContent); } }
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"); }
@Override protected String getTemplateName(WMSMapContent mapContent) { if (!browserSupportsOL3(mapContent)) { throw new ServiceException("OpenLayers 3 is not supported on the current browser"); } return OL3_TEMPLATE_FTL; }