changeset 109:dca5f208500f

Merged with raimunds changes
author Stephan Holl <stephan.holl@intevation.de>
date Tue, 14 Jun 2011 12:37:03 +0200
parents 3c58c07cee6b (current diff) 163d474165b0 (diff)
children 01cd6b736acd
files ChangeLog
diffstat 6 files changed, 108 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Tue Jun 14 12:35:36 2011 +0200
+++ b/ChangeLog	Tue Jun 14 12:37:03 2011 +0200
@@ -1,7 +1,30 @@
 2011-06-14  Stephan Holl  <stephan.holl@intevation.de>
 
-		* mxd/connections/SDE/sde_areas.txt: New. Added hints for
-		cconnecting to ArcSDE.
+	* mxd/connections/SDE/sde_areas.txt: New. Added hints for
+	cconnecting to ArcSDE.
+
+2011-06-10  Raimund Renkert  <raimund.renkert@intevation.de>
+
+	* src/java/de/intevation/mxd/ArcGISInitializer.java:
+	  Check for ArcGISDesktop environment and added logging.
+	* src/java/de/intevation/mxd/reader/MXDReader.java:
+	  Check the initializer return value.
+
+2011-06-10  Raimund Renkert  <raimund.renkert@intevation.de>
+
+	* src/java/de/intevation/mxd/writer/MapScriptWriter.java:
+	  Set TILEITEM to an empty string.
+
+2011-06-08  Raimund Renkert  <raimund.renkert@intevation.de>
+
+	* src/java/de/intevation/mxd/writer/FillStyleWriter.java:
+	  Write PATTERN to the style if a hatch symbol is used to fill a
+	  polygon.
+
+2011-06-08  Raimund Renkert  <raimund.renkert@intevation.de>
+
+	* src/java/de/intevation/mxd/reader/FeatureLayerReader.java:
+	  Read the connection settings for file geodatabase.
 
 2011-06-07  Raimund Renkert  <raimund.renkert@intevation.de>
 
--- a/src/java/de/intevation/mxd/ArcGISInitializer.java	Tue Jun 14 12:35:36 2011 +0200
+++ b/src/java/de/intevation/mxd/ArcGISInitializer.java	Tue Jun 14 12:37:03 2011 +0200
@@ -1,6 +1,9 @@
 package de.intevation.mxd;
 
 import java.io.IOException;
+import java.io.File;
+
+import org.apache.log4j.Logger;
 
 import com.esri.arcgis.system.AoInitialize;
 import com.esri.arcgis.system.EngineInitializer;
