Mercurial > mxd2map
annotate src/java/de/intevation/mxd/reader/MarkerFillSymbolReader.java @ 184:c79c3c6fc99a
Always save a symbol set, use the mapfile name as prefix for the symbol set and
use the mapfile path to save the symbol set.
author | raimund renkert <raimund.renkert@intevation.de> |
---|---|
date | Wed, 20 Jul 2011 12:23:57 +0200 |
parents | 0bde090506f9 |
children | df4e0946ef02 |
rev | line source |
---|---|
75
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.mxd.reader; |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
2 |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
3 import java.awt.Color; |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
4 |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
5 import org.apache.log4j.Logger; |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
6 |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
7 import com.esri.arcgis.display.ISymbol; |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
8 import com.esri.arcgis.display.IFillSymbol; |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
9 import com.esri.arcgis.display.ILineSymbol; |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
10 import com.esri.arcgis.display.IMarkerSymbol; |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
11 import com.esri.arcgis.display.MarkerFillSymbol; |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
12 import com.esri.arcgis.display.esriSimpleFillStyle; |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
13 import com.esri.arcgis.display.IRgbColor; |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
14 import com.esri.arcgis.display.RgbColor; |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
15 |
9ea64427ac7e
Added marker fill 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:
83
diff
changeset
|
17 import java.io.IOException; |
75
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
18 |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
19 /** |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
20 * Reads marker line symbol information. |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
21 * |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
22 * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a> |
9ea64427ac7e
Added marker fill 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:
75
diff
changeset
|
24 public class MarkerFillSymbolReader |
83932f18dddc
All symbol reader now extend the abstract symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
75
diff
changeset
|
25 extends AbstractSymbolReader{ |
75
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
26 |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
27 /** |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
28 * The logger. |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
29 */ |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
30 private static final Logger logger = |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
31 Logger.getLogger(MarkerFillSymbolReader.class); |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
32 |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
33 /** |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
34 * Private member. |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
35 */ |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
36 private MarkerFillSymbol symbol; |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
37 |
181 | 38 /** |
39 * Constructor with symbol. | |
40 * | |
41 * @param symbol The symbol used to display polygons. | |
42 */ | |
75
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
43 public MarkerFillSymbolReader(ISymbol symbol) |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
44 throws Exception { |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
45 logger.debug("contructor()"); |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
46 if(symbol instanceof MarkerFillSymbol) { |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
47 this.symbol = (MarkerFillSymbol)symbol; |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
48 } |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
49 else { |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
50 throw new Exception("Not a MarkerFillSymbol!"); |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
51 } |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
52 } |
9ea64427ac7e
Added marker fill symbol 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 polygons. | |
58 */ | |
75
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
59 public MarkerFillSymbolReader(IFillSymbol symbol) |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
60 throws Exception { |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
61 logger.debug("contructor()"); |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
62 if(symbol instanceof MarkerFillSymbol) { |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
63 this.symbol = (MarkerFillSymbol)symbol; |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
64 } |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
65 else { |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
66 throw new Exception("Not a MarkerFillSymbol!"); |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
67 } |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
68 } |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
69 |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
70 /** |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
71 * Reads the symbol attributes. |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
72 * |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
73 * @return The XML node. |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
74 */ |
115
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
75 public Element read() { |
75
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
76 logger.debug("read()"); |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
77 |
80
83932f18dddc
All symbol reader now extend the abstract symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
75
diff
changeset
|
78 Element symbolElement = util.addSymbol(parent); |
75
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
79 |
115
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
80 try { |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
81 symbolElement.setAttribute("name", symbol.getNameString()); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
82 } |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
83 catch(IOException ioe) { |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
84 logger.warn("Could not read name. Setting name to \"default\"."); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
85 symbolElement.setAttribute("name", "default"); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
86 } |
75
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
87 symbolElement.setAttribute("style", "fill"); |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
88 |
115
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
89 try { |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
90 symbolElement.setAttribute( |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
91 "xoffset", |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
92 String.valueOf(symbol.getXOffset())); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
93 } |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
94 catch(IOException ioe) { |
135
a4ab239509f1
Updated the default values and reader error handling.
Raimund Renkert <rrenkert@intevation.de>
parents:
115
diff
changeset
|
95 logger.warn("Could not read x-offset."); |
115
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
96 } |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
97 |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
98 try { |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
99 symbolElement.setAttribute( |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
100 "yoffset", |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
101 String.valueOf(symbol.getYOffset())); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
102 } |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
103 catch(IOException ioe) { |
135
a4ab239509f1
Updated the default values and reader error handling.
Raimund Renkert <rrenkert@intevation.de>
parents:
115
diff
changeset
|
104 logger.warn("Could not read y-offset."); |
115
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
105 } |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
106 |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
107 try { |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
108 symbolElement.setAttribute( |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
109 "xseparation", |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
110 String.valueOf(symbol.getXSeparation())); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
111 } |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
112 catch(IOException ioe) { |
135
a4ab239509f1
Updated the default values and reader error handling.
Raimund Renkert <rrenkert@intevation.de>
parents:
115
diff
changeset
|
113 logger.warn("Could not read x-separation."); |
115
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
114 } |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
115 |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
116 try { |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
117 symbolElement.setAttribute( |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
118 "yseparation", |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
119 String.valueOf(symbol.getYSeparation())); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
120 } |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
121 catch(IOException ioe) { |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
122 logger.warn( |
135
a4ab239509f1
Updated the default values and reader error handling.
Raimund Renkert <rrenkert@intevation.de>
parents:
115
diff
changeset
|
123 "Could not read y-separation."); |
115
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
124 } |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
125 |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
126 int style; |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
127 try { |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
128 style = symbol.getStyle(); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
129 } |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
130 catch(IOException ioe) { |
135
a4ab239509f1
Updated the default values and reader error handling.
Raimund Renkert <rrenkert@intevation.de>
parents:
115
diff
changeset
|
131 logger.warn("Could not read style."); |
115
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
132 style = -1; |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
133 } |
75
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
134 switch(style) { |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
135 case esriSimpleFillStyle.esriSFSCross: |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
136 symbolElement.setAttribute("fillstyle", "cross"); break; |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
137 case esriSimpleFillStyle.esriSFSSolid: |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
138 symbolElement.setAttribute("fillstyle", "solid"); break; |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
139 case esriSimpleFillStyle.esriSFSVertical: |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
140 symbolElement.setAttribute("fillstyle", "vertical"); break; |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
141 case esriSimpleFillStyle.esriSFSHorizontal: |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
142 symbolElement.setAttribute("fillstyle", "horizontal"); break; |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
143 case esriSimpleFillStyle.esriSFSForwardDiagonal: |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
144 symbolElement.setAttribute("fillstyle", "fwdiagonal"); break; |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
145 case esriSimpleFillStyle.esriSFSBackwardDiagonal: |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
146 symbolElement.setAttribute("fillstyle", "bwdiagonal"); break; |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
147 case esriSimpleFillStyle.esriSFSDiagonalCross: |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
148 symbolElement.setAttribute("fillstyle", "diagonalcross"); |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
149 break; |
135
a4ab239509f1
Updated the default values and reader error handling.
Raimund Renkert <rrenkert@intevation.de>
parents:
115
diff
changeset
|
150 default: break; |
75
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
151 } |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
152 |
115
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
153 try { |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
154 if(symbol.getColor() instanceof IRgbColor) { |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
155 IRgbColor color = (IRgbColor)symbol.getColor(); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
156 Color c = new Color ( |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
157 color.getRed(), |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
158 color.getGreen(), |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
159 color.getBlue()); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
160 symbolElement.setAttribute("color", String.valueOf(c.getRGB())); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
161 symbolElement.setAttribute("transparency", |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
162 String.valueOf(color.getTransparency())); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
163 } |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
164 else { |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
165 RgbColor col = new RgbColor(); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
166 col.setRGB(symbol.getColor().getRGB()); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
167 Color c = new Color ( |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
168 col.getRed(), |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
169 col.getGreen(), |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
170 col.getBlue()); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
171 symbolElement.setAttribute("color", String.valueOf(c.getRGB())); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
172 symbolElement.setAttribute("transparency", |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
173 String.valueOf(col.getTransparency())); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
174 } |
75
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
175 } |
115
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
176 catch(IOException ioe) { |
135
a4ab239509f1
Updated the default values and reader error handling.
Raimund Renkert <rrenkert@intevation.de>
parents:
115
diff
changeset
|
177 logger.warn("Could not read color."); |
75
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
178 } |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
179 |
115
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
180 try { |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
181 ILineSymbol ls = symbol.getOutline(); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
182 LineSymbolReader lsr = new LineSymbolReader(); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
183 if(lsr.canRead(ls)) { |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
184 lsr.setSymbol(ls); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
185 lsr.setUtil(util); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
186 lsr.setParent(symbolElement); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
187 lsr.read(); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
188 } |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
189 else { |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
190 logger.debug("The type of " + ls.getClass().toString() + |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
191 " is not implemented!"); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
192 } |
75
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
193 } |
115
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
194 catch(Exception e) { |
135
a4ab239509f1
Updated the default values and reader error handling.
Raimund Renkert <rrenkert@intevation.de>
parents:
115
diff
changeset
|
195 logger.warn("Could not read outline."); |
75
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
196 } |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
197 |
115
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
198 try { |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
199 IMarkerSymbol sym = symbol.getMarkerSymbol(); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
200 MarkerSymbolReader msr = new MarkerSymbolReader(); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
201 if(msr.canRead(sym)) { |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
202 msr.setSymbol(sym); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
203 msr.setParent(symbolElement); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
204 msr.setUtil(util); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
205 msr.read(); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
206 } |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
207 else { |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
208 logger.debug("The type of " + sym.getClass().toString() + |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
209 " is not implemented!"); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
210 } |
75
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
211 } |
115
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
212 catch(Exception e) { |
135
a4ab239509f1
Updated the default values and reader error handling.
Raimund Renkert <rrenkert@intevation.de>
parents:
115
diff
changeset
|
213 logger.warn("Could not read marker symbol."); |
75
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
214 } |
80
83932f18dddc
All symbol reader now extend the abstract symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
75
diff
changeset
|
215 return parent; |
75
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
216 } |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
217 } |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
218 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |