request.setRawKvp(rawKvp);
@SuppressWarnings("unchecked") private GetMapRequest initGetMapRequest(QName... names) { GetMapRequest request = createGetMapRequest(names); request.setRawKvp(new KvpMap(request.getRawKvp())); String layers = request.getLayers() .stream() .map(MapLayerInfo::getName) .collect(Collectors.joining(",")); request.getRawKvp().put("layers", layers); request.setFormat(DefaultWebMapService.FORMAT); DefaultWebMapService.autoSetBoundsAndSize(request); return request; }
GetMapRequest getMap = (GetMapRequest) super.read(request, kvp, rawKvp); getMap.setRawKvp(rawKvp);
@Test public void testTimeDimension() throws Exception { MapLayerInfo mapLayerInfo = new MapLayerInfo(getCatalog().getLayerByName(WATTEMP_TIME.getLocalPart())); final GridCoverage2DReader reader = (GridCoverage2DReader) mapLayerInfo.getCoverageReader(); GetMapRequest req = new GetMapRequest(); req.setRawKvp(new HashMap<String, String>()); req.getRawKvp() .put( "DIM_" + CustomFormat.CUSTOM_DIMENSION_NAME, "2001-05-01T00:00:00.000Z, 2001-05-02T00:00:00.000Z"); GeneralParameterValue[] readParam = wms.getWMSReadParameters( req, mapLayerInfo, Filter.INCLUDE, null, null, reader, false); @SuppressWarnings("unchecked") ParameterValue<List<Date>> val = (ParameterValue<List<Date>>) readParam[readParam.length - 1]; assertEquals(2, val.getValue().size()); assertEquals(DF.parse("2001-05-01 00:00:00"), val.getValue().get(0)); assertEquals(DF.parse("2001-05-02 00:00:00"), val.getValue().get(1)); }
/** * See GEOS-5003 */ public void testNullsInDimensionAndTimeParameters() throws Exception { TileLayerInfoUtil.updateAcceptAllFloatParameterFilter(tileLayerInfo, "ELEVATION", true); TileLayerInfoUtil.updateAcceptAllRegExParameterFilter(tileLayerInfo, "TIME", true); tileLayer = new GeoServerTileLayer(layer, gridSetBroker, tileLayerInfo); GetMapRequest request = new GetMapRequest(); @SuppressWarnings("unchecked") Map<String, String> rawKvp = new CaseInsensitiveMap(new HashMap<String, String>()); request.setRawKvp(rawKvp); StringBuilder target = new StringBuilder(); boolean cachingPossible; request.setElevation(Arrays.asList((Object) null)); cachingPossible = mediator.isCachingPossible(tileLayer, request, target); assertTrue(cachingPossible); assertEquals(0, target.length()); request.setElevation(Collections.emptyList()); request.setTime(Arrays.asList((Object) null)); cachingPossible = mediator.isCachingPossible(tileLayer, request, target); assertTrue(cachingPossible); assertEquals(0, target.length()); }
@Test public void testCustomDepthListDimension() throws Exception { MapLayerInfo mapLayerInfo = new MapLayerInfo(getCatalog().getLayerByName(WATTEMP_DEPTH.getLocalPart())); final GridCoverage2DReader reader = (GridCoverage2DReader) mapLayerInfo.getCoverageReader(); GetMapRequest req = new GetMapRequest(); req.setRawKvp(new HashMap<String, String>()); req.getRawKvp().put("DIM_" + CustomFormat.CUSTOM_DIMENSION_NAME, "10,50"); GeneralParameterValue[] readParam = wms.getWMSReadParameters( req, mapLayerInfo, Filter.INCLUDE, null, null, reader, false); @SuppressWarnings("unchecked") ParameterValue<List<Double>> val = (ParameterValue<List<Double>>) readParam[readParam.length - 1]; assertEquals(10, (Double) val.getValue().get(0), 1E-6); assertEquals(50, (Double) val.getValue().get(1), 1E-6); } }
@Test public void testCustomDepthIntervalDimension() throws Exception { MapLayerInfo mapLayerInfo = new MapLayerInfo(getCatalog().getLayerByName(WATTEMP_DEPTH.getLocalPart())); final GridCoverage2DReader reader = (GridCoverage2DReader) mapLayerInfo.getCoverageReader(); GetMapRequest req = new GetMapRequest(); req.setRawKvp(new HashMap<String, String>()); req.getRawKvp().put("DIM_" + CustomFormat.CUSTOM_DIMENSION_NAME, "10/50"); GeneralParameterValue[] readParam = wms.getWMSReadParameters( req, mapLayerInfo, Filter.INCLUDE, null, null, reader, false); @SuppressWarnings("unchecked") ParameterValue<List<NumberRange>> val = (ParameterValue<List<NumberRange>>) readParam[readParam.length - 1]; assertEquals(new NumberRange<Double>(Double.class, 10d, 50d), val.getValue().get(0)); }
request.setCrs(DefaultGeographicCRS.WGS84); request.setSRS("EPSG:4326"); request.setRawKvp(new HashMap()); return request;
public GetMapRequest createRequest() { GetMapRequest request; request = new GetMapRequest(); request.setFormat(DummyRasterMapProducer.MIME_TYPE); request.setWidth(512); request.setHeight(256); Envelope envelope = new Envelope(-180, 180, -90, 90); request.setBbox(envelope); request.setSRS("EPSG:4326"); request.setCrs(DefaultGeographicCRS.WGS84); try { request.setStyles(Collections.singletonList(defaultStyle.getStyle())); } catch (IOException e) { throw new RuntimeException("shouldn't happen", e); } request.setRawKvp(new HashMap<String, String>()); request.setBaseUrl("http://example.geoserver.org/geoserver"); return request; }
request.setRawKvp(rawKvp); request.setFormat("image/png");
protected WMSMapContent createMapContent(double dpi) { GetMapRequest request = new GetMapRequest(); request.setWidth(1000); request.setHeight(1000); request.setRawKvp(new HashMap<String, String>()); if (dpi > 0) { request.getFormatOptions().put("dpi", dpi); } WMSMapContent map = new WMSMapContent(request); map.setMapWidth(request.getWidth()); map.setMapHeight(request.getHeight()); map.getViewport() .setBounds( new ReferencedEnvelope( new Envelope(0, 0.01, 0, 0.01), DefaultGeographicCRS.WGS84)); return map; }
request.setRawKvp(new HashMap<String, String>()); return request;
request.setRawKvp(new HashMap<String, String>()); request.setBuffer(buffer); return request;
request.setRawKvp(rawKvp);
request.setRawKvp(rawKvp);
request.setRawKvp(Collections.emptyMap()); request.setFormat(format); WMSMapContent mapContent = new WMSMapContent(request);
request.setRawKvp(rawKvp); request.setFormat("image/png"); request.setSRS("EPSG:900913");
request.setRawKvp(rawKvp);