Mercurial > dive4elements > river
view flys-artifacts/src/main/java/de/intevation/flys/utils/RiverMapfileGenerator.java @ 4693:a91d3bde7255
Change parameters of updateCollectionName
author | Björn Ricks <bjoern.ricks@intevation.de> |
---|---|
date | Mon, 17 Dec 2012 16:15:05 +0100 |
parents | 442fbb290fa8 |
children | 13abfb1bcb75 |
line wrap: on
line source
package de.intevation.flys.utils; import de.intevation.flys.artifacts.model.LayerInfo; import de.intevation.flys.artifacts.model.RiverFactory; import de.intevation.flys.model.River; import java.io.File; import java.io.FileNotFoundException; import java.util.List; import org.apache.log4j.Logger; import org.apache.velocity.Template; public class RiverMapfileGenerator extends MapfileGenerator { private static Logger logger = Logger.getLogger(RiverMapfileGenerator.class); /** * Generate river axis mapfile. */ @Override public void generate() { List<River> rivers = RiverFactory.getRivers(); for (River river : rivers) { createRiverAxisLayer( river.getName(), river.getId(), "41677", "100,100,100,100"); } } protected void createRiverAxisLayer(String riverName, int riverID, String srid, String extend) { LayerInfo layerInfo = new LayerInfo(); layerInfo.setName(riverName); layerInfo.setSrid(srid); layerInfo.setExtent(extend); File layerFile = new File(getMapfilePath()); Template template = getTemplateByName(DB_LAYER_TEMPLATE); if (template == null) { logger.warn("Template '" + DB_LAYER_TEMPLATE + "' found."); return; } try { writeLayer(layerInfo, layerFile, template); } catch (FileNotFoundException e) { logger.warn(e.getLocalizedMessage(), e); } } @Override protected String getVelocityLogfile() { return FLYSUtils.getXPathString(FLYSUtils.XPATH_RIVERMAP_VELOCITY_LOGFILE); } @Override protected String getMapserverTemplatePath() { return FLYSUtils.getXPathString(FLYSUtils.XPATH_RIVERMAP_MAPSERVER_TEMPLATE_PATH); } @Override protected String getMapserverUrl() { return FLYSUtils.getXPathString(FLYSUtils.XPATH_RIVERMAP_MAPSERVER_URL); } @Override protected String getMapfilePath() { return FLYSUtils.getXPathString(FLYSUtils.XPATH_RIVERMAP_MAPFILE_PATH); } @Override protected String getMapfileTemplate() { return FLYSUtils.getXPathString(FLYSUtils.XPATH_RIVERMAP_MAPFILE_TEMPLATE); } }