annotate src/java/de/intevation/mxd/reader/MarkerFillSymbolReader.java @ 132:02df1dbc2166

Remove all whitespaces in layer name.
author vc11884admin@VC11884.win.bsh.de
date Mon, 20 Jun 2011 17:54:09 +0200
parents fb93f20478cc
children a4ab239509f1
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) {
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
86 logger.warn("Could not read x-offset. Setting x-offset to 0");
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
87 symbolElement.setAttribute("xoffset", "0");
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
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
90 try {
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
91 symbolElement.setAttribute(
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
92 "yoffset",
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
93 String.valueOf(symbol.getYOffset()));
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
94 }
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
95 catch(IOException ioe) {
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
96 logger.warn("Could not read y-offset. Setting y-offset to 0.");
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
97 symbolElement.setAttribute("yoffset", "0");
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
98 }
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
99
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
100 try {
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
101 symbolElement.setAttribute(
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
102 "xseparation",
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
103 String.valueOf(symbol.getXSeparation()));
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
104 }
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
105 catch(IOException ioe) {
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
106 logger.warn(
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
107 "Could not read x-separation." +
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
108 " Setting x-separation to 0.");
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
109 symbolElement.setAttribute("xseparation", "0");
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
110 }
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 try {
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
113 symbolElement.setAttribute(
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
114 "yseparation",
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
115 String.valueOf(symbol.getYSeparation()));
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 catch(IOException ioe) {
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
118 logger.warn(
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
119 "Could not read y-separation." +
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
120 " Setting y-separation to 0.");
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
121 symbolElement.setAttribute("yseparation", "0");
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
122 }
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
123
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
124 int style;
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
125 try {
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
126 style = symbol.getStyle();
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
127 }
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
128 catch(IOException ioe) {
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
129 logger.warn("Could not read style. Setting style to \"empty\"");
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
130 style = -1;
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
131 }
75
9ea64427ac7e Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
132 switch(style) {
9ea64427ac7e Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
133 case esriSimpleFillStyle.esriSFSCross:
9ea64427ac7e Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
134 symbolElement.setAttribute("fillstyle", "cross"); break;
9ea64427ac7e Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
135 case esriSimpleFillStyle.esriSFSSolid:
9ea64427ac7e Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
136 symbolElement.setAttribute("fillstyle", "solid"); break;
9ea64427ac7e Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
137 case esriSimpleFillStyle.esriSFSVertical:
9ea64427ac7e Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
138 symbolElement.setAttribute("fillstyle", "vertical"); break;
9ea64427ac7e Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
139 case esriSimpleFillStyle.esriSFSHorizontal:
9ea64427ac7e Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
140 symbolElement.setAttribute("fillstyle", "horizontal"); break;
9ea64427ac7e Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
141 case esriSimpleFillStyle.esriSFSForwardDiagonal:
9ea64427ac7e Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
142 symbolElement.setAttribute("fillstyle", "fwdiagonal"); break;
9ea64427ac7e Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
143 case esriSimpleFillStyle.esriSFSBackwardDiagonal:
9ea64427ac7e Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
144 symbolElement.setAttribute("fillstyle", "bwdiagonal"); break;
9ea64427ac7e Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
145 case esriSimpleFillStyle.esriSFSDiagonalCross:
9ea64427ac7e Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
146 symbolElement.setAttribute("fillstyle", "diagonalcross");
9ea64427ac7e Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
147 break;
9ea64427ac7e Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
148 default: symbolElement.setAttribute("fillstyle", "empty");
9ea64427ac7e Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
149 }
9ea64427ac7e Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
150
115
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
151 try {
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
152 if(symbol.getColor() instanceof IRgbColor) {
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
153 IRgbColor color = (IRgbColor)symbol.getColor();
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
154 Color c = new Color (
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
155 color.getRed(),
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
156 color.getGreen(),
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
157 color.getBlue());
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
158 symbolElement.setAttribute("color", String.valueOf(c.getRGB()));
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
159 symbolElement.setAttribute("transparency",
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
160 String.valueOf(color.getTransparency()));
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
161 }
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
162 else {
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
163 RgbColor col = new RgbColor();
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
164 col.setRGB(symbol.getColor().getRGB());
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
165 Color c = new Color (
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
166 col.getRed(),
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
167 col.getGreen(),
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
168 col.getBlue());
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
169 symbolElement.setAttribute("color", String.valueOf(c.getRGB()));
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
170 symbolElement.setAttribute("transparency",
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
171 String.valueOf(col.getTransparency()));
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
172 }
75
9ea64427ac7e Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
173 }
115
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
174 catch(IOException ioe) {
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
175 logger.warn(
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
176 "Could not read color." +
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
177 " Setting color to black with no transparency.");
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
178 Color black = new Color (0, 0, 0);
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
179 symbolElement.setAttribute("color", String.valueOf(black.getRGB()));
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
180 symbolElement.setAttribute("transparency", "-1");
75
9ea64427ac7e Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
181 }
9ea64427ac7e Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
182
115
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
183 try {
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
184 ILineSymbol ls = symbol.getOutline();
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
185 LineSymbolReader lsr = new LineSymbolReader();
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
186 if(lsr.canRead(ls)) {
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
187 lsr.setSymbol(ls);
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
188 lsr.setUtil(util);
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
189 lsr.setParent(symbolElement);
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
190 lsr.read();
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
191 }
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
192 else {
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
193 logger.debug("The type of " + ls.getClass().toString() +
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
194 " is not implemented!");
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
195 }
75
9ea64427ac7e Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
196 }
115
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
197 catch(Exception e) {
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
198 logger.warn("Could not read outline. No fallback defined.");
75
9ea64427ac7e Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
199 }
9ea64427ac7e Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
200
115
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
201 try {
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
202 IMarkerSymbol sym = symbol.getMarkerSymbol();
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
203 MarkerSymbolReader msr = new MarkerSymbolReader();
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
204 if(msr.canRead(sym)) {
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
205 msr.setSymbol(sym);
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
206 msr.setParent(symbolElement);
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
207 msr.setUtil(util);
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
208 msr.read();
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
209 }
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
210 else {
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
211 logger.debug("The type of " + sym.getClass().toString() +
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
212 " is not implemented!");
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
213 }
75
9ea64427ac7e Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
214 }
115
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
215 catch(Exception e) {
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
216 logger.warn("Could not read marker symbol. No fallback defined.");
75
9ea64427ac7e Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
217 }
80
83932f18dddc All symbol reader now extend the abstract symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 75
diff changeset
218 return parent;
75
9ea64427ac7e Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
219 }
9ea64427ac7e Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
220 }
9ea64427ac7e Added marker fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
221 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)