annotate src/java/de/intevation/mxd/reader/MultiLayerMarkerSymbolReader.java @ 58:4e0464c620f0

Introduced the picture symbol reader.
author Raimund Renkert <rrenkert@intevation.de>
date Fri, 20 May 2011 15:34:35 +0200
parents 5fc813f40fa5
children 5c5ef5768893
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;
58
4e0464c620f0 Introduced the picture symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 47
diff changeset
14 import com.esri.arcgis.display.PictureMarkerSymbol;
4e0464c620f0 Introduced the picture symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 47
diff changeset
15
46
34a93dad7604 Added MultiLayerMarkerSymbol(ArrowMarkerSymbol) support.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
16 import com.esri.arcgis.display.IColor;
34a93dad7604 Added MultiLayerMarkerSymbol(ArrowMarkerSymbol) support.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
17 import com.esri.arcgis.display.RgbColor;
34a93dad7604 Added MultiLayerMarkerSymbol(ArrowMarkerSymbol) support.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
18
34a93dad7604 Added MultiLayerMarkerSymbol(ArrowMarkerSymbol) support.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
19 import org.w3c.dom.Element;
34a93dad7604 Added MultiLayerMarkerSymbol(ArrowMarkerSymbol) support.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
20 import de.intevation.mxd.utils.MapToXMLUtils;
34a93dad7604 Added MultiLayerMarkerSymbol(ArrowMarkerSymbol) support.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
21
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 * Reads multi layer marker symbol information.
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 * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a>
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 public class MultiLayerMarkerSymbolReader implements ISymbolReader{
34a93dad7604 Added MultiLayerMarkerSymbol(ArrowMarkerSymbol) support.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
28
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 * The logger.
34a93dad7604 Added MultiLayerMarkerSymbol(ArrowMarkerSymbol) support.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
31 */
34a93dad7604 Added MultiLayerMarkerSymbol(ArrowMarkerSymbol) support.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
32 private static final Logger logger =
34a93dad7604 Added MultiLayerMarkerSymbol(ArrowMarkerSymbol) support.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
33 Logger.getLogger(MultiLayerMarkerSymbolReader.class);
34a93dad7604 Added MultiLayerMarkerSymbol(ArrowMarkerSymbol) support.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
34
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 member.
34a93dad7604 Added MultiLayerMarkerSymbol(ArrowMarkerSymbol) support.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
37 */
34a93dad7604 Added MultiLayerMarkerSymbol(ArrowMarkerSymbol) support.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
38 private Element renderer;
34a93dad7604 Added MultiLayerMarkerSymbol(ArrowMarkerSymbol) support.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
39 private MultiLayerMarkerSymbol symbol;
34a93dad7604 Added MultiLayerMarkerSymbol(ArrowMarkerSymbol) support.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
40 private MapToXMLUtils util;
34a93dad7604 Added MultiLayerMarkerSymbol(ArrowMarkerSymbol) support.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
41
34a93dad7604 Added MultiLayerMarkerSymbol(ArrowMarkerSymbol) support.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
42
34a93dad7604 Added MultiLayerMarkerSymbol(ArrowMarkerSymbol) support.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
43 public MultiLayerMarkerSymbolReader(ISymbol symbol)
34a93dad7604 Added MultiLayerMarkerSymbol(ArrowMarkerSymbol) support.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
44 throws Exception {
34a93dad7604 Added MultiLayerMarkerSymbol(ArrowMarkerSymbol) support.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
45 logger.debug("contructor()");
34a93dad7604 Added MultiLayerMarkerSymbol(ArrowMarkerSymbol) support.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
46 if(symbol instanceof MultiLayerMarkerSymbol) {
34a93dad7604 Added MultiLayerMarkerSymbol(ArrowMarkerSymbol) support.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
47 this.symbol = (MultiLayerMarkerSymbol)symbol;
34a93dad7604 Added MultiLayerMarkerSymbol(ArrowMarkerSymbol) support.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
48 }
34a93dad7604 Added MultiLayerMarkerSymbol(ArrowMarkerSymbol) support.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
49 else {
34a93dad7604 Added MultiLayerMarkerSymbol(ArrowMarkerSymbol) support.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
50 throw new Exception("Not a MultiLayerMarkerSymbol!");
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
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 * Setter for the parent XML element.
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 * @param parent The XML parent node.
34a93dad7604 Added MultiLayerMarkerSymbol(ArrowMarkerSymbol) support.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
58 */
34a93dad7604 Added MultiLayerMarkerSymbol(ArrowMarkerSymbol) support.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
59 public void setParent(Element parent) {
34a93dad7604 Added MultiLayerMarkerSymbol(ArrowMarkerSymbol) support.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
60 this.renderer = parent;
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
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 * Setter for XML document helper.
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 * @param util The helper class for storing map information.
34a93dad7604 Added MultiLayerMarkerSymbol(ArrowMarkerSymbol) support.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
67 */
34a93dad7604 Added MultiLayerMarkerSymbol(ArrowMarkerSymbol) support.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
68 public void setUtil(MapToXMLUtils util) {
34a93dad7604 Added MultiLayerMarkerSymbol(ArrowMarkerSymbol) support.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
69 this.util = util;
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
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 * Reads the symbol attributes.
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 * @return The XML node.
34a93dad7604 Added MultiLayerMarkerSymbol(ArrowMarkerSymbol) support.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
76 */
34a93dad7604 Added MultiLayerMarkerSymbol(ArrowMarkerSymbol) support.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
77 public Element read()
34a93dad7604 Added MultiLayerMarkerSymbol(ArrowMarkerSymbol) support.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
78 throws IOException {
34a93dad7604 Added MultiLayerMarkerSymbol(ArrowMarkerSymbol) support.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
79 logger.debug("read()");
34a93dad7604 Added MultiLayerMarkerSymbol(ArrowMarkerSymbol) support.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
80 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
81 try {
5fc813f40fa5 Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 46
diff changeset
82 ISymbol sym = (ISymbol)symbol.getLayer(i);
5fc813f40fa5 Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 46
diff changeset
83
5fc813f40fa5 Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 46
diff changeset
84 if(sym instanceof ArrowMarkerSymbol) {
5fc813f40fa5 Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 46
diff changeset
85 ISymbolReader sreader = new ArrowMarkerSymbolReader(sym);
5fc813f40fa5 Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 46
diff changeset
86 sreader.setParent(renderer);
5fc813f40fa5 Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 46
diff changeset
87 sreader.setUtil(util);
5fc813f40fa5 Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 46
diff changeset
88 sreader.read();
5fc813f40fa5 Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 46
diff changeset
89 }
58
4e0464c620f0 Introduced the picture symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 47
diff changeset
90 else if(sym instanceof CharacterMarkerSymbol) {
47
5fc813f40fa5 Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 46
diff changeset
91 ISymbolReader sreader = new CharacterMarkerSymbolReader(sym);
5fc813f40fa5 Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 46
diff changeset
92 sreader.setParent(renderer);
5fc813f40fa5 Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 46
diff changeset
93 sreader.setUtil(util);
5fc813f40fa5 Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 46
diff changeset
94 sreader.read();
5fc813f40fa5 Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 46
diff changeset
95 }
58
4e0464c620f0 Introduced the picture symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 47
diff changeset
96 else if(sym instanceof PictureMarkerSymbol) {
4e0464c620f0 Introduced the picture symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 47
diff changeset
97 ISymbolReader sreader = new PictureMarkerSymbolReader(sym);
4e0464c620f0 Introduced the picture symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 47
diff changeset
98 sreader.setParent(renderer);
4e0464c620f0 Introduced the picture symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 47
diff changeset
99 sreader.setUtil(util);
4e0464c620f0 Introduced the picture symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 47
diff changeset
100 sreader.read();
4e0464c620f0 Introduced the picture symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 47
diff changeset
101 }
47
5fc813f40fa5 Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 46
diff changeset
102 else {
58
4e0464c620f0 Introduced the picture symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 47
diff changeset
103 logger.debug("The type of " + sym.getClass().toString() +
4e0464c620f0 Introduced the picture symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 47
diff changeset
104 " is not implemented!");
47
5fc813f40fa5 Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 46
diff changeset
105 System.out.println(
5fc813f40fa5 Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 46
diff changeset
106 "No known instance: " + sym.getClass().toString());
5fc813f40fa5 Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 46
diff changeset
107 }
5fc813f40fa5 Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 46
diff changeset
108 }
5fc813f40fa5 Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 46
diff changeset
109 catch(Exception e) {
5fc813f40fa5 Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 46
diff changeset
110 e.printStackTrace();
46
34a93dad7604 Added MultiLayerMarkerSymbol(ArrowMarkerSymbol) support.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
111 }
34a93dad7604 Added MultiLayerMarkerSymbol(ArrowMarkerSymbol) support.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
112 }
47
5fc813f40fa5 Added CharacterMarkerSymbol reader and extracted the ArrowMarkerSymbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 46
diff changeset
113 return renderer;
46
34a93dad7604 Added MultiLayerMarkerSymbol(ArrowMarkerSymbol) support.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
114 }
34a93dad7604 Added MultiLayerMarkerSymbol(ArrowMarkerSymbol) support.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
115 }
34a93dad7604 Added MultiLayerMarkerSymbol(ArrowMarkerSymbol) support.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
116 // 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)