annotate src/java/de/intevation/mxd/reader/SimpleFillSymbolReader.java @ 241:7fbb643d5378

Set fill color to black and transparent if the mxd contains no color.
author raimund renkert <raimund.renkert@intevation.de>
date Mon, 08 Aug 2011 17:19:03 +0200
parents 0bde090506f9
children df4e0946ef02
rev   line source
36
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
1 package de.intevation.mxd.reader;
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
2
68
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 43
diff changeset
3 import java.awt.Color;
36
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
4
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
5 import org.apache.log4j.Logger;
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
6
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
7 import com.esri.arcgis.display.ISymbol;
68
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 43
diff changeset
8 import com.esri.arcgis.display.ILineSymbol;
72
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 69
diff changeset
9 import com.esri.arcgis.display.IFillSymbol;
36
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
10 import com.esri.arcgis.display.SimpleFillSymbol;
68
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 43
diff changeset
11 import com.esri.arcgis.display.esriSimpleFillStyle;
36
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
12 import com.esri.arcgis.display.IRgbColor;
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
13 import com.esri.arcgis.display.RgbColor;
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
14
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
15 import org.w3c.dom.Element;
115
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
16 import java.io.IOException;
36
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
17
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
18 /**
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
19 * Reads simple marker symbol information.
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
20 *
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
21 * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a>
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
22 */
43
ef7ca23c4233 Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents: 36
diff changeset
23 public class SimpleFillSymbolReader
80
83932f18dddc All symbol reader now extend the abstract symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 74
diff changeset
24 extends AbstractSymbolReader {
36
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
25
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
26 /**
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
27 * The logger.
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
28 */
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
29 private static final Logger logger =
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
30 Logger.getLogger(SimpleFillSymbolReader.class);
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
31
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
32 /**
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
33 * Private member.
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
34 */
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
35 private SimpleFillSymbol symbol;
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
36
181
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 135
diff changeset
37 /**
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 135
diff changeset
38 * Constructor with symbol.
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 135
diff changeset
39 *
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 135
diff changeset
40 * @param symbol The symbol used to display polygons.
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 135
diff changeset
41 */
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 135
diff changeset
42 public SimpleFillSymbolReader(ISymbol symbol)
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 135
diff changeset
43 throws Exception {
72
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 69
diff changeset
44 logger.debug("contructor(ISymbol)");
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 69
diff changeset
45 if(symbol instanceof SimpleFillSymbol) {
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 69
diff changeset
46 this.symbol = (SimpleFillSymbol)symbol;
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 69
diff changeset
47 }
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 69
diff changeset
48 else {
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 69
diff changeset
49 throw new Exception("Not a SimpleFillSymbol!");
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 69
diff changeset
50 }
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 69
diff changeset
51 }
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 69
diff changeset
52
181
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 135
diff changeset
53 /**
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 135
diff changeset
54 * Constructor with symbol.
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 135
diff changeset
55 *
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 135
diff changeset
56 * @param symbol The symbol used to diplay polygons.
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 135
diff changeset
57 */
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 135
diff changeset
58 public SimpleFillSymbolReader(IFillSymbol symbol)
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 135
diff changeset
59 throws Exception {
72
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 69
diff changeset
60 logger.debug("contructor(IFillSymbol)");
43
ef7ca23c4233 Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents: 36
diff changeset
61 if(symbol instanceof SimpleFillSymbol) {
36
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
62 this.symbol = (SimpleFillSymbol)symbol;
43
ef7ca23c4233 Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents: 36
diff changeset
63 }
ef7ca23c4233 Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents: 36
diff changeset
64 else {
36
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
65 throw new Exception("Not a SimpleFillSymbol!");
43
ef7ca23c4233 Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents: 36
diff changeset
66 }
36
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
67 }
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
68
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
69 /**
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
70 * Reads the symbol attributes.
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
71 *
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
72 * @return The XML node.
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
73 */
115
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
74 public Element read() {
36
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
75 logger.debug("read()");
80
83932f18dddc All symbol reader now extend the abstract symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 74
diff changeset
76 Element symbolElement = util.addSymbol(parent);
36
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
77
115
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
78 try {
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
79 symbolElement.setAttribute("name", symbol.getNameString());
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
80 }
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
81 catch(IOException ioe) {
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
82 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
83 symbolElement.setAttribute("name", "default");
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
84 }
68
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 43
diff changeset
85 symbolElement.setAttribute("style", "fill");
115
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
86 int style;
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
87 try {
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
88 style = symbol.getStyle();
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 catch(IOException ioe) {
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
91 logger.warn(
135
a4ab239509f1 Updated the default values and reader error handling.
Raimund Renkert <rrenkert@intevation.de>
parents: 115
diff changeset
92 "Could not read fill style.");
115
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
93 style = -1;
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
68
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 43
diff changeset
96 switch(style) {
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 43
diff changeset
97 case esriSimpleFillStyle.esriSFSCross:
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 43
diff changeset
98 symbolElement.setAttribute("fillstyle", "cross"); break;
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 43
diff changeset
99 case esriSimpleFillStyle.esriSFSSolid:
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 43
diff changeset
100 symbolElement.setAttribute("fillstyle", "solid"); break;
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 43
diff changeset
101 case esriSimpleFillStyle.esriSFSVertical:
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 43
diff changeset
102 symbolElement.setAttribute("fillstyle", "vertical"); break;
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 43
diff changeset
103 case esriSimpleFillStyle.esriSFSHorizontal:
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 43
diff changeset
104 symbolElement.setAttribute("fillstyle", "horizontal"); break;
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 43
diff changeset
105 case esriSimpleFillStyle.esriSFSForwardDiagonal:
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 43
diff changeset
106 symbolElement.setAttribute("fillstyle", "fwdiagonal"); break;
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 43
diff changeset
107 case esriSimpleFillStyle.esriSFSBackwardDiagonal:
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 43
diff changeset
108 symbolElement.setAttribute("fillstyle", "bwdiagonal"); break;
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 43
diff changeset
109 case esriSimpleFillStyle.esriSFSDiagonalCross:
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 43
diff changeset
110 symbolElement.setAttribute("fillstyle", "diagonalcross");
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 43
diff changeset
111 break;
135
a4ab239509f1 Updated the default values and reader error handling.
Raimund Renkert <rrenkert@intevation.de>
parents: 115
diff changeset
112 default: break;
43
ef7ca23c4233 Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents: 36
diff changeset
113 }
36
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
114
115
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
115 try {
241
7fbb643d5378 Set fill color to black and transparent if the mxd contains no color.
raimund renkert <raimund.renkert@intevation.de>
parents: 181
diff changeset
116 if(symbol.getColor().isNullColor()) {
7fbb643d5378 Set fill color to black and transparent if the mxd contains no color.
raimund renkert <raimund.renkert@intevation.de>
parents: 181
diff changeset
117 symbolElement.setAttribute("color", "0");
7fbb643d5378 Set fill color to black and transparent if the mxd contains no color.
raimund renkert <raimund.renkert@intevation.de>
parents: 181
diff changeset
118 symbolElement.setAttribute("transparency", "255");
115
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
119 }
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
120 else {
241
7fbb643d5378 Set fill color to black and transparent if the mxd contains no color.
raimund renkert <raimund.renkert@intevation.de>
parents: 181
diff changeset
121 if(symbol.getColor() instanceof IRgbColor) {
7fbb643d5378 Set fill color to black and transparent if the mxd contains no color.
raimund renkert <raimund.renkert@intevation.de>
parents: 181
diff changeset
122 IRgbColor color = (IRgbColor)symbol.getColor();
7fbb643d5378 Set fill color to black and transparent if the mxd contains no color.
raimund renkert <raimund.renkert@intevation.de>
parents: 181
diff changeset
123 Color c = new Color (
7fbb643d5378 Set fill color to black and transparent if the mxd contains no color.
raimund renkert <raimund.renkert@intevation.de>
parents: 181
diff changeset
124 color.getRed(),
7fbb643d5378 Set fill color to black and transparent if the mxd contains no color.
raimund renkert <raimund.renkert@intevation.de>
parents: 181
diff changeset
125 color.getGreen(),
7fbb643d5378 Set fill color to black and transparent if the mxd contains no color.
raimund renkert <raimund.renkert@intevation.de>
parents: 181
diff changeset
126 color.getBlue());
7fbb643d5378 Set fill color to black and transparent if the mxd contains no color.
raimund renkert <raimund.renkert@intevation.de>
parents: 181
diff changeset
127 symbolElement.setAttribute(
7fbb643d5378 Set fill color to black and transparent if the mxd contains no color.
raimund renkert <raimund.renkert@intevation.de>
parents: 181
diff changeset
128 "color",
7fbb643d5378 Set fill color to black and transparent if the mxd contains no color.
raimund renkert <raimund.renkert@intevation.de>
parents: 181
diff changeset
129 String.valueOf(c.getRGB()));
7fbb643d5378 Set fill color to black and transparent if the mxd contains no color.
raimund renkert <raimund.renkert@intevation.de>
parents: 181
diff changeset
130 symbolElement.setAttribute(
7fbb643d5378 Set fill color to black and transparent if the mxd contains no color.
raimund renkert <raimund.renkert@intevation.de>
parents: 181
diff changeset
131 "transparency",
7fbb643d5378 Set fill color to black and transparent if the mxd contains no color.
raimund renkert <raimund.renkert@intevation.de>
parents: 181
diff changeset
132 String.valueOf(color.getTransparency()));
7fbb643d5378 Set fill color to black and transparent if the mxd contains no color.
raimund renkert <raimund.renkert@intevation.de>
parents: 181
diff changeset
133 }
7fbb643d5378 Set fill color to black and transparent if the mxd contains no color.
raimund renkert <raimund.renkert@intevation.de>
parents: 181
diff changeset
134 else {
7fbb643d5378 Set fill color to black and transparent if the mxd contains no color.
raimund renkert <raimund.renkert@intevation.de>
parents: 181
diff changeset
135 RgbColor col = new RgbColor();
7fbb643d5378 Set fill color to black and transparent if the mxd contains no color.
raimund renkert <raimund.renkert@intevation.de>
parents: 181
diff changeset
136 col.setRGB(symbol.getColor().getRGB());
7fbb643d5378 Set fill color to black and transparent if the mxd contains no color.
raimund renkert <raimund.renkert@intevation.de>
parents: 181
diff changeset
137
7fbb643d5378 Set fill color to black and transparent if the mxd contains no color.
raimund renkert <raimund.renkert@intevation.de>
parents: 181
diff changeset
138 Color c = new Color (
7fbb643d5378 Set fill color to black and transparent if the mxd contains no color.
raimund renkert <raimund.renkert@intevation.de>
parents: 181
diff changeset
139 col.getRed(),
7fbb643d5378 Set fill color to black and transparent if the mxd contains no color.
raimund renkert <raimund.renkert@intevation.de>
parents: 181
diff changeset
140 col.getGreen(),
7fbb643d5378 Set fill color to black and transparent if the mxd contains no color.
raimund renkert <raimund.renkert@intevation.de>
parents: 181
diff changeset
141 col.getBlue());
7fbb643d5378 Set fill color to black and transparent if the mxd contains no color.
raimund renkert <raimund.renkert@intevation.de>
parents: 181
diff changeset
142 symbolElement.setAttribute(
7fbb643d5378 Set fill color to black and transparent if the mxd contains no color.
raimund renkert <raimund.renkert@intevation.de>
parents: 181
diff changeset
143 "color",
7fbb643d5378 Set fill color to black and transparent if the mxd contains no color.
raimund renkert <raimund.renkert@intevation.de>
parents: 181
diff changeset
144 String.valueOf(c.getRGB()));
7fbb643d5378 Set fill color to black and transparent if the mxd contains no color.
raimund renkert <raimund.renkert@intevation.de>
parents: 181
diff changeset
145 symbolElement.setAttribute("transparency",
115
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
146 String.valueOf(col.getTransparency()));
241
7fbb643d5378 Set fill color to black and transparent if the mxd contains no color.
raimund renkert <raimund.renkert@intevation.de>
parents: 181
diff changeset
147 }
115
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
148 }
36
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
149 }
115
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
150 catch(IOException ioe) {
135
a4ab239509f1 Updated the default values and reader error handling.
Raimund Renkert <rrenkert@intevation.de>
parents: 115
diff changeset
151 logger.warn("Could not read color.");
36
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
152 }
68
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 43
diff changeset
153
115
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
154 try {
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
155 ILineSymbol ls = symbol.getOutline();
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
156 LineSymbolReader lsr = new LineSymbolReader();
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
157 if(lsr.canRead(ls)) {
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
158 lsr.setSymbol(ls);
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
159 lsr.setUtil(util);
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
160 lsr.setParent(symbolElement);
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
161 lsr.read();
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
162 }
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
163 else {
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
164 logger.debug("The type of " + ls.getClass().toString() +
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
165 " is not implemented!");
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
166 }
68
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 43
diff changeset
167 }
115
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
168 catch(Exception e) {
135
a4ab239509f1 Updated the default values and reader error handling.
Raimund Renkert <rrenkert@intevation.de>
parents: 115
diff changeset
169 logger.warn("Could not read line symbol.");
68
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 43
diff changeset
170 }
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 43
diff changeset
171
36
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
172 return symbolElement;
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
173 }
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
174 }
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
175 // 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)