annotate src/java/de/intevation/mxd/reader/HashLineSymbolReader.java @ 153:7ed49420ee5a

Changed min scale and max scale in writer.
author vc11884admin@VC11884.win.bsh.de
date Thu, 30 Jun 2011 14:31:01 +0200
parents a4ab239509f1
children f4eb506499f5
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
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
38 public HashLineSymbolReader(ISymbol symbol)
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
39 throws Exception {
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
40 logger.debug("contructor()");
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
41 if(symbol instanceof HashLineSymbol) {
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
42 this.symbol = (HashLineSymbol)symbol;
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
43 }
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
44 else {
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
45 throw new Exception("Not a HashLineSymbol!");
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
46 }
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
47 }
6bfebb7eb1df Added hash 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: 66
diff changeset
49 public HashLineSymbolReader(ILineSymbol symbol)
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 66
diff changeset
50 throws Exception {
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 66
diff changeset
51 logger.debug("contructor()");
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 66
diff changeset
52 if(symbol instanceof HashLineSymbol) {
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 66
diff changeset
53 this.symbol = (HashLineSymbol)symbol;
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 66
diff changeset
54 }
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 66
diff changeset
55 else {
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 66
diff changeset
56 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
57 }
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 66
diff changeset
58 }
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 66
diff changeset
59
66
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
60 /**
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
61 * Reads the symbol attributes.
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
62 *
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
63 * @return The XML node.
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
64 */
115
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
65 public Element read() {
66
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
66 logger.debug("read()");
80
83932f18dddc All symbol reader now extend the abstract symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 74
diff changeset
67 Element symbolElement = util.addSymbol(parent);
66
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
68
115
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
69 try {
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
70 symbolElement.setAttribute("name", symbol.getNameString());
66
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
71 }
115
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
72 catch(IOException ioe) {
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
73 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
74 symbolElement.setAttribute("name", "default");
66
6bfebb7eb1df Added hash 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
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
77 try {
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
78 if(symbol.getColor() instanceof IRgbColor) {
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
79 IRgbColor color = (IRgbColor)symbol.getColor();
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
80 Color c = new Color (
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
81 color.getRed(),
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
82 color.getGreen(),
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
83 color.getBlue());
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
84 symbolElement.setAttribute("color", String.valueOf(c.getRGB()));
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
85 }
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
86 else {
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
87 RgbColor col = new RgbColor();
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
88 col.setRGB(symbol.getColor().getRGB());
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
89 Color c = new Color (
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
90 col.getRed(),
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
91 col.getGreen(),
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
92 col.getBlue());
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
93 symbolElement.setAttribute("color", String.valueOf(c.getRGB()));
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
94 }
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 catch(IOException ioe) {
135
a4ab239509f1 Updated the default values and reader error handling.
Raimund Renkert <rrenkert@intevation.de>
parents: 115
diff changeset
97 logger.warn("Could not read color.");
115
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
98 }
135
a4ab239509f1 Updated the default values and reader error handling.
Raimund Renkert <rrenkert@intevation.de>
parents: 115
diff changeset
99
115
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
100 int cap;
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
101 try {
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
102 cap = symbol.getCap();
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
103 }
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
104 catch(IOException ioe) {
135
a4ab239509f1 Updated the default values and reader error handling.
Raimund Renkert <rrenkert@intevation.de>
parents: 115
diff changeset
105 logger.warn("Could not read line cap.");
115
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
106 cap = -1;
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
107 }
135
a4ab239509f1 Updated the default values and reader error handling.
Raimund Renkert <rrenkert@intevation.de>
parents: 115
diff changeset
108 String capStyle = "";
66
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
109 switch(cap) {
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
110 case esriLineCapStyle.esriLCSRound: capStyle = "round"; break;
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
111 case esriLineCapStyle.esriLCSSquare: capStyle = "square"; break;
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
112 default: break;
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
113 }
115
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
114
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
115 int join;
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
116 try {
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
117 join = symbol.getJoin();
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
118 }
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
119 catch(IOException ioe) {
135
a4ab239509f1 Updated the default values and reader error handling.
Raimund Renkert <rrenkert@intevation.de>
parents: 115
diff changeset
120 logger.warn("Could not read line join.");
115
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
121 join = -1;
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
122 }
135
a4ab239509f1 Updated the default values and reader error handling.
Raimund Renkert <rrenkert@intevation.de>
parents: 115
diff changeset
123 String joinStyle = "";
66
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
124 switch(join) {
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
125 case esriLineJoinStyle.esriLJSRound: joinStyle = "round"; break;
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
126 case esriLineJoinStyle.esriLJSMitre: joinStyle = "miter"; break;
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
127 default: break;
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
128 }
135
a4ab239509f1 Updated the default values and reader error handling.
Raimund Renkert <rrenkert@intevation.de>
parents: 115
diff changeset
129 if(!capStyle.equals("")) {
a4ab239509f1 Updated the default values and reader error handling.
Raimund Renkert <rrenkert@intevation.de>
parents: 115
diff changeset
130 symbolElement.setAttribute("cap", capStyle);
a4ab239509f1 Updated the default values and reader error handling.
Raimund Renkert <rrenkert@intevation.de>
parents: 115
diff changeset
131 }
a4ab239509f1 Updated the default values and reader error handling.
Raimund Renkert <rrenkert@intevation.de>
parents: 115
diff changeset
132 if(!joinStyle.equals("")) {
a4ab239509f1 Updated the default values and reader error handling.
Raimund Renkert <rrenkert@intevation.de>
parents: 115
diff changeset
133 symbolElement.setAttribute("join", joinStyle);
a4ab239509f1 Updated the default values and reader error handling.
Raimund Renkert <rrenkert@intevation.de>
parents: 115
diff changeset
134 }
a4ab239509f1 Updated the default values and reader error handling.
Raimund Renkert <rrenkert@intevation.de>
parents: 115
diff changeset
135
115
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
136 try {
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
137 symbolElement.setAttribute(
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
138 "linestart",
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
139 String.valueOf(symbol.getLineStartOffset()));
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
140 }
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
141 catch(IOException ioe) {
135
a4ab239509f1 Updated the default values and reader error handling.
Raimund Renkert <rrenkert@intevation.de>
parents: 115
diff changeset
142 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
143 }
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
144
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
145 try {
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
146 symbolElement.setAttribute(
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
147 "miterlimit",
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
148 String.valueOf(symbol.getMiterLimit()));
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
149 }
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
150 catch(IOException ioe) {
135
a4ab239509f1 Updated the default values and reader error handling.
Raimund Renkert <rrenkert@intevation.de>
parents: 115
diff changeset
151 logger.warn("Could not read miter limit.");
115
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
152 }
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 try {
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
155 symbolElement.setAttribute(
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
156 "offset",
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
157 String.valueOf(symbol.getOffset()));
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 catch(IOException ioe) {
135
a4ab239509f1 Updated the default values and reader error handling.
Raimund Renkert <rrenkert@intevation.de>
parents: 115
diff changeset
160 logger.warn("Could not read offset.");
115
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
161 }
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 try {
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
164 symbolElement.setAttribute(
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
165 "width",
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
166 String.valueOf(symbol.getWidth()));
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 catch(IOException ioe) {
135
a4ab239509f1 Updated the default values and reader error handling.
Raimund Renkert <rrenkert@intevation.de>
parents: 115
diff changeset
169 logger.warn("Could not read width.");
115
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
170 }
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 try {
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
173 ILineSymbol ls = symbol.getHashSymbol();
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
174 readHashSymbol(ls, symbolElement);
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 catch(Exception e) {
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
177 logger.warn(
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
178 "Could not read HashSymbol." +
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
179 " No fallback symbol defined.");
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
180 }
66
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
181
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
182 //TODO Read further HashLine specific attributes:
67
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 66
diff changeset
183 // LineDecoration, Template.
115
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
184 symbolElement.setAttribute("type", "line");
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 97
diff changeset
185 symbolElement.setAttribute("style", "hash");
66
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
186
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
187 return symbolElement;
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
188 }
67
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 66
diff changeset
189
82
4d6fae53956a Use the wrapper to read hash line symbols.
Raimund Renkert <rrenkert@intevation.de>
parents: 80
diff changeset
190 private void readHashSymbol(ILineSymbol ls, Element parent)
4d6fae53956a Use the wrapper to read hash line symbols.
Raimund Renkert <rrenkert@intevation.de>
parents: 80
diff changeset
191 throws Exception {
4d6fae53956a Use the wrapper to read hash line symbols.
Raimund Renkert <rrenkert@intevation.de>
parents: 80
diff changeset
192 LineSymbolReader lsr = new LineSymbolReader ();
4d6fae53956a Use the wrapper to read hash line symbols.
Raimund Renkert <rrenkert@intevation.de>
parents: 80
diff changeset
193 if (lsr.canRead(ls)) {
4d6fae53956a Use the wrapper to read hash line symbols.
Raimund Renkert <rrenkert@intevation.de>
parents: 80
diff changeset
194 lsr.setSymbol(ls);
4d6fae53956a Use the wrapper to read hash line symbols.
Raimund Renkert <rrenkert@intevation.de>
parents: 80
diff changeset
195 lsr.setParent(parent);
4d6fae53956a Use the wrapper to read hash line symbols.
Raimund Renkert <rrenkert@intevation.de>
parents: 80
diff changeset
196 lsr.setUtil(util);
4d6fae53956a Use the wrapper to read hash line symbols.
Raimund Renkert <rrenkert@intevation.de>
parents: 80
diff changeset
197 lsr.read();
67
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 66
diff changeset
198 }
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 66
diff changeset
199 }
66
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
200 }
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
201 // 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)