changeset 180:f4eb506499f5

Done some code styling and removed TODOs.
author Raimund Renkert <rrenkert@intevation.de>
date Mon, 11 Jul 2011 12:11:08 +0200
parents f3a91cd7440b
children 0bde090506f9
files ChangeLog src/java/de/intevation/mxd/ArcGISInitializer.java src/java/de/intevation/mxd/Converter.java src/java/de/intevation/mxd/reader/CartoLineSymbolReader.java src/java/de/intevation/mxd/reader/FeatureLayerReader.java src/java/de/intevation/mxd/reader/FillSymbolReader.java src/java/de/intevation/mxd/reader/GroupLayerReader.java src/java/de/intevation/mxd/reader/HashLineSymbolReader.java src/java/de/intevation/mxd/reader/LabelEngineReader.java src/java/de/intevation/mxd/reader/LineSymbolReader.java src/java/de/intevation/mxd/reader/MarkerSymbolReader.java src/java/de/intevation/mxd/reader/SimpleLineSymbolReader.java src/java/de/intevation/mxd/reader/TextSymbolReader.java src/java/de/intevation/mxd/utils/MapToXMLUtils.java src/java/de/intevation/mxd/writer/FillStyleWriter.java src/java/de/intevation/mxd/writer/LineStyleWriter.java src/java/de/intevation/mxd/writer/MapScriptWriter.java
diffstat 17 files changed, 256 insertions(+), 215 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Fri Jul 08 16:32:05 2011 +0200
+++ b/ChangeLog	Mon Jul 11 12:11:08 2011 +0200
@@ -1,3 +1,23 @@
+2011-07-11  Raimund Renkert  <raimund.renkert@intevation.de>
+
+	* src/java/de/intevation/mxd/ArcGISInitializer.java,
+	  src/java/de/intevation/mxd/Converter.java,
+	  src/java/de/intevation/mxd/reader/CartoLineSymbolReader.java,
+	  src/java/de/intevation/mxd/reader/FeatureLayerReader.java,
+	  src/java/de/intevation/mxd/reader/FillSymbolReader.java,
+	  src/java/de/intevation/mxd/reader/GroupLayerReader.java,
+	  src/java/de/intevation/mxd/reader/HashLineSymbolReader.java,
+	  src/java/de/intevation/mxd/reader/LabelEngineReader.java,
+	  src/java/de/intevation/mxd/reader/LineSymbolReader.java,
+	  src/java/de/intevation/mxd/reader/MarkerSymbolReader.java,
+	  src/java/de/intevation/mxd/reader/SimpleLineSymbolReader.java,
+	  src/java/de/intevation/mxd/reader/TextSymbolReader.java,
+	  src/java/de/intevation/mxd/utils/MapToXMLUtils.java,
+	  src/java/de/intevation/mxd/writer/FillStyleWriter.java,
+	  src/java/de/intevation/mxd/writer/LineStyleWriter.java,
+	  src/java/de/intevation/mxd/writer/MapScriptWriter.java:
+	  Done some code styling and removed TODOs.
+
 2011-07-07  Raimund Renkert  <raimund.renkert@intevation.de>
 
 	Added a first version of feature labeling.
--- a/src/java/de/intevation/mxd/ArcGISInitializer.java	Fri Jul 08 16:32:05 2011 +0200
+++ b/src/java/de/intevation/mxd/ArcGISInitializer.java	Mon Jul 11 12:11:08 2011 +0200
@@ -40,49 +40,53 @@
         logger.debug("initArcGIS()");
 
         String engineInstallDir    = System.getenv("AGSENGINEJAVA");
-	if(engineInstallDir == null) {
+        if(engineInstallDir == null) {
             engineInstallDir = System.getenv("AGSDESKTOPJAVA");
-	    if(engineInstallDir == null) {
+            if(engineInstallDir == null) {
                 logger.error("Could not find ArcGIS Environment. \n" +
                              "AGSENGINEJAVA or AGSDESKTOPJAVA not set.");
-		return false;
-	    }
-	}
+                return false;
+            }
+        }
 
-	//Obtain the relative path to the arcobjects.jar file
+        //Obtain the relative path to the arcobjects.jar file
         String jarPath = engineInstallDir + "java" + File.separator + "lib" +
-            			 File.separator + "arcobjects.jar";
+                         File.separator + "arcobjects.jar";
 
         //Create a new file
         File jarFile = new File(jarPath);
-        
+
         //Test for file existence
         if(!jarFile.exists()){
-                logger.error("The arcobjects.jar was not found in the following location: " +
-                                                jarFile.getParent());
-                logger.error("Verify that arcobjects.jar can be located in the specified folder.");
-                logger.error("If not present, try uninstalling your ArcGIS software and reinstalling it.");
+                logger.error("The arcobjects.jar was not found in the" +
+                             " following location: " + jarFile.getParent());
+                logger.error("Verify that arcobjects.jar can" +
+                             " be located in the specified folder.");
+                logger.error("If not present, try uninstalling your" +
+                             " ArcGIS software and reinstalling it.");
                 System.exit(0);
         }
 
         //Helps load classes and resources from a search path of URLs
-        URLClassLoader sysloader = (URLClassLoader) ClassLoader.getSystemClassLoader();
+        URLClassLoader sysloader =
+            (URLClassLoader) ClassLoader.getSystemClassLoader();
         Class<URLClassLoader> sysclass = URLClassLoader.class;
 
         try {
-            Method method = sysclass.getDeclaredMethod("addURL", new Class[]{URL.class});
+            Method method = sysclass.getDeclaredMethod("addURL",
+                                                       new Class[]{URL.class});
             method.setAccessible(true);
             method.invoke(sysloader, new Object[]{jarFile.toURI().toURL()});
         }
-	catch (Throwable throwable) {
+        catch (Throwable throwable) {
             throwable.printStackTrace();
             logger.error("Could not add arcobjects.jar to system classloader");
             System.exit(0);
         }
-    
-	EngineInitializer.initializeEngine();
-	
-	aoInit              = new AoInitialize();
+
+        EngineInitializer.initializeEngine();
+
+        aoInit = new AoInitialize();
         return true;
     }
 
--- a/src/java/de/intevation/mxd/Converter.java	Fri Jul 08 16:32:05 2011 +0200
+++ b/src/java/de/intevation/mxd/Converter.java	Mon Jul 11 12:11:08 2011 +0200
@@ -19,7 +19,7 @@
 /**
  * The entry point of the MXD converter tool.
  *
- * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
+ * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a>
  */
 public class Converter {
 
@@ -145,7 +145,7 @@
         }
     }
 
