annotate src/java/de/intevation/mxd/reader/SimpleFillSymbolReader.java @ 272:f4539c905008

* website/download-de.htm4, website/download.htm4: Changed order of download-boxes
author Stephan Holl <stephan.holl@intevation.de>
date Fri, 09 Sep 2011 11:31:42 +0200
parents df4e0946ef02
children a46adb3697fa
rev   line source
243
df4e0946ef02 Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents: 241
diff changeset
1 /*
df4e0946ef02 Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents: 241
diff changeset
2 * Copyright (c) 2011 by Intevation GmbH, Germany <info@intevation.de>
df4e0946ef02 Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents: 241
diff changeset
3 *
df4e0946ef02 Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents: 241
diff changeset
4 * This file is part of MXD2map.
df4e0946ef02 Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents: 241
diff changeset
5 *
df4e0946ef02 Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents: 241
diff changeset
6 * This program is free software under the LGPL (>=v2.1)
df4e0946ef02 Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents: 241
diff changeset
7 * Read the file LICENCE.txt coming with the software for details
df4e0946ef02 Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents: 241
diff changeset
8 * or visit http://www.gnu.org/licenses/ if it does not exist.
df4e0946ef02 Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents: 241
diff changeset
9 *
df4e0946ef02 Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents: 241
diff changeset
10 * MXD2map has been developed on behalf of the
df4e0946ef02 Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents: 241
diff changeset
11 * Bundesamt fuer Seeschifffahrt und Hydrographie (BSH) in Hamburg
df4e0946ef02 Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents: 241
diff changeset
12 * by Intevation GmbH.
df4e0946ef02 Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents: 241
diff changeset
13 *
df4e0946ef02 Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents: 241
diff changeset
14 * Authors:
df4e0946ef02 Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents: 241
diff changeset
15 * Raimund Renkert <raimund.renkert@intevation.de>
df4e0946ef02 Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents: 241
diff changeset
16 * Bjoern Schilberg <bjoern.schilberg@intevation.de>
df4e0946ef02 Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents: 241
diff changeset
17 * Stephan Holl <stephan.holl@intevation.de>
df4e0946ef02 Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents: 241
diff changeset
18 */
df4e0946ef02 Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents: 241
diff changeset
19
36
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
20 package de.intevation.mxd.reader;
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
21
68
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 43
diff changeset
22 import java.awt.Color;
36
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
23
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
24 import org.apache.log4j.Logger;
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 import com.esri.arcgis.display.ISymbol;
68
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 43
diff changeset
27 import com.esri.arcgis.display.ILineSymbol;
72
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 69
diff changeset
28 import com.esri.arcgis.display.IFillSymbol;
36
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
29 import com.esri.arcgis.display.SimpleFillSymbol;
68
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 43
diff changeset
30 import com.esri.arcgis.display.esriSimpleFillStyle;
36
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
31 import com.esri.arcgis.display.IRgbColor;
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
32 import com.esri.arcgis.display.RgbColor;
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
33
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
34 import org.w3c.dom.Element;
115
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
35 import java.io.IOException;
36
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 /**
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
38 * Reads simple marker symbol information.
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
39 *
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
40 * @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
41 */
43
ef7ca23c4233 Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents: 36
diff changeset
42 public class SimpleFillSymbolReader
80
83932f18dddc All symbol reader now extend the abstract symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 74
diff changeset
43 extends AbstractSymbolReader {
36
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
44
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
45 /**
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
46 * The logger.
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
47 */
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
48 private static final Logger logger =
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
49 Logger.getLogger(SimpleFillSymbolReader.class);
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
50
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
51 /**
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
52 * Private member.
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
53 */
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
54 private SimpleFillSymbol symbol;
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
55
181
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 135
diff changeset
56 /**
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 135
diff changeset
57 * Constructor with symbol.
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 135
diff changeset
58 *
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 135
diff changeset
59 * @param symbol The symbol used to display polygons.
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 135
diff changeset
60 */
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 135
diff changeset
61 public SimpleFillSymbolReader(ISymbol symbol)
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 135
diff changeset
62 throws Exception {
72
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 69
diff changeset
63 logger.debug("contructor(ISymbol)");
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 69
diff changeset
64 if(symbol instanceof SimpleFillSymbol) {
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 69
diff changeset
65 this.symbol = (SimpleFillSymbol)symbol;
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 69
diff changeset
66 }
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 69
diff changeset
67 else {
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 69
diff changeset
68 throw new Exception("Not a SimpleFillSymbol!");
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 69
diff changeset
69 }
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 69
diff changeset
70 }
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 69
diff changeset
71
181
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 135
diff changeset
72 /**
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 135
diff changeset
73 * Constructor with symbol.
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 135
diff changeset
74 *
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 135
diff changeset
75 * @param symbol The symbol used to diplay polygons.
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 135
diff changeset
76 */
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 135
diff changeset
77 public SimpleFillSymbolReader(IFillSymbol symbol)
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 135
diff changeset
78 throws Exception {
72
2cbe423b1fda Added wrapper for fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 69
diff changeset
79 logger.debug("contructor(IFillSymbol)");
43
ef7ca23c4233 Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents: 36
diff changeset
80 if(symbol instanceof SimpleFillSymbol) {
36
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
81 this.symbol = (SimpleFillSymbol)symbol;
43
ef7ca23c4233 Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents: 36
diff changeset
82 }
ef7ca23c4233 Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents: 36
diff changeset
83 else {
36
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
84 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
85 }
36
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
86 }
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
87
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
88 /**
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
89 * Reads the symbol attributes.
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
90 *
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
91 * @return The XML node.
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
92 */
115
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
93 public Element read() {
36
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
94 logger.debug("read()");
80
83932f18dddc All symbol reader now extend the abstract symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 74
diff changeset
95 Element symbolElement = util.addSymbol(parent);
36
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
96
115
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
97 try {
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
98 symbolElement.setAttribute("name", symbol.getNameString());
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 catch(IOException ioe) {
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
101 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
102 symbolElement.setAttribute("name", "default");
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
103 }
68
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 43
diff changeset
104 symbolElement.setAttribute("style", "fill");
115
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
105 int style;
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
106 try {
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
107 style = symbol.getStyle();
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
108 }
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
109 catch(IOException ioe) {
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
110 logger.warn(
135
a4ab239509f1 Updated the default values and reader error handling.
Raimund Renkert <rrenkert@intevation.de>
parents: 115
diff changeset
111 "Could not read fill style.");
115
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
112 style = -1;
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
113 }
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
114
68
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 43
diff changeset
115 switch(style) {
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 43
diff changeset
116 case esriSimpleFillStyle.esriSFSCross:
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 43
diff changeset
117 symbolElement.setAttribute("fillstyle", "cross"); break;
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 43
diff changeset
118 case esriSimpleFillStyle.esriSFSSolid:
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 43
diff changeset
119 symbolElement.setAttribute("fillstyle", "solid"); break;
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 43
diff changeset
120 case esriSimpleFillStyle.esriSFSVertical:
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 43
diff changeset
121 symbolElement.setAttribute("fillstyle", "vertical"); break;
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 43
diff changeset
122 case esriSimpleFillStyle.esriSFSHorizontal:
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 43
diff changeset
123 symbolElement.setAttribute("fillstyle", "horizontal"); break;
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 43
diff changeset
124 case esriSimpleFillStyle.esriSFSForwardDiagonal:
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 43
diff changeset
125 symbolElement.setAttribute("fillstyle", "fwdiagonal"); break;
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 43
diff changeset
126 case esriSimpleFillStyle.esriSFSBackwardDiagonal:
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 43
diff changeset
127 symbolElement.setAttribute("fillstyle", "bwdiagonal"); break;
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 43
diff changeset
128 case esriSimpleFillStyle.esriSFSDiagonalCross:
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 43
diff changeset
129 symbolElement.setAttribute("fillstyle", "diagonalcross");
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 43
diff changeset
130 break;
135
a4ab239509f1 Updated the default values and reader error handling.
Raimund Renkert <rrenkert@intevation.de>
parents: 115
diff changeset
131 default: break;
43
ef7ca23c4233 Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents: 36
diff changeset
132 }
36
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
133
115
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
134 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
135 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
136 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
137 symbolElement.setAttribute("transparency", "255");
115
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
138 }
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
139 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
140 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
141 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
142 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
143 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
144 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
145 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
146 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
147 "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
148 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
149 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
150 "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
151 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
152 }
7fbb643d5378 Set fill color to black and transparent if the mxd contains no color.
raimund renkert <raimund.renkert@intevation.de>
parents: 181
diff changeset
153 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
154 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
155 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
156
7fbb643d5378 Set fill color to black and transparent if the mxd contains no color.
raimund renkert <raimund.renkert@intevation.de>
parents: 181
diff changeset
157 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
158 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
159 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
160 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
161 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
162 "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
163 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
164 symbolElement.setAttribute("transparency",
115
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
165 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
166 }
115
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
167 }
36
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
168 }
115
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
169 catch(IOException ioe) {
135
a4ab239509f1 Updated the default values and reader error handling.
Raimund Renkert <rrenkert@intevation.de>
parents: 115
diff changeset
170 logger.warn("Could not read color.");
36
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
171 }
68
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 43
diff changeset
172
115
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
173 try {
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
174 ILineSymbol ls = symbol.getOutline();
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
175 LineSymbolReader lsr = new LineSymbolReader();
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
176 if(lsr.canRead(ls)) {
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
177 lsr.setSymbol(ls);
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
178 lsr.setUtil(util);
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
179 lsr.setParent(symbolElement);
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
180 lsr.read();
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
181 }
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
182 else {
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
183 logger.debug("The type of " + ls.getClass().toString() +
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
184 " is not implemented!");
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
185 }
68
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 43
diff changeset
186 }
115
fb93f20478cc Improved exception handling for symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 83
diff changeset
187 catch(Exception e) {
135
a4ab239509f1 Updated the default values and reader error handling.
Raimund Renkert <rrenkert@intevation.de>
parents: 115
diff changeset
188 logger.warn("Could not read line symbol.");
68
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 43
diff changeset
189 }
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 43
diff changeset
190
36
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
191 return symbolElement;
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
192 }
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
193 }
472aa36d0e01 Added a new layer reader and symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
194 // 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)