annotate src/java/de/intevation/mxd/reader/CartoLineSymbolReader.java @ 117:6c3d880db7c5

Improved exception handling for layer reader.
author Raimund Renkert <rrenkert@intevation.de>
date Thu, 16 Jun 2011 12:05:34 +0200
parents fb93f20478cc
children a4ab239509f1
rev   line source
65
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
1 package de.intevation.mxd.reader;
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
2
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
3 import java.awt.Color;
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
4
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
5 import org.apache.log4j.Logger;
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
6
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
7 import com.esri.arcgis.display.ISymbol;
67
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 65
diff changeset
8 import com.esri.arcgis.display.ILineSymbol;
65
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
9 import com.esri.arcgis.display.CartographicLineSymbol;
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
10 import com.esri.arcgis.display.IRgbColor;
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
11 import com.esri.arcgis.display.RgbColor;
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
12
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
13 import com.esri.arcgis.display.esriLineCapStyle;
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
14 import com.esri.arcgis.display.esriLineJoinStyle;
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
15
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
16 import org.w3c.dom.Element;
115
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
17 import java.io.IOException;
65
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
18
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
19 /**
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
20 * Reads cartoline symbol information.
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
21 *
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
22 * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a>
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
23 */
80
83932f18dddc All symbol reader now extend the abstract symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 74
diff changeset
24 public class CartoLineSymbolReader
83932f18dddc All symbol reader now extend the abstract symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 74
diff changeset
25 extends AbstractSymbolReader {
65
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
26
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
27 /**
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
28 * The logger.
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
29 */
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
30 private static final Logger logger =
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
31 Logger.getLogger(CartoLineSymbolReader.class);
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
32
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
33 /**
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
34 * Private member.
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
35 */
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
36 private CartographicLineSymbol symbol;
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
37
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
38 public CartoLineSymbolReader(ISymbol symbol)
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
39 throws Exception {
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
40 logger.debug("contructor()");
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
41 if(symbol instanceof CartographicLineSymbol) {
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
42 this.symbol = (CartographicLineSymbol)symbol;
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
43 }
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
44 else {
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
45 throw new Exception("Not a CartographicLineSymbol!");
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
46 }
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
47 }
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
48
67
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 65
diff changeset
49
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 65
diff changeset
50 public CartoLineSymbolReader(ILineSymbol symbol)
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 65
diff changeset
51 throws Exception {
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 65
diff changeset
52 logger.debug("contructor()");
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 65
diff changeset
53 if(symbol instanceof CartographicLineSymbol) {
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 65
diff changeset
54 this.symbol = (CartographicLineSymbol)symbol;
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 65
diff changeset
55 }
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 65
diff changeset
56 else {
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 65
diff changeset
57 throw new Exception("Not a CartographicLineSymbol!");
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 65
diff changeset
58 }
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 65
diff changeset
59 }
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 65
diff changeset
60
65
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
61 /**
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
62 * Reads the symbol attributes.
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
63 *
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
64 * @return The XML node.
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
65 */
115
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
66 public Element read() {
65
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
67 logger.debug("read()");
80
83932f18dddc All symbol reader now extend the abstract symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 74
diff changeset
68 Element symbolElement = util.addSymbol(parent);
65
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
69
115
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
70 try {
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
71 symbolElement.setAttribute("name", symbol.getNameString());
65
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
72 }
115
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
73 catch(IOException ioe) {
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
74 logger.warn("Could not read name. Setting name to \"default\"");
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
75 symbolElement.setAttribute("name", "default");
65
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
76 }
115
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
77
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
78 try {
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
79 if(symbol.getColor() instanceof IRgbColor) {
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
80 IRgbColor color = (IRgbColor)symbol.getColor();
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
81 Color c = new Color (
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
82 color.getRed(),
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
83 color.getGreen(),
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
84 color.getBlue());
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
85 symbolElement.setAttribute("color", String.valueOf(c.getRGB()));
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
86 }
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
87 else {
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
88 RgbColor col = new RgbColor();
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
89 col.setRGB(symbol.getColor().getRGB());
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
90 Color c = new Color (
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
91 col.getRed(),
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
92 col.getGreen(),
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
93 col.getBlue());
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
94 symbolElement.setAttribute("color", String.valueOf(c.getRGB()));
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
95 }
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
96 }
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
97 catch(IOException ioe) {
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
98 logger.warn(
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
99 "Could not read color." +
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
100 " Setting color to black with no transparency");
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
101 Color black = new Color(0, 0, 0);
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
102 symbolElement.setAttribute("color", String.valueOf(black.getRGB()));
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
103 symbolElement.setAttribute("transparency", "-1");
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
104 }
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
105
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
106 int cap;
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
107 try {
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
108 cap = symbol.getCap();
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
109 }
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
110 catch(IOException ioe) {
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
111 logger.warn(
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
112 "Could not read line cap." +
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
113 " Setting line cap to \"butt\"");
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
114 cap = -1;
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
115 }
65
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
116 String capStyle = "butt";
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
117 switch(cap) {
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
118 case esriLineCapStyle.esriLCSRound: capStyle = "round"; break;
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
119 case esriLineCapStyle.esriLCSSquare: capStyle = "square"; break;
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
120 default: break;
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
121 }
115
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
122
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
123
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
124 int join;
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
125 try {
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
126 join = symbol.getJoin();
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
127 }
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
128 catch(IOException ioe) {
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
129 logger.warn(
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
130 "Could not read line join." +
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
131 " Setting line join to \"bevel\".");
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
132 join = -1;
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
133 }
65
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
134 String joinStyle = "bevel";
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
135 switch(join) {
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
136 case esriLineJoinStyle.esriLJSRound: joinStyle = "round"; break;
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
137 case esriLineJoinStyle.esriLJSMitre: joinStyle = "miter"; break;
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
138 default: break;
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
139 }
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
140 symbolElement.setAttribute("cap", capStyle);
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
141 symbolElement.setAttribute("join", joinStyle);
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
142
115
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
143 try {
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
144 symbolElement.setAttribute(
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
145 "linestart",
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
146 String.valueOf(symbol.getLineStartOffset()));
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
147 }
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
148 catch(IOException ioe) {
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
149 logger.warn(
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
150 "Could not read line start offset." +
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
151 " Setting line start offset to 0.");
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
152 symbolElement.setAttribute("linestart", "0");
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
153 }
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
154
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
155 try {
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
156 symbolElement.setAttribute(
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
157 "miterlimit",
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
158 String.valueOf(symbol.getMiterLimit()));
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
159 }
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
160 catch(IOException ioe) {
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
161 logger.warn(
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
162 "Could not read miter limit. " +
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
163 " Setting miter limit to 0.");
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
164 symbolElement.setAttribute("miterlimit", "0");
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
165 }
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
166
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
167 try {
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
168 symbolElement.setAttribute(
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
169 "offset",
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
170 String.valueOf(symbol.getOffset()));
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
171 }
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
172 catch(IOException ioe) {
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
173 logger.warn("Could not read offset. Setting offset to 0.");
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
174 symbolElement.setAttribute("offset", "0");
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
175 }
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
176
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
177 try {
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
178 symbolElement.setAttribute(
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
179 "width",
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
180 String.valueOf(symbol.getWidth()));
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
181 }
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
182 catch(IOException ioe) {
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
183 logger.warn("Could not read width. Setting width to 1.");
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
184 symbolElement.setAttribute("width", "1");
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
185 }
65
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
186 //TODO Read further attributes depending on the Mapscript functionality:
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
187 // Template, MarkerSymbol, LineDecorations
115
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
188 symbolElement.setAttribute("type", "line");
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
189 symbolElement.setAttribute("style", "carto");
65
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
190
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
191 return symbolElement;
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
192 }
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
193 }
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
194 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)