public ClientMapInfo getMapInfo(String mapId, String applicationId) { if (null == mapId || null == applicationId) { return null; } ClientApplicationInfo application = applicationMap.get(applicationId); if (application != null) { for (ClientMapInfo map : application.getMaps()) { if (mapId.equals(map.getId())) { return map; } } } return null; }
/** * Retrieve the mapinfo from the userapplication's main map. * * @param userApplication * the userapplication * @return the mapInfo */ public static ClientMapInfo getMainMap(UserApplicationInfo userApplication) { for (ClientMapInfo mapInfo : userApplication.getApplicationInfo().getMaps()) { if (mapInfo.getId().equals(GdmLayout.MAPMAIN_ID)) { return mapInfo; } } return null; }
/** * Retrieve the list of ClientWidgetInfo's from a userapplications main map. This consists of the widget infos * defined in the UserApplication itself, and those defined in the {@link UserApplicationInfo#getApplicationInfo()}. * * @param uai the user application info * @return List of ClientWidgetInfo as defined in the user application */ public static Map<String, ClientWidgetInfo> getMainMapClientWidgetInfo(UserApplicationInfo uai) { Map<String, ClientWidgetInfo> widgetInfos = new HashMap<String, ClientWidgetInfo>(); for (ClientMapInfo cmi : uai.getApplicationInfo().getMaps()) { if (GdmLayout.MAPMAIN_ID.equals(cmi.getId())) { widgetInfos.putAll(cmi.getWidgetInfo()); } } widgetInfos.putAll(uai.getMainMapWidgetInfos()); return widgetInfos; }
/** * Retrieve the list of ClientWidgetInfo's from the userapplication's overview map. used. * * @param userApplication * the userapplication * @return List of ClientWidgetInfo as defined in the userapplication */ public static Map<String, ClientWidgetInfo> getOverviewMapClientWidgetInfo(UserApplicationInfo userApplication) { Map<String, ClientWidgetInfo> widgetInfos = new HashMap<String, ClientWidgetInfo>(); for (ClientMapInfo mapInfo : userApplication.getApplicationInfo().getMaps()) { if (mapInfo.getId().equals(GdmLayout.MAPOVERVIEW_ID)) { widgetInfos.putAll(mapInfo.getWidgetInfo()); } } widgetInfos.putAll(userApplication.getOverviewMapWidgetInfos()); return widgetInfos; }
/** * Retrieve the list of ClientWidgetInfo's from a userapplications overview map. This consists of the widget infos * defined in the UserApplication itself, and those defined in the {@link UserApplicationInfo#getApplicationInfo()}. * * @param uai the user application info * @return List of ClientWidgetInfo as defined in the user application */ public static Map<String, ClientWidgetInfo> getOverviewMapClientWidgetInfo(UserApplicationInfo uai) { Map<String, ClientWidgetInfo> widgetInfos = new HashMap<String, ClientWidgetInfo>(); for (ClientMapInfo cmi : uai.getApplicationInfo().getMaps()) { if (GdmLayout.MAPOVERVIEW_ID.equals(cmi.getId())) { widgetInfos.putAll(cmi.getWidgetInfo()); } } widgetInfos.putAll(uai.getMainMapWidgetInfos()); return widgetInfos; }
public ClientMapInfo getMapInfo(String mapId, String applicationId) { try { // FIXME: code duplication from GetConfigurationCommand. move to service! String id = applicationId; Geodesk geodesk = geodeskService.getGeodeskByPublicId(id); // this checks if geodesk is allowed if (geodesk != null) { // request from cache ClientApplicationInfo geodeskConfig = getClonedGeodeskConfiguration(geodesk); for (ClientMapInfo map : geodeskConfig.getMaps()) { if (map.getId().equals(mapId)) { return map; } } } } catch (GeomajasSecurityException e) { LOG.error("Could not get mapInfo, insufficent rights.", e); } return null; }
/** * Retrieve the list of ClientWidgetInfo's from the userApplication's main map. * * @param userApplication * the userapplication * @return List of ClientWidgetInfo as defined in the userapplication */ public static Map<String, ClientWidgetInfo> getMainMapClientWidgetInfo(UserApplicationInfo userApplication) { Map<String, ClientWidgetInfo> widgetInfos = new HashMap<String, ClientWidgetInfo>(); for (ClientMapInfo mapInfo : userApplication.getApplicationInfo().getMaps()) { if (mapInfo.getId().equals(GdmLayout.MAPMAIN_ID)) { widgetInfos.putAll(mapInfo.getWidgetInfo()); } } widgetInfos.putAll(userApplication.getMainMapWidgetInfos()); return widgetInfos; }
public ClientMapInfo getMapInfo(String mapId, String applicationId) { try { // FIXME: code duplication from GetConfigurationCommand. move to service! String id = applicationId; Geodesk geodesk = geodeskService.getGeodeskByPublicId(id); // this checks if geodesk is allowed if (geodesk != null) { // request from cache ClientApplicationInfo geodeskConfig = getClonedGeodeskConfiguration(geodesk); for (ClientMapInfo map : geodeskConfig.getMaps()) { if (map.getId().equals(mapId)) { return map; } } } } catch (GeomajasSecurityException e) { // TODO Auto-generated catch block e.printStackTrace(); } return null; }
/** * 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 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 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); } } }
public void execute(GetMapConfigurationRequest request, GetMapConfigurationResponse response) throws Exception { if (null == request.getApplicationId()) { throw new GeomajasException(ExceptionCode.PARAMETER_MISSING, "applicationId"); } String mapId = request.getMapId(); if (null == mapId) { throw new GeomajasException(ExceptionCode.PARAMETER_MISSING, "mapId"); } // this checks if geodesk is allowed Geodesk loket = geodeskService.getGeodeskByPublicId(request.getApplicationId()); if (loket != null) { ClientApplicationInfo loketConfig = configurationService.createClonedGeodeskConfiguration(loket, true); for (ClientMapInfo mapInfo : loketConfig.getMaps()) { if (request.getMapId().equals(mapInfo.getId())) { response.setMapInfo(mapInfo); } } } else { throw new GeomajasException(ExceptionCode.APPLICATION_NOT_FOUND, request.getApplicationId()); } }
public void execute(GetMapConfigurationRequest request, GetMapConfigurationResponse response) throws Exception { if (null == request.getApplicationId()) { throw new GeomajasException(ExceptionCode.PARAMETER_MISSING, "applicationId"); } String mapId = request.getMapId(); if (null == mapId) { throw new GeomajasException(ExceptionCode.PARAMETER_MISSING, "mapId"); } // this checks if geodesk is allowed Geodesk loket = geodeskService.getGeodeskByPublicId(request.getApplicationId()); if (loket != null) { ClientApplicationInfo loketConfig = configurationService.createClonedGeodeskConfiguration(loket, true); for (ClientMapInfo mapInfo : loketConfig.getMaps()) { if (request.getMapId().equals(mapInfo.getId())) { response.setMapInfo(mapInfo); } } } else { throw new GeomajasException(ExceptionCode.APPLICATION_NOT_FOUND, request.getApplicationId()); } if (response.getMapInfo() == null) { throw new GeomajasException(ExceptionCode.MAP_NOT_FOUND, request.getMapId()); } }
@Override protected MapComponentInfo buildMap() { ViewPort viewPort = mapPresenter.getViewPort(); ClientMapInfo mapInfo = mapPresenter.getConfiguration().getHintValue(GeomajasServerExtension.MAPINFO); double printWidth = getPageWidth() - 2 * marginX; double printHeight = getPageHeight() - 2 * marginY; Bbox fittingBox = createFittingBox(viewPort.getBounds(), printWidth / printHeight); MapComponentInfo map = super.buildMap(fittingBox); map.getLayoutConstraint().setMarginX(marginX); map.getLayoutConstraint().setMarginY(marginY); map.setLocation(new org.geomajas.geometry.Coordinate(fittingBox.getX(), fittingBox.getY())); map.setPpUnit((float) (printWidth / fittingBox.getWidth())); map.setTag("map"); map.setMapId(mapInfo.getId()); map.setApplicationId(applicationId); map.setRasterResolution(rasterDpi); // use rasterized layers for pure GWT double rasterScale = map.getPpUnit() * map.getRasterResolution() / 72.0; // map.getPpUnit() = number of pixels per map unit at 72 dpi mapBuilder.build(mapPresenter, fittingBox, 1 / rasterScale); List<PrintComponentInfo> layers = new ArrayList<PrintComponentInfo>(); RasterizedLayersComponentInfo rasterizedLayersComponentInfo = new RasterizedLayersComponentInfo(); rasterizedLayersComponentInfo.setMapInfo(mapInfo); layers.add(rasterizedLayersComponentInfo); map.getChildren().addAll(0, layers); return map; }
@Override protected MapComponentInfo buildMap() { ViewPort viewPort = mapPresenter.getViewPort(); double printWidth = getPageWidth() - 2 * marginX; double printHeight = getPageHeight() - 2 * marginY; Bbox fittingBox = createFittingBox(viewPort.getBounds(), printWidth / printHeight); MapComponentInfo map = super.buildMap(fittingBox); map.getLayoutConstraint().setMarginX(marginX); map.getLayoutConstraint().setMarginY(marginY); map.setLocation(new org.geomajas.geometry.Coordinate(fittingBox.getX(), fittingBox.getY())); map.setPpUnit((float) (printWidth / fittingBox.getWidth())); map.setTag("map"); // GWT:map.setMapId(mapModel.getMapInfo().getId()); // Old puregwt: map.setMapId(mapPresenter.getConfiguration().getId()); map.setMapId(mapPresenter.getConfiguration().getServerConfiguration().getId()); map.setApplicationId(applicationId); map.setRasterResolution(rasterDpi); // use rasterized layers for pure GWT double rasterScale = map.getPpUnit() * map.getRasterResolution() / 72.0; // map.getPpUnit() = aantal pixels per map unit bij 72 dpi mapBuilder.build(mapPresenter, fittingBox, rasterScale); List<PrintComponentInfo> layers = new ArrayList<PrintComponentInfo>(); RasterizedLayersComponentInfo rasterizedLayersComponentInfo = new RasterizedLayersComponentInfo(); rasterizedLayersComponentInfo.setMapInfo(mapPresenter.getConfiguration().getServerConfiguration()); layers.add(rasterizedLayersComponentInfo); map.getChildren().addAll(0, layers); return map; }
style.setSize((int) PrintingLayout.templateDefaultFontSize); legend.setFont(style); legend.setMapId(mapModel.getMapInfo().getId()); legend.setTag("legend"); for (Layer layer : mapModel.getLayers()) {
legend.setFont(style); ClientMapInfo mapInfo = mapPresenter.getConfiguration().getHintValue(GeomajasServerExtension.MAPINFO); legend.setMapId(mapInfo.getId());
style.setSize((int) PrintingLayout.templateDefaultFontSize); legend.setFont(style); legend.setMapId(mapModel.getMapInfo().getId()); legend.setTag("legend"); legend.setTitle(MESSAGES.legendTitle());
style.setSize((int) PrintingLayout.templateDefaultFontSize); legend.setFont(style); legend.setMapId(mapPresenter.getConfiguration().getServerConfiguration().getId());