private Layer createLayer(ClientLayerInfo layerInfo) { ServerLayer<?> layer = null; switch (layerInfo.getLayerType()) { case RASTER: layer = layerFactory.createRasterLayer((ClientRasterLayerInfo) layerInfo, viewPort, eventBus); break; default: layer = layerFactory.createVectorLayer((ClientVectorLayerInfo) layerInfo, viewPort, eventBus); break; } if (!mapInfo.getLayers().contains(layer.getLayerInfo())) { mapInfo.getLayers().add(layer.getLayerInfo()); } return layer; }
public boolean removeLayer(String id) { Layer layer = getLayer(id); if (layer != null) { int index = getLayerPosition(layer); layers.remove(layer); if (layer instanceof ServerLayer) { ServerLayer<?> serverLayer = (ServerLayer<?>) layer; mapInfo.getLayers().remove(serverLayer.getLayerInfo()); } eventBus.fireEvent(new LayerRemovedEvent(layer, index)); return true; } return false; }
applicationInfo.getMaps().get(0).getLayers() .add(clonedLayerConfiguration.getClientLayerInfo()); } catch (Exception e) {
for (ClientLayerInfo layerInfo : mapInfo.getLayers()) { Layer layer = createLayer(layerInfo); addLayer(layer);
applicationInfo.getMaps().get(0).getLayers() .add(clonedLayerConfiguration.getClientLayerInfo()); } catch (Exception e) {
/** * Updates blueprint that has no layers set so that the layers configured in the userApplication are inserted into * the database. * */ @Transactional(rollbackFor = { Exception.class }) private void updateBluePrintMainMapFromUserApplication(Blueprint bp) { UserApplicationInfo uai = getUserApplication(bp.getUserApplicationKey()); if (uai != null) { ClientMapInfo mainMap = null; for (ClientMapInfo map : uai.getApplicationInfo().getMaps()) { if (GdmLayout.MAPMAIN_ID.equals(map.getId())) { mainMap = map; } } Map<String, LayerModel> layerModels = new HashMap<String, LayerModel>(); for (LayerModel lm : layerModelService.getLayerModelsInternal()) { layerModels.put(lm.getClientLayerId(), lm); } for (ClientLayerInfo clientLayer : mainMap.getLayers()) { org.geomajas.plugin.deskmanager.domain.ClientLayer layer = new org.geomajas.plugin.deskmanager.domain.ClientLayer(); layer.setLayerModel(layerModels.get(clientLayer.getId())); bp.getMainMapLayers().add(layer); } } }
/** * Updates blueprint that has no layers set so that the layers configured in the userApplication are inserted into * the database. * */ @Transactional(rollbackFor = { Exception.class }) private void updateBluePrintOverviewMapFromUserApplication(Blueprint bp) { UserApplicationInfo uai = getUserApplication(bp.getUserApplicationKey()); if (uai != null) { ClientMapInfo overviewMap = null; for (ClientMapInfo map : uai.getApplicationInfo().getMaps()) { if (GdmLayout.MAPOVERVIEW_ID.equals(map.getId())) { overviewMap = map; } } Map<String, LayerModel> models = new HashMap<String, LayerModel>(); for (LayerModel model : layerModelService.getLayerModelsInternal()) { models.put(model.getClientLayerId(), model); } for (ClientLayerInfo clientLayer : overviewMap.getLayers()) { org.geomajas.plugin.deskmanager.domain.ClientLayer layer = new org.geomajas.plugin.deskmanager.domain.ClientLayer(); LayerModel model = models.get(clientLayer.getId()); layer.setLayerModel(model); bp.getOverviewMapLayers().add(layer); } } }
/** * Updates blueprint that has no layers set so that the layers configured in the userApplication are inserted into * the database. * */ @Transactional(rollbackFor = { Exception.class }) private void updateBluePrintMainMapFromUserApplication(Blueprint bp) { UserApplicationInfo uai = getUserApplication(bp.getUserApplicationKey()); if (uai != null) { ClientMapInfo mainMap = null; for (ClientMapInfo map : uai.getApplicationInfo().getMaps()) { if (GdmLayout.MAPMAIN_ID.equals(map.getId())) { mainMap = map; } } Map<String, LayerModel> layerModels = new HashMap<String, LayerModel>(); for (LayerModel lm : layerModelService.getLayerModelsInternal()) { layerModels.put(lm.getClientLayerId(), lm); } for (ClientLayerInfo clientLayer : mainMap.getLayers()) { org.geomajas.plugin.deskmanager.domain.ClientLayer layer = new org.geomajas.plugin.deskmanager.domain.ClientLayer(); layer.setLayerModel(layerModels.get(clientLayer.getId())); bp.getMainMapLayers().add(layer); } } }
/** * Updates blueprint that has no layers set so that the layers configured in the userApplication are inserted into * the database. * */ @Transactional(rollbackFor = { Exception.class }) private void updateBluePrintOverviewMapFromUserApplication(Blueprint bp) { UserApplicationInfo uai = getUserApplication(bp.getUserApplicationKey()); if (uai != null) { ClientMapInfo overviewMap = null; for (ClientMapInfo map : uai.getApplicationInfo().getMaps()) { if (GdmLayout.MAPOVERVIEW_ID.equals(map.getId())) { overviewMap = map; } } Map<String, LayerModel> models = new HashMap<String, LayerModel>(); for (LayerModel model : layerModelService.getLayerModelsInternal()) { models.put(model.getClientLayerId(), model); } for (ClientLayerInfo clientLayer : overviewMap.getLayers()) { org.geomajas.plugin.deskmanager.domain.ClientLayer layer = new org.geomajas.plugin.deskmanager.domain.ClientLayer(); LayerModel model = models.get(clientLayer.getId()); layer.setLayerModel(model); bp.getOverviewMapLayers().add(layer); } } }
@Override public void visit(LegendComponent legend) { legend.clearItems(); ClientMapInfo map = configurationService.getMapInfo(legend.getMapId(), legend.getApplicationId()); for (ClientLayerInfo info : map.getLayers()) { if (info instanceof ClientVectorLayerInfo) { legend.addVectorLayer((ClientVectorLayerInfo) info); } else if (info instanceof ClientRasterLayerInfo) { legend.addRasterLayer((ClientRasterLayerInfo) info); } } }
private void buildDeskmanagerAuthorizationInfo() { // Set basic authorization info (from configuration) deskmanagerAuthorizationInfo = (DeskmanagerAuthorizationInfo) deskmanagerAuthorizationInfos.get( profile.getRole().toString()).clone(); // Add geodesk specific authorization if (geodeskId != null && !RetrieveRolesRequest.MANAGER_ID.equals(geodeskId) && isGeodeskUseAllowed(geodeskId)) { try { LOG.debug("building deskmanagerAauthorizationInfo"); Geodesk geodesk = geodeskService.getGeodeskByPublicId(geodeskId); ClientApplicationInfo geodeskInfo = applicationContext.getBean(GeodeskConfigurationService.class) .createGeodeskConfiguration(geodesk, true); // Add all layers visible in this geodesk if (geodeskInfo != null) { for (ClientMapInfo map : geodeskInfo.getMaps()) { for (ClientLayerInfo layer : map.getLayers()) { // Add layers if they are public, or the user is not guest. if (!profile.getRole().equals(Role.GUEST) || layerModelService. getLayerModelByClientLayerIdInternal(layer.getId()).isPublic()) { deskmanagerAuthorizationInfo.getVisibleLayersInclude().add(layer.getServerLayerId()); } } } } } catch (GeomajasSecurityException e) { LOG.error("Error building authorization info, insuficcent rights.", e); } } }
private void addSavedSearches() { if (mapWidget.getMapModel().isInitialized()) { Map<String, List<ConfiguredSearch>> searches = new LinkedHashMap<String, List<ConfiguredSearch>>(); for (ClientLayerInfo clientLayerInfo : mapWidget.getMapModel().getMapInfo().getLayers()) { if (clientLayerInfo.getWidgetInfo().containsKey(ConfiguredSearchesInfo.IDENTIFIER)) { ConfiguredSearchesInfo searchesInfo = (ConfiguredSearchesInfo) clientLayerInfo.getWidgetInfo().
private void buildDeskmanagerAuthorizationInfo() { // Set basic authorization info (from configuration) deskmanagerAuthorizationInfo = (DeskmanagerAuthorizationInfo) deskmanagerAuthorizationInfos.get( profile.getRole().toString()).clone(); // Add geodesk specific authorization if (geodeskId != null && !RetrieveRolesRequest.MANAGER_ID.equals(geodeskId) && isGeodeskUseAllowed(geodeskId)) { try { LOG.debug("building deskmanagerAauthorizationInfo"); Geodesk geodesk = geodeskService.getGeodeskByPublicId(geodeskId); ClientApplicationInfo geodeskInfo = applicationContext.getBean(GeodeskConfigurationService.class) .createGeodeskConfiguration(geodesk, true); // Add all layers visible in this geodesk if (geodeskInfo != null) { for (ClientMapInfo map : geodeskInfo.getMaps()) { for (ClientLayerInfo layer : map.getLayers()) { // Add layers if they are public, or the user is not guest. if (!profile.getRole().equals(Role.GUEST) || layerModelService. getLayerModelByClientLayerIdInternal(layer.getId()).isPublic()) { deskmanagerAuthorizationInfo.getVisibleLayersInclude().add(layer.getServerLayerId()); } } } } } catch (GeomajasSecurityException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }
mainMap.getLayers().clear(); mainMap.getLayers().addAll(addLayers(geodesk.getMainMapLayers(), blueprint.getMainMapLayers())); } else if (!blueprint.getMainMapLayers().isEmpty()) { mainMap.getLayers().clear(); mainMap.getLayers().addAll(addLayers(blueprint.getMainMapLayers(), null)); overviewMap.getLayers().clear(); overviewMap.getLayers().addAll( addLayers(geodesk.getOverviewMapLayers(), blueprint.getOverviewMapLayers())); } else if (!blueprint.getOverviewMapLayers().isEmpty()) { overviewMap.getLayers().clear(); overviewMap.getLayers().addAll(addLayers(blueprint.getOverviewMapLayers(), null));
@Override public void initialize(ClientMapInfo mapInfo, MapEventBus eventBus) { this.mapInfo = mapInfo; this.eventBus = eventBus; crs = mapInfo.getCrs(); // Calculate maximum bounds: maxBounds = new Bbox(mapInfo.getMaxBounds().getX(), mapInfo.getMaxBounds().getY(), mapInfo.getMaxBounds() .getWidth(), mapInfo.getMaxBounds().getHeight()); // if the max bounds was not configured, take the union of initial and layer bounds if (BboxService.equals(maxBounds, Bbox.ALL, 1e-10)) { maxBounds = new Bbox(mapInfo.getInitialBounds().getX(), mapInfo.getInitialBounds().getY(), mapInfo .getInitialBounds().getWidth(), mapInfo.getInitialBounds().getHeight()); if (mapInfo.getLayers() != null && mapInfo.getLayers().size() > 0) { for (ClientLayerInfo layerInfo : mapInfo.getLayers()) { if (layerInfo.getMaxExtent() != null) { maxBounds = BboxService.union(maxBounds, layerInfo.getMaxExtent()); } } } } // Set the best zoom strategy given the map info: if (mapInfo.getScaleConfiguration().getZoomLevels() != null && mapInfo.getScaleConfiguration().getZoomLevels().size() > 0) { zoomStrategy = new FixedStepZoomStrategy(mapInfo, maxBounds); } else { zoomStrategy = new FreeForAllZoomStrategy(mapInfo, maxBounds); } zoomStrategy.setMapSize(mapWidth, mapHeight); initialized = true; }
ClientMapInfo map = configurationService.getMapInfo(mapComponent.getMapId(), mapComponent.getApplicationId()); List<BaseLayerComponent> layers = new ArrayList<BaseLayerComponent>(); for (ClientLayerInfo info : map.getLayers()) { if (info instanceof ClientVectorLayerInfo) { VectorLayerComponentInfo vectorInfo = new VectorLayerComponentInfo();
/** * Calculate max bounds based on the map's max bounds, combined with the layer's bounds. * @return Polygon based on the max bounds bbox. */ private Geometry getMaxBoundsAsGeometry() { ClientMapInfo mapModel = territoryMap.getMapModel().getMapInfo(); Bbox result = mapModel.getMaxBounds(); for (ClientLayerInfo layer : mapModel.getLayers()) { result = BboxService.union(result, layer.getMaxExtent()); } if (result == null || result.getHeight() == 0 || result.getWidth() == 0) { result = new Bbox(); result.setX(Double.MIN_VALUE); result.setY(Double.MIN_VALUE); result.setMaxX(Double.MAX_VALUE); result.setMaxY(Double.MAX_VALUE); } return GeometryService.toPolygon(result); }
for (ClientLayerInfo layerInfo : mapModel.getMapInfo().getLayers()) {
for (ClientLayerInfo layerInfo : mapModel.getMapInfo().getLayers()) {