changeset 4633:fc52ee878412

Preparations for autogenerated riveraxis WMSs.
author Christian Lins <christian.lins@intevation.de>
date Tue, 04 Dec 2012 14:19:59 +0100
parents 02cf2b1dff84
children 3661df206a7c
files flys-artifacts/doc/mapserver/river-mapfile.vm flys-artifacts/doc/mapserver/riveraxis-layer.vm flys-artifacts/src/main/java/de/intevation/flys/exports/MapGenerator.java flys-artifacts/src/main/java/de/intevation/flys/utils/MapfileGenerator.java flys-artifacts/src/main/java/de/intevation/flys/utils/ThemeUtil.java
diffstat 5 files changed, 129 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-artifacts/doc/mapserver/river-mapfile.vm	Tue Dec 04 14:19:59 2012 +0100
@@ -0,0 +1,60 @@
+MAP
+    NAME "River $RIVERNAME"
+    STATUS ON
+    SIZE 600 400
+    MAXSIZE 4000
+    EXTENT 3233232.55407617 5303455.37850183 3421524.44644752 5585825.50888523
+    UNITS DD
+    SHAPEPATH "$SHAPEFILEPATH"
+    FONTSET "$CONFIGDIR/mapserver/fontset.txt"
+    SYMBOLSET "$CONFIGDIR/mapserver/symbols.sym"
+    IMAGECOLOR 255 255 255
+    PROJECTION
+        "init=epsg:31467"
+    END
+
+    DEBUG 5
+    CONFIG "MS_ERRORFILE" "log/river-$RIVERNAME.log"
+
+    WEB
+      METADATA
+        "wms_title"             "FLYS $RIVERNAME Web Map Service"
+        "wms_onlineresource"    "$MAPSERVERURL"
+        "wms_accessconstraints" "none"
+        "wms_fees"              "none"
+        "wms_addresstype"       "postal"
+        "wms_address"           "Any Street"
+        "wms_city"              "Any City"
+        "wms_stateorprovince"   "Any state"
+        "wms_postcode"          "My Postalcode"
+        "wms_country"           "Any Country"
+        "wms_contactperson"     "Any Person"
+        "wms_contactorganization" "Any Orga"
+        "wms_contactelectronicmailaddress" "any-email@example.com"
+        "wms_contactvoicetelephone" "Any's telephone number"
+        "wms_srs" "EPSG:4326 EPSG:31466 EPSG:31467"
+        "wms_feature_info_mime_type" "text/html"
+        "ows_enable_request"   "*"
+      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)
+        include "$LAYER"
+    #end
+END
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-artifacts/doc/mapserver/riveraxis-layer.vm	Tue Dec 04 14:19:59 2012 +0100
@@ -0,0 +1,58 @@
+LAYER
+    NAME "$LAYER.getName()"
+    TYPE $LAYER.getType()
+
+    CONNECTIONTYPE $LAYER.getConnectionType()
+    CONNECTION "$LAYER.getConnection()"
+
+    DATA    "$LAYER.getData()"
+    FILTER  "$LAYER.getFilter()"
+    EXTENT  $LAYER.getExtent()
+
+    STATUS    ON
+    TEMPLATE  map.html
+    TOLERANCE 10
+    DUMP      TRUE
+    #if( $LAYER.getGroup() )
+        GROUP "$LAYER.getGroup()"
+    #end
+
+    #if ( $LAYER.getLabelItem() )
+        LABELITEM $LAYER.getLabelItem()
+    #end
+
+    PROJECTION
+        "init=epsg:31467"
+    END
+
+    METADATA
+        "wms_title" "$LAYER.getTitle()"
+        "gml_include_items" "all"
+        #if ( $LAYER.getGroupTitle() )
+            "wms_group_title" "$LAYER.getGroupTitle()"
+        #end
+    END
+
+    #if ( $LAYER.getStyle() )
+        $LAYER.getStyle()
+    #else
+        CLASS
+            NAME ""
+            STYLE
+                SIZE 5
+                OUTLINECOLOR "#000000"
+            END
+            #if ( $LAYER.getLabelItem() )
+                LABEL
+                    ANGLE auto
+                    SIZE 10
+                    COLOR "#000000"
+                    TYPE truetype
+                    FONT LiberationSans-Italic
+                    POSITION ur
+                    OFFSET 2 2
+                END
+            #end
+        END
+    #end
+END
\ No newline at end of file
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/MapGenerator.java	Tue Dec 04 13:20:38 2012 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/MapGenerator.java	Tue Dec 04 14:19:59 2012 +0100
@@ -137,7 +137,7 @@
                 mfg.createUeskLayer(
                     flys,
                     (WSPLGENLayerFacet) wms,
-                    ThemeUtil.createWSPLGENStyle(attr),
+                    ThemeUtil.createDynamicMapserverStyle(attr),
                     context);
             }
             else {
--- a/flys-artifacts/src/main/java/de/intevation/flys/utils/MapfileGenerator.java	Tue Dec 04 13:20:38 2012 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/utils/MapfileGenerator.java	Tue Dec 04 14:19:59 2012 +0100
@@ -235,9 +235,11 @@
         }
         catch (FileNotFoundException fnfe) {
             // this is bad
+            logger.warn(fnfe, fnfe);
         }
         catch (IOException ioe) {
             // this is also bad
+            logger.warn(ioe, ioe);
         }
 
         return context;
--- a/flys-artifacts/src/main/java/de/intevation/flys/utils/ThemeUtil.java	Tue Dec 04 13:20:38 2012 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/utils/ThemeUtil.java	Tue Dec 04 14:19:59 2012 +0100
@@ -623,7 +623,14 @@
     }
 
 
-    public static String createWSPLGENStyle(Document theme) {
+    /**
+     * Creates a MapserverStyle from the given XML theme.
+     * This method uses a start- and endcolor to interpolate a
+     * given number of color classes for the MapserverStyle.
+     * @param theme
+     * @return String representation of the MapserverStyle
+     */
+    public static String createDynamicMapserverStyle(Document theme) {
         MapserverStyle ms = new MapserverStyle();
 
         String strStartColor = XMLUtils.xpathString(theme, XPATH_WSPLGEN_STARTCOLOR, null);

http://dive4elements.wald.intevation.org