annotate src/java/de/intevation/mxd/reader/MultiLayerMarkerSymbolReader.java @ 50:50a6d2d63885

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