changeset 67:5ed9e720b6cd

Read the hash symbol in the hash line symbol reader.
author Raimund Renkert <rrenkert@intevation.de>
date Wed, 25 May 2011 15:48:55 +0200
parents 6bfebb7eb1df
children 686a88eb531d
files ChangeLog src/java/de/intevation/mxd/reader/CartoLineSymbolReader.java src/java/de/intevation/mxd/reader/HashLineSymbolReader.java src/java/de/intevation/mxd/reader/MarkerLineSymbolReader.java src/java/de/intevation/mxd/reader/MultiLayerLineSymbolReader.java src/java/de/intevation/mxd/reader/PictureLineSymbolReader.java src/java/de/intevation/mxd/reader/SimpleLineSymbolReader.java
diffstat 7 files changed, 143 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Wed May 25 14:44:46 2011 +0200
+++ b/ChangeLog	Wed May 25 15:48:55 2011 +0200
@@ -1,3 +1,15 @@
+2011-05-25  Raimund Renkert  <raimund.renkert@intevation.de>
+
+	* src/java/de/intevation/mxd/reader/CartoLineSymbolReader.java,
+	  src/java/de/intevation/mxd/reader/MarkerLineSymbolReader.java,
+	  src/java/de/intevation/mxd/reader/MultiLayerLineSymbolReader.java,
+	  src/java/de/intevation/mxd/reader/PictureLineSymbolReader.java,
+	  src/java/de/intevation/mxd/reader/SimpleLineSymbolReader.java:
+	  Added constructor for ILineSymbols.
+
+	* src/java/de/intevation/mxd/reader/HashLineSymbolReader.java:
+	  Read the hash symbol.
+
 2011-05-25  Raimund Renkert  <raimund.renkert@intevation.de>
 
 	* src/java/de/intevation/mxd/reader/MultiLayerLineSymbolReader.java:
--- a/src/java/de/intevation/mxd/reader/CartoLineSymbolReader.java	Wed May 25 14:44:46 2011 +0200
+++ b/src/java/de/intevation/mxd/reader/CartoLineSymbolReader.java	Wed May 25 15:48:55 2011 +0200
@@ -7,6 +7,7 @@
 import org.apache.log4j.Logger;
 
 import com.esri.arcgis.display.ISymbol;
+import com.esri.arcgis.display.ILineSymbol;
 import com.esri.arcgis.display.CartographicLineSymbol;
 import com.esri.arcgis.display.esriSimpleLineStyle;
 import com.esri.arcgis.display.IRgbColor;
@@ -50,6 +51,18 @@
         }
     }
 
+
+    public CartoLineSymbolReader(ILineSymbol symbol)
+    throws Exception {
+        logger.debug("contructor()");
+        if(symbol instanceof CartographicLineSymbol) {
+            this.symbol = (CartographicLineSymbol)symbol;
+        }
+        else {
+            throw new Exception("Not a CartographicLineSymbol!");
+        }
+    }
+
     /**
      * Setter for the parent XML element.
      *
--- a/src/java/de/intevation/mxd/reader/HashLineSymbolReader.java	Wed May 25 14:44:46 2011 +0200
+++ b/src/java/de/intevation/mxd/reader/HashLineSymbolReader.java	Wed May 25 15:48:55 2011 +0200
@@ -7,7 +7,13 @@
 import org.apache.log4j.Logger;
 
 import com.esri.arcgis.display.ISymbol;
+import com.esri.arcgis.display.ILineSymbol;
 import com.esri.arcgis.display.HashLineSymbol;
+import com.esri.arcgis.display.SimpleLineSymbol;
+import com.esri.arcgis.display.MarkerLineSymbol;
+import com.esri.arcgis.display.PictureLineSymbol;
+import com.esri.arcgis.display.CartographicLineSymbol;
+import com.esri.arcgis.display.MultiLayerLineSymbol;
 import com.esri.arcgis.display.esriSimpleLineStyle;
 import com.esri.arcgis.display.IRgbColor;
 import com.esri.arcgis.display.RgbColor;
@@ -50,6 +56,18 @@
         }
     }
 
+
+    public HashLineSymbolReader(ILineSymbol symbol)
+    throws Exception {
+        logger.debug("contructor()");
+        if(symbol instanceof HashLineSymbol) {
+            this.symbol = (HashLineSymbol)symbol;
+        }
+        else {
+            throw new Exception("Not a HashLineSymbol!");
+        }
+    }
+
     /**
      * Setter for the parent XML element.
      *
@@ -130,11 +148,58 @@
             "offset",
             String.valueOf(symbol.getOffset()));
         symbolElement.setAttribute("width", String.valueOf(symbol.getWidth()));
+        ILineSymbol ls = symbol.getHashSymbol();
+        readHashSymbol(ls, symbolElement);
 
         //TODO Read further HashLine specific attributes:
-        //     LineSymbol, LineDecoration, Template.
+        //     LineDecoration, Template.
 
         return symbolElement;
     }
+
+    private void readHashSymbol(ILineSymbol ls, Element parent) {
+        try {
+            if (ls instanceof MultiLayerLineSymbol) {
+                ISymbolReader sr = new MultiLayerLineSymbolReader(ls);
+                sr.setParent(parent);
+                sr.setUtil(util);
+                sr.read();
+            }
+            else if(ls instanceof MarkerLineSymbol) {
+                ISymbolReader sreader = new MarkerLineSymbolReader(ls);
+                sreader.setParent(parent);
+                sreader.setUtil(util);
+                sreader.read();
+            }
+            else if(ls instanceof PictureLineSymbol) {
+                ISymbolReader sreader = new PictureLineSymbolReader(ls);
+                sreader.setParent(parent);
+                sreader.setUtil(util);
+                sreader.read();
+            }
+            else if(ls instanceof CartographicLineSymbol) {
+                ISymbolReader sreader = new CartoLineSymbolReader(ls);
+                sreader.setParent(parent);
+                sreader.setUtil(util);
+                sreader.read();
+            }
+            else if(ls instanceof HashLineSymbol) {
+                ISymbolReader sreader = new HashLineSymbolReader(ls);
+                sreader.setParent(parent);
+                sreader.setUtil(util);
+                sreader.read();
+            }
+            else {
+                logger.debug("The type of " + ls.getClass().toString() +
+                             " is not implemented!");
+                System.out.println(
+                        "No known instance: " + ls.getClass().toString());
+            }
+        }
+        catch(Exception e) {
+            e.printStackTrace();
+        }
+
+    }
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/src/java/de/intevation/mxd/reader/MarkerLineSymbolReader.java	Wed May 25 14:44:46 2011 +0200
+++ b/src/java/de/intevation/mxd/reader/MarkerLineSymbolReader.java	Wed May 25 15:48:55 2011 +0200
@@ -7,6 +7,7 @@
 import org.apache.log4j.Logger;
 
 import com.esri.arcgis.display.ISymbol;
+import com.esri.arcgis.display.ILineSymbol;
 import com.esri.arcgis.display.IMarkerSymbol;
 import com.esri.arcgis.display.MarkerLineSymbol;
 import com.esri.arcgis.display.esriSimpleLineStyle;
@@ -49,6 +50,18 @@
         }
     }
 
+
+    public MarkerLineSymbolReader(ILineSymbol symbol)
+    throws Exception {
+        logger.debug("contructor()");
+        if(symbol instanceof MarkerLineSymbol) {
+            this.symbol = (MarkerLineSymbol)symbol;
+        }
+        else {
+            throw new Exception("Not a MarkerLineSymbol!");
+        }
+    }
+
     /**
      * Setter for the parent XML element.
      *
--- a/src/java/de/intevation/mxd/reader/MultiLayerLineSymbolReader.java	Wed May 25 14:44:46 2011 +0200
+++ b/src/java/de/intevation/mxd/reader/MultiLayerLineSymbolReader.java	Wed May 25 15:48:55 2011 +0200
@@ -7,6 +7,7 @@
 import org.apache.log4j.Logger;
 
 import com.esri.arcgis.display.ISymbol;
+import com.esri.arcgis.display.ILineSymbol;
 import com.esri.arcgis.display.MultiLayerLineSymbol;
 import com.esri.arcgis.display.SimpleLineSymbol;
 import com.esri.arcgis.display.MarkerLineSymbol;
@@ -52,6 +53,18 @@
         }
     }
 
+
+    public MultiLayerLineSymbolReader(ILineSymbol symbol)
+    throws Exception {
+        logger.debug("contructor()");
+        if(symbol instanceof MultiLayerLineSymbol) {
+            this.symbol = (MultiLayerLineSymbol)symbol;
+        }
+        else {
+            throw new Exception("Not a MultiLayerLineSymbol!");
+        }
+    }
+
     /**
      * Setter for the parent XML element.
      *
--- a/src/java/de/intevation/mxd/reader/PictureLineSymbolReader.java	Wed May 25 14:44:46 2011 +0200
+++ b/src/java/de/intevation/mxd/reader/PictureLineSymbolReader.java	Wed May 25 15:48:55 2011 +0200
@@ -8,6 +8,7 @@
 import org.apache.log4j.Logger;
 
 import com.esri.arcgis.display.ISymbol;
+import com.esri.arcgis.display.ILineSymbol;
 import com.esri.arcgis.display.PictureLineSymbol;
 import com.esri.arcgis.support.ms.stdole.Picture;
 import com.esri.arcgis.display.esriSimpleLineStyle;
@@ -49,6 +50,18 @@
         }
     }
 
+
+    public PictureLineSymbolReader(ILineSymbol symbol)
+    throws Exception {
+        logger.debug("contructor()");
+        if(symbol instanceof PictureLineSymbol) {
+            this.symbol = (PictureLineSymbol)symbol;
+        }
+        else {
+            throw new Exception("Not a PictureLineSymbol!");
+        }
+    }
+
     /**
      * Setter for the parent XML element.
      *
--- a/src/java/de/intevation/mxd/reader/SimpleLineSymbolReader.java	Wed May 25 14:44:46 2011 +0200
+++ b/src/java/de/intevation/mxd/reader/SimpleLineSymbolReader.java	Wed May 25 15:48:55 2011 +0200
@@ -7,6 +7,7 @@
 import org.apache.log4j.Logger;
 
 import com.esri.arcgis.display.ISymbol;
+import com.esri.arcgis.display.ILineSymbol;
 import com.esri.arcgis.display.SimpleLineSymbol;
 import com.esri.arcgis.display.esriSimpleLineStyle;
 import com.esri.arcgis.display.IRgbColor;
@@ -47,6 +48,18 @@
         }
     }
 
+
+    public SimpleLineSymbolReader(ILineSymbol symbol)
+    throws Exception {
+        logger.debug("contructor()");
+        if(symbol instanceof SimpleLineSymbol) {
+            this.symbol = (SimpleLineSymbol)symbol;
+        }
+        else {
+            throw new Exception("Not a SimpleLineSymbol!");
+        }
+    }
+
     /**
      * Setter for the parent XML element.
      *
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)