-    
+
     private static void printUsage() {
         System.out.println("Available parameters:[{-m,--mxd} path/to/mxd]\n" +
                            "\t\t[{-a,--map} path/to/mapfile]\n" +
--- a/src/java/de/intevation/mxd/reader/CartoLineSymbolReader.java	Fri Jul 08 16:32:05 2011 +0200
+++ b/src/java/de/intevation/mxd/reader/CartoLineSymbolReader.java	Mon Jul 11 12:11:08 2011 +0200
@@ -174,8 +174,6 @@
         catch(IOException ioe) {
             logger.warn("Could not read width.");
         }
-        //TODO Read further attributes depending on the Mapscript functionality:
-        //     Template, MarkerSymbol, LineDecorations
 
         try {
             Template temp = (Template)symbol.getTemplate();
--- a/src/java/de/intevation/mxd/reader/FeatureLayerReader.java	Fri Jul 08 16:32:05 2011 +0200
+++ b/src/java/de/intevation/mxd/reader/FeatureLayerReader.java	Mon Jul 11 12:11:08 2011 +0200
@@ -140,9 +140,10 @@
         }
 
         try {
-            AnnotateLayerPropertiesCollection annotation= 
-                (AnnotateLayerPropertiesCollection)layer.getAnnotationProperties();
-        
+            AnnotateLayerPropertiesCollection annotation =
+                (AnnotateLayerPropertiesCollection)
+                  layer.getAnnotationProperties();
+
             if (layer.isDisplayAnnotation() && annotation.getCount() > 0){
                 for(int i = 0; i < annotation.getCount(); i++) {
                     IAnnotateLayerProperties prop = annotation.getProperties(0);
@@ -203,7 +204,8 @@
 
             }
             else if(layer.getWorkspace().getType() == 2) {
-                IPropertySet set = layer.getWorkspace().getConnectionProperties();
+                IPropertySet set =
+                    layer.getWorkspace().getConnectionProperties();
                 Object names[] = new Object[set.getCount()];
                 Object prop[] = new Object[set.getCount()];
                 set.getAllProperties(names, prop);
--- a/src/java/de/intevation/mxd/reader/FillSymbolReader.java	Fri Jul 08 16:32:05 2011 +0200
+++ b/src/java/de/intevation/mxd/reader/FillSymbolReader.java	Mon Jul 11 12:11:08 2011 +0200
@@ -65,7 +65,8 @@
                     sreader = new LineFillSymbolReader(symbol);
                 }
                 else {
-                    logger.debug("The reader for type " + symbol.getClass().toString() +
+                    logger.debug("The reader for type " +
+                                 symbol.getClass().toString() +
                                  " is not implemented!");
                     return parent;
                 }
--- a/src/java/de/intevation/mxd/reader/GroupLayerReader.java	Fri Jul 08 16:32:05 2011 +0200
+++ b/src/java/de/intevation/mxd/reader/GroupLayerReader.java	Mon Jul 11 12:11:08 2011 +0200
@@ -70,7 +70,7 @@
     public Element read()
     throws IOException{
         logger.debug("read()");
-	Element layerElement = null;
+        Element layerElement = null;
         for(int i = 0; i < layer.getCount();i++) {
             ILayer lay = layer.getLayer(i);
             try {
@@ -81,7 +81,7 @@
                     if (layerElement == null) {
                         continue;
                     }
-		    layerElement.setAttribute("group", layer.getName());
+                    layerElement.setAttribute("group", layer.getName());
                     IFeatureRenderer renderer =
                         ((FeatureLayer)lay).getRenderer();
                     IRendererReader rreader;
@@ -113,7 +113,7 @@
                         new GdbRasterCatalogLayerReader(lay);
                     gclr.setUtil(util);
                     layerElement = gclr.read();
-		    layerElement.setAttribute("group", layer.getName());
+                    layerElement.setAttribute("group", layer.getName());
                     IFeatureRenderer renderer =
                         ((GdbRasterCatalogLayer)lay).getRenderer();
                     IRendererReader rreader;
@@ -140,18 +140,18 @@
                                      renderer.getClass().toString());
                     }
                 }
-	    }
-	    catch(Exception e) {
-	        invalidLayerCount++;
+            }
+            catch(Exception e) {
+                invalidLayerCount++;
                 if(i == 0 && (i + 1) == layer.getCount() ||
                     invalidLayerCount == layer.getCount()) {
                     throw new IOException(
                         "No valid layer in MXD file." +
                         " Aborting.");
                 }
-	    }
-	}
-	return layerElement;
+            }
+        }
+        return layerElement;
     }
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/src/java/de/intevation/mxd/reader/HashLineSymbolReader.java	Fri Jul 08 16:32:05 2011 +0200
+++ b/src/java/de/intevation/mxd/reader/HashLineSymbolReader.java	Mon Jul 11 12:11:08 2011 +0200
@@ -179,15 +179,13 @@
                 " No fallback symbol defined.");
         }
 
-        //TODO Read further HashLine specific attributes:
-        //     LineDecoration, Template.
         symbolElement.setAttribute("type", "line");
         symbolElement.setAttribute("style", "hash");
 
         return symbolElement;
     }
 
-    private void readHashSymbol(ILineSymbol ls, Element parent) 
+    private void readHashSymbol(ILineSymbol ls, Element parent)
     throws Exception {
         LineSymbolReader lsr = new LineSymbolReader ();
         if (lsr.canRead(ls)) {
--- a/src/java/de/intevation/mxd/reader/LabelEngineReader.java	Fri Jul 08 16:32:05 2011 +0200
+++ b/src/java/de/intevation/mxd/reader/LabelEngineReader.java	Mon Jul 11 12:11:08 2011 +0200
@@ -44,8 +44,9 @@
             this.properties = (LabelEngineLayerProperties)prop;
         }
         else {
-            throw new Exception("Not an instance of LaberEngineLayerProperties: " +
-                prop.getClass().toString());
+            throw new Exception("Not an instance of" +
+                                " LaberEngineLayerProperties: " +
+                                prop.getClass().toString());
         }
     }
 
@@ -59,7 +60,7 @@
     }
 
     public void setParent(Element parent) {
-	this.parent = parent;     
+        this.parent = parent;
     }
 
 
