Mercurial > mxd2map
annotate src/java/de/intevation/mxd/reader/SimpleFillSymbolReader.java @ 131:cd18c61cbcf6
Do not write lines or outlines if their width is smaller than 1.0.
author | vc11884admin@VC11884.win.bsh.de |
---|---|
date | Mon, 20 Jun 2011 17:41:55 +0200 |
parents | fb93f20478cc |
children | a4ab239509f1 |
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 |
472aa36d0e01
Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
37 public SimpleFillSymbolReader(ISymbol symbol) throws Exception{ |
72
2cbe423b1fda
Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
69
diff
changeset
|
38 logger.debug("contructor(ISymbol)"); |
2cbe423b1fda
Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
69
diff
changeset
|
39 if(symbol instanceof SimpleFillSymbol) { |
2cbe423b1fda
Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
69
diff
changeset
|
40 this.symbol = (SimpleFillSymbol)symbol; |
2cbe423b1fda
Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
69
diff
changeset
|
41 } |
2cbe423b1fda
Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
69
diff
changeset
|
42 else { |
2cbe423b1fda
Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
69
diff
changeset
|
43 throw new Exception("Not a SimpleFillSymbol!"); |
2cbe423b1fda
Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
69
diff
changeset
|
44 } |
2cbe423b1fda
Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
69
diff
changeset
|
45 } |
2cbe423b1fda
Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
69
diff
changeset
|
46 |
2cbe423b1fda
Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
69
diff
changeset
|
47 public SimpleFillSymbolReader(IFillSymbol symbol) throws Exception{ |
2cbe423b1fda
Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
69
diff
changeset
|
48 logger.debug("contructor(IFillSymbol)"); |
43
ef7ca23c4233
Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents:
36
diff
changeset
|
49 if(symbol instanceof SimpleFillSymbol) { |
36
472aa36d0e01
Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
50 this.symbol = (SimpleFillSymbol)symbol; |
43
ef7ca23c4233
Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents:
36
diff
changeset
|
51 } |
ef7ca23c4233
Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents:
36
diff
changeset
|
52 else { |
36
472aa36d0e01
Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
53 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
|
54 } |
36
472aa36d0e01
Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
55 } |
472aa36d0e01
Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
56 |
472aa36d0e01
Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
57 /** |
472aa36d0e01
Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
58 * Reads the symbol attributes. |
472aa36d0e01
Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
59 * |
472aa36d0e01
Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
60 * @return The XML node. |
472aa36d0e01
Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
61 */ |
115
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
62 public Element read() { |
36
472aa36d0e01
Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
63 logger.debug("read()"); |
80
83932f18dddc
All symbol reader now extend the abstract symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
74
diff
changeset
|
64 Element symbolElement = util.addSymbol(parent); |
36
472aa36d0e01
Added a new layer reader and 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 try { |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
67 symbolElement.setAttribute("name", symbol.getNameString()); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
68 } |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
69 catch(IOException ioe) { |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
70 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
|
71 symbolElement.setAttribute("name", "default"); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
72 } |
68
686a88eb531d
Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
73 symbolElement.setAttribute("style", "fill"); |
115
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
74 int style; |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
75 try { |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
76 style = symbol.getStyle(); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
77 } |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
78 catch(IOException ioe) { |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
79 logger.warn( |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
80 "Could not read fill style." + |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
81 " Setting fill style to \"empty\""); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
82 style = -1; |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
83 } |
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 switch(style) { |
686a88eb531d
Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
86 case esriSimpleFillStyle.esriSFSCross: |
686a88eb531d
Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
87 symbolElement.setAttribute("fillstyle", "cross"); break; |
686a88eb531d
Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
88 case esriSimpleFillStyle.esriSFSSolid: |
686a88eb531d
Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
89 symbolElement.setAttribute("fillstyle", "solid"); break; |
686a88eb531d
Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
90 case esriSimpleFillStyle.esriSFSVertical: |
686a88eb531d
Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
91 symbolElement.setAttribute("fillstyle", "vertical"); break; |
686a88eb531d
Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
92 case esriSimpleFillStyle.esriSFSHorizontal: |
686a88eb531d
Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
93 symbolElement.setAttribute("fillstyle", "horizontal"); break; |
686a88eb531d
Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
94 case esriSimpleFillStyle.esriSFSForwardDiagonal: |
686a88eb531d
Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
95 symbolElement.setAttribute("fillstyle", "fwdiagonal"); break; |
686a88eb531d
Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
96 case esriSimpleFillStyle.esriSFSBackwardDiagonal: |
686a88eb531d
Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
97 symbolElement.setAttribute("fillstyle", "bwdiagonal"); break; |
686a88eb531d
Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
98 case esriSimpleFillStyle.esriSFSDiagonalCross: |
686a88eb531d
Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
99 symbolElement.setAttribute("fillstyle", "diagonalcross"); |
686a88eb531d
Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
100 break; |
686a88eb531d
Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
101 default: symbolElement.setAttribute("fillstyle", "empty"); |
43
ef7ca23c4233
Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents:
36
diff
changeset
|
102 } |
36
472aa36d0e01
Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
103 |
115
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
104 try { |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
105 if(symbol.getColor() instanceof IRgbColor) { |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
106 IRgbColor color = (IRgbColor)symbol.getColor(); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
107 Color c = new Color ( |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
108 color.getRed(), |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
109 color.getGreen(), |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
110 color.getBlue()); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
111 symbolElement.setAttribute("color", String.valueOf(c.getRGB())); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
112 symbolElement.setAttribute("transparency", |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
113 String.valueOf(color.getTransparency())); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
114 } |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
115 else { |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
116 RgbColor col = new RgbColor(); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
117 col.setRGB(symbol.getColor().getRGB()); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
118 Color c = new Color ( |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
119 col.getRed(), |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
120 col.getGreen(), |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
121 col.getBlue()); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
122 symbolElement.setAttribute("color", String.valueOf(c.getRGB())); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
123 symbolElement.setAttribute("transparency", |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
124 String.valueOf(col.getTransparency())); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
125 } |
36
472aa36d0e01
Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
126 } |
115
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
127 catch(IOException ioe) { |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
128 logger.warn( |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
129 "Could not read color." + |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
130 " Setting color to black with no transparency"); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
131 Color black = new Color(0, 0, 0); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
132 symbolElement.setAttribute("color", String.valueOf(black.getRGB())); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
133 symbolElement.setAttribute("transparency", "-1"); |
36
472aa36d0e01
Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
134 } |
68
686a88eb531d
Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
135 |
115
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
136 try { |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
137 ILineSymbol ls = symbol.getOutline(); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
138 LineSymbolReader lsr = new LineSymbolReader(); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
139 if(lsr.canRead(ls)) { |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
140 lsr.setSymbol(ls); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
141 lsr.setUtil(util); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
142 lsr.setParent(symbolElement); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
143 lsr.read(); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
144 } |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
145 else { |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
146 logger.debug("The type of " + ls.getClass().toString() + |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
147 " is not implemented!"); |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
148 } |
68
686a88eb531d
Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
149 } |
115
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
150 catch(Exception e) { |
fb93f20478cc
Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
83
diff
changeset
|
151 logger.warn("Could not read line symbol. No fallback defined."); |
68
686a88eb531d
Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
152 } |
686a88eb531d
Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
43
diff
changeset
|
153 |
36
472aa36d0e01
Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
154 return symbolElement; |
472aa36d0e01
Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
155 } |
472aa36d0e01
Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
156 } |
472aa36d0e01
Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
157 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |