Mercurial > dive4elements > river
changeset 956:1cf7b4ee7b6d
Made the background layer in floodmaps configurable.
flys-artifacts/trunk@2375 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Wed, 20 Jul 2011 14:01:38 +0000 |
parents | 30f48f5ccdc3 |
children | e91996b46e3c |
files | flys-artifacts/ChangeLog flys-artifacts/doc/conf/conf.xml flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/WMSBackgroundState.java |
diffstat | 3 files changed, 49 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog Wed Jul 20 13:21:16 2011 +0000 +++ b/flys-artifacts/ChangeLog Wed Jul 20 14:01:38 2011 +0000 @@ -1,3 +1,12 @@ +2011-07-20 Ingo Weinzierl <ingo@intevation.de> + + * doc/conf/conf.xml: Added a config section for floodmaps. Currently, the + background layer's url and layername is defined here. + + * src/main/java/de/intevation/flys/artifacts/states/WMSBackgroundState.java: + Read the background layer configuration from conf.xml. Those values are + used to create the WMSLayerFacet. + 2011-07-20 Ingo Weinzierl <ingo@intevation.de> * src/main/java/de/intevation/flys/artifacts/states/WMSBackgroundState.java:
--- a/flys-artifacts/doc/conf/conf.xml Wed Jul 20 13:21:16 2011 +0000 +++ b/flys-artifacts/doc/conf/conf.xml Wed Jul 20 14:01:38 2011 +0000 @@ -93,6 +93,11 @@ <!-- path to the template file of the meta data --> <metadata template="${artifacts.config.dir}/meta-data-template.xml"/> + <!-- the WMS layer that is displayed as background layer in floodmaps. --> + <floodmap> + <background-layer url="http://vmap0.tiles.osgeo.org/wms/vmap0" layer="basic"/> + </floodmap> + <rest-server> <!-- at this Point it is possible to Change the Port the ArtifactDatabase will bind to.--> <port>8181</port>
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/WMSBackgroundState.java Wed Jul 20 13:21:16 2011 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/WMSBackgroundState.java Wed Jul 20 14:01:38 2011 +0000 @@ -4,8 +4,12 @@ import org.apache.log4j.Logger; +import org.w3c.dom.Node; + import de.intevation.artifacts.CallMeta; +import de.intevation.artifacts.common.utils.Config; + import de.intevation.artifactdatabase.state.Facet; import de.intevation.flys.artifacts.FLYSArtifact; @@ -18,9 +22,31 @@ public static final String I18N_DESCRIPTION = "floodmap.wmsbackground"; + public static final String XPATH_WMS_URL = + "/artifact-database/floodmap/background-layer/@url"; + + public static final String XPATH_WMS_LAYER = + "/artifact-database/floodmap/background-layer/@layer"; + + + protected String url; + protected String layer; + private static final Logger logger = Logger.getLogger(WMSBackgroundState.class); + + @Override + public void setup(Node config) { + super.setup(config); + + logger.debug("WMSBackgroundState.setup()"); + + this.url = Config.getStringXPath(XPATH_WMS_URL); + this.layer = Config.getStringXPath(XPATH_WMS_LAYER); + } + + @Override public Object computeInit( FLYSArtifact artifact, @@ -30,16 +56,22 @@ ) { logger.debug("WMSBackgroundState.computeInit()"); - // TODO Add config for background layer + if (url == null || layer == null) { + logger.warn("No background layers currently configured:"); + logger.warn("... add config for WMS url: " + XPATH_WMS_URL); + logger.warn("... add config for WMS layer: " + XPATH_WMS_LAYER); + return null; + } + WMSLayerFacet facet = new WMSLayerFacet( 0, FLOODMAP_WMSBACKGROUND, Resources.getMsg(meta, I18N_DESCRIPTION, I18N_DESCRIPTION), ComputeType.INIT, getID(), hash, - "http://vmap0.tiles.osgeo.org/wms/vmap0"); + url); - facet.addLayer("basic"); + facet.addLayer(layer); facets.add(facet);