@@ -72,7 +73,7 @@
     public Element read()
     throws IOException{
         logger.debug("read()");
-	Element labelElement;
+        Element labelElement;
         try {
             labelElement = util.addLabel(parent);
         }
@@ -81,58 +82,60 @@
             return null;
         }
 
-	try {
-	    labelElement.setAttribute("expression", properties.getExpression());
-	}
-	catch(IOException ioe) {
-	    logger.warn("Could not read label expression.");
-	    return null;
-	}
+        try {
+            labelElement.setAttribute(
+                "expression",
+                properties.getExpression());
+        }
+        catch(IOException ioe) {
+            logger.warn("Could not read label expression.");
+            return null;
+        }
 
         try {
-	    labelElement.setAttribute(
+            labelElement.setAttribute(
                 "offset",
-	       	String.valueOf(properties.getOffset()));
-	}
-	catch(IOException ioe) {
-	    logger.warn("Could not read label offset.");
-	}
-
-	try {
-	    labelElement.setAttribute(
-                "definition_query",
-	       	properties.getWhereClause());
-	}
-	catch(IOException ioe) {
-	    logger.warn("Could not read label where clause.");
-	}
+                String.valueOf(properties.getOffset()));
+        }
+        catch(IOException ioe) {
+            logger.warn("Could not read label offset.");
+        }
 
         try {
-	    labelElement.setAttribute(
-		"max_scale",
-		String.valueOf(properties.getAnnotationMaximumScale()));
-	    labelElement.setAttribute(
-		"min_scale",
-		String.valueOf(properties.getAnnotationMinimumScale()));
-	}
-	catch(IOException ioe) {
-	    logger.warn("Could not read label scale.");
-	}
+            labelElement.setAttribute(
+                "definition_query",
+            properties.getWhereClause());
+        }
+        catch(IOException ioe) {
+            logger.warn("Could not read label where clause.");
+        }
 
-	try {
+        try {
+            labelElement.setAttribute(
+                "max_scale",
+                String.valueOf(properties.getAnnotationMaximumScale()));
+            labelElement.setAttribute(
+                "min_scale",
+                String.valueOf(properties.getAnnotationMinimumScale()));
+        }
+        catch(IOException ioe) {
+            logger.warn("Could not read label scale.");
+        }
+
+        try {
             ITextSymbol sym = properties.getSymbol();
-	    if(sym instanceof TextSymbol) {
-	        TextSymbolReader tsr = new TextSymbolReader(sym);
-		tsr.setParent(labelElement);
-		tsr.setUtil(util);
-		tsr.read();
-	    }
-	}
+            if(sym instanceof TextSymbol) {
+                TextSymbolReader tsr = new TextSymbolReader(sym);
+                tsr.setParent(labelElement);
+                tsr.setUtil(util);
+                tsr.read();
+            }
+        }
         catch(Exception e) {
-	    logger.warn("Could not read label text symbol.");
-	}
-	
-	return labelElement;
+            logger.warn("Could not read label text symbol.");
+        }
+
+        return labelElement;
     }
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/src/java/de/intevation/mxd/reader/LineSymbolReader.java	Fri Jul 08 16:32:05 2011 +0200
+++ b/src/java/de/intevation/mxd/reader/LineSymbolReader.java	Mon Jul 11 12:11:08 2011 +0200
@@ -73,7 +73,8 @@
                     sreader = new HashLineSymbolReader(symbol);
                 }
                 else {
-                    logger.debug("The reader for type " + symbol.getClass().toString() +
+                    logger.debug("The reader for type " +
+                                 symbol.getClass().toString() +
                                  " is not implemented!");
                     return parent;
                 }
--- a/src/java/de/intevation/mxd/reader/MarkerSymbolReader.java	Fri Jul 08 16:32:05 2011 +0200
+++ b/src/java/de/intevation/mxd/reader/MarkerSymbolReader.java	Mon Jul 11 12:11:08 2011 +0200
@@ -73,7 +73,8 @@
                     sreader = new MultiLayerMarkerSymbolReader(symbol);
                 }
                 else {
-                    logger.debug("The reader for type " + symbol.getClass().toString() +
+                    logger.debug("The reader for type " +
+                                 symbol.getClass().toString() +
                                  " is not implemented!");
                     return parent;
                 }
@@ -104,7 +105,8 @@
                     sreader = new MultiLayerMarkerSymbolReader(markerSymbol);
                 }
                 else {
-                    logger.debug("The reader for type " + symbol.getClass().toString() +
+                    logger.debug("The reader for type " +
+                                 symbol.getClass().toString() +
                                  " is not implemented!");
                     return parent;
                 }
@@ -160,5 +162,5 @@
             return false;
         }
     }
