Mercurial > mxd2map
annotate src/java/de/intevation/mxd/reader/SimpleMarkerSymbolReader.java @ 178:d10d5f560b1a
Renamed executable jar file.
author | raimund renkert <raimund.renkert@intevation.de> |
---|---|
date | Thu, 07 Jul 2011 16:33:21 +0200 |
parents | a4ab239509f1 |
children | 0bde090506f9 |
rev | line source |
---|---|
33
c51376f8e24c
Separated converter components into packages.
Raimund Renkert <rrenkert@intevation.de>
parents:
32
diff
changeset
|
1 package de.intevation.mxd.reader; |
25
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
2 |
42
395307e8b7ee
First MapScript Writer that generates valid mapfiles.
Raimund Renkert <rrenkert@intevation.de>
parents:
34
diff
changeset
|
3 import java.awt.Color; |
395307e8b7ee
First MapScript Writer that generates valid mapfiles.
Raimund Renkert <rrenkert@intevation.de>
parents:
34
diff
changeset
|
4 |
25
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
5 import org.apache.log4j.Logger; |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
6 |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
7 import com.esri.arcgis.display.ISymbol; |
75
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
74
diff
changeset
|
8 import com.esri.arcgis.display.IMarkerSymbol; |
25
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
9 import com.esri.arcgis.display.SimpleMarkerSymbol; |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
10 import com.esri.arcgis.display.esriSimpleMarkerStyle; |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
11 import com.esri.arcgis.display.IRgbColor; |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
12 import com.esri.arcgis.display.RgbColor; |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
13 |
31
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
26
diff
changeset
|
14 import org.w3c.dom.Element; |
115
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
89
diff
changeset
|
15 import java.io.IOException; |
33
c51376f8e24c
Separated converter components into packages.
Raimund Renkert <rrenkert@intevation.de>
parents:
32
diff
changeset
|
16 |
25
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
17 /** |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
18 * Reads simple marker symbol information. |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
19 * |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
20 * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a> |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
21 */ |
70
6d181c02efce
Added wrapper for marker symbol reader and extracted methods from symbol
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
22 public class SimpleMarkerSymbolReader |
85
04ea8a4972ff
Fixed some compile time bugs.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
23 extends AbstractSymbolReader { |
25
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
24 |
31
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
26
diff
changeset
|
25 /** |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
26
diff
changeset
|
26 * The logger. |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
26
diff
changeset
|
27 */ |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
26
diff
changeset
|
28 private static final Logger logger = |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
26
diff
changeset
|
29 Logger.getLogger(SimpleMarkerSymbolReader.class); |
25
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
30 |
31
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
26
diff
changeset
|
31 /** |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
26
diff
changeset
|
32 * Private member. |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
26
diff
changeset
|
33 */ |
25
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
34 private SimpleMarkerSymbol symbol; |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
35 |
75
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
74
diff
changeset
|
36 public SimpleMarkerSymbolReader(ISymbol symbol) |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
74
diff
changeset
|
37 throws Exception { |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
74
diff
changeset
|
38 logger.debug("contructor()"); |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
74
diff
changeset
|
39 if(symbol instanceof SimpleMarkerSymbol) { |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
74
diff
changeset
|
40 this.symbol = (SimpleMarkerSymbol)symbol; |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
74
diff
changeset
|
41 } |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
74
diff
changeset
|
42 else { |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
74
diff
changeset
|
43 throw new Exception("Not a SimpleMarkerSymbol!"); |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
74
diff
changeset
|
44 } |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
74
diff
changeset
|
45 } |
31
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
26
diff
changeset
|
46 |
75
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
74
diff
changeset
|
47 public SimpleMarkerSymbolReader(IMarkerSymbol symbol) |
43
ef7ca23c4233
Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents:
42
diff
changeset
|
48 throws Exception { |
25
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
49 logger.debug("contructor()"); |
43
ef7ca23c4233
Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents:
42
diff
changeset
|
50 if(symbol instanceof SimpleMarkerSymbol) { |
25
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
51 this.symbol = (SimpleMarkerSymbol)symbol; |
43
ef7ca23c4233
Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents:
42
diff
changeset
|
52 } |
ef7ca23c4233
Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents:
42
diff
changeset
|
53 else { |
25
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
54 throw new Exception("Not a SimpleMarkerSymbol!"); |
43
ef7ca23c4233
Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents:
42
diff
changeset
|
55 } |
25
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
56 } |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
57 |
31
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
26
diff
changeset
|
58 /** |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
26
diff
changeset
|
59 * Reads the symbol attributes. |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
26
diff
changeset
|
60 * |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
26
diff
changeset
|
61 * @return The XML node. |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
26
diff
changeset
|
62 */ |
115
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
89
diff
changeset
|
63 public Element read() { |
25
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
64 logger.debug("read()"); |
74
7eba97e8201b
Catch all exceptions in the MXDReader.
Raimund Renkert <rrenkert@intevation.de>
parents:
70
diff
changeset
|
65 Element symbolElement = util.addSymbol(parent); |
25
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
66 |
115
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
89
diff
changeset
|
67 try { |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
89
diff
changeset
|
68 symbolElement.setAttribute("name", symbol.getNameString()); |
25
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
69 } |
115
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
89
diff
changeset
|
70 catch(IOException ioe) { |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
89
diff
changeset
|
71 logger.warn("Could not read name. Setting name to \"default\"."); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
89
diff
changeset
|
72 symbolElement.setAttribute("name", "default"); |
31
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
26
diff
changeset
|
73 } |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
26
diff
changeset
|
74 |
115
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
89
diff
changeset
|
75 try { |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
89
diff
changeset
|
76 if(symbol.getStyle() == esriSimpleMarkerStyle.esriSMSCircle) |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
89
diff
changeset
|
77 symbolElement.setAttribute("style", "point"); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
89
diff
changeset
|
78 } |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
89
diff
changeset
|
79 catch(IOException ioe) { |
135
a4ab239509f1
Updated the default values and reader error handling.
Raimund Renkert <rrenkert@intevation.de>
parents:
115
diff
changeset
|
80 logger.warn("Could not read marker style."); |
115
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
89
diff
changeset
|
81 } |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
89
diff
changeset
|
82 |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
89
diff
changeset
|
83 try { |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
89
diff
changeset
|
84 if(symbol.getColor() instanceof IRgbColor) { |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
89
diff
changeset
|
85 IRgbColor color = (IRgbColor)symbol.getColor(); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
89
diff
changeset
|
86 Color c = new Color ( |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
89
diff
changeset
|
87 color.getRed(), |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
89
diff
changeset
|
88 color.getGreen(), |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
89
diff
changeset
|
89 color.getBlue()); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
89
diff
changeset
|
90 symbolElement.setAttribute("color", String.valueOf(c.getRGB())); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
89
diff
changeset
|
91 symbolElement.setAttribute("transparency", |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
89
diff
changeset
|
92 String.valueOf(color.getTransparency())); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
89
diff
changeset
|
93 } |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
89
diff
changeset
|
94 else { |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
89
diff
changeset
|
95 RgbColor col = new RgbColor(); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
89
diff
changeset
|
96 col.setRGB(symbol.getColor().getRGB()); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
89
diff
changeset
|
97 Color c = new Color ( |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
89
diff
changeset
|
98 col.getRed(), |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
89
diff
changeset
|
99 col.getGreen(), |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
89
diff
changeset
|
100 col.getBlue()); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
89
diff
changeset
|
101 symbolElement.setAttribute("color", String.valueOf(c.getRGB())); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
89
diff
changeset
|
102 symbolElement.setAttribute("transparency", |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
89
diff
changeset
|
103 String.valueOf(col.getTransparency())); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
89
diff
changeset
|
104 } |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
89
diff
changeset
|
105 } |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
89
diff
changeset
|
106 catch(IOException ioe) { |
135
a4ab239509f1
Updated the default values and reader error handling.
Raimund Renkert <rrenkert@intevation.de>
parents:
115
diff
changeset
|
107 logger.warn("Could not read color."); |
115
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
89
diff
changeset
|
108 } |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
89
diff
changeset
|
109 |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
89
diff
changeset
|
110 try { |
42
395307e8b7ee
First MapScript Writer that generates valid mapfiles.
Raimund Renkert <rrenkert@intevation.de>
parents:
34
diff
changeset
|
111 symbolElement.setAttribute( |
115
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
89
diff
changeset
|
112 "size", |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
89
diff
changeset
|
113 String.valueOf(symbol.getSize())); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
89
diff
changeset
|
114 } |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
89
diff
changeset
|
115 catch(IOException ioe) { |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
89
diff
changeset
|
116 logger.warn("Could not read size. Setting size to 1."); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
89
diff
changeset
|
117 symbolElement.setAttribute("size", "1"); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
89
diff
changeset
|
118 } |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
89
diff
changeset
|
119 |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
89
diff
changeset
|
120 try { |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
89
diff
changeset
|
121 symbolElement.setAttribute( |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
89
diff
changeset
|
122 "outline_size", |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
89
diff
changeset
|
123 String.valueOf(symbol.getOutlineSize())); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
89
diff
changeset
|
124 } |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
89
diff
changeset
|
125 catch(IOException ioe) { |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
89
diff
changeset
|
126 logger.warn( |
135
a4ab239509f1
Updated the default values and reader error handling.
Raimund Renkert <rrenkert@intevation.de>
parents:
115
diff
changeset
|
127 "Could not read outline size."); |
115
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
89
diff
changeset
|
128 } |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
89
diff
changeset
|
129 |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
89
diff
changeset
|
130 try { |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
89
diff
changeset
|
131 if(symbol.getOutlineColor() instanceof IRgbColor) { |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
89
diff
changeset
|
132 IRgbColor color = (IRgbColor)symbol.getOutlineColor(); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
89
diff
changeset
|
133 Color c = new Color ( |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
89
diff
changeset
|
134 color.getRed(), |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
89
diff
changeset
|
135 color.getGreen(), |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
89
diff
changeset
|
136 color.getBlue()); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
89
diff
changeset
|
137 symbolElement.setAttribute( |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
89
diff
changeset
|
138 "outline_color", |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
89
diff
changeset
|
139 String.valueOf(c.getRGB())); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
89
diff
changeset
|
140 symbolElement.setAttribute("outline_transparency", |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
89
diff
changeset
|
141 String.valueOf(color.getTransparency())); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
89
diff
changeset
|
142 } |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
89
diff
changeset
|
143 else { |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
89
diff
changeset
|
144 RgbColor col = new RgbColor(); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
89
diff
changeset
|
145 col.setRGB(symbol.getOutlineColor().getRGB()); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
89
diff
changeset
|
146 Color c = new Color ( |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
89
diff
changeset
|
147 col.getRed(), |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
89
diff
changeset
|
148 col.getGreen(), |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
89
diff
changeset
|
149 col.getBlue()); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
89
diff
changeset
|
150 symbolElement.setAttribute( |
42
395307e8b7ee
First MapScript Writer that generates valid mapfiles.
Raimund Renkert <rrenkert@intevation.de>
parents:
34
diff
changeset
|
151 "outline_color", |
395307e8b7ee
First MapScript Writer that generates valid mapfiles.
Raimund Renkert <rrenkert@intevation.de>
parents:
34
diff
changeset
|
152 String.valueOf(c.getRGB())); |
115
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
89
diff
changeset
|
153 symbolElement.setAttribute("outline_transparency", |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
89
diff
changeset
|
154 String.valueOf(col.getTransparency())); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
89
diff
changeset
|
155 } |
31
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
26
diff
changeset
|
156 } |
115
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
89
diff
changeset
|
157 catch(IOException ioe) { |
135
a4ab239509f1
Updated the default values and reader error handling.
Raimund Renkert <rrenkert@intevation.de>
parents:
115
diff
changeset
|
158 logger.warn("Could not read outline color."); |
25
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
159 } |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
160 |
115
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
89
diff
changeset
|
161 try { |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
89
diff
changeset
|
162 symbolElement.setAttribute( |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
89
diff
changeset
|
163 "angle", |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
89
diff
changeset
|
164 String.valueOf(symbol.getAngle())); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
89
diff
changeset
|
165 } |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
89
diff
changeset
|
166 catch(IOException ioe) { |
135
a4ab239509f1
Updated the default values and reader error handling.
Raimund Renkert <rrenkert@intevation.de>
parents:
115
diff
changeset
|
167 logger.warn("Could not read angle."); |
115
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
89
diff
changeset
|
168 } |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
89
diff
changeset
|
169 |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
89
diff
changeset
|
170 try { |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
89
diff
changeset
|
171 symbolElement.setAttribute( |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
89
diff
changeset
|
172 "offset", |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
89
diff
changeset
|
173 symbol.getXOffset() + "," + symbol.getYOffset()); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
89
diff
changeset
|
174 } |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
89
diff
changeset
|
175 catch(IOException ioe) { |
135
a4ab239509f1
Updated the default values and reader error handling.
Raimund Renkert <rrenkert@intevation.de>
parents:
115
diff
changeset
|
176 logger.warn("Could not read offset."); |
115
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
89
diff
changeset
|
177 } |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
89
diff
changeset
|
178 |
89
475ee3e4bc8b
Added "type" as XML attribute to symbols.
Raimund Renkert <rrenkert@intevation.de>
parents:
85
diff
changeset
|
179 symbolElement.setAttribute("type", "marker"); |
31
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
26
diff
changeset
|
180 return symbolElement; |
25
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
181 } |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
182 } |
cbd67b1100d8
Initial commit of the first prototype.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
183 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |