Mercurial > mxd2map
annotate src/java/de/intevation/mxd/reader/CharacterMarkerSymbolReader.java @ 296:72b85bac29fa
Add changelog entry for dynamic angles change which
should have went in one commit.
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Mon, 03 Sep 2012 17:24:31 +0200 |
parents | c2747cec2814 |
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 |
47
5fc813f40fa5
Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
20 package de.intevation.mxd.reader; |
5fc813f40fa5
Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
21 |
5fc813f40fa5
Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
22 import org.apache.log4j.Logger; |
5fc813f40fa5
Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
23 |
5fc813f40fa5
Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
24 import com.esri.arcgis.display.ISymbol; |
63
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
48
diff
changeset
|
25 import com.esri.arcgis.display.IMarkerSymbol; |
47
5fc813f40fa5
Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
26 import com.esri.arcgis.display.CharacterMarkerSymbol; |
5fc813f40fa5
Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
27 import com.esri.arcgis.support.ms.stdole.Font; |
93
3993b5adf67c
Write the character symbol correctly to the mapfile and the symbolset.
Raimund Renkert <rrenkert@intevation.de>
parents:
89
diff
changeset
|
28 import com.esri.arcgis.display.IRgbColor; |
3993b5adf67c
Write the character symbol correctly to the mapfile and the symbolset.
Raimund Renkert <rrenkert@intevation.de>
parents:
89
diff
changeset
|
29 import com.esri.arcgis.display.RgbColor; |
3993b5adf67c
Write the character symbol correctly to the mapfile and the symbolset.
Raimund Renkert <rrenkert@intevation.de>
parents:
89
diff
changeset
|
30 |
47
5fc813f40fa5
Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
31 import org.w3c.dom.Element; |
93
3993b5adf67c
Write the character symbol correctly to the mapfile and the symbolset.
Raimund Renkert <rrenkert@intevation.de>
parents:
89
diff
changeset
|
32 import java.awt.Color; |
115
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
96
diff
changeset
|
33 import java.io.IOException; |
47
5fc813f40fa5
Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
34 |
5fc813f40fa5
Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
35 /** |
5fc813f40fa5
Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
36 * Reads character marker symbol information. |
5fc813f40fa5
Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
37 * |
5fc813f40fa5
Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
38 * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a> |
5fc813f40fa5
Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
39 */ |
80
83932f18dddc
All symbol reader now extend the abstract symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
74
diff
changeset
|
40 public class CharacterMarkerSymbolReader |
83932f18dddc
All symbol reader now extend the abstract symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
74
diff
changeset
|
41 extends AbstractSymbolReader { |
47
5fc813f40fa5
Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
42 |
5fc813f40fa5
Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
43 /** |
5fc813f40fa5
Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
44 * The logger. |
5fc813f40fa5
Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
45 */ |
5fc813f40fa5
Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
46 private static final Logger logger = |
5fc813f40fa5
Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
47 Logger.getLogger(CharacterMarkerSymbolReader.class); |
5fc813f40fa5
Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
48 |
5fc813f40fa5
Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
49 /** |
5fc813f40fa5
Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
50 * Private member. |
5fc813f40fa5
Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
51 */ |
5fc813f40fa5
Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
52 private CharacterMarkerSymbol symbol; |
5fc813f40fa5
Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol 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 points. | |
58 */ | |
47
5fc813f40fa5
Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
59 public CharacterMarkerSymbolReader(ISymbol symbol) |
5fc813f40fa5
Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
60 throws Exception { |
5fc813f40fa5
Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
61 logger.debug("contructor()"); |
5fc813f40fa5
Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
62 if(symbol instanceof CharacterMarkerSymbol) { |
5fc813f40fa5
Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
63 this.symbol = (CharacterMarkerSymbol)symbol; |
5fc813f40fa5
Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
64 } |
5fc813f40fa5
Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
65 else { |
5fc813f40fa5
Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
66 throw new Exception("Not a CharacterMarkerSymbol!"); |
5fc813f40fa5
Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
67 } |
5fc813f40fa5
Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
68 } |
5fc813f40fa5
Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
69 |
181 | 70 /** |
71 * Constructor with symbol. | |
72 * | |
73 * @param symbol The symbol used to display points. | |
74 */ | |
63
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
48
diff
changeset
|
75 public CharacterMarkerSymbolReader(IMarkerSymbol symbol) |
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
48
diff
changeset
|
76 throws Exception { |
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
48
diff
changeset
|
77 logger.debug("contructor()"); |
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
48
diff
changeset
|
78 if(symbol instanceof CharacterMarkerSymbol) { |
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
48
diff
changeset
|
79 this.symbol = (CharacterMarkerSymbol)symbol; |
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
48
diff
changeset
|
80 } |
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
48
diff
changeset
|
81 else { |
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
48
diff
changeset
|
82 throw new Exception("Not a CharacterMarkerSymbol!"); |
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
48
diff
changeset
|
83 } |
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
48
diff
changeset
|
84 } |
5c5ef5768893
Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
48
diff
changeset
|
85 |
47
5fc813f40fa5
Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
86 /** |
5fc813f40fa5
Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
87 * Reads the symbol attributes. |
5fc813f40fa5
Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
88 * |
5fc813f40fa5
Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
89 * @return The XML node. |
5fc813f40fa5
Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
90 */ |
115
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
96
diff
changeset
|
91 public Element read() { |
47
5fc813f40fa5
Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
92 logger.debug("read()"); |
80
83932f18dddc
All symbol reader now extend the abstract symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
74
diff
changeset
|
93 Element symbolElement = util.addSymbol(parent); |
47
5fc813f40fa5
Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
94 |
293
c2747cec2814
Save rotationElement in the symbol attributes as angleBinding
Andre Heinecke <aheinecke@intevation.de>
parents:
243
diff
changeset
|
95 // Save the rotationField value of the Element |
c2747cec2814
Save rotationElement in the symbol attributes as angleBinding
Andre Heinecke <aheinecke@intevation.de>
parents:
243
diff
changeset
|
96 if (!parent.getAttribute("rotationField").isEmpty()) { |
c2747cec2814
Save rotationElement in the symbol attributes as angleBinding
Andre Heinecke <aheinecke@intevation.de>
parents:
243
diff
changeset
|
97 logger.debug("Setting angleBinding to rotationField: " + |
c2747cec2814
Save rotationElement in the symbol attributes as angleBinding
Andre Heinecke <aheinecke@intevation.de>
parents:
243
diff
changeset
|
98 parent.getAttribute("rotationField")); |
c2747cec2814
Save rotationElement in the symbol attributes as angleBinding
Andre Heinecke <aheinecke@intevation.de>
parents:
243
diff
changeset
|
99 symbolElement.setAttribute("angleBinding", |
c2747cec2814
Save rotationElement in the symbol attributes as angleBinding
Andre Heinecke <aheinecke@intevation.de>
parents:
243
diff
changeset
|
100 parent.getAttribute("rotationField")); |
c2747cec2814
Save rotationElement in the symbol attributes as angleBinding
Andre Heinecke <aheinecke@intevation.de>
parents:
243
diff
changeset
|
101 } |
c2747cec2814
Save rotationElement in the symbol attributes as angleBinding
Andre Heinecke <aheinecke@intevation.de>
parents:
243
diff
changeset
|
102 |
115
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
96
diff
changeset
|
103 try { |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
96
diff
changeset
|
104 symbolElement.setAttribute( |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
96
diff
changeset
|
105 "angle", |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
96
diff
changeset
|
106 String.valueOf(symbol.getAngle())); |
93
3993b5adf67c
Write the character symbol correctly to the mapfile and the symbolset.
Raimund Renkert <rrenkert@intevation.de>
parents:
89
diff
changeset
|
107 } |
115
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
96
diff
changeset
|
108 catch(IOException ioe) { |
135
a4ab239509f1
Updated the default values and reader error handling.
Raimund Renkert <rrenkert@intevation.de>
parents:
115
diff
changeset
|
109 logger.warn("Could not read angle."); |
93
3993b5adf67c
Write the character symbol correctly to the mapfile and the symbolset.
Raimund Renkert <rrenkert@intevation.de>
parents:
89
diff
changeset
|
110 } |
3993b5adf67c
Write the character symbol correctly to the mapfile and the symbolset.
Raimund Renkert <rrenkert@intevation.de>
parents:
89
diff
changeset
|
111 |
115
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
96
diff
changeset
|
112 try { |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
96
diff
changeset
|
113 symbolElement.setAttribute( |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
96
diff
changeset
|
114 "size", |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
96
diff
changeset
|
115 String.valueOf(symbol.getSize())); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
96
diff
changeset
|
116 } |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
96
diff
changeset
|
117 catch(IOException ioe) { |
135
a4ab239509f1
Updated the default values and reader error handling.
Raimund Renkert <rrenkert@intevation.de>
parents:
115
diff
changeset
|
118 logger.warn("Could not read size."); |
115
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
96
diff
changeset
|
119 } |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
96
diff
changeset
|
120 |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
96
diff
changeset
|
121 try { |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
96
diff
changeset
|
122 symbolElement.setAttribute( |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
96
diff
changeset
|
123 "x_offset", |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
96
diff
changeset
|
124 String.valueOf(symbol.getXOffset())); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
96
diff
changeset
|
125 } |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
96
diff
changeset
|
126 catch(IOException ioe) { |
135
a4ab239509f1
Updated the default values and reader error handling.
Raimund Renkert <rrenkert@intevation.de>
parents:
115
diff
changeset
|
127 logger.warn("Could not read x-offset."); |
115
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
96
diff
changeset
|
128 } |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
96
diff
changeset
|
129 |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
96
diff
changeset
|
130 try { |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
96
diff
changeset
|
131 symbolElement.setAttribute( |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
96
diff
changeset
|
132 "y_offset", |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
96
diff
changeset
|
133 String.valueOf(symbol.getYOffset())); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
96
diff
changeset
|
134 } |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
96
diff
changeset
|
135 catch(IOException ioe) { |
135
a4ab239509f1
Updated the default values and reader error handling.
Raimund Renkert <rrenkert@intevation.de>
parents:
115
diff
changeset
|
136 logger.warn("Could not read y-offset."); |
115
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
96
diff
changeset
|
137 } |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
96
diff
changeset
|
138 |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
96
diff
changeset
|
139 try { |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
96
diff
changeset
|
140 symbolElement.setAttribute( |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
96
diff
changeset
|
141 "name", |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
96
diff
changeset
|
142 symbol.getNameString()); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
96
diff
changeset
|
143 } |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
96
diff
changeset
|
144 catch(IOException ioe) { |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
96
diff
changeset
|
145 logger.warn("Could not read name. Setting name to \"default\""); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
96
diff
changeset
|
146 symbolElement.setAttribute("name", "default"); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
96
diff
changeset
|
147 } |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
96
diff
changeset
|
148 |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
96
diff
changeset
|
149 try { |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
96
diff
changeset
|
150 symbolElement.setAttribute( |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
96
diff
changeset
|
151 "char", |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
96
diff
changeset
|
152 String.valueOf(symbol.getCharacterIndex())); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
96
diff
changeset
|
153 } |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
96
diff
changeset
|
154 catch(IOException ioe) { |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
96
diff
changeset
|
155 logger.warn( |
135
a4ab239509f1
Updated the default values and reader error handling.
Raimund Renkert <rrenkert@intevation.de>
parents:
115
diff
changeset
|
156 "Could not read character number."); |
115
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
96
diff
changeset
|
157 } |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
96
diff
changeset
|
158 |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
96
diff
changeset
|
159 try { |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
96
diff
changeset
|
160 if(symbol.getColor() instanceof IRgbColor) { |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
96
diff
changeset
|
161 IRgbColor color = (IRgbColor)symbol.getColor(); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
96
diff
changeset
|
162 Color c = new Color ( |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
96
diff
changeset
|
163 color.getRed(), |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
96
diff
changeset
|
164 color.getGreen(), |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
96
diff
changeset
|
165 color.getBlue()); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
96
diff
changeset
|
166 symbolElement.setAttribute("color", String.valueOf(c.getRGB())); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
96
diff
changeset
|
167 symbolElement.setAttribute("transparency", |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
96
diff
changeset
|
168 String.valueOf(color.getTransparency())); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
96
diff
changeset
|
169 } |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
96
diff
changeset
|
170 else { |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
96
diff
changeset
|
171 RgbColor col = new RgbColor(); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
96
diff
changeset
|
172 col.setRGB(symbol.getColor().getRGB()); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
96
diff
changeset
|
173 Color c = new Color ( |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
96
diff
changeset
|
174 col.getRed(), |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
96
diff
changeset
|
175 col.getGreen(), |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
96
diff
changeset
|
176 col.getBlue()); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
96
diff
changeset
|
177 symbolElement.setAttribute("color", String.valueOf(c.getRGB())); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
96
diff
changeset
|
178 symbolElement.setAttribute("transparency", |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
96
diff
changeset
|
179 String.valueOf(col.getTransparency())); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
96
diff
changeset
|
180 } |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
96
diff
changeset
|
181 } |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
96
diff
changeset
|
182 catch(IOException ioe) { |
135
a4ab239509f1
Updated the default values and reader error handling.
Raimund Renkert <rrenkert@intevation.de>
parents:
115
diff
changeset
|
183 logger.warn("Could not read color."); |
115
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
96
diff
changeset
|
184 } |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
96
diff
changeset
|
185 |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
96
diff
changeset
|
186 try { |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
96
diff
changeset
|
187 Font f = symbol.getFont(); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
96
diff
changeset
|
188 symbolElement.setAttribute("font", f.getName()); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
96
diff
changeset
|
189 symbolElement.setAttribute("char_set", String.valueOf(f.getCharset())); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
96
diff
changeset
|
190 symbolElement.setAttribute("bold", String.valueOf(f.getBold())); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
96
diff
changeset
|
191 symbolElement.setAttribute("italic", String.valueOf(f.getItalic())); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
96
diff
changeset
|
192 symbolElement.setAttribute("font_size", String.valueOf(f.getSize())); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
96
diff
changeset
|
193 symbolElement.setAttribute( |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
96
diff
changeset
|
194 "strike_through", |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
96
diff
changeset
|
195 String.valueOf(f.getStrikethrough())); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
96
diff
changeset
|
196 symbolElement.setAttribute("weight", String.valueOf(f.getWeight())); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
96
diff
changeset
|
197 } |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
96
diff
changeset
|
198 catch(IOException ioe) { |
135
a4ab239509f1
Updated the default values and reader error handling.
Raimund Renkert <rrenkert@intevation.de>
parents:
115
diff
changeset
|
199 logger.warn("Could not read font. Setting font to \"FreeSans\"."); |
a4ab239509f1
Updated the default values and reader error handling.
Raimund Renkert <rrenkert@intevation.de>
parents:
115
diff
changeset
|
200 symbolElement.setAttribute("font", "FreeSans"); |
115
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
96
diff
changeset
|
201 } |
47
5fc813f40fa5
Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
202 symbolElement.setAttribute("style", "char"); |
89
475ee3e4bc8b
Added "type" as XML attribute to symbols.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
203 symbolElement.setAttribute("type", "marker"); |
47
5fc813f40fa5
Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
204 return symbolElement; |
5fc813f40fa5
Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
205 } |
5fc813f40fa5
Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
206 } |
5fc813f40fa5
Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
207 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |