Mercurial > mxd2map
annotate src/java/de/intevation/mxd/reader/LineFillSymbolReader.java @ 250:d10fd4de02aa
Documented a bunch of new features
* Support of picture-marker symbol (issue343)
* Support for ArcGIS named groups (issue381)
* GLOBAL and Layer extents and SRS (issue 379)
author | Stephan Holl <stephan.holl@intevation.de> |
---|---|
date | Fri, 12 Aug 2011 09:15:34 +0200 |
parents | df4e0946ef02 |
children | a46adb3697fa |
rev | line source |
---|---|
243
df4e0946ef02
Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents:
181
diff
changeset
|
1 /* |
df4e0946ef02
Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents:
181
diff
changeset
|
2 * Copyright (c) 2011 by Intevation GmbH, Germany <info@intevation.de> |
df4e0946ef02
Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents:
181
diff
changeset
|
3 * |
df4e0946ef02
Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents:
181
diff
changeset
|
4 * This file is part of MXD2map. |
df4e0946ef02
Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents:
181
diff
changeset
|
5 * |
df4e0946ef02
Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents:
181
diff
changeset
|
6 * This program is free software under the LGPL (>=v2.1) |
df4e0946ef02
Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents:
181
diff
changeset
|
7 * Read the file LICENCE.txt coming with the software for details |
df4e0946ef02
Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents:
181
diff
changeset
|
8 * or visit http://www.gnu.org/licenses/ if it does not exist. |
df4e0946ef02
Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents:
181
diff
changeset
|
9 * |
df4e0946ef02
Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents:
181
diff
changeset
|
10 * MXD2map has been developed on behalf of the |
df4e0946ef02
Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents:
181
diff
changeset
|
11 * Bundesamt fuer Seeschifffahrt und Hydrographie (BSH) in Hamburg |
df4e0946ef02
Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents:
181
diff
changeset
|
12 * by Intevation GmbH. |
df4e0946ef02
Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents:
181
diff
changeset
|
13 * |
df4e0946ef02
Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents:
181
diff
changeset
|
14 * Authors: |
df4e0946ef02
Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents:
181
diff
changeset
|
15 * Raimund Renkert <raimund.renkert@intevation.de> |
df4e0946ef02
Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents:
181
diff
changeset
|
16 * Bjoern Schilberg <bjoern.schilberg@intevation.de> |
df4e0946ef02
Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents:
181
diff
changeset
|
17 * Stephan Holl <stephan.holl@intevation.de> |
df4e0946ef02
Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents:
181
diff
changeset
|
18 */ |
df4e0946ef02
Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents:
181
diff
changeset
|
19 |
76
3087c89a5bb8
Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
20 package de.intevation.mxd.reader; |
3087c89a5bb8
Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
21 |
3087c89a5bb8
Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
22 import java.awt.Color; |
3087c89a5bb8
Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
23 |
3087c89a5bb8
Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
24 import org.apache.log4j.Logger; |
3087c89a5bb8
Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
25 |
3087c89a5bb8
Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
26 import com.esri.arcgis.display.ISymbol; |
3087c89a5bb8
Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
27 import com.esri.arcgis.display.IFillSymbol; |
3087c89a5bb8
Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
28 import com.esri.arcgis.display.ILineSymbol; |
3087c89a5bb8
Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
29 import com.esri.arcgis.display.LineFillSymbol; |
3087c89a5bb8
Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
30 import com.esri.arcgis.display.IRgbColor; |
3087c89a5bb8
Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
31 import com.esri.arcgis.display.RgbColor; |
3087c89a5bb8
Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
32 |
3087c89a5bb8
Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
33 import org.w3c.dom.Element; |
115
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
34 import java.io.IOException; |
76
3087c89a5bb8
Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
35 |
3087c89a5bb8
Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
36 /** |
3087c89a5bb8
Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
37 * Reads marker line symbol information. |
3087c89a5bb8
Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
38 * |
3087c89a5bb8
Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
39 * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a> |
3087c89a5bb8
Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
40 */ |
3087c89a5bb8
Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
41 public class LineFillSymbolReader |
3087c89a5bb8
Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
42 extends AbstractSymbolReader{ |
3087c89a5bb8
Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
43 |
3087c89a5bb8
Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
44 /** |
3087c89a5bb8
Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
45 * The logger. |
3087c89a5bb8
Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
46 */ |
3087c89a5bb8
Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
47 private static final Logger logger = |
3087c89a5bb8
Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
48 Logger.getLogger(LineFillSymbolReader.class); |
3087c89a5bb8
Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
49 |
3087c89a5bb8
Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
50 /** |
3087c89a5bb8
Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
51 * Private member. |
3087c89a5bb8
Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
52 */ |
3087c89a5bb8
Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
53 private LineFillSymbol symbol; |
3087c89a5bb8
Added line fill 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 polygons. | |
59 */ | |
76
3087c89a5bb8
Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
60 public LineFillSymbolReader(ISymbol symbol) |
3087c89a5bb8
Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
61 throws Exception { |
3087c89a5bb8
Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
62 logger.debug("contructor()"); |
3087c89a5bb8
Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
63 if(symbol instanceof LineFillSymbol) { |
3087c89a5bb8
Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
64 this.symbol = (LineFillSymbol)symbol; |
3087c89a5bb8
Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
65 } |
3087c89a5bb8
Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
66 else { |
3087c89a5bb8
Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
67 throw new Exception("Not a LineFillSymbol!"); |
3087c89a5bb8
Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
68 } |
3087c89a5bb8
Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
69 } |
3087c89a5bb8
Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
70 |
181 | 71 /** |
72 * Constructor with symbol. | |
73 * | |
74 * @param symbol The symbol used to display polygons. | |
75 */ | |
76
3087c89a5bb8
Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
76 public LineFillSymbolReader(IFillSymbol symbol) |
3087c89a5bb8
Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
77 throws Exception { |
3087c89a5bb8
Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
78 logger.debug("contructor()"); |
3087c89a5bb8
Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
79 if(symbol instanceof LineFillSymbol) { |
3087c89a5bb8
Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
80 this.symbol = (LineFillSymbol)symbol; |
3087c89a5bb8
Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
81 } |
3087c89a5bb8
Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
82 else { |
3087c89a5bb8
Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
83 throw new Exception("Not a LineFillSymbol!"); |
3087c89a5bb8
Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
84 } |
3087c89a5bb8
Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
85 } |
3087c89a5bb8
Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
86 |
3087c89a5bb8
Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
87 /** |
3087c89a5bb8
Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
88 * Reads the symbol attributes. |
3087c89a5bb8
Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
89 * |
3087c89a5bb8
Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
90 * @return The XML node. |
3087c89a5bb8
Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
91 */ |
115
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
92 public Element read() { |
76
3087c89a5bb8
Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
93 logger.debug("read()"); |
3087c89a5bb8
Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
94 |
3087c89a5bb8
Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
95 Element symbolElement = util.addSymbol(parent); |
3087c89a5bb8
Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
96 |
115
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
97 try { |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
98 symbolElement.setAttribute("name", symbol.getNameString()); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
99 } |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
100 catch(IOException ioe) { |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
101 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
|
102 symbolElement.setAttribute("name", "default"); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
103 } |
76
3087c89a5bb8
Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
104 symbolElement.setAttribute("style", "fill"); |
3087c89a5bb8
Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
105 |
115
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
106 try { |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
107 symbolElement.setAttribute( |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
108 "offset", |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
109 String.valueOf(symbol.getOffset())); |
76
3087c89a5bb8
Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
110 } |
115
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
111 catch(IOException ioe) { |
135
a4ab239509f1
Updated the default values and reader error handling.
Raimund Renkert <rrenkert@intevation.de>
parents:
115
diff
changeset
|
112 logger.warn("Could not read offset."); |
76
3087c89a5bb8
Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
113 } |
3087c89a5bb8
Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
114 |
115
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
115 try { |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
116 symbolElement.setAttribute( |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
117 "separation", |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
118 String.valueOf(symbol.getSeparation())); |
76
3087c89a5bb8
Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
119 } |
115
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
120 catch(IOException ioe) { |
135
a4ab239509f1
Updated the default values and reader error handling.
Raimund Renkert <rrenkert@intevation.de>
parents:
115
diff
changeset
|
121 logger.warn("Could not read separation."); |
76
3087c89a5bb8
Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
122 } |
115
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
123 |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
124 try { |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
125 symbolElement.setAttribute( |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
126 "angle", |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
127 String.valueOf(symbol.getAngle())); |
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 e) { |
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 angle."); |
115
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
131 } |
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 try { |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
134 if(symbol.getColor() instanceof IRgbColor) { |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
135 IRgbColor color = (IRgbColor)symbol.getColor(); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
136 Color c = new Color ( |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
137 color.getRed(), |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
138 color.getGreen(), |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
139 color.getBlue()); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
140 symbolElement.setAttribute("color", String.valueOf(c.getRGB())); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
141 symbolElement.setAttribute("transparency", |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
142 String.valueOf(color.getTransparency())); |
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 else { |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
145 RgbColor col = new RgbColor(); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
146 col.setRGB(symbol.getColor().getRGB()); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
147 Color c = new Color ( |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
148 col.getRed(), |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
149 col.getGreen(), |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
150 col.getBlue()); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
151 symbolElement.setAttribute("color", String.valueOf(c.getRGB())); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
152 symbolElement.setAttribute("transparency", |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
153 String.valueOf(col.getTransparency())); |
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 } |
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 color."); |
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 ILineSymbol ols = symbol.getOutline(); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
162 LineSymbolReader olsr = new LineSymbolReader(); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
163 if(olsr.canRead(ols)) { |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
164 olsr.setSymbol(ols); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
165 olsr.setUtil(util); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
166 olsr.setParent(symbolElement); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
167 olsr.read(); |
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 else { |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
170 logger.debug("The type of " + ols.getClass().toString() + |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
171 " is not implemented!"); |
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 } |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
174 catch(Exception e) { |
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 outline."); |
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 ILineSymbol ls = symbol.getLineSymbol(); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
180 LineSymbolReader lsr = new LineSymbolReader(); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
181 if(lsr.canRead(ls)) { |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
182 symbolElement.setAttribute("hatch", "1"); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
183 lsr.setSymbol(ls); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
184 lsr.setUtil(util); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
185 lsr.setParent(symbolElement); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
186 lsr.read(); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
187 } |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
188 else { |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
189 logger.debug("The type of " + ls.getClass().toString() + |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
190 " is not implemented!"); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
191 } |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
192 } |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
97
diff
changeset
|
193 catch(Exception e) { |
135
a4ab239509f1
Updated the default values and reader error handling.
Raimund Renkert <rrenkert@intevation.de>
parents:
115
diff
changeset
|
194 logger.warn("Could not read line symbol."); |
76
3087c89a5bb8
Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
195 } |
3087c89a5bb8
Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
196 return parent; |
3087c89a5bb8
Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
197 } |
3087c89a5bb8
Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
198 } |
3087c89a5bb8
Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
199 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |