changeset 123:3c792458a716

Write PATTERN for polygon outlines and hatch symbols.
author Raimund Renkert <rrenkert@intevation.de>
date Fri, 17 Jun 2011 13:36:33 +0200
parents f0a72d232aa8
children 0f5819732288
files ChangeLog src/java/de/intevation/mxd/writer/FillStyleWriter.java
diffstat 2 files changed, 56 insertions(+), 25 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Fri Jun 17 12:30:21 2011 +0200
+++ b/ChangeLog	Fri Jun 17 13:36:33 2011 +0200
@@ -1,3 +1,8 @@
+2011-06-17  Raimund Renkert  <raimund.renkert@intevation.de>
+
+	* src/java/de/intevation/mxd/writer/FillStyleWriter.java:
+	  Write PATTERN for polygon outlines and hatch symbols.
+
 2011-06-17  Raimund Renkert  <raimund.renkert@intevation.de>
 
 	* src/java/de/intevation/mxd/writer/LineStyleWriter.java:
--- a/src/java/de/intevation/mxd/writer/FillStyleWriter.java	Fri Jun 17 12:30:21 2011 +0200
+++ b/src/java/de/intevation/mxd/writer/FillStyleWriter.java	Fri Jun 17 13:36:33 2011 +0200
@@ -46,6 +46,7 @@
      * Write the content.
      */
     public boolean write(Element symbolElement) {
+        logger.debug("write()Element");
         symbolSetObj symbolSet = map.getSymbolset();
 
         if(symbolElement.hasChildNodes()) {
@@ -135,6 +136,32 @@
         outline.setOutlinecolor(outlinecolor);
         outline.setOutlinewidth(Double.parseDouble(
             symbolElement.getAttribute("width")));
+        if(symbolElement.hasAttribute("linestyle")) {
+            String ls = symbolElement.getAttribute("linestyle");
+            double[] vals;
+            if(ls.equals("dash")) {
+                outline.setPatternlength(2);
+                vals = new double[] {4.0, 4.0, 0, 0, 0, 0, 0, 0, 0, 0};
+                outline.setPattern(vals);
+            }
+            else if(ls.equals("dot")) {
+                outline.setPatternlength(2);
+                vals = new double[] {1.0, 3.0, 0, 0, 0, 0, 0, 0, 0, 0};
+                outline.setPattern(vals);
+            }
+            else if(ls.equals("dashdot")) {
+                outline.setPatternlength(4);
+                vals = new double[] {4.0, 3.0, 1.0, 3.0, 0, 0, 0, 0, 0, 0, 0};
+                outline.setPattern(vals);
+            }
+            else if (ls.equals("dashdotdot")) {
+                outline.setPatternlength(6);
+                vals = new double[] {5.0, 3.0, 1.0, 3.0, 1.0, 4.0, 0, 0, 0, 0};
+                outline.setPattern(vals);
+            }
+        }
+
+
     }
 
     /**
@@ -180,31 +207,6 @@
             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);
             SymbolWriter sw = new SymbolWriter(this.map, this.cl);
@@ -215,6 +217,30 @@
             SymbolWriter sw = new SymbolWriter(this.map, this.cl);
             symbolElement.setAttribute("name", "hatch");
             sw.write(symbolElement);
+            if(symbolElement.hasAttribute("linestyle")) {
+                String ls = symbolElement.getAttribute("linestyle");
+                double[] vals;
+                if(ls.equals("dash")) {
+                    style.setPatternlength(2);
+                    vals = new double[] {4.0, 4.0, 0, 0, 0, 0, 0, 0, 0, 0};
+                    style.setPattern(vals);
+                }
+                else if(ls.equals("dot")) {
+                    style.setPatternlength(2);
+                    vals = new double[] {1.0, 3.0, 0, 0, 0, 0, 0, 0, 0, 0};
+                    style.setPattern(vals);
+                }
+                else if(ls.equals("dashdot")) {
+                    style.setPatternlength(4);
+                    vals = new double[] {4.0, 3.0, 1.0, 3.0, 0, 0, 0, 0, 0, 0, 0};
+                    style.setPattern(vals);
+                }
+                else if (ls.equals("dashdotdot")) {
+                    style.setPatternlength(6);
+                    vals = new double[] {5.0, 3.0, 1.0, 3.0, 1.0, 4.0, 0, 0, 0, 0};
+                    style.setPattern(vals);
+                }
+            }
         }
     }
 
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)