annotate src/java/de/intevation/mxd/reader/LineFillSymbolReader.java @ 83:59e06c405a9a

Removed needless imports.
author Raimund Renkert <rrenkert@intevation.de>
date Fri, 27 May 2011 14:09:10 +0200
parents 83932f18dddc
children 18e4f143896b
rev   line source
76
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
1 package de.intevation.mxd.reader;
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
2
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
3 import java.awt.Color;
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
4
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
5 import org.apache.log4j.Logger;
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
6
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
7 import com.esri.arcgis.display.ISymbol;
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
8 import com.esri.arcgis.display.IFillSymbol;
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
9 import com.esri.arcgis.display.ILineSymbol;
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
10 import com.esri.arcgis.display.LineFillSymbol;
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
11 import com.esri.arcgis.display.IRgbColor;
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
12 import com.esri.arcgis.display.RgbColor;
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
13
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
14 import org.w3c.dom.Element;
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
15
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
16 /**
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
17 * Reads marker line symbol information.
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
18 *
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
19 * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a>
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
20 */
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
21 public class LineFillSymbolReader
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
22 extends AbstractSymbolReader{
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
23
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
24 /**
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
25 * The logger.
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
26 */
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
27 private static final Logger logger =
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
28 Logger.getLogger(LineFillSymbolReader.class);
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
29
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
30 /**
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
31 * Private member.
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
32 */
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
33 private LineFillSymbol symbol;
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
34
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
35 public LineFillSymbolReader(ISymbol symbol)
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
36 throws Exception {
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
37 logger.debug("contructor()");
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
38 if(symbol instanceof LineFillSymbol) {
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
39 this.symbol = (LineFillSymbol)symbol;
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
40 }
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
41 else {
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
42 throw new Exception("Not a LineFillSymbol!");
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
43 }
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
44 }
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
45
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
46
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
47 public LineFillSymbolReader(IFillSymbol symbol)
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
48 throws Exception {
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
49 logger.debug("contructor()");
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
50 if(symbol instanceof LineFillSymbol) {
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
51 this.symbol = (LineFillSymbol)symbol;
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
52 }
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
53 else {
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
54 throw new Exception("Not a LineFillSymbol!");
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
55 }
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
56 }
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
57
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
58 /**
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
59 * Reads the symbol attributes.
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
60 *
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
61 * @return The XML node.
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
62 */
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
63 public Element read()
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
64 throws Exception {
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
65 logger.debug("read()");
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
66
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
67 Element symbolElement = util.addSymbol(parent);
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
68
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
69 symbolElement.setAttribute("name", symbol.getNameString());
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
70 symbolElement.setAttribute("style", "fill");
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
71 symbolElement.setAttribute(
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
72 "offset",
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
73 String.valueOf(symbol.getOffset()));
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
74 symbolElement.setAttribute(
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
75 "separation",
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
76 String.valueOf(symbol.getSeparation()));
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
77
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
78 if(symbol.getColor() instanceof IRgbColor) {
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
79 IRgbColor color = (IRgbColor)symbol.getColor();
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
80 Color c = new Color (
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
81 color.getRed(),
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
82 color.getGreen(),
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
83 color.getBlue());
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
84 symbolElement.setAttribute("color", String.valueOf(c.getRGB()));
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
85 symbolElement.setAttribute("transparency",
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
86 String.valueOf(color.getTransparency()));
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
87 }
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
88 else {
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
89 RgbColor col = new RgbColor();
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
90 col.setRGB(symbol.getColor().getRGB());
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
91 Color c = new Color (
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
92 col.getRed(),
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
93 col.getGreen(),
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
94 col.getBlue());
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
95 symbolElement.setAttribute("color", String.valueOf(c.getRGB()));
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
96 symbolElement.setAttribute("transparency",
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
97 String.valueOf(col.getTransparency()));
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
98 }
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
99
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
100 ILineSymbol ols = symbol.getOutline();
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
101 LineSymbolReader olsr = new LineSymbolReader();
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
102 if(olsr.canRead(ols)) {
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
103 olsr.setSymbol(ols);
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
104 olsr.setUtil(util);
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
105 olsr.setParent(symbolElement);
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
106 olsr.read();
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
107 }
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
108 else {
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
109 logger.debug("The type of " + ols.getClass().toString() +
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
110 " is not implemented!");
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
111 }
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
112 ILineSymbol ls = symbol.getLineSymbol();
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
113 LineSymbolReader lsr = new LineSymbolReader();
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
114 if(lsr.canRead(ls)) {
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
115 lsr.setSymbol(ls);
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
116 lsr.setUtil(util);
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
117 lsr.setParent(symbolElement);
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
118 lsr.read();
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
119 }
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
120 else {
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
121 logger.debug("The type of " + ls.getClass().toString() +
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
122 " is not implemented!");
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
123 }
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
124 return parent;
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
125 }
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
126 }
3087c89a5bb8 Added line fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
127 // 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)