changeset 167:b1e4a871033e

Write special pattern for outlines.
author vc11884admin@VC11884.win.bsh.de
date Tue, 05 Jul 2011 15:41:01 +0200
parents 51c99594346e
children f3a539ace2a4
files ChangeLog src/java/de/intevation/mxd/writer/FillStyleWriter.java
diffstat 2 files changed, 49 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Mon Jul 04 12:12:17 2011 +0200
+++ b/ChangeLog	Tue Jul 05 15:41:01 2011 +0200
@@ -1,3 +1,8 @@
+2011-07-05  Raimund Renkert  <raimund.renkert@intevation.de>
+
+	* src/java/de/intevation/mxd/writer/FillStyleWriter.java:
+	  Write special pattern for outlines.
+
 2011-07-04  Raimund Renkert  <raimund.renkert@intevation.de>
 
 	* src/java/de/intevation/mxd/reader/UniqueValueRendererReader.java:
--- a/src/java/de/intevation/mxd/writer/FillStyleWriter.java	Mon Jul 04 12:12:17 2011 +0200
+++ b/src/java/de/intevation/mxd/writer/FillStyleWriter.java	Tue Jul 05 15:41:01 2011 +0200
@@ -146,8 +146,13 @@
         if(symbolElement.hasAttribute("width")) {
             try {
                 w = Double.parseDouble(symbolElement.getAttribute("width"));
-                transp = Double.parseDouble(
-                    symbolElement.getAttribute("transparency"));
+                if(symbolElement.hasAttribute("transparency")) {
+                    transp = Double.parseDouble(
+                        symbolElement.getAttribute("transparency"));
+                }
+                else {
+                    transp = -1;
+                }
             }
             catch(NumberFormatException nfe) {
                 logger.warn("Error setting outline width or transparency.");
@@ -205,8 +210,44 @@
                 outline.setPattern(vals);
             }
         }
+        else if(symbolElement.hasAttribute("pattern_count")) {
+            int count = 0;
+            try {
+                count = Integer.parseInt(
+                            symbolElement.getAttribute("pattern_count"));
+                double[] vals = new double[10];
+                double move = 0.0;
+                int pos = 0;
+                for(int i = 0; i < count; i++) {
+                    double mark =
+                        Double.parseDouble(symbolElement.getAttribute("mark_" + i));
+                    double gap =
+                        Double.parseDouble(symbolElement.getAttribute("gap_" + i));
+                    if(i == 0 && mark == 0.0) {
+                        move = gap;
+                    }
+                    else if(i == count - 1 && move > 0.0) {
+                       vals[pos++] = mark;
+                       vals[pos++] = gap + move;
+                    }
+                    else {
+                        vals[pos++] = mark;
+                        vals[pos++] = gap;
+                    }
+                }
+                if(move > 0.0) {
+                    outline.setPatternlength((count*2) -2);
+                }
+                else {
+                    outline.setPatternlength(count*2);
+                }
+                outline.setPattern(vals);
 
-
+            }
+            catch(NumberFormatException nfe) {
+                logger.warn("Could not write PATTERN.");
+            }
+        }
     }
 
     /**
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)