changeset 2637:baaf7d125c43

Issue 560. Enabled GetFeatureInfo-request for WSPLGEN-layer. flys-artifacts/trunk@4264 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Raimund Renkert <raimund.renkert@intevation.de>
date Wed, 18 Apr 2012 11:35:14 +0000
parents 31772c144725
children ccad7a6ddaa4
files flys-artifacts/ChangeLog flys-artifacts/doc/conf/mapserver/wsplgen_layer.vm flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WMSLayerFacet.java flys-artifacts/src/main/java/de/intevation/flys/exports/MapGenerator.java flys-artifacts/src/main/java/de/intevation/flys/utils/MapfileGenerator.java
diffstat 5 files changed, 66 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Wed Apr 18 09:28:50 2012 +0000
+++ b/flys-artifacts/ChangeLog	Wed Apr 18 11:35:14 2012 +0000
@@ -1,3 +1,20 @@
+2012-04-18  Raimund Renkert <raimund.renkert@intevation.de>
+
+	Issue 560.
+
+	* src/main/java/de/intevation/flys/utils/MapfileGenerator.java:
+	  Generate WSPLGEN-Layer with its own template and set the layertitle to
+	  an i18n string.
+
+	* src/main/java/de/intevation/flys/exports/MapGenerator.java:
+	  Call createUeskLayer with a CallContext.
+
+	* src/main/java/de/intevation/flys/artifacts/model/WMSLayerFacet.java:
+	  Set queryable to true.
+
+	* doc/conf/mapserver/wsplgen_layer.vm:
+	  New. Template for WSPLGEN-Layer.
+
 2012-04-18	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
 
 	* src/main/java/de/intevation/flys/exports/TimeseriesChartGenerator.java:
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-artifacts/doc/conf/mapserver/wsplgen_layer.vm	Wed Apr 18 11:35:14 2012 +0000
@@ -0,0 +1,36 @@
+LAYER
+    NAME      "$LAYER.getName()"
+    TYPE      $LAYER.getType()
+    DATA      "$LAYER.getDirectory()/$LAYER.getData()"
+    STATUS    ON
+    TEMPLATE  map.html
+    TOLERANCE 10
+    DUMP      TRUE
+    #if( $LAYER.getGroup() )
+        GROUP "$LAYER.getGroup()"
+    #end
+
+    METADATA
+        "wms_title" "$LAYER.getTitle()"
+        "gml_include_items" "all"
+        "ows_enable_request" "GetFeatureInfo"
+        "wms_feature_info_mime_type" "gml"
+        #if ( $LAYER.getGroupTitle() )
+            "wms_group_title" "$LAYER.getGroupTitle()"
+        #end
+    END
+
+    #if ( !$LAYER.getStyle() )
+        #if ( $LAYER.getGroupTitle() )
+            #if ( $LAYER.getType() == "POLYGON" )
+                #include("barrier_polygons_class.vm")
+            #else
+                #include("barrier_lines_class.vm")
+            #end
+        #else
+            #include("wsplgen_class.vm")
+        #end
+    #else
+        $LAYER.getStyle()
+    #end
+END
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WMSLayerFacet.java	Wed Apr 18 09:28:50 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WMSLayerFacet.java	Wed Apr 18 11:35:14 2012 +0000
@@ -150,7 +150,7 @@
 
 
     public boolean isQueryable() {
-        return false;
+        return true;
     }
 
 
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/MapGenerator.java	Wed Apr 18 09:28:50 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/MapGenerator.java	Wed Apr 18 11:35:14 2012 +0000
@@ -129,7 +129,8 @@
             mfg.createUeskLayer(
                 flys,
                 wms,
-                ThemeUtil.createWSPLGENStyle(attr));
+                ThemeUtil.createWSPLGENStyle(attr),
+                context);
         }
         catch (IOException ioe) {
             logger.error(ioe, ioe);
--- a/flys-artifacts/src/main/java/de/intevation/flys/utils/MapfileGenerator.java	Wed Apr 18 09:28:50 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/utils/MapfileGenerator.java	Wed Apr 18 11:35:14 2012 +0000
@@ -17,12 +17,14 @@
 import org.apache.velocity.VelocityContext;
 import org.apache.velocity.app.VelocityEngine;
 
+import de.intevation.artifacts.CallContext;
 import de.intevation.artifacts.common.utils.Config;
 
 import de.intevation.flys.artifacts.FLYSArtifact;
 import de.intevation.flys.artifacts.model.LayerInfo;
 import de.intevation.flys.artifacts.model.WMSLayerFacet;
 import de.intevation.flys.artifacts.model.WMSDBLayerFacet;
+import de.intevation.flys.artifacts.resources.Resources;
 
 /**
  * This class iterates over a bunch of directories, searches for meta
@@ -38,6 +40,7 @@
     public static final String WSPLGEN_LINES_SHAPE    = "barrier_lines.shp";
     public static final String WSPLGEN_POLYGONS_SHAPE = "barrier_polygons.shp";
 
+    public static final String WSPLGEN_LAYER_TEMPLATE = "wsplgen_layer.vm";
     public static final String SHP_LAYER_TEMPLATE = "shapefile_layer.vm";
     public static final String DB_LAYER_TEMPLATE  = "db_layer.vm";
 
@@ -367,7 +370,8 @@
     public void createUeskLayer(
         FLYSArtifact  flys,
         WMSLayerFacet wms,
-        String        style
+        String        style,
+        CallContext context
     ) throws FileNotFoundException, IOException
     {
         logger.debug("createUeskLayer");
@@ -377,14 +381,16 @@
         layerinfo.setType("POLYGON");
         layerinfo.setDirectory(flys.identifier());
         layerinfo.setData(WSPLGEN_RESULT_SHAPE);
-        layerinfo.setTitle("I18N_WSPLGEN_RESULT");
+        layerinfo.setTitle(Resources.getMsg(Resources.getLocale(context.getMeta()),
+                                            "floodmap.uesk",
+                                            "Floodmap"));
         layerinfo.setStyle(style);
 
         String name = MS_LAYER_PREFIX + wms.getName();
 
-        Template template = getTemplateByName(SHP_LAYER_TEMPLATE);
+        Template template = getTemplateByName(WSPLGEN_LAYER_TEMPLATE);
         if (template == null) {
-            logger.warn("Template '" + SHP_LAYER_TEMPLATE + "' found.");
+            logger.warn("Template '" + WSPLGEN_LAYER_TEMPLATE + "' found.");
             return;
         }
 

http://dive4elements.wald.intevation.org