private LayerQuery buildQuery( StyleRef style, LayerRef lr, MapOptionsMaps options, List<MapOptions> mapOptions, OperatorFilter f, org.deegree.protocol.wms.ops.GetMap gm) { for (org.deegree.layer.Layer l : Themes.getAllLayers(themeMap.get(lr.getName()))) { insertMissingOptions( l.getMetadata().getName(), options, l.getMetadata().getMapOptions(), defaultLayerOptions); mapOptions.add(options.get(l.getMetadata().getName())); } LayerQuery query = new LayerQuery( gm.getBoundingBox(), gm.getWidth(), gm.getHeight(), style, f, gm.getParameterMap(), gm.getDimensions(), gm.getPixelSize(), options, gm.getQueryBox()); return query; }
public void getMap( org.deegree.protocol.wms.ops.GetMap gm, List<String> headers, RenderContext ctx) throws OWSException { Iterator<StyleRef> styleItr = gm.getStyles().iterator(); MapOptionsMaps options = gm.getRenderingOptions(); List<MapOptions> mapOptions = new ArrayList<MapOptions>(); double scale = gm.getScale(); List<LayerQuery> queries = new ArrayList<LayerQuery>(); Iterator<LayerRef> layerItr = gm.getLayers().iterator(); List<OperatorFilter> filters = gm.getFilters(); Iterator<OperatorFilter> filterItr = filters == null ? null : filters.iterator(); while (layerItr.hasNext()) { LayerRef lr = layerItr.next(); StyleRef sr = styleItr.next(); OperatorFilter f = filterItr == null ? null : filterItr.next(); LayerQuery query = buildQuery(sr, lr, options, mapOptions, f, gm); queries.add(query); } ListIterator<LayerQuery> queryIter = queries.listIterator(); ScaleFunction.getCurrentScaleValue().set(scale); List<LayerData> layerDataList = checkStyleValidAndBuildLayerDataList(gm, headers, scale, queryIter); Iterator<MapOptions> optIter = mapOptions.iterator(); for (LayerData d : layerDataList) { ctx.applyOptions(optIter.next()); try { d.render(ctx); } catch (InterruptedException e) { String msg = "Request time-out."; throw new OWSException(msg, NO_APPLICABLE_CODE); } } ctx.optimizeAndDrawLabels(); ScaleFunction.getCurrentScaleValue().remove(); }
private List<LayerData> checkStyleValidAndBuildLayerDataList( org.deegree.protocol.wms.ops.GetMap gm, List<String> headers, double scale, ListIterator<LayerQuery> queryIter) throws OWSException { List<LayerData> layerDataList = new ArrayList<LayerData>(); for (LayerRef lr : gm.getLayers()) { LayerQuery query = queryIter.next(); List<Layer> layers = getAllLayers(themeMap.get(lr.getName())); assertStyleApplicableForAtLeastOneLayer(layers, query.getStyle(), lr.getName()); for (org.deegree.layer.Layer layer : layers) { if (layer.getMetadata().getScaleDenominators().first > scale || layer.getMetadata().getScaleDenominators().second < scale) { continue; } if (layer.isStyleApplicable(query.getStyle())) { layerDataList.add(layer.mapQuery(query, headers)); } } } return layerDataList; }