changeset 1710:055f32a5388a

Improved the mapfile templates to create nicer GetLegendGraphic images. flys-artifacts/trunk@2970 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Fri, 14 Oct 2011 11:13:04 +0000 (2011-10-14)
parents f643ea084213
children f708120cb7bc
files flys-artifacts/ChangeLog flys-artifacts/doc/conf/mapserver/mapfile.vm flys-artifacts/doc/conf/mapserver/wsplgen_class.vm flys-artifacts/src/main/java/de/intevation/flys/utils/MapfileGenerator.java
diffstat 4 files changed, 39 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Fri Oct 14 08:52:44 2011 +0000
+++ b/flys-artifacts/ChangeLog	Fri Oct 14 11:13:04 2011 +0000
@@ -1,3 +1,15 @@
+2011-10-14  Ingo Weinzierl <ingo@intevation.de>
+
+	* src/main/java/de/intevation/flys/utils/MapfileGenerator.java: Put the
+	  config directory into the Velocity context. It is available as
+	  '$CONFIGDIR' in templates.
+
+	* doc/conf/mapserver/mapfile.vm: Set the debug file to
+	  "$CONFIGDIR/flys-user-wms.log" and added a LEGEND section.
+
+	* doc/conf/mapserver/wsplgen_class.vm: Adapted the class names. Those
+	  names are displayed in the image served by GetLegendGraphic.
+
 2011-10-14	Felix Wolfsteller	<felix.wolfsteller@intevation.de>
 
 	Add possibility of programmatic configuration of initial "activity"
--- a/flys-artifacts/doc/conf/mapserver/mapfile.vm	Fri Oct 14 08:52:44 2011 +0000
+++ b/flys-artifacts/doc/conf/mapserver/mapfile.vm	Fri Oct 14 11:13:04 2011 +0000
@@ -6,13 +6,14 @@
     EXTENT -90 -180 90 180
     UNITS DD
     SHAPEPATH "$SHAPEFILEPATH"
+    FONTSET "$CONFIGDIR/fontset.txt"
     IMAGECOLOR 255 255 255
     PROJECTION
         "init=epsg:31466"
     END
 
     DEBUG 5
-    CONFIG "MS_ERRORFILE" "mapserver.log"
+    CONFIG "MS_ERRORFILE" "/tmp/flys-user-wms.log"
 
     WEB
       METADATA
@@ -36,6 +37,21 @@
       END
     END
 
+    LEGEND
+        KEYSIZE 20 20
+        STATUS ON
+        TRANSPARENT ON
+
+        LABEL
+            COLOR 150 150 150
+            OUTLINECOLOR 255 255 255
+            TYPE truetype
+            FONT "FreeSans"
+            SIZE 12
+            POSITION AUTO
+        END
+    END
+
     ## Don't change the following lines.
     #foreach ($LAYER in $LAYERS)
         $LAYER
--- a/flys-artifacts/doc/conf/mapserver/wsplgen_class.vm	Fri Oct 14 08:52:44 2011 +0000
+++ b/flys-artifacts/doc/conf/mapserver/wsplgen_class.vm	Fri Oct 14 11:13:04 2011 +0000
@@ -1,5 +1,5 @@
 CLASS
-    NAME "WSPLGEN_POLYGON"
+    NAME "0.0 <= DIFF < 1"
     EXPRESSION ([DIFF] < 1)
     STYLE
         SIZE 5
@@ -8,7 +8,7 @@
 END
 
 CLASS
-    NAME "WSPLGEN_POLYGON"
+    NAME "1.0 <= DIFF < 2"
     EXPRESSION ([DIFF] >= 1 AND [DIFF] < 2)
     STYLE
         SIZE 5
@@ -17,7 +17,7 @@
 END
 
 CLASS
-    NAME "WSPLGEN_POLYGON"
+    NAME "2.0 <= DIFF < 3"
     EXPRESSION ([DIFF] >= 2 AND [DIFF] < 3)
     STYLE
         SIZE 5
@@ -26,7 +26,7 @@
 END
 
 CLASS
-    NAME "WSPLGEN_POLYGON"
+    NAME "3.0 <= DIFF < 4"
     EXPRESSION ([DIFF] >= 3 AND [DIFF] < 4)
     STYLE
         SIZE 5
@@ -35,8 +35,8 @@
 END
 
 CLASS
-    NAME "WSPLGEN_POLYGON"
-    EXPRESSION ([DIFF] >= 3 AND [DIFF] < 4)
+    NAME "Sonstiges"
+    EXPRESSION ([DIFF] >= 4)
     STYLE
         SIZE 5
         COLOR "#021B2A"
--- a/flys-artifacts/src/main/java/de/intevation/flys/utils/MapfileGenerator.java	Fri Oct 14 08:52:44 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/utils/MapfileGenerator.java	Fri Oct 14 11:13:04 2011 +0000
@@ -17,6 +17,8 @@
 import org.apache.velocity.VelocityContext;
 import org.apache.velocity.app.VelocityEngine;
 
+import de.intevation.artifacts.common.utils.Config;
+
 import de.intevation.flys.artifacts.model.LayerInfo;
 
 /**
@@ -395,6 +397,8 @@
                 FLYSUtils.getXPathString(FLYSUtils.XPATH_MAPSERVER_URL));
             context.put("SHAPEFILEPATH",
                 getShapefileBaseDir().getCanonicalPath());
+            context.put("CONFIGDIR",
+                Config.getConfigDirectory().getCanonicalPath());
             context.put("LAYERS", fillLayerTemplates(layers));
 
             Template mapTemplate = getMapfileTemplate();

http://dive4elements.wald.intevation.org