comparison flys-artifacts/src/main/java/de/intevation/flys/utils/MapfileGenerator.java @ 2637:baaf7d125c43

Issue 560. Enabled GetFeatureInfo-request for WSPLGEN-layer. flys-artifacts/trunk@4264 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Raimund Renkert <raimund.renkert@intevation.de>
date Wed, 18 Apr 2012 11:35:14 +0000
parents 27cc95e65f18
children ccad7a6ddaa4
comparison
equal deleted inserted replaced
2636:31772c144725 2637:baaf7d125c43
15 15
16 import org.apache.velocity.Template; 16 import org.apache.velocity.Template;
17 import org.apache.velocity.VelocityContext; 17 import org.apache.velocity.VelocityContext;
18 import org.apache.velocity.app.VelocityEngine; 18 import org.apache.velocity.app.VelocityEngine;
19 19
20 import de.intevation.artifacts.CallContext;
20 import de.intevation.artifacts.common.utils.Config; 21 import de.intevation.artifacts.common.utils.Config;
21 22
22 import de.intevation.flys.artifacts.FLYSArtifact; 23 import de.intevation.flys.artifacts.FLYSArtifact;
23 import de.intevation.flys.artifacts.model.LayerInfo; 24 import de.intevation.flys.artifacts.model.LayerInfo;
24 import de.intevation.flys.artifacts.model.WMSLayerFacet; 25 import de.intevation.flys.artifacts.model.WMSLayerFacet;
25 import de.intevation.flys.artifacts.model.WMSDBLayerFacet; 26 import de.intevation.flys.artifacts.model.WMSDBLayerFacet;
27 import de.intevation.flys.artifacts.resources.Resources;
26 28
27 /** 29 /**
28 * This class iterates over a bunch of directories, searches for meta 30 * This class iterates over a bunch of directories, searches for meta
29 * information coresponding to shapefiles and creates a mapfile which is used by 31 * information coresponding to shapefiles and creates a mapfile which is used by
30 * a <i>MapServer</i>. 32 * a <i>MapServer</i>.
36 { 38 {
37 public static final String WSPLGEN_RESULT_SHAPE = "wsplgen.shp"; 39 public static final String WSPLGEN_RESULT_SHAPE = "wsplgen.shp";
38 public static final String WSPLGEN_LINES_SHAPE = "barrier_lines.shp"; 40 public static final String WSPLGEN_LINES_SHAPE = "barrier_lines.shp";
39 public static final String WSPLGEN_POLYGONS_SHAPE = "barrier_polygons.shp"; 41 public static final String WSPLGEN_POLYGONS_SHAPE = "barrier_polygons.shp";
40 42
43 public static final String WSPLGEN_LAYER_TEMPLATE = "wsplgen_layer.vm";
41 public static final String SHP_LAYER_TEMPLATE = "shapefile_layer.vm"; 44 public static final String SHP_LAYER_TEMPLATE = "shapefile_layer.vm";
42 public static final String DB_LAYER_TEMPLATE = "db_layer.vm"; 45 public static final String DB_LAYER_TEMPLATE = "db_layer.vm";
43 46
44 public static final String MS_WSPLGEN_PREFIX = "wsplgen-"; 47 public static final String MS_WSPLGEN_PREFIX = "wsplgen-";
45 public static final String MS_BARRIERS_PREFIX = "barriers-"; 48 public static final String MS_BARRIERS_PREFIX = "barriers-";
365 * @param wms The WMSLayerFacet that contains information for the layer. 368 * @param wms The WMSLayerFacet that contains information for the layer.
366 */ 369 */
367 public void createUeskLayer( 370 public void createUeskLayer(
368 FLYSArtifact flys, 371 FLYSArtifact flys,
369 WMSLayerFacet wms, 372 WMSLayerFacet wms,
370 String style 373 String style,
374 CallContext context
371 ) throws FileNotFoundException, IOException 375 ) throws FileNotFoundException, IOException
372 { 376 {
373 logger.debug("createUeskLayer"); 377 logger.debug("createUeskLayer");
374 378
375 LayerInfo layerinfo = new LayerInfo(); 379 LayerInfo layerinfo = new LayerInfo();
376 layerinfo.setName(MS_WSPLGEN_PREFIX + flys.identifier()); 380 layerinfo.setName(MS_WSPLGEN_PREFIX + flys.identifier());
377 layerinfo.setType("POLYGON"); 381 layerinfo.setType("POLYGON");
378 layerinfo.setDirectory(flys.identifier()); 382 layerinfo.setDirectory(flys.identifier());
379 layerinfo.setData(WSPLGEN_RESULT_SHAPE); 383 layerinfo.setData(WSPLGEN_RESULT_SHAPE);
380 layerinfo.setTitle("I18N_WSPLGEN_RESULT"); 384 layerinfo.setTitle(Resources.getMsg(Resources.getLocale(context.getMeta()),
385 "floodmap.uesk",
386 "Floodmap"));
381 layerinfo.setStyle(style); 387 layerinfo.setStyle(style);
382 388
383 String name = MS_LAYER_PREFIX + wms.getName(); 389 String name = MS_LAYER_PREFIX + wms.getName();
384 390
385 Template template = getTemplateByName(SHP_LAYER_TEMPLATE); 391 Template template = getTemplateByName(WSPLGEN_LAYER_TEMPLATE);
386 if (template == null) { 392 if (template == null) {
387 logger.warn("Template '" + SHP_LAYER_TEMPLATE + "' found."); 393 logger.warn("Template '" + WSPLGEN_LAYER_TEMPLATE + "' found.");
388 return; 394 return;
389 } 395 }
390 396
391 try { 397 try {
392 File dir = new File(getShapefileBaseDir(), flys.identifier()); 398 File dir = new File(getShapefileBaseDir(), flys.identifier());

http://dive4elements.wald.intevation.org