-
 }
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/src/java/de/intevation/mxd/reader/SimpleLineSymbolReader.java	Fri Jul 08 16:32:05 2011 +0200
+++ b/src/java/de/intevation/mxd/reader/SimpleLineSymbolReader.java	Mon Jul 11 12:11:08 2011 +0200
@@ -102,7 +102,9 @@
         }
 
         try {
-            symbolElement.setAttribute("width", String.valueOf(symbol.getWidth()));
+            symbolElement.setAttribute(
+                "width",
+                String.valueOf(symbol.getWidth()));
         }
         catch(IOException ioe) {
             logger.warn("Could not read width.");
@@ -126,7 +128,8 @@
             case esriSimpleLineStyle.esriSLSDashDot:
                     symbolElement.setAttribute("linestyle", "dashdot"); break;
             case esriSimpleLineStyle.esriSLSDashDotDot:
-                    symbolElement.setAttribute("linestyle", "dashdotdot"); break;
+                    symbolElement.setAttribute("linestyle", "dashdotdot");
+                    break;
             default: break;
         }
 
--- a/src/java/de/intevation/mxd/reader/TextSymbolReader.java	Fri Jul 08 16:32:05 2011 +0200
+++ b/src/java/de/intevation/mxd/reader/TextSymbolReader.java	Mon Jul 11 12:11:08 2011 +0200
@@ -118,7 +118,7 @@
             logger.warn("Could not read offset.");
         }
 
