Mercurial > mxd2map
annotate src/java/de/intevation/mxd/reader/HashLineSymbolReader.java @ 184:c79c3c6fc99a
Always save a symbol set, use the mapfile name as prefix for the symbol set and
use the mapfile path to save the symbol set.
author | raimund renkert <raimund.renkert@intevation.de> |
---|---|
date | Wed, 20 Jul 2011 12:23:57 +0200 |
parents | 0bde090506f9 |
children | df4e0946ef02 |
rev | line source |
---|---|
66
6bfebb7eb1df
Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.mxd.reader; |
6bfebb7eb1df
Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
2 |
6bfebb7eb1df
Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
3 import java.awt.Color; |
6bfebb7eb1df
Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
4 |
6bfebb7eb1df
Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
5 import org.apache.log4j.Logger; |
6bfebb7eb1df
Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
6 |
6bfebb7eb1df
Added hash 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:
66
diff
changeset
|
8 import com.esri.arcgis.display.ILineSymbol; |
66
6bfebb7eb1df
Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
9 import com.esri.arcgis.display.HashLineSymbol; |
6bfebb7eb1df
Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
10 import com.esri.arcgis.display.IRgbColor; |
6bfebb7eb1df
Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
11 import com.esri.arcgis.display.RgbColor; |
6bfebb7eb1df
Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
12 |
6bfebb7eb1df
Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
13 import com.esri.arcgis.display.esriLineCapStyle; |
6bfebb7eb1df
Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
14 import com.esri.arcgis.display.esriLineJoinStyle; |
6bfebb7eb1df
Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
15 |
6bfebb7eb1df
Added hash 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; |
66
6bfebb7eb1df
Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
18 |
6bfebb7eb1df
Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
19 /** |
6bfebb7eb1df
Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
20 * Reads cartoline symbol information. |
6bfebb7eb1df
Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
21 * |
6bfebb7eb1df
Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
22 * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a> |
6bfebb7eb1df
Added hash 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 HashLineSymbolReader |
83932f18dddc
All symbol reader now extend the abstract symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
74
diff
changeset
|
25 extends AbstractSymbolReader { |
66
6bfebb7eb1df
Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
26 |
6bfebb7eb1df
Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
27 /** |
6bfebb7eb1df
Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
28 * The logger. |
6bfebb7eb1df
Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
29 */ |
6bfebb7eb1df
Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
30 private static final Logger logger = |
6bfebb7eb1df
Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
31 Logger.getLogger(HashLineSymbolReader.class); |
6bfebb7eb1df
Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
32 |
6bfebb7eb1df
Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
33 /** |
6bfebb7eb1df
Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
34 * Private member. |
6bfebb7eb1df
Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
35 */ |
6bfebb7eb1df
Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
36 private HashLineSymbol symbol; |
6bfebb7eb1df
Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
37 |
181 | 38 /** |
39 * Constructor with symbol. | |
40 * | |
41 * @param symbol The symbol used to display lines. | |
42 */ | |
66
6bfebb7eb1df
Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
43 public HashLineSymbolReader(ISymbol symbol) |
6bfebb7eb1df
Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
44 throws Exception { |
6bfebb7eb1df
Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
45 logger.debug("contructor()"); |
6bfebb7eb1df
Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
46 if(symbol instanceof HashLineSymbol) { |
6bfebb7eb1df
Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
47 this.symbol = (HashLineSymbol)symbol; |
6bfebb7eb1df
Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
48 } |
6bfebb7eb1df
Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
49 else { |
6bfebb7eb1df
Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
50 throw new Exception("Not a HashLineSymbol!"); |
6bfebb7eb1df
Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
51 } |
6bfebb7eb1df
Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
52 } |
6bfebb7eb1df
Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
53 |
181 | 54 /** |
55 * Constructor with symbol. | |
56 * | |
57 * @param symbol The symbol used to display lines. | |
58 */ | |
67
5ed9e720b6cd
Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
66
diff
changeset
|
59 public HashLineSymbolReader(ILineSymbol symbol) |
5ed9e720b6cd
Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
66
diff
changeset
|
60 throws Exception { |
5ed9e720b6cd
Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
66
diff
changeset
|
61 logger.debug("contructor()"); |
5ed9e720b6cd
Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
66
diff
changeset
|
62 if(symbol instanceof HashLineSymbol) { |
5ed9e720b6cd
Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
66
diff
changeset
|
63 this.symbol = (HashLineSymbol)symbol; |
5ed9e720b6cd
Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
66
diff
changeset
|
64 } |
5ed9e720b6cd
Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
66
diff
changeset
|
65 else { |
5ed9e720b6cd
Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
66
diff
changeset
|
66 throw new Exception("Not a HashLineSymbol!"); |
5ed9e720b6cd
Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
66
diff
changeset
|
67 } |
5ed9e720b6cd
Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
66
diff
changeset
|
68 } |
5ed9e720b6cd
Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
66
diff
changeset
|
69 |
66
6bfebb7eb1df
Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
70 /** |
6bfebb7eb1df
Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
71 * Reads the symbol attributes. |
6bfebb7eb1df
Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
72 * |
6bfebb7eb1df
Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
73 * @return The XML node. |
6bfebb7eb1df
Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
74 */ |
115
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
75 public Element read() { |
66
6bfebb7eb1df
Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
76 logger.debug("read()"); |
80
83932f18dddc
All symbol reader now extend the abstract symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
74
diff
changeset
|
77 Element symbolElement = util.addSymbol(parent); |
66
6bfebb7eb1df
Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
78 |
115
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
79 try { |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
80 symbolElement.setAttribute("name", symbol.getNameString()); |
66
6bfebb7eb1df
Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
81 } |
115
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
82 catch(IOException ioe) { |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
83 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
|
84 symbolElement.setAttribute("name", "default"); |
66
6bfebb7eb1df
Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
85 } |
115
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 try { |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
88 if(symbol.getColor() instanceof IRgbColor) { |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
89 IRgbColor color = (IRgbColor)symbol.getColor(); |
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 color.getRed(), |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
92 color.getGreen(), |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
93 color.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 else { |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
97 RgbColor col = new RgbColor(); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
98 col.setRGB(symbol.getColor().getRGB()); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
99 Color c = new Color ( |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
100 col.getRed(), |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
101 col.getGreen(), |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
102 col.getBlue()); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
103 symbolElement.setAttribute("color", String.valueOf(c.getRGB())); |
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 catch(IOException ioe) { |
135
a4ab239509f1
Updated the default values and reader error handling.
Raimund Renkert <rrenkert@intevation.de>
parents:
115
diff
changeset
|
107 logger.warn("Could not read color."); |
115
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
108 } |
135
a4ab239509f1
Updated the default values and reader error handling.
Raimund Renkert <rrenkert@intevation.de>
parents:
115
diff
changeset
|
109 |
115
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
110 int cap; |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
111 try { |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
112 cap = symbol.getCap(); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
113 } |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
114 catch(IOException ioe) { |
135
a4ab239509f1
Updated the default values and reader error handling.
Raimund Renkert <rrenkert@intevation.de>
parents:
115
diff
changeset
|
115 logger.warn("Could not read line cap."); |
115
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
116 cap = -1; |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
117 } |
135
a4ab239509f1
Updated the default values and reader error handling.
Raimund Renkert <rrenkert@intevation.de>
parents:
115
diff
changeset
|
118 String capStyle = ""; |
66
6bfebb7eb1df
Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
119 switch(cap) { |
6bfebb7eb1df
Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
120 case esriLineCapStyle.esriLCSRound: capStyle = "round"; break; |
6bfebb7eb1df
Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
121 case esriLineCapStyle.esriLCSSquare: capStyle = "square"; break; |
6bfebb7eb1df
Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
122 default: break; |
6bfebb7eb1df
Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
123 } |
115
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
124 |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
125 int join; |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
126 try { |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
127 join = symbol.getJoin(); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
128 } |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
129 catch(IOException ioe) { |
135
a4ab239509f1
Updated the default values and reader error handling.
Raimund Renkert <rrenkert@intevation.de>
parents:
115
diff
changeset
|
130 logger.warn("Could not read line join."); |
115
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
131 join = -1; |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
132 } |
135
a4ab239509f1
Updated the default values and reader error handling.
Raimund Renkert <rrenkert@intevation.de>
parents:
115
diff
changeset
|
133 String joinStyle = ""; |
66
6bfebb7eb1df
Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
134 switch(join) { |
6bfebb7eb1df
Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
135 case esriLineJoinStyle.esriLJSRound: joinStyle = "round"; break; |
6bfebb7eb1df
Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
136 case esriLineJoinStyle.esriLJSMitre: joinStyle = "miter"; break; |
6bfebb7eb1df
Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
137 default: break; |
6bfebb7eb1df
Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
138 } |
135
a4ab239509f1
Updated the default values and reader error handling.
Raimund Renkert <rrenkert@intevation.de>
parents:
115
diff
changeset
|
139 if(!capStyle.equals("")) { |
a4ab239509f1
Updated the default values and reader error handling.
Raimund Renkert <rrenkert@intevation.de>
parents:
115
diff
changeset
|
140 symbolElement.setAttribute("cap", capStyle); |
a4ab239509f1
Updated the default values and reader error handling.
Raimund Renkert <rrenkert@intevation.de>
parents:
115
diff
changeset
|
141 } |
a4ab239509f1
Updated the default values and reader error handling.
Raimund Renkert <rrenkert@intevation.de>
parents:
115
diff
changeset
|
142 if(!joinStyle.equals("")) { |
a4ab239509f1
Updated the default values and reader error handling.
Raimund Renkert <rrenkert@intevation.de>
parents:
115
diff
changeset
|
143 symbolElement.setAttribute("join", joinStyle); |
a4ab239509f1
Updated the default values and reader error handling.
Raimund Renkert <rrenkert@intevation.de>
parents:
115
diff
changeset
|
144 } |
a4ab239509f1
Updated the default values and reader error handling.
Raimund Renkert <rrenkert@intevation.de>
parents:
115
diff
changeset
|
145 |
115
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
146 try { |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
147 symbolElement.setAttribute( |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
148 "linestart", |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
149 String.valueOf(symbol.getLineStartOffset())); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
150 } |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
151 catch(IOException ioe) { |
135
a4ab239509f1
Updated the default values and reader error handling.
Raimund Renkert <rrenkert@intevation.de>
parents:
115
diff
changeset
|
152 logger.warn("Could not read line start offset."); |
115
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) { |
135
a4ab239509f1
Updated the default values and reader error handling.
Raimund Renkert <rrenkert@intevation.de>
parents:
115
diff
changeset
|
161 logger.warn("Could not read miter limit."); |
115
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
162 } |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
163 |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
164 try { |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
165 symbolElement.setAttribute( |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
166 "offset", |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
167 String.valueOf(symbol.getOffset())); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
168 } |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
169 catch(IOException ioe) { |
135
a4ab239509f1
Updated the default values and reader error handling.
Raimund Renkert <rrenkert@intevation.de>
parents:
115
diff
changeset
|
170 logger.warn("Could not read offset."); |
115
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 |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
173 try { |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
174 symbolElement.setAttribute( |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
175 "width", |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
176 String.valueOf(symbol.getWidth())); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
177 } |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
178 catch(IOException ioe) { |
135
a4ab239509f1
Updated the default values and reader error handling.
Raimund Renkert <rrenkert@intevation.de>
parents:
115
diff
changeset
|
179 logger.warn("Could not read width."); |
115
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
180 } |
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 try { |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
183 ILineSymbol ls = symbol.getHashSymbol(); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
184 readHashSymbol(ls, symbolElement); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
185 } |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
186 catch(Exception e) { |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
187 logger.warn( |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
188 "Could not read HashSymbol." + |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
189 " No fallback symbol defined."); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
190 } |
66
6bfebb7eb1df
Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
191 |
115
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
192 symbolElement.setAttribute("type", "line"); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
193 symbolElement.setAttribute("style", "hash"); |
66
6bfebb7eb1df
Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
194 |
6bfebb7eb1df
Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
195 return symbolElement; |
6bfebb7eb1df
Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
196 } |
67
5ed9e720b6cd
Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
66
diff
changeset
|
197 |
181 | 198 /** |
199 * Read the hash line symbol. | |
200 * | |
201 * @param ls The hash line symbol. | |
202 * @param parent Parent DOM element. | |
203 */ | |
180
f4eb506499f5
Done some code styling and removed TODOs.
Raimund Renkert <rrenkert@intevation.de>
parents:
135
diff
changeset
|
204 private void readHashSymbol(ILineSymbol ls, Element parent) |
82
4d6fae53956a
Use the wrapper to read hash line symbols.
Raimund Renkert <rrenkert@intevation.de>
parents:
80
diff
changeset
|
205 throws Exception { |
4d6fae53956a
Use the wrapper to read hash line symbols.
Raimund Renkert <rrenkert@intevation.de>
parents:
80
diff
changeset
|
206 LineSymbolReader lsr = new LineSymbolReader (); |
4d6fae53956a
Use the wrapper to read hash line symbols.
Raimund Renkert <rrenkert@intevation.de>
parents:
80
diff
changeset
|
207 if (lsr.canRead(ls)) { |
4d6fae53956a
Use the wrapper to read hash line symbols.
Raimund Renkert <rrenkert@intevation.de>
parents:
80
diff
changeset
|
208 lsr.setSymbol(ls); |
4d6fae53956a
Use the wrapper to read hash line symbols.
Raimund Renkert <rrenkert@intevation.de>
parents:
80
diff
changeset
|
209 lsr.setParent(parent); |
4d6fae53956a
Use the wrapper to read hash line symbols.
Raimund Renkert <rrenkert@intevation.de>
parents:
80
diff
changeset
|
210 lsr.setUtil(util); |
4d6fae53956a
Use the wrapper to read hash line symbols.
Raimund Renkert <rrenkert@intevation.de>
parents:
80
diff
changeset
|
211 lsr.read(); |
67
5ed9e720b6cd
Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
66
diff
changeset
|
212 } |
5ed9e720b6cd
Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
66
diff
changeset
|
213 } |
66
6bfebb7eb1df
Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
214 } |
6bfebb7eb1df
Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
215 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |