comparison src/java/de/intevation/mxd/reader/MultiLayerFillSymbolReader.java @ 68:686a88eb531d

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