comparison flys-artifacts/src/main/java/de/intevation/flys/mapserver/ArtifactMapfileGenerator.java @ 5023:1da61095040c mapgenfix

Renaming methods and fields. Start refactoring with ArtifactMapfileGenerator.generate() which should be the main entry point.
author Christian Lins <christian.lins@intevation.de>
date Tue, 19 Feb 2013 14:25:38 +0100
parents a9243df307b1
children cc50e1b9fc60
comparison
equal deleted inserted replaced
5022:a9243df307b1 5023:1da61095040c
12 import de.intevation.flys.utils.GeometryUtils; 12 import de.intevation.flys.utils.GeometryUtils;
13 13
14 import java.io.File; 14 import java.io.File;
15 import java.io.FileNotFoundException; 15 import java.io.FileNotFoundException;
16 import java.io.IOException; 16 import java.io.IOException;
17 import java.util.ArrayList;
17 import java.util.List; 18 import java.util.List;
18 19
19 import org.apache.log4j.Logger; 20 import org.apache.log4j.Logger;
20 import org.apache.velocity.Template; 21 import org.apache.velocity.Template;
21 import org.geotools.data.shapefile.ShpFiles; 22 import org.geotools.data.shapefile.ShpFiles;
40 protected String getMapserverUrl() { 41 protected String getMapserverUrl() {
41 return FLYSUtils.getXPathString(FLYSUtils.XPATH_FLOODMAP_MAPSERVER_URL); 42 return FLYSUtils.getXPathString(FLYSUtils.XPATH_FLOODMAP_MAPSERVER_URL);
42 } 43 }
43 44
44 /** 45 /**
45 * Method which starts searching for meta information file and mapfile 46 * Generates flys.map file that contains layers of all
46 * generation. 47 * projects and types (floodmap, user defined, barriers).
47 */ 48 */
48 @Override 49 @Override
49 public void generate() throws IOException 50 public void generate() throws IOException
50 { 51 {
51 File[] userDirs = getUserDirs(); 52 // Get all directories below "shapefiles/"
52 List<String> layers = parseLayers(userDirs); 53 File[] prjDirs = getProjectDirs();
53 logger.info("Found " + layers.size() + " layers for user mapfile."); 54
54 55 // Look for appropriate shapefiles that we can use as layers
55 writeMapfile(layers); 56 List<File> layerShapes = searchForLayerShapes(prjDirs);
57
58 List<String> layerSnippets = new ArrayList<String>();
59
60 // Generate layer snippet for each shapefile
61 for (File layerShape : layerShapes) {
62 String fileName = layerShape.getName();
63 if (fileName.startsWith(MS_PREFIX_BARRIERS)) {
64
65 }
66 else if (fileName.startsWith(MS_PREFIX_USER)) {
67
68 }
69 else if (fileName.startsWith(MS_PREFIX_WSPLGEN)) {
70
71 }
72 }
73
74 writeMapfile(layerSnippets);
56 } 75 }
57 76
58 /** 77 /**
59 * Creates a layer file used for Mapserver's mapfile which represents the 78 * Creates a layer file used for Mapserver's mapfile which represents the
60 * floodmap. 79 * floodmap.
61 * 80 *
62 * @param flys The FLYSArtifact that owns <i>wms</i>. 81 * @param flys The FLYSArtifact that owns <i>wms</i>.
63 * @param wms The WMSLayerFacet that contains information for the layer. 82 * @param wms The WMSLayerFacet that contains information for the layer.
64 */ 83 */
65 public void createUeskLayer( 84 protected void createUeskLayer(
66 FLYSArtifact flys, 85 FLYSArtifact flys,
67 WSPLGENLayerFacet wms, 86 WSPLGENLayerFacet wms,
68 String style, 87 String style,
69 CallContext context 88 CallContext context
70 ) throws FileNotFoundException, IOException 89 ) throws FileNotFoundException, IOException
108 * user defined barriers. 127 * user defined barriers.
109 * 128 *
110 * @param flys The FLYSArtifact that owns <i>wms</i>. 129 * @param flys The FLYSArtifact that owns <i>wms</i>.
111 * @param wms The WMSLayerFacet that contains information for the layer. 130 * @param wms The WMSLayerFacet that contains information for the layer.
112 */ 131 */
113 public void createBarriersLayer(FLYSArtifact flys, WMSLayerFacet wms) 132 protected void createBarriersLayer(FLYSArtifact flys, WMSLayerFacet wms)
114 throws FileNotFoundException, IOException 133 throws FileNotFoundException, IOException
115 { 134 {
116 logger.debug("createBarriersLayer"); 135 logger.debug("createBarriersLayer");
117 136
118 //String uuid = flys.identifier(); 137 //String uuid = flys.identifier();
219 * shape files uploaded by the user. 238 * shape files uploaded by the user.
220 * 239 *
221 * @param flys The FLYSArtifact that owns <i>wms</i>. 240 * @param flys The FLYSArtifact that owns <i>wms</i>.
222 * @param wms The WMSLayerFacet that contains information for the layer. 241 * @param wms The WMSLayerFacet that contains information for the layer.
223 */ 242 */
224 public void createUserShapeLayer(FLYSArtifact flys, WMSLayerFacet wms) 243 protected void createUserShapeLayer(FLYSArtifact flys, WMSLayerFacet wms)
225 throws FileNotFoundException, IOException 244 throws FileNotFoundException, IOException
226 { 245 {
227 logger.debug("createUserShapeLayer"); 246 logger.debug("createUserShapeLayer");
228 247
229 String uuid = flys.identifier(); 248 String uuid = flys.identifier();
285 * geometries from database. 304 * geometries from database.
286 * 305 *
287 * @param flys The FLYSArtifact that owns <i>wms</i>. 306 * @param flys The FLYSArtifact that owns <i>wms</i>.
288 * @param wms The WMSLayerFacet that contains information for the layer. 307 * @param wms The WMSLayerFacet that contains information for the layer.
289 */ 308 */
290 public void createDatabaseLayer( 309 protected void createDatabaseLayer(
291 FLYSArtifact flys, 310 FLYSArtifact flys,
292 WMSDBLayerFacet wms, 311 WMSDBLayerFacet wms,
293 String style 312 String style
294 ) 313 )
295 throws FileNotFoundException, IOException 314 throws FileNotFoundException, IOException

http://dive4elements.wald.intevation.org