protected LayerScaleRenderer getOrCreate(double scale) { if (tiledScaleRenderers.containsKey(scale)) { return tiledScaleRenderers.get(scale); } final HtmlContainer container = new HtmlGroup(); //container.getElement().setId("scale-" + scale); htmlContainer.insert(container, 0); LayerScaleRenderer scalePresenter = null; if (layer instanceof RasterServerLayer) { scalePresenter = rasterRendererFactory.create(this, viewPort.getCrs(), (RasterServerLayer) layer, container, scale); } else if (layer instanceof VectorServerLayer) { scalePresenter = rasterRendererFactory.create(this, viewPort.getCrs(), (VectorServerLayer) layer, container, scale); } if (scalePresenter != null) { tiledScaleRenderers.put(scale, scalePresenter); } return scalePresenter; }
@Override public void search(final FeaturesSupported layer, SearchCriterion[] criteria, LogicalOperator operator, int maxResultSize, final FeatureMapFunction callback) { SearchFeatureRequest request = new SearchFeatureRequest(); request.setBooleanOperator(operator.getValue()); request.setCriteria(criteria); request.setMax(maxResultSize); if (layer instanceof ServerLayer) { ServerLayer<?> serverLayer = (ServerLayer<?>) layer; request.setLayerId(serverLayer.getServerLayerId()); } request.setCrs(mapPresenter.getViewPort().getCrs()); request.setFilter(layer.getFilter()); request.setFeatureIncludes(11); GwtCommand command = new GwtCommand(SearchFeatureRequest.COMMAND); command.setCommandRequest(request); commandService.execute(command, new AbstractCommandCallback<SearchFeatureResponse>() { public void execute(SearchFeatureResponse response) { List<Feature> features = new ArrayList<Feature>(); for (org.geomajas.layer.feature.Feature feature : response.getFeatures()) { features.add(featureFactory.create(feature, layer)); } Map<FeaturesSupported, List<Feature>> mapping = new HashMap<FeaturesSupported, List<Feature>>(); mapping.put(layer, features); callback.execute(mapping); } }); }
@Override public void search(final FeaturesSupported layer, Geometry location, double buffer, final FeatureMapFunction callback) { SearchByLocationRequest request = new SearchByLocationRequest(); request.setBuffer(buffer); if (layer instanceof ServerLayer) { ServerLayer<?> serverLayer = (ServerLayer<?>) layer; request.addLayerWithFilter(serverLayer.getServerLayerId(), serverLayer.getServerLayerId(), layer.getFilter()); } request.setLocation(location); request.setSearchType(SearchLayerType.SEARCH_ALL_LAYERS.getValue()); request.setCrs(mapPresenter.getViewPort().getCrs()); request.setFeatureIncludes(11); GwtCommand command = new GwtCommand(SearchByLocationRequest.COMMAND); command.setCommandRequest(request); commandService.execute(command, new AbstractCommandCallback<SearchByLocationResponse>() { public void execute(SearchByLocationResponse response) { for (List<org.geomajas.layer.feature.Feature> dtos : response.getFeatureMap().values()) { List<Feature> features = new ArrayList<Feature>(dtos.size()); for (org.geomajas.layer.feature.Feature feature : dtos) { features.add(featureFactory.create(feature, layer)); } Map<FeaturesSupported, List<Feature>> map = new HashMap<FeaturesSupported, List<Feature>>(); map.put(layer, features); callback.execute(map); } } }); }
request.setSearchType(searchType.getValue()); request.setRatio(ratio); request.setCrs(mapPresenter.getViewPort().getCrs()); request.setFeatureIncludes(11);