annotate src/java/de/intevation/mxd/reader/MultiLayerFillSymbolReader.java @ 71:260748e3d08f

Added wrapper for line symbol reader.
author Raimund Renkert <rrenkert@intevation.de>
date Thu, 26 May 2011 16:01:29 +0200
parents b41fcf268827
children 7eba97e8201b
rev   line source
68
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
1 package de.intevation.mxd.reader;
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
2
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
3 import java.io.IOException;
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
4
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
5 import java.awt.Color;
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
6
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
7 import org.apache.log4j.Logger;
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
8
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
9 import com.esri.arcgis.display.ISymbol;
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
10 import com.esri.arcgis.display.IFillSymbol;
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
11 import com.esri.arcgis.display.MultiLayerFillSymbol;
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
12 import com.esri.arcgis.display.SimpleFillSymbol;
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
13 import com.esri.arcgis.display.MarkerFillSymbol;
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
14 import com.esri.arcgis.display.PictureFillSymbol;
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
15 import com.esri.arcgis.display.esriSimpleMarkerStyle;
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
16 import com.esri.arcgis.display.IRgbColor;
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
17 import com.esri.arcgis.display.RgbColor;
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
18
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
19 import org.w3c.dom.Element;
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
20 import de.intevation.mxd.utils.MapToXMLUtils;
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
21
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
22 /**
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
23 * Reads multi layer line symbol information.
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
24 *
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
25 * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a>
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
26 */
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
27 public class MultiLayerFillSymbolReader implements ISymbolReader{
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
28
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
29 /**
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
30 * The logger.
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
31 */
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
32 private static final Logger logger =
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
33 Logger.getLogger(MultiLayerFillSymbolReader.class);
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
34
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
35 /**
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
36 * Private member.
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
37 */
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
38 private Element renderer;
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
39 private MultiLayerFillSymbol symbol;
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
40 private MapToXMLUtils util;
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
41
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
42
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
43 public MultiLayerFillSymbolReader(ISymbol symbol)
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
44 throws Exception {
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
45 logger.debug("contructor()");
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
46 if(symbol instanceof MultiLayerFillSymbol) {
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
47 this.symbol = (MultiLayerFillSymbol)symbol;
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
48 }
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
49 else {
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
50 throw new Exception("Not a MultiLayerFillSymbol!");
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
51 }
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
52 }
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
53
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
54
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
55 public MultiLayerFillSymbolReader(IFillSymbol symbol)
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
56 throws Exception {
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
57 logger.debug("contructor()");
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
58 if(symbol instanceof MultiLayerFillSymbol) {
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
59 this.symbol = (MultiLayerFillSymbol)symbol;
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
60 }
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
61 else {
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
62 throw new Exception("Not a MultiLayerFillSymbol!");
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
63 }
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
64 }
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
65
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
66 /**
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
67 * Setter for the parent XML element.
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
68 *
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
69 * @param parent The XML parent node.
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
70 */
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
71 public void setParent(Element parent) {
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
72 this.renderer = parent;
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
73 }
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
74
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
75 /**
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
76 * Setter for XML document helper.
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
77 *
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
78 * @param util The helper class for storing map information.
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
79 */
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
80 public void setUtil(MapToXMLUtils util) {
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
81 this.util = util;
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
82 }
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
83
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
84 /**
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
85 * Reads the symbol attributes.
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
86 *
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
87 * @return The XML node.
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
88 */
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
89 public Element read()
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
90 throws IOException {
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
91 logger.debug("read()");
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
92 for(int i = 0; i < symbol.getLayerCount(); i++) {
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
93 try {
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
94 ISymbol sym = (ISymbol)symbol.getLayer(i);
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
95
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
96 if(sym instanceof SimpleFillSymbol) {
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
97 ISymbolReader sreader = new SimpleFillSymbolReader(sym);
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
98 sreader.setParent(renderer);
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
99 sreader.setUtil(util);
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
100 sreader.read();
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
101 }
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
102 else {
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
103 logger.debug("The type of " + sym.getClass().toString() +
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
104 " is not implemented!");
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
105 }
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
106 }
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
107 catch(Exception e) {
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
108 e.printStackTrace();
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
109 return null;
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
110 }
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
111 }
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
112 return renderer;
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
113 }
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
114 }
686a88eb531d Added multi layer fill symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
115 // 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)