annotate src/java/de/intevation/mxd/reader/MarkerLineSymbolReader.java @ 63:5c5ef5768893

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