# HG changeset patch # User Christian Lins # Date 1354748049 -3600 # Node ID c04db3178d0919148f8ea81f9f540afa7c222408 # Parent c2e23c3f29c7cd84cbadeb9f8d7a88aebc421b02 Work on river axis mapfile generator. diff -r c2e23c3f29c7 -r c04db3178d09 flys-artifacts/doc/conf/conf.xml --- 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 @@ de.intevation.flys.artifacts.datacage.Datacage de.intevation.flys.wsplgen.SchedulerSetup + de.intevation.flys.map.RiverMapGenerator diff -r c2e23c3f29c7 -r c04db3178d09 flys-artifacts/src/main/java/de/intevation/flys/utils/FLYSUtils.java --- 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; /** diff -r c2e23c3f29c7 -r c04db3178d09 flys-artifacts/src/main/java/de/intevation/flys/utils/MapfileGenerator.java --- 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 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