-	try {
+        try {
             Font f = symbol.getFont();
             symbolElement.setAttribute("font", f.getName());
             symbolElement.setAttribute("char_set", String.valueOf(f.getCharset()));
--- a/src/java/de/intevation/mxd/utils/MapToXMLUtils.java	Fri Jul 08 16:32:05 2011 +0200
+++ b/src/java/de/intevation/mxd/utils/MapToXMLUtils.java	Mon Jul 11 12:11:08 2011 +0200
@@ -139,7 +139,7 @@
         renderer.appendChild(node);
         return node;
     }
-    
+
     /**
      * Add a label element to the map.
      * @param layer The parent layer element.
--- a/src/java/de/intevation/mxd/writer/FillStyleWriter.java	Fri Jul 08 16:32:05 2011 +0200
+++ b/src/java/de/intevation/mxd/writer/FillStyleWriter.java	Mon Jul 11 12:11:08 2011 +0200
@@ -165,8 +165,7 @@
                 transp = -1;
             }
         }
-        //write new style for the outline
-        //TODO write further attribute like pattern etc.
+
         Color oCol = Color.decode(
             symbolElement.getAttribute("color"));
 
--- a/src/java/de/intevation/mxd/writer/LineStyleWriter.java	Fri Jul 08 16:32:05 2011 +0200
+++ b/src/java/de/intevation/mxd/writer/LineStyleWriter.java	Mon Jul 11 12:11:08 2011 +0200
@@ -162,9 +162,11 @@
                 int pos = 0;
                 for(int i = 0; i < count; i++) {
                     double mark =
-                        Double.parseDouble(symbolElement.getAttribute("mark_" + i));
+                        Double.parseDouble(symbolElement.getAttribute("mark_" +
+                                                                      i));
                     double gap =
-                        Double.parseDouble(symbolElement.getAttribute("gap_" + i));
+                        Double.parseDouble(symbolElement.getAttribute("gap_" +
+                                                                      i));
                     if(i == 0 && mark == 0.0) {
                         move = gap;
                     }
--- a/src/java/de/intevation/mxd/writer/MapScriptWriter.java	Fri Jul 08 16:32:05 2011 +0200
+++ b/src/java/de/intevation/mxd/writer/MapScriptWriter.java	Mon Jul 11 12:11:08 2011 +0200
@@ -58,27 +58,27 @@
     }
 
     public MapScriptWriter(String templ, String filename) {
-	String path = System.getProperty("user.dir");
+        String path = System.getProperty("user.dir");
         map = new mapObj(templ);
-	File f = new File(filename);
-	mapFilename = filename;
-	if(f.isAbsolute()) {
+        File f = new File(filename);
+        mapFilename = filename;
+        if(f.isAbsolute()) {
             map.setMappath(mapFilename);
-	}
-	else {
-	    map.setMappath(
-	        System.getProperty("user.dir") +
-	       	File.separator +
-		mapFilename);
-	    mapFilename = System.getProperty("user.dir") +
-	       	File.separator +
-		mapFilename;
-	}
-	String fontSetPath = map.getFontset().getFilename();
-	File fonts = new File(fontSetPath);
-	String fontSet = fonts.getAbsolutePath();
-	fontSet = fontSet.replaceAll("\\\\", "/");
-	map.setFontSet(fontSet);
+        }
+        else {
+            map.setMappath(
+                System.getProperty("user.dir") +
+                File.separator +
+                mapFilename);
+            mapFilename = System.getProperty("user.dir") +
+                File.separator +
+                mapFilename;
+        }
+        String fontSetPath = map.getFontset().getFilename();
+        File fonts = new File(fontSetPath);
+        String fontSet = fonts.getAbsolutePath();
+        fontSet = fontSet.replaceAll("\\\\", "/");
+        map.setFontSet(fontSet);
     }
 
     /**
@@ -103,7 +103,7 @@
         //Save the map.
         mapObj cloneMap = map.cloneMap();
 
-	cloneMap.save(mapFilename);
+        cloneMap.save(mapFilename);
         logger.info("Mapfile created: " + mapFilename);
         return true;
     }
@@ -130,10 +130,10 @@
             Double.parseDouble(mapNode.getAttribute("extent_max_y")));
 
         //Set the units and projection.
-	int proj = Integer.parseInt(mapNode.getAttribute("projection"));
-	if(proj != 0) {
-	    map.setProjection("epsg:" + mapNode.getAttribute("projection"));
-	}
+        int proj = Integer.parseInt(mapNode.getAttribute("projection"));
+        if(proj != 0) {
+            map.setProjection("epsg:" + mapNode.getAttribute("projection"));
+        }
         String u = mapNode.getAttribute("units");
         if(u.equals("feet")) {
             units = MS_UNITS.MS_FEET;
@@ -156,16 +156,13 @@
         else if(u.equals("points")) {
             units = MS_UNITS.MS_PIXELS;
         }
-	else if(u.equals("degree")) {
-	    units = MS_UNITS.MS_DD;
-	}
+        else if(u.equals("degree")) {
+            units = MS_UNITS.MS_DD;
+        }
         else {
             units = MS_UNITS.MS_METERS;
         }
         map.setUnits(units);
-
-        //TODO: Find out whats the correct scale value.
-        //map.setScaledenom(Double.parseDouble(mapNode.getAttribute("scale")));
     }
 
     /**
@@ -186,11 +183,12 @@
             String lname = layerElement.getAttribute("name");
             lname = lname.replaceAll(" ", "");
             layer.setName(lname);
-	    layer.setUnits(units.swigValue());
+            layer.setUnits(units.swigValue());
             layer.setMetaData("wms_title", layerElement.getAttribute("name"));
             if(layerElement.hasAttribute("group")) {
-	    	layer.setGroup(layerElement.getAttribute("group"));
-	    }
+                layer.setGroup(layerElement.getAttribute("group"));
+            }
+
             //The layer status.
             String stat = layerElement.getAttribute("status");
             if (stat.equals("on")) {
@@ -239,7 +237,7 @@
                     datasource += File.separator;
                 }
                 datasource += layerElement.getAttribute("data_source");
-		datasource = datasource.replaceAll("\\\\", "/");
+                datasource = datasource.replaceAll("\\\\", "/");
                 layer.setData(datasource);
             }
             else if(con_type.equals("SDE")) {
@@ -275,27 +273,28 @@
                 }
                 else {
                     prefix = layerElement.getAttribute("data_source");
-		    if(layerElement.hasAttribute("definition_query") &&
-		       !layerElement.getAttribute("definition_query").equals("")) {
-		        layer.setFilter("where " +
-		            layerElement.getAttribute("definition_query"));   
-		    }
+                    if(layerElement.hasAttribute("definition_query") &&
+                       !layerElement.getAttribute("definition_query")
+                                     .equals("")) {
+                        layer.setFilter("where " +
+                        layerElement.getAttribute("definition_query"));
+                    }
                 }
-
             }
             layer.setTemplate("PleaseInsertAValidTemplateForGFI");
 
-	    NodeList labels = layerElement.getElementsByTagName("label");
-	    if(labels.getLength() > 0) {
-		Element label = (Element)labels.item(0);
+            NodeList labels = layerElement.getElementsByTagName("label");
+            if(labels.getLength() > 0) {
+                Element label = (Element)labels.item(0);
                 String expr = label.getAttribute("expression");
-		expr = expr.replaceAll("\\[", "");
-		expr = expr.replaceAll("\\]", "");
-		if(!prefix.equals("")) {
-		    expr = prefix + "." + expr;
-		}
-		layer.setLabelitem(expr);
-	    }
+                expr = expr.replaceAll("\\[", "");
+                expr = expr.replaceAll("\\]", "");
+                if(!prefix.equals("")) {
+                    expr = prefix + "." + expr;
+                }
+                layer.setLabelitem(expr);
+            }
+
             //Write classes.
             writeClass(layer, layerElement);
         }
@@ -327,12 +326,12 @@
             }
             co.setName (name);
 
-       	    NodeList labels = layerElement.getElementsByTagName("label");
-	    if(labels.getLength() > 0) {
-	        Element labelElement = (Element)labels.item(0);
-		String  layerType = layerElement.getAttribute("type");
-		writeLabel(co, labelElement, layerType);
-	    } 
+            NodeList labels = layerElement.getElementsByTagName("label");
+            if(labels.getLength() > 0) {
+                Element labelElement = (Element)labels.item(0);
+                String  layerType = layerElement.getAttribute("type");
+                writeLabel(co, labelElement, layerType);
+            }
             if(classElement.hasAttribute("field_count")) {
                 co.setExpression(createExpression(classElement, i));
             }
@@ -342,16 +341,22 @@
                 Element elem = (Element)l.item(j);
 
                 String type = layerElement.getAttribute("type");
-                if(type.equals("point") && elem.getTagName().equals("symbol")) {
-                    MarkerStyleWriter swriter = new MarkerStyleWriter (this.map, co);
+                if(type.equals("point") &&
+                   elem.getTagName().equals("symbol")) {
+                    MarkerStyleWriter swriter =
+                        new MarkerStyleWriter (this.map, co);
                     swriter.write (elem);
                 }
-                else if(type.equals("line") && elem.getTagName().equals("symbol")) {
-                    LineStyleWriter swriter = new LineStyleWriter (this.map, co);
+                else if(type.equals("line") &&
+                        elem.getTagName().equals("symbol")) {
+                    LineStyleWriter swriter =
+                        new LineStyleWriter (this.map, co);
                     swriter.write (elem);
                 }
-                else if(type.equals("polygon") && elem.getTagName().equals("symbol")) {
-                    FillStyleWriter swriter = new FillStyleWriter (this.map, co);
+                else if(type.equals("polygon") &&
+                        elem.getTagName().equals("symbol")) {
+                    FillStyleWriter swriter =
+                        new FillStyleWriter (this.map, co);
                     swriter.write (elem);
                 }
             }
@@ -360,19 +365,19 @@
 
 
     private void writeLabel(
-	classObj co,
-       	Element labelElement,
-       	String layerType) {
+        classObj co,
+        Element labelElement,
+        String layerType) {
 
         labelObj label = co.getLabel();
-	Element symbol = (Element)labelElement.getFirstChild();
-	if(symbol != null && symbol.getTagName().equals("symbol")) {
-	    String type = symbol.getAttribute("type");
-	    if(type.equals("text")) {
-	    	label.setType(MS_FONT_TYPE.MS_TRUETYPE);
-	    }
-	    label.setSize(Double.parseDouble(symbol.getAttribute("size")));
-            
+        Element symbol = (Element)labelElement.getFirstChild();
+        if(symbol != null && symbol.getTagName().equals("symbol")) {
+            String type = symbol.getAttribute("type");
+            if(type.equals("text")) {
+                label.setType(MS_FONT_TYPE.MS_TRUETYPE);
+            }
+            label.setSize(Double.parseDouble(symbol.getAttribute("size")));
+
             if(symbol.hasAttribute("color")) {
                 String c = symbol.getAttribute("color");
                 Color col = Color.decode(c);
@@ -382,42 +387,42 @@
                     col.getBlue(),
                     -4);
                 label.setColor(color);
-	    }
-	    if(symbol.hasAttribute("font")) {
-	        String font = symbol.getAttribute("font");
-		fontSetObj fso = this.map.getFontset();
-		hashTableObj fonts = fso.getFonts();
-		String mapFont = fonts.get(font,"");
-		if(mapFont != null && !mapFont.equals("")) {
-		    label.setFont(font);
-		}
-		else {
-		    logger.info(
-			"Could not find font " + font + " in font set. " +
-			"Using FreeSans for labels.");
-                    label.setFont("FreeSans");
-		}
-	    }
+            }
+            if(symbol.hasAttribute("font")) {
+                String font = symbol.getAttribute("font");
+                fontSetObj fso = this.map.getFontset();
+                hashTableObj fonts = fso.getFonts();
+                String mapFont = fonts.get(font,"");
+                if(mapFont != null && !mapFont.equals("")) {
+                    label.setFont(font);
+                }
+                else {
+                    logger.info(
+                        "Could not find font " + font + " in font set. " +
+                        "Using FreeSans for labels.");
+                        label.setFont("FreeSans");
+                }
+            }
 
             if(labelElement.hasAttribute("max_scale")) {
-		double min =
-		    Double.parseDouble(labelElement.getAttribute("max_scale"));
-		if(min > 0) {
-	            label.setMinscaledenom(min);
-		}
-	    }
-	    if(labelElement.hasAttribute("min_scale")) {
-	        double max =
-		    Double.parseDouble(labelElement.getAttribute("min_scale"));
-		if(max > 0) {
-		    label.setMaxscaledenom(max);
-		}
-	    }
+                double min =
+                    Double.parseDouble(labelElement.getAttribute("max_scale"));
+                if(min > 0) {
+                    label.setMinscaledenom(min);
+                }
+            }
+            if(labelElement.hasAttribute("min_scale")) {
+                double max =
+                    Double.parseDouble(labelElement.getAttribute("min_scale"));
+                if(max > 0) {
+                    label.setMaxscaledenom(max);
+                }
+            }
 
-	    if(layerType.equals("point")) {
-	        label.setPosition(MS_POSITIONS_ENUM.MS_UC.swigValue());
-	    }
-	}
+            if(layerType.equals("point")) {
+                label.setPosition(MS_POSITIONS_ENUM.MS_UC.swigValue());
+            }
+        }
     }
 
 
@@ -441,14 +446,15 @@
                 expression += "[" + pre;
                 expression += ce.getAttribute("expression_field_0") + "]";
                 if(ce.hasAttribute("min_value")) {
-		    if(index == 0) {
-		        expression += " >= " + ce.getAttribute("min_value");
-		    }
-		    else {
+                    if(index == 0) {
+                        expression += " >= " + ce.getAttribute("min_value");
+                    }
+                    else {
                         expression += " > " + ce.getAttribute("min_value");
-		    }
-                    expression += " AND [" + pre;
-                    expression += ce.getAttribute("expression_field_0")+ "]";
+                    }
+                        expression += " AND [" + pre;
+                        expression += ce.getAttribute("expression_field_0");
+                        expression += "]";
                 }
                 expression += " " + ce.getAttribute("expression_operator");
                 expression += " " + ce.getAttribute("value") + ")";
@@ -478,7 +484,8 @@
                        pre = prefix + ".";
                     }
                     expression += "[" + pre;
-                    expression += ce.getAttribute("expression_field_" + i) + "]";
+                    expression += ce.getAttribute("expression_field_" + i);
+                    expression += "]";
                     expression += " " + ce.getAttribute("expression_operator");
                     expression += " " + ce.getAttribute("value_" + i);
                     if (i < count - 1) {
@@ -495,7 +502,8 @@
                        pre = prefix + ".";
                     }
                     expression += "\"[" + pre;
-                    expression += ce.getAttribute("expression_field_" + i) + "]\"";
+                    expression += ce.getAttribute("expression_field_" + i);
+                    expression += "]\"";
                     expression += " " + ce.getAttribute("expression_operator");
                     expression += " " + ce.getAttribute("value_" + i);
                     if (i < count - 1) {
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)