Mercurial > mxd2map
annotate src/java/de/intevation/mxd/reader/MarkerFillSymbolReader.java @ 167:b1e4a871033e
Write special pattern for outlines.
author | vc11884admin@VC11884.win.bsh.de |
---|---|
date | Tue, 05 Jul 2011 15:41:01 +0200 |
parents | a4ab239509f1 |
children | 0bde090506f9 |
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 |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
38 public MarkerFillSymbolReader(ISymbol symbol) |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
39 throws Exception { |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
40 logger.debug("contructor()"); |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
41 if(symbol instanceof MarkerFillSymbol) { |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
42 this.symbol = (MarkerFillSymbol)symbol; |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
43 } |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
44 else { |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
45 throw new Exception("Not a MarkerFillSymbol!"); |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
46 } |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
47 } |
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 |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
50 public MarkerFillSymbolReader(IFillSymbol symbol) |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
51 throws Exception { |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
52 logger.debug("contructor()"); |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
53 if(symbol instanceof MarkerFillSymbol) { |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
54 this.symbol = (MarkerFillSymbol)symbol; |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
55 } |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
56 else { |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
57 throw new Exception("Not a MarkerFillSymbol!"); |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
58 } |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
59 } |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
60 |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
61 /** |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
62 * Reads the symbol attributes. |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
63 * |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
64 * @return The XML node. |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
65 */ |
115
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
66 public Element read() { |
75
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
67 logger.debug("read()"); |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
68 |
80
83932f18dddc
All symbol reader now extend the abstract symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
75
diff
changeset
|
69 Element symbolElement = util.addSymbol(parent); |
75
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
70 |
115
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
71 try { |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
72 symbolElement.setAttribute("name", symbol.getNameString()); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
73 } |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
74 catch(IOException ioe) { |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
75 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
|
76 symbolElement.setAttribute("name", "default"); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
77 } |
75
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
78 symbolElement.setAttribute("style", "fill"); |
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( |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
82 "xoffset", |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
83 String.valueOf(symbol.getXOffset())); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
84 } |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
85 catch(IOException ioe) { |
135
a4ab239509f1
Updated the default values and reader error handling.
Raimund Renkert <rrenkert@intevation.de>
parents:
115
diff
changeset
|
86 logger.warn("Could not read x-offset."); |
115
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
87 } |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
88 |
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 "yoffset", |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
92 String.valueOf(symbol.getYOffset())); |
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 y-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 "xseparation", |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
101 String.valueOf(symbol.getXSeparation())); |
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 x-separation."); |
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 "yseparation", |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
110 String.valueOf(symbol.getYSeparation())); |
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) { |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
113 logger.warn( |
135
a4ab239509f1
Updated the default values and reader error handling.
Raimund Renkert <rrenkert@intevation.de>
parents:
115
diff
changeset
|
114 "Could not read y-separation."); |
115
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 |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
117 int style; |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
118 try { |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
119 style = symbol.getStyle(); |
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) { |
135
a4ab239509f1
Updated the default values and reader error handling.
Raimund Renkert <rrenkert@intevation.de>
parents:
115
diff
changeset
|
122 logger.warn("Could not read style."); |
115
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
123 style = -1; |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
124 } |
75
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
125 switch(style) { |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
126 case esriSimpleFillStyle.esriSFSCross: |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
127 symbolElement.setAttribute("fillstyle", "cross"); break; |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
128 case esriSimpleFillStyle.esriSFSSolid: |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
129 symbolElement.setAttribute("fillstyle", "solid"); break; |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
130 case esriSimpleFillStyle.esriSFSVertical: |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
131 symbolElement.setAttribute("fillstyle", "vertical"); break; |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
132 case esriSimpleFillStyle.esriSFSHorizontal: |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
133 symbolElement.setAttribute("fillstyle", "horizontal"); break; |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
134 case esriSimpleFillStyle.esriSFSForwardDiagonal: |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
135 symbolElement.setAttribute("fillstyle", "fwdiagonal"); break; |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
136 case esriSimpleFillStyle.esriSFSBackwardDiagonal: |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
137 symbolElement.setAttribute("fillstyle", "bwdiagonal"); break; |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
138 case esriSimpleFillStyle.esriSFSDiagonalCross: |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
139 symbolElement.setAttribute("fillstyle", "diagonalcross"); |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
140 break; |
135
a4ab239509f1
Updated the default values and reader error handling.
Raimund Renkert <rrenkert@intevation.de>
parents:
115
diff
changeset
|
141 default: break; |
75
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
142 } |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
143 |
115
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
144 try { |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
145 if(symbol.getColor() instanceof IRgbColor) { |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
146 IRgbColor color = (IRgbColor)symbol.getColor(); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
147 Color c = new Color ( |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
148 color.getRed(), |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
149 color.getGreen(), |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
150 color.getBlue()); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
151 symbolElement.setAttribute("color", String.valueOf(c.getRGB())); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
152 symbolElement.setAttribute("transparency", |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
153 String.valueOf(color.getTransparency())); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
154 } |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
155 else { |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
156 RgbColor col = new RgbColor(); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
157 col.setRGB(symbol.getColor().getRGB()); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
158 Color c = new Color ( |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
159 col.getRed(), |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
160 col.getGreen(), |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
161 col.getBlue()); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
162 symbolElement.setAttribute("color", String.valueOf(c.getRGB())); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
163 symbolElement.setAttribute("transparency", |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
164 String.valueOf(col.getTransparency())); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
165 } |
75
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
166 } |
115
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
167 catch(IOException ioe) { |
135
a4ab239509f1
Updated the default values and reader error handling.
Raimund Renkert <rrenkert@intevation.de>
parents:
115
diff
changeset
|
168 logger.warn("Could not read color."); |
75
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
169 } |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
170 |
115
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
171 try { |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
172 ILineSymbol ls = symbol.getOutline(); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
173 LineSymbolReader lsr = new LineSymbolReader(); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
174 if(lsr.canRead(ls)) { |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
175 lsr.setSymbol(ls); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
176 lsr.setUtil(util); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
177 lsr.setParent(symbolElement); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
178 lsr.read(); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
179 } |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
180 else { |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
181 logger.debug("The type of " + ls.getClass().toString() + |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
182 " is not implemented!"); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
183 } |
75
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
184 } |
115
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
185 catch(Exception e) { |
135
a4ab239509f1
Updated the default values and reader error handling.
Raimund Renkert <rrenkert@intevation.de>
parents:
115
diff
changeset
|
186 logger.warn("Could not read outline."); |
75
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
187 } |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
188 |
115
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
189 try { |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
190 IMarkerSymbol sym = symbol.getMarkerSymbol(); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
191 MarkerSymbolReader msr = new MarkerSymbolReader(); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
192 if(msr.canRead(sym)) { |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
193 msr.setSymbol(sym); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
194 msr.setParent(symbolElement); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
195 msr.setUtil(util); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
196 msr.read(); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
197 } |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
198 else { |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
199 logger.debug("The type of " + sym.getClass().toString() + |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
200 " is not implemented!"); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
201 } |
75
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
202 } |
115
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
203 catch(Exception e) { |
135
a4ab239509f1
Updated the default values and reader error handling.
Raimund Renkert <rrenkert@intevation.de>
parents:
115
diff
changeset
|
204 logger.warn("Could not read marker symbol."); |
75
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
205 } |
80
83932f18dddc
All symbol reader now extend the abstract symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
75
diff
changeset
|
206 return parent; |
75
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
207 } |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
208 } |
9ea64427ac7e
Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
209 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |