changeset 4648:c04db3178d09

Work on river axis mapfile generator.
author Christian Lins <christian.lins@intevation.de>
date Wed, 05 Dec 2012 23:54:09 +0100
parents c2e23c3f29c7
children 64664e8244ff
files flys-artifacts/doc/conf/conf.xml flys-artifacts/src/main/java/de/intevation/flys/utils/FLYSUtils.java flys-artifacts/src/main/java/de/intevation/flys/utils/MapfileGenerator.java
diffstat 3 files changed, 54 insertions(+), 32 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/doc/conf/conf.xml	Wed Dec 05 10:05:47 2012 +0100
+++ b/flys-artifacts/doc/conf/conf.xml	Wed Dec 05 23:54:09 2012 +0100
@@ -224,6 +224,7 @@
     <lifetime-listeners>
         <listener>de.intevation.flys.artifacts.datacage.Datacage</listener>
         <listener>de.intevation.flys.wsplgen.SchedulerSetup</listener>
+        <listener>de.intevation.flys.map.RiverMapGenerator</listener>
     </lifetime-listeners>
 
     <backend-listeners>
--- a/flys-artifacts/src/main/java/de/intevation/flys/utils/FLYSUtils.java	Wed Dec 05 10:05:47 2012 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/utils/FLYSUtils.java	Wed Dec 05 23:54:09 2012 +0100
@@ -1,6 +1,29 @@
 package de.intevation.flys.utils;
 
-import org.apache.log4j.Logger;
+import de.intevation.artifactdatabase.state.State;
+import de.intevation.artifacts.Artifact;
+import de.intevation.artifacts.CallContext;
+import de.intevation.artifacts.common.utils.Config;
+import de.intevation.artifacts.common.utils.XMLUtils;
+import de.intevation.flys.artifacts.FLYSArtifact;
+import de.intevation.flys.artifacts.StaticWKmsArtifact;
+import de.intevation.flys.artifacts.WINFOArtifact;
+import de.intevation.flys.artifacts.context.FLYSContext;
+import de.intevation.flys.artifacts.model.LocationProvider;
+import de.intevation.flys.artifacts.model.RiverFactory;
+import de.intevation.flys.artifacts.model.WKms;
+import de.intevation.flys.artifacts.model.WQ;
+import de.intevation.flys.artifacts.model.WQKms;
+import de.intevation.flys.artifacts.states.WDifferencesState;
+import de.intevation.flys.artifacts.states.WaterlevelSelectState;
+import de.intevation.flys.backend.SessionFactoryProvider;
+import de.intevation.flys.model.Gauge;
+import de.intevation.flys.model.MainValue;
+import de.intevation.flys.model.River;
+
+import gnu.trove.TDoubleArrayList;
+import gnu.trove.TIntArrayList;
+import gnu.trove.TLongArrayList;
 
 import java.text.NumberFormat;
 import java.util.HashMap;
@@ -11,39 +34,10 @@
 
 import javax.xml.xpath.XPathConstants;
 
-import org.w3c.dom.Document;
-
+import org.apache.log4j.Logger;
 import org.hibernate.SessionFactory;
 import org.hibernate.impl.SessionFactoryImpl;
-
-import gnu.trove.TDoubleArrayList;
-import gnu.trove.TIntArrayList;
-import gnu.trove.TLongArrayList;
-
-import de.intevation.artifacts.Artifact;
-import de.intevation.artifacts.CallContext;
-
-import de.intevation.artifacts.common.utils.Config;
-import de.intevation.artifacts.common.utils.XMLUtils;
-
-import de.intevation.flys.backend.SessionFactoryProvider;
-
-import de.intevation.flys.artifacts.context.FLYSContext;
-import de.intevation.flys.artifacts.FLYSArtifact;
-import de.intevation.flys.artifacts.WINFOArtifact;
-import de.intevation.flys.artifacts.StaticWKmsArtifact;
-import de.intevation.flys.artifacts.model.RiverFactory;
-import de.intevation.flys.artifacts.model.LocationProvider;
-import de.intevation.flys.artifacts.model.WQ;
-import de.intevation.flys.artifacts.model.WKms;
-import de.intevation.flys.artifacts.model.WQKms;
-
-import de.intevation.artifactdatabase.state.State;
-import de.intevation.flys.artifacts.states.WaterlevelSelectState;
-import de.intevation.flys.artifacts.states.WDifferencesState;
-import de.intevation.flys.model.Gauge;
-import de.intevation.flys.model.MainValue;
-import de.intevation.flys.model.River;
+import org.w3c.dom.Document;
 
 
 /**
--- a/flys-artifacts/src/main/java/de/intevation/flys/utils/MapfileGenerator.java	Wed Dec 05 10:05:47 2012 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/utils/MapfileGenerator.java	Wed Dec 05 23:54:09 2012 +0100
@@ -4,10 +4,12 @@
 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.RiverFactory;
 import de.intevation.flys.artifacts.model.map.WMSDBLayerFacet;
 import de.intevation.flys.artifacts.model.map.WMSLayerFacet;
 import de.intevation.flys.artifacts.model.map.WSPLGENLayerFacet;
 import de.intevation.flys.artifacts.resources.Resources;
+import de.intevation.flys.model.River;
 
 import java.io.File;
 import java.io.FileNotFoundException;
@@ -45,6 +47,7 @@
     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";
+    public static final String RIVERAXIS_LAYER_TEMPLATE = "riveraxis-layer.vm";
 
     public static final String MS_WSPLGEN_PREFIX   = "wsplgen-";
     public static final String MS_BARRIERS_PREFIX  = "barriers-";
@@ -174,6 +177,22 @@
 
 
     /**
+     * Generate river axis mapfile.
+     */
+    protected void generateRiverAxisMapfile() {
+        List<River> rivers = RiverFactory.getRivers();
+
+        for (River river : rivers) {
+            createRiverAxisLayer(
+                    river.getName(),
+                    river.getId(),
+                    "41677",
+                    "100,100,100,100");
+        }
+    }
+
+
+    /**
      * Returns the VelocityEngine used for the template mechanism.
      *
      * @return the velocity engine.
@@ -472,6 +491,14 @@
     }
 
 
+    protected void createRiverAxisLayer(String riverName, int riverID, String srid, String extend) {
+        LayerInfo layerInfo = new LayerInfo();
+        layerInfo.setName(riverName);
+        layerInfo.setSrid(srid);
+        layerInfo.setExtent(extend);
+    }
+
+
     protected void createBarriersPolygonLayer(
         FLYSArtifact  flys,
         WMSLayerFacet wms

http://dive4elements.wald.intevation.org