Mercurial > dive4elements > river
changeset 4703:38ec171544de
Work on rivers.map Generator.
author | Christian Lins <christian.lins@intevation.de> |
---|---|
date | Tue, 18 Dec 2012 15:46:36 +0100 |
parents | 13abfb1bcb75 |
children | 115afdaf3e85 |
files | flys-artifacts/doc/conf/mapserver/river-mapfile.vm flys-artifacts/src/main/java/de/intevation/flys/utils/FLYSUtils.java flys-artifacts/src/main/java/de/intevation/flys/utils/MapfileGenerator.java flys-artifacts/src/main/java/de/intevation/flys/utils/RiverMapfileGenerator.java |
diffstat | 4 files changed, 36 insertions(+), 37 deletions(-) [+] |
line wrap: on
line diff
--- 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
--- 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() { }
--- 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); }
--- 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); } }