Mercurial > mxd2map
annotate src/java/de/intevation/mxd/reader/CartoLineSymbolReader.java @ 209:1d7fc059e538
* doku/source/functionality.txt: Added part about the translation
of umlauts into the doku.
author | Stephan Holl <stephan.holl@intevation.de> |
---|---|
date | Fri, 22 Jul 2011 11:14:19 +0200 |
parents | 0bde090506f9 |
children | df4e0946ef02 |
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; |
136
7632850b9520
Convert cartographic line template to mapfile pattern.
Raimund Renkert <rrenkert@intevation.de>
parents:
135
diff
changeset
|
12 import com.esri.arcgis.display.Template; |
65
9fca9e09b966
Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
13 |
9fca9e09b966
Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
14 import com.esri.arcgis.display.esriLineCapStyle; |
9fca9e09b966
Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
15 import com.esri.arcgis.display.esriLineJoinStyle; |
9fca9e09b966
Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
16 |
9fca9e09b966
Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
17 import org.w3c.dom.Element; |
115
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
18 import java.io.IOException; |
65
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 /** |
9fca9e09b966
Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
21 * Reads cartoline symbol information. |
9fca9e09b966
Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
22 * |
9fca9e09b966
Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
23 * @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
|
24 */ |
80
83932f18dddc
All symbol reader now extend the abstract symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
74
diff
changeset
|
25 public class CartoLineSymbolReader |
83932f18dddc
All symbol reader now extend the abstract symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
74
diff
changeset
|
26 extends AbstractSymbolReader { |
65
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 /** |
9fca9e09b966
Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
29 * The logger. |
9fca9e09b966
Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
30 */ |
9fca9e09b966
Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
31 private static final Logger logger = |
9fca9e09b966
Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
32 Logger.getLogger(CartoLineSymbolReader.class); |
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 /** |
9fca9e09b966
Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
35 * Private member. |
9fca9e09b966
Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
36 */ |
9fca9e09b966
Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
37 private CartographicLineSymbol symbol; |
9fca9e09b966
Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
38 |
181 | 39 /** |
40 * Constructor with symbol. | |
41 * | |
42 * @param symbol The symbol used to display lines. | |
43 */ | |
65
9fca9e09b966
Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
44 public CartoLineSymbolReader(ISymbol symbol) |
9fca9e09b966
Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
45 throws Exception { |
9fca9e09b966
Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
46 logger.debug("contructor()"); |
9fca9e09b966
Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
47 if(symbol instanceof CartographicLineSymbol) { |
9fca9e09b966
Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
48 this.symbol = (CartographicLineSymbol)symbol; |
9fca9e09b966
Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
49 } |
9fca9e09b966
Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
50 else { |
9fca9e09b966
Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
51 throw new Exception("Not a CartographicLineSymbol!"); |
9fca9e09b966
Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
52 } |
9fca9e09b966
Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
53 } |
9fca9e09b966
Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
54 |
181 | 55 /** |
56 * Constructor with symbol. | |
57 * | |
58 * @param symbol The symbol used to display lines. | |
59 */ | |
67
5ed9e720b6cd
Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
65
diff
changeset
|
60 public CartoLineSymbolReader(ILineSymbol symbol) |
5ed9e720b6cd
Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
65
diff
changeset
|
61 throws Exception { |
5ed9e720b6cd
Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
65
diff
changeset
|
62 logger.debug("contructor()"); |
5ed9e720b6cd
Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
65
diff
changeset
|
63 if(symbol instanceof CartographicLineSymbol) { |
5ed9e720b6cd
Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
65
diff
changeset
|
64 this.symbol = (CartographicLineSymbol)symbol; |
5ed9e720b6cd
Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
65
diff
changeset
|
65 } |
5ed9e720b6cd
Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
65
diff
changeset
|
66 else { |
5ed9e720b6cd
Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
65
diff
changeset
|
67 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
|
68 } |
5ed9e720b6cd
Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
65
diff
changeset
|
69 } |
5ed9e720b6cd
Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
65
diff
changeset
|
70 |
65
9fca9e09b966
Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
71 /** |
9fca9e09b966
Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
72 * Reads the symbol attributes. |
9fca9e09b966
Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
73 * |
9fca9e09b966
Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
74 * @return The XML node. |
9fca9e09b966
Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
75 */ |
115
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
76 public Element read() { |
65
9fca9e09b966
Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
77 logger.debug("read()"); |
80
83932f18dddc
All symbol reader now extend the abstract symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
74
diff
changeset
|
78 Element symbolElement = util.addSymbol(parent); |
65
9fca9e09b966
Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
79 |
115
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
80 try { |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
81 symbolElement.setAttribute("name", symbol.getNameString()); |
65
9fca9e09b966
Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
82 } |
115
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
83 catch(IOException ioe) { |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
84 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
|
85 symbolElement.setAttribute("name", "default"); |
65
9fca9e09b966
Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
86 } |
115
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
87 |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
88 try { |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
89 if(symbol.getColor() instanceof IRgbColor) { |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
90 IRgbColor color = (IRgbColor)symbol.getColor(); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
91 Color c = new Color ( |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
92 color.getRed(), |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
93 color.getGreen(), |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
94 color.getBlue()); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
95 symbolElement.setAttribute("color", String.valueOf(c.getRGB())); |
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 else { |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
98 RgbColor col = new RgbColor(); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
99 col.setRGB(symbol.getColor().getRGB()); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
100 Color c = new Color ( |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
101 col.getRed(), |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
102 col.getGreen(), |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
103 col.getBlue()); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
104 symbolElement.setAttribute("color", String.valueOf(c.getRGB())); |
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 } |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
107 catch(IOException ioe) { |
135
a4ab239509f1
Updated the default values and reader error handling.
Raimund Renkert <rrenkert@intevation.de>
parents:
115
diff
changeset
|
108 logger.warn("Could not read color."); |
115
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 |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
111 int cap; |
135
a4ab239509f1
Updated the default values and reader error handling.
Raimund Renkert <rrenkert@intevation.de>
parents:
115
diff
changeset
|
112 String capStyle = ""; |
115
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
113 try { |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
114 cap = symbol.getCap(); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
115 } |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
116 catch(IOException ioe) { |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
117 logger.warn( |
135
a4ab239509f1
Updated the default values and reader error handling.
Raimund Renkert <rrenkert@intevation.de>
parents:
115
diff
changeset
|
118 "Could not read line cap."); |
115
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
119 cap = -1; |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
120 } |
65
9fca9e09b966
Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
121 switch(cap) { |
9fca9e09b966
Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
122 case esriLineCapStyle.esriLCSRound: capStyle = "round"; break; |
9fca9e09b966
Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
123 case esriLineCapStyle.esriLCSSquare: capStyle = "square"; break; |
9fca9e09b966
Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
124 default: break; |
9fca9e09b966
Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
125 } |
115
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
126 |
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 int join; |
135
a4ab239509f1
Updated the default values and reader error handling.
Raimund Renkert <rrenkert@intevation.de>
parents:
115
diff
changeset
|
129 String joinStyle = ""; |
115
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
130 try { |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
131 join = symbol.getJoin(); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
132 } |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
133 catch(IOException ioe) { |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
134 logger.warn( |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
135 "Could not read line join." + |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
136 " Setting line join to \"bevel\"."); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
137 join = -1; |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
138 } |
65
9fca9e09b966
Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
139 switch(join) { |
9fca9e09b966
Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
140 case esriLineJoinStyle.esriLJSRound: joinStyle = "round"; break; |
9fca9e09b966
Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
141 case esriLineJoinStyle.esriLJSMitre: joinStyle = "miter"; break; |
9fca9e09b966
Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
142 default: break; |
9fca9e09b966
Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
143 } |
135
a4ab239509f1
Updated the default values and reader error handling.
Raimund Renkert <rrenkert@intevation.de>
parents:
115
diff
changeset
|
144 if(!capStyle.equals("")) { |
a4ab239509f1
Updated the default values and reader error handling.
Raimund Renkert <rrenkert@intevation.de>
parents:
115
diff
changeset
|
145 symbolElement.setAttribute("cap", capStyle); |
a4ab239509f1
Updated the default values and reader error handling.
Raimund Renkert <rrenkert@intevation.de>
parents:
115
diff
changeset
|
146 } |
a4ab239509f1
Updated the default values and reader error handling.
Raimund Renkert <rrenkert@intevation.de>
parents:
115
diff
changeset
|
147 if (!joinStyle.equals("")) { |
a4ab239509f1
Updated the default values and reader error handling.
Raimund Renkert <rrenkert@intevation.de>
parents:
115
diff
changeset
|
148 symbolElement.setAttribute("join", joinStyle); |
a4ab239509f1
Updated the default values and reader error handling.
Raimund Renkert <rrenkert@intevation.de>
parents:
115
diff
changeset
|
149 } |
65
9fca9e09b966
Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
150 |
115
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
151 try { |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
152 symbolElement.setAttribute( |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
153 "linestart", |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
154 String.valueOf(symbol.getLineStartOffset())); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
155 } |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
156 catch(IOException ioe) { |
135
a4ab239509f1
Updated the default values and reader error handling.
Raimund Renkert <rrenkert@intevation.de>
parents:
115
diff
changeset
|
157 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
|
158 } |
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 try { |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
161 symbolElement.setAttribute( |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
162 "miterlimit", |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
163 String.valueOf(symbol.getMiterLimit())); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
164 } |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
165 catch(IOException ioe) { |
135
a4ab239509f1
Updated the default values and reader error handling.
Raimund Renkert <rrenkert@intevation.de>
parents:
115
diff
changeset
|
166 logger.warn("Could not read miter limit."); |
115
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
167 } |
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 try { |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
170 symbolElement.setAttribute( |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
171 "offset", |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
172 String.valueOf(symbol.getOffset())); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
173 } |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
174 catch(IOException ioe) { |
135
a4ab239509f1
Updated the default values and reader error handling.
Raimund Renkert <rrenkert@intevation.de>
parents:
115
diff
changeset
|
175 logger.warn("Could not read offset."); |
115
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 |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
178 try { |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
179 symbolElement.setAttribute( |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
180 "width", |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
181 String.valueOf(symbol.getWidth())); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
182 } |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
183 catch(IOException ioe) { |
135
a4ab239509f1
Updated the default values and reader error handling.
Raimund Renkert <rrenkert@intevation.de>
parents:
115
diff
changeset
|
184 logger.warn("Could not read width."); |
115
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
185 } |
136
7632850b9520
Convert cartographic line template to mapfile pattern.
Raimund Renkert <rrenkert@intevation.de>
parents:
135
diff
changeset
|
186 |
7632850b9520
Convert cartographic line template to mapfile pattern.
Raimund Renkert <rrenkert@intevation.de>
parents:
135
diff
changeset
|
187 try { |
7632850b9520
Convert cartographic line template to mapfile pattern.
Raimund Renkert <rrenkert@intevation.de>
parents:
135
diff
changeset
|
188 Template temp = (Template)symbol.getTemplate(); |
7632850b9520
Convert cartographic line template to mapfile pattern.
Raimund Renkert <rrenkert@intevation.de>
parents:
135
diff
changeset
|
189 double length = temp.getInterval(); |
7632850b9520
Convert cartographic line template to mapfile pattern.
Raimund Renkert <rrenkert@intevation.de>
parents:
135
diff
changeset
|
190 int count = temp.getPatternElementCount(); |
7632850b9520
Convert cartographic line template to mapfile pattern.
Raimund Renkert <rrenkert@intevation.de>
parents:
135
diff
changeset
|
191 symbolElement.setAttribute("pattern_count", String.valueOf(count)); |
7632850b9520
Convert cartographic line template to mapfile pattern.
Raimund Renkert <rrenkert@intevation.de>
parents:
135
diff
changeset
|
192 for (int j = 0; j < count; j++) { |
7632850b9520
Convert cartographic line template to mapfile pattern.
Raimund Renkert <rrenkert@intevation.de>
parents:
135
diff
changeset
|
193 double[] mark = new double[1]; |
7632850b9520
Convert cartographic line template to mapfile pattern.
Raimund Renkert <rrenkert@intevation.de>
parents:
135
diff
changeset
|
194 double[] gap = new double[1]; |
7632850b9520
Convert cartographic line template to mapfile pattern.
Raimund Renkert <rrenkert@intevation.de>
parents:
135
diff
changeset
|
195 temp.getPatternElement(j, mark, gap); |
7632850b9520
Convert cartographic line template to mapfile pattern.
Raimund Renkert <rrenkert@intevation.de>
parents:
135
diff
changeset
|
196 symbolElement.setAttribute( |
7632850b9520
Convert cartographic line template to mapfile pattern.
Raimund Renkert <rrenkert@intevation.de>
parents:
135
diff
changeset
|
197 "mark_" + j, |
7632850b9520
Convert cartographic line template to mapfile pattern.
Raimund Renkert <rrenkert@intevation.de>
parents:
135
diff
changeset
|
198 String.valueOf(mark[0])); |
7632850b9520
Convert cartographic line template to mapfile pattern.
Raimund Renkert <rrenkert@intevation.de>
parents:
135
diff
changeset
|
199 symbolElement.setAttribute("gap_" + j, String.valueOf(gap[0])); |
7632850b9520
Convert cartographic line template to mapfile pattern.
Raimund Renkert <rrenkert@intevation.de>
parents:
135
diff
changeset
|
200 } |
7632850b9520
Convert cartographic line template to mapfile pattern.
Raimund Renkert <rrenkert@intevation.de>
parents:
135
diff
changeset
|
201 } |
7632850b9520
Convert cartographic line template to mapfile pattern.
Raimund Renkert <rrenkert@intevation.de>
parents:
135
diff
changeset
|
202 catch(IOException ioe){ |
7632850b9520
Convert cartographic line template to mapfile pattern.
Raimund Renkert <rrenkert@intevation.de>
parents:
135
diff
changeset
|
203 logger.warn("Could not read pattern elements."); |
7632850b9520
Convert cartographic line template to mapfile pattern.
Raimund Renkert <rrenkert@intevation.de>
parents:
135
diff
changeset
|
204 } |
143
6d294beb0e59
Fixed exception handling for CartoLineSymbolReader.
vc11884admin@VC11884.win.bsh.de
parents:
136
diff
changeset
|
205 catch(NullPointerException npe) { |
6d294beb0e59
Fixed exception handling for CartoLineSymbolReader.
vc11884admin@VC11884.win.bsh.de
parents:
136
diff
changeset
|
206 logger.debug("No pattern elements in carto line symbol"); |
6d294beb0e59
Fixed exception handling for CartoLineSymbolReader.
vc11884admin@VC11884.win.bsh.de
parents:
136
diff
changeset
|
207 } |
115
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
208 symbolElement.setAttribute("type", "line"); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
209 symbolElement.setAttribute("style", "carto"); |
65
9fca9e09b966
Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
210 |
9fca9e09b966
Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
211 return symbolElement; |
9fca9e09b966
Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
212 } |
9fca9e09b966
Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
213 } |
9fca9e09b966
Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
214 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |