diff 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
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/mapserver/ArtifactMapfileGenerator.java	Tue Feb 19 13:41:20 2013 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/mapserver/ArtifactMapfileGenerator.java	Tue Feb 19 14:25:38 2013 +0100
@@ -14,6 +14,7 @@
 import java.io.File;
 import java.io.FileNotFoundException;
 import java.io.IOException;
+import java.util.ArrayList;
 import java.util.List;
 
 import org.apache.log4j.Logger;
@@ -42,17 +43,35 @@
     }
 
     /**
-     * Method which starts searching for meta information file and mapfile
-     * generation.
+     * Generates flys.map file that contains layers of all
+     * projects and types (floodmap, user defined, barriers).
      */
     @Override
     public void generate() throws IOException
     {
-        File[] userDirs = getUserDirs();
-        List<String> layers = parseLayers(userDirs);
-        logger.info("Found " + layers.size() + " layers for user mapfile.");
+        // Get all directories below "shapefiles/"
+        File[] prjDirs = getProjectDirs();
 
-        writeMapfile(layers);
+        // Look for appropriate shapefiles that we can use as layers
+        List<File> layerShapes = searchForLayerShapes(prjDirs);
+
+        List<String> layerSnippets = new ArrayList<String>();
+
+        // Generate layer snippet for each shapefile
+        for (File layerShape : layerShapes) {
+            String fileName = layerShape.getName();
+            if (fileName.startsWith(MS_PREFIX_BARRIERS)) {
+
+            }
+            else if (fileName.startsWith(MS_PREFIX_USER)) {
+
+            }
+            else if (fileName.startsWith(MS_PREFIX_WSPLGEN)) {
+
+            }
+        }
+
+        writeMapfile(layerSnippets);
     }
 
     /**
@@ -62,7 +81,7 @@
      * @param flys The FLYSArtifact that owns <i>wms</i>.
      * @param wms The WMSLayerFacet that contains information for the layer.
      */
-    public void createUeskLayer(
+    protected void createUeskLayer(
         FLYSArtifact  flys,
         WSPLGENLayerFacet wms,
         String        style,
@@ -110,7 +129,7 @@
      * @param flys The FLYSArtifact that owns <i>wms</i>.
      * @param wms The WMSLayerFacet that contains information for the layer.
      */
-    public void createBarriersLayer(FLYSArtifact flys, WMSLayerFacet wms)
+    protected void createBarriersLayer(FLYSArtifact flys, WMSLayerFacet wms)
     throws FileNotFoundException, IOException
     {
         logger.debug("createBarriersLayer");
@@ -221,7 +240,7 @@
          * @param flys The FLYSArtifact that owns <i>wms</i>.
          * @param wms The WMSLayerFacet that contains information for the layer.
          */
-        public void createUserShapeLayer(FLYSArtifact flys, WMSLayerFacet wms)
+        protected void createUserShapeLayer(FLYSArtifact flys, WMSLayerFacet wms)
         throws FileNotFoundException, IOException
         {
             logger.debug("createUserShapeLayer");
@@ -287,7 +306,7 @@
          * @param flys The FLYSArtifact that owns <i>wms</i>.
          * @param wms The WMSLayerFacet that contains information for the layer.
          */
-        public void createDatabaseLayer(
+        protected void createDatabaseLayer(
             FLYSArtifact    flys,
             WMSDBLayerFacet wms,
             String          style

http://dive4elements.wald.intevation.org