diff src/java/de/intevation/mxd/reader/CartoLineSymbolReader.java @ 135:a4ab239509f1

Updated the default values and reader error handling.
author Raimund Renkert <rrenkert@intevation.de>
date Wed, 22 Jun 2011 13:55:22 +0200
parents fb93f20478cc
children 7632850b9520
line wrap: on
line diff
--- a/src/java/de/intevation/mxd/reader/CartoLineSymbolReader.java	Wed Jun 22 12:01:28 2011 +0200
+++ b/src/java/de/intevation/mxd/reader/CartoLineSymbolReader.java	Wed Jun 22 13:55:22 2011 +0200
@@ -95,25 +95,19 @@
             }
         }
         catch(IOException ioe) {
-            logger.warn(
-                "Could not read color." +
-                " Setting color to black with no transparency");
-            Color black = new Color(0, 0, 0);
-            symbolElement.setAttribute("color", String.valueOf(black.getRGB()));
-            symbolElement.setAttribute("transparency", "-1");
+            logger.warn("Could not read color.");
         }
 
         int cap;
+        String capStyle = "";
         try {
             cap = symbol.getCap();
         }
         catch(IOException ioe) {
             logger.warn(
-                "Could not read line cap." +
-                " Setting line cap to \"butt\"");
+                "Could not read line cap.");
             cap = -1;
         }
-        String capStyle = "butt";
         switch(cap) {
             case esriLineCapStyle.esriLCSRound: capStyle = "round"; break;
             case esriLineCapStyle.esriLCSSquare: capStyle = "square"; break;
@@ -122,6 +116,7 @@
 
 
         int join;
+        String joinStyle = "";
         try {
             join = symbol.getJoin();
         }
@@ -131,14 +126,17 @@
                 " Setting line join to \"bevel\".");
             join = -1;
         }
-        String joinStyle = "bevel";
         switch(join) {
             case esriLineJoinStyle.esriLJSRound: joinStyle = "round"; break;
             case esriLineJoinStyle.esriLJSMitre: joinStyle = "miter"; break;
             default: break;
         }
-        symbolElement.setAttribute("cap", capStyle);
-        symbolElement.setAttribute("join", joinStyle);
+        if(!capStyle.equals("")) {
+            symbolElement.setAttribute("cap", capStyle);
+        }
+        if (!joinStyle.equals("")) {
+            symbolElement.setAttribute("join", joinStyle);
+        }
 
         try {
             symbolElement.setAttribute(
@@ -146,10 +144,7 @@
                 String.valueOf(symbol.getLineStartOffset()));
         }
         catch(IOException ioe) {
-            logger.warn(
-                "Could not read line start offset." +
-                " Setting line start offset to 0.");
-            symbolElement.setAttribute("linestart", "0");
+            logger.warn("Could not read line start offset.");
         }
 
         try {
@@ -158,10 +153,7 @@
                 String.valueOf(symbol.getMiterLimit()));
         }
         catch(IOException ioe) {
-            logger.warn(
-                "Could not read miter limit. " +
-                " Setting miter limit to 0.");
-            symbolElement.setAttribute("miterlimit", "0");
+            logger.warn("Could not read miter limit.");
         }
 
         try {
@@ -170,8 +162,7 @@
                 String.valueOf(symbol.getOffset()));
         }
         catch(IOException ioe) {
-            logger.warn("Could not read offset. Setting offset to 0.");
-            symbolElement.setAttribute("offset", "0");
+            logger.warn("Could not read offset.");
         }
 
         try {
@@ -180,8 +171,7 @@
                 String.valueOf(symbol.getWidth()));
         }
         catch(IOException ioe) {
-            logger.warn("Could not read width. Setting width to 1.");
-            symbolElement.setAttribute("width", "1");
+            logger.warn("Could not read width.");
         }
         //TODO Read further attributes depending on the Mapscript functionality:
         //     Template, MarkerSymbol, LineDecorations
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)