@@ -15,6 +18,11 @@
 public class ArcGISInitializer {
 
     /**
+     * The Logger.
+     */
+    private static final Logger logger = Logger.getLogger(ArcGISInitializer.class);
+
+    /**
      * Private member.
      */
     private AoInitialize    aoInit;
@@ -26,17 +34,32 @@
      */
     public boolean initArcGIS ()
     throws IOException {
+        logger.debug("initArcGIS()");
         EngineInitializer.initializeEngine();
         aoInit              = new AoInitialize();
         engineInstallDir    = System.getenv("AGSENGINEJAVA");
+        File installDir = new File(engineInstallDir);
+        if(!installDir.exists()) {
+            engineInstallDir = System.getenv("AGSDESKTOPJAVA");
+            installDir = new File(engineInstallDir);
+            if(!installDir.exists()) {
+                logger.error("Could not find ArcGIS Environment. \n" +
+                             "AGSENGINEJAVA or AGSDESKTOPJAVA not set.");
+                return false;
+            }
+        }
+        else {
+            return true;
+        }
         return true;
     }
 
     /**
      * Init ArcGIS License.
      */
-    public void initArcGISLicenses()
+    public boolean initArcGISLicenses()
     throws IOException {
+        logger.debug("initArcGISLicenses()");
         if(aoInit.isProductCodeAvailable
            (esriLicenseProductCode.esriLicenseProductCodeEngine) ==
            esriLicenseStatus.esriLicenseAvailable) {
@@ -50,11 +73,13 @@
                      (esriLicenseProductCode.esriLicenseProductCodeArcView);
         }
         else {
-            System.err.println("Engine Runtime or ArcView" +
-                " license not initialized.");
-            System.err.println("Exiting application.");
-            System.exit(-1);
+            logger.error("Engine Runtime or ArcView" +
+                         " license not initialized.\n" +
+                         "Please install an ArcGIS product and set the" +
+                         " PATH-variable correctly.");
+            return false;
         }
+        return true;
     }
 
     /**
--- a/src/java/de/intevation/mxd/reader/FeatureLayerReader.java	Tue Jun 14 12:35:36 2011 +0200
+++ b/src/java/de/intevation/mxd/reader/FeatureLayerReader.java	Tue Jun 14 12:37:03 2011 +0200
@@ -89,10 +89,29 @@
             FeatureClassName name = (FeatureClassName)fcn;
             layerElement.setAttribute("data_source", name.getName());
         }
+        else {
+            logger.debug ("Unknown FeatureClass name:" + fcn.getClass().toString());
+        }
 
-        layerElement.setAttribute(
-            "workspace",
-            layer.getWorkspace().getPathName());
+
+        String datatype = layer.getDataSourceType();
+        if(datatype.equals("Shapefile Feature Class")) {
+            layerElement.setAttribute("connection_type", "local");
+            layerElement.setAttribute(
+                "workspace",
+                layer.getWorkspace().getPathName());
+        }
+        else if(datatype.equals("File Geodatabase Feature Class")){
+            layerElement.setAttribute("connection_type", "ogr");
+            layerElement.setAttribute("data", layer.getFeatureClass().getFeatureDataset().getName());
+            layerElement.setAttribute(
+                "workspace",
+                layer.getWorkspace().getPathName());
+
+        }
+        else if(datatype.equals("SDE Feature Class")) {
+            //TODO Read SDE data settings
+        }
         return layerElement;
     }
 }
--- a/src/java/de/intevation/mxd/reader/MXDReader.java	Tue Jun 14 12:35:36 2011 +0200
+++ b/src/java/de/intevation/mxd/reader/MXDReader.java	Tue Jun 14 12:37:03 2011 +0200
@@ -55,8 +55,12 @@
     public boolean init()
     throws IOException {
         logger.debug("init()");
-        initializer.initArcGIS();
-        initializer.initArcGISLicenses();
+        if(!initializer.initArcGIS()) {
+            return false;
+        }
+        if(!initializer.initArcGISLicenses()) {
+            return false;
+        }
         return true;
     }
 
--- a/src/java/de/intevation/mxd/writer/FillStyleWriter.java	Tue Jun 14 12:35:36 2011 +0200
+++ b/src/java/de/intevation/mxd/writer/FillStyleWriter.java	Tue Jun 14 12:37:03 2011 +0200
@@ -183,6 +183,30 @@
             style.setOutlinewidth(Double.parseDouble(
                 symbolElement.getAttribute("outline_size")));
         }
+        if(symbolElement.hasAttribute("linestyle")) {
+            String ls = symbolElement.getAttribute("linestyle");
+            double[] vals;
+            if(ls.equals("dash")) {
+                style.setPatternlength(2);
+                vals = new double[] {2.0, 2.0};
+                style.setPattern(vals);
+            }
+            else if(ls.equals("dot")) {
+                style.setPatternlength(2);
+                vals = new double[] {1.0, 2.0};
+                style.setPattern(vals);
+            }
+            else if(ls.equals("dashdot")) {
+                style.setPatternlength(4);
+                vals = new double[] {2.0, 2.0, 1.0, 2.0};
+                style.setPattern(vals);
+            }
+            else if (ls.equals("dashdotdot")) {
+                style.setPatternlength(6);
+                vals = new double[] {2.0, 2.0, 1.0, 2.0, 1.0, 2.0};
+                style.setPattern(vals);
+            }
+        }
 
         if(type.equals("marker")) {
             style.setSymbolByName(map, name);
--- a/src/java/de/intevation/mxd/writer/MapScriptWriter.java	Tue Jun 14 12:35:36 2011 +0200
+++ b/src/java/de/intevation/mxd/writer/MapScriptWriter.java	Tue Jun 14 12:37:03 2011 +0200
@@ -176,6 +176,7 @@
             else if (type.equals("polygon")) {
                 layer.setType(MS_LAYER_TYPE.MS_LAYER_POLYGON);
             }
+            layer.setTileitem("");
 
             //The layer datasource.
             String datasource = "";
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)