[Dive4elements-commits] [PATCH] Work on rivers.map Generator

Wald Commits scm-commit at wald.intevation.org
Tue Dec 18 15:46:42 CET 2012


# HG changeset patch
# User Christian Lins <christian.lins at intevation.de>
# Date 1355841996 -3600
# Node ID 38ec171544de0fb61d3ae335a0171a785a87597d
# Parent  13abfb1bcb75e78fef474ffde665f4c5242ebccd
Work on rivers.map Generator.

diff -r 13abfb1bcb75 -r 38ec171544de flys-artifacts/doc/conf/mapserver/river-mapfile.vm
--- a/flys-artifacts/doc/conf/mapserver/river-mapfile.vm	Mon Dec 17 23:24:27 2012 +0100
+++ b/flys-artifacts/doc/conf/mapserver/river-mapfile.vm	Tue Dec 18 15:46:36 2012 +0100
@@ -14,7 +14,7 @@
     END
 
     DEBUG 5
-    CONFIG "MS_ERRORFILE" "log/river-$RIVERNAME.log"
+    CONFIG "MS_ERRORFILE" "log/rivers.log"
 
     WEB
       METADATA
diff -r 13abfb1bcb75 -r 38ec171544de flys-artifacts/src/main/java/de/intevation/flys/utils/FLYSUtils.java
--- a/flys-artifacts/src/main/java/de/intevation/flys/utils/FLYSUtils.java	Mon Dec 17 23:24:27 2012 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/utils/FLYSUtils.java	Tue Dec 18 15:46:36 2012 +0100
@@ -91,27 +91,6 @@
     public static final String XPATH_FLOODMAP_MAPSERVER_TEMPLATE_PATH =
         "/artifact-database/floodmap/mapserver/templates/@path";
 
-    public static final String XPATH_RIVERMAP_RIVER_PROJECTION =
-        "/artifact-database/rivermap/river[@name=$name]/srid/@value";
-
-    public static final String XPATH_RIVERMAP_SHAPEFILE_DIR =
-        "/artifact-database/rivermap/shapefile-path/@value";
-
-    public static final String XPATH_RIVERMAP_VELOCITY_LOGFILE =
-        "/artifact-database/rivermap/velocity/logfile/@path";
-
-    public static final String XPATH_RIVERMAP_MAPSERVER_URL =
-        "/artifact-database/rivermap/mapserver/server/@path";
-
-    public static final String XPATH_RIVERMAP_MAPFILE_PATH =
-        "/artifact-database/rivermap/mapserver/mapfile/@path";
-
-    public static final String XPATH_RIVERMAP_MAPFILE_TEMPLATE =
-        "/artifact-database/rivermap/mapserver/map-template/@path";
-
-    public static final String XPATH_RIVERMAP_MAPSERVER_TEMPLATE_PATH =
-        "/artifact-database/rivermap/mapserver/templates/@path";
-
 
     private FLYSUtils() {
     }
diff -r 13abfb1bcb75 -r 38ec171544de flys-artifacts/src/main/java/de/intevation/flys/utils/MapfileGenerator.java
--- a/flys-artifacts/src/main/java/de/intevation/flys/utils/MapfileGenerator.java	Mon Dec 17 23:24:27 2012 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/utils/MapfileGenerator.java	Tue Dec 18 15:46:36 2012 +0100
@@ -186,9 +186,7 @@
     protected Template getMapfileTemplateObj()
     throws Exception
     {
-        String mapfileName = FLYSUtils.getXPathString(
-            FLYSUtils.XPATH_FLOODMAP_MAPFILE_TEMPLATE);
-
+        String mapfileName = getMapfileTemplate();
         return getTemplateByName(mapfileName);
     }
 
diff -r 13abfb1bcb75 -r 38ec171544de flys-artifacts/src/main/java/de/intevation/flys/utils/RiverMapfileGenerator.java
--- a/flys-artifacts/src/main/java/de/intevation/flys/utils/RiverMapfileGenerator.java	Mon Dec 17 23:24:27 2012 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/utils/RiverMapfileGenerator.java	Tue Dec 18 15:46:36 2012 +0100
@@ -14,6 +14,27 @@
 
 public class RiverMapfileGenerator extends MapfileGenerator {
 
+    public static final String XPATH_RIVERMAP_RIVER_PROJECTION =
+            "/artifact-database/rivermap/river[@name=$name]/srid/@value";
+
+    public static final String XPATH_RIVERMAP_SHAPEFILE_DIR =
+            "/artifact-database/rivermap/shapefile-path/@value";
+
+    public static final String XPATH_RIVERMAP_VELOCITY_LOGFILE =
+            "/artifact-database/rivermap/velocity/logfile/@path";
+
+    public static final String XPATH_RIVERMAP_MAPSERVER_URL =
+            "/artifact-database/rivermap/mapserver/server/@path";
+
+    public static final String XPATH_RIVERMAP_MAPFILE_PATH =
+            "/artifact-database/rivermap/mapserver/mapfile/@path";
+
+    public static final String XPATH_RIVERMAP_MAPFILE_TEMPLATE =
+            "/artifact-database/rivermap/mapserver/map-template/@path";
+
+    public static final String XPATH_RIVERMAP_MAPSERVER_TEMPLATE_PATH =
+            "/artifact-database/rivermap/mapserver/templates/@path";
+
     private static Logger logger = Logger.getLogger(RiverMapfileGenerator.class);
 
     /**
@@ -24,17 +45,17 @@
         logger.debug("generate()");
 
         List<River>  rivers     = RiverFactory.getRivers();
-        List<String> riverNames = new ArrayList<String>();
+        List<String> riverFiles = new ArrayList<String>();
 
         for (River river : rivers) {
-            /*createRiverAxisLayer(
+            createRiverAxisLayer(
                     river.getName(),
                     river.getId(),
                     "41677",
-                    "100,100,100,100");*/
-            riverNames.add(river.getName());
+                    "100,100,100,100");
+            riverFiles.add("river-" + river.getName() + ".map");
         }
-        writeMapfile(riverNames);
+        writeMapfile(riverFiles);
     }
 
     protected void createRiverAxisLayer(String riverName, int riverID, String srid, String extend) {
@@ -42,11 +63,12 @@
         layerInfo.setName(riverName);
         layerInfo.setSrid(srid);
         layerInfo.setExtent(extend);
+        layerInfo.setConnectionType(FLYSUtils.isUsingOracle() ? "oraclespatial" : "postgis");
 
-        File layerFile = new File(getMapfilePath());
+        File layerFile = new File("river-" + riverName + ".map");
         Template template = getTemplateByName(DB_LAYER_TEMPLATE);
         if (template == null) {
-            logger.warn("Template '" + DB_LAYER_TEMPLATE + "' found.");
+            logger.warn("Template '" + DB_LAYER_TEMPLATE + "' not found.");
             return;
         }
 
@@ -60,26 +82,26 @@
 
     @Override
     protected String getVelocityLogfile() {
-        return FLYSUtils.getXPathString(FLYSUtils.XPATH_RIVERMAP_VELOCITY_LOGFILE);
+        return FLYSUtils.getXPathString(XPATH_RIVERMAP_VELOCITY_LOGFILE);
     }
 
     @Override
     protected String getMapserverTemplatePath() {
-        return FLYSUtils.getXPathString(FLYSUtils.XPATH_RIVERMAP_MAPSERVER_TEMPLATE_PATH);
+        return FLYSUtils.getXPathString(XPATH_RIVERMAP_MAPSERVER_TEMPLATE_PATH);
     }
 
     @Override
     protected String getMapserverUrl() {
-        return FLYSUtils.getXPathString(FLYSUtils.XPATH_RIVERMAP_MAPSERVER_URL);
+        return FLYSUtils.getXPathString(XPATH_RIVERMAP_MAPSERVER_URL);
     }
 
     @Override
     protected String getMapfilePath() {
-        return FLYSUtils.getXPathString(FLYSUtils.XPATH_RIVERMAP_MAPFILE_PATH);
+        return FLYSUtils.getXPathString(XPATH_RIVERMAP_MAPFILE_PATH);
     }
 
     @Override
     protected String getMapfileTemplate() {
-        return FLYSUtils.getXPathString(FLYSUtils.XPATH_RIVERMAP_MAPFILE_TEMPLATE);
+        return FLYSUtils.getXPathString(XPATH_RIVERMAP_MAPFILE_TEMPLATE);
     }
 }


More information about the Dive4elements-commits mailing list