comparison src/java/de/intevation/mxd/reader/MultiLayerLineSymbolReader.java @ 61:e00deee347a5

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