annotate src/java/de/intevation/mxd/reader/MultiLayerLineSymbolReader.java @ 69:b41fcf268827

Removed all "System.out" outputs.
author Raimund Renkert <rrenkert@intevation.de>
date Thu, 26 May 2011 12:44:59 +0200
parents 5ed9e720b6cd
children 260748e3d08f
rev   line source
61
e00deee347a5 Added first line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
1 package de.intevation.mxd.reader;
e00deee347a5 Added first line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
2
e00deee347a5 Added first line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
3 import java.io.IOException;
e00deee347a5 Added first line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
4
e00deee347a5 Added first line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
5 import java.awt.Color;
e00deee347a5 Added first line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
6
e00deee347a5 Added first line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
7 import org.apache.log4j.Logger;
e00deee347a5 Added first line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
8
e00deee347a5 Added first line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
9 import com.esri.arcgis.display.ISymbol;
67
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 66
diff changeset
10 import com.esri.arcgis.display.ILineSymbol;
61
e00deee347a5 Added first line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
11 import com.esri.arcgis.display.MultiLayerLineSymbol;
e00deee347a5 Added first line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
12 import com.esri.arcgis.display.SimpleLineSymbol;
63
5c5ef5768893 Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents: 61
diff changeset
13 import com.esri.arcgis.display.MarkerLineSymbol;
64
c73647bd71c0 Added picture line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 63
diff changeset
14 import com.esri.arcgis.display.PictureLineSymbol;
65
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 64
diff changeset
15 import com.esri.arcgis.display.CartographicLineSymbol;
66
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 65
diff changeset
16 import com.esri.arcgis.display.HashLineSymbol;
61
e00deee347a5 Added first line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
17 import com.esri.arcgis.display.esriSimpleMarkerStyle;
e00deee347a5 Added first line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
18 import com.esri.arcgis.display.IRgbColor;
e00deee347a5 Added first line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
19 import com.esri.arcgis.display.RgbColor;
e00deee347a5 Added first line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
20
e00deee347a5 Added first line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
21 import org.w3c.dom.Element;
e00deee347a5 Added first line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
22 import de.intevation.mxd.utils.MapToXMLUtils;
e00deee347a5 Added first line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
23
e00deee347a5 Added first line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
24 /**
e00deee347a5 Added first line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
25 * Reads multi layer line symbol information.
e00deee347a5 Added first line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
26 *
e00deee347a5 Added first line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
27 * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a>
e00deee347a5 Added first line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
28 */
e00deee347a5 Added first line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
29 public class MultiLayerLineSymbolReader implements ISymbolReader{
e00deee347a5 Added first line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
30
e00deee347a5 Added first line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
31 /**
e00deee347a5 Added first line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
32 * The logger.
e00deee347a5 Added first line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
33 */
e00deee347a5 Added first line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
34 private static final Logger logger =
e00deee347a5 Added first line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
35 Logger.getLogger(MultiLayerLineSymbolReader.class);
e00deee347a5 Added first line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
36
e00deee347a5 Added first line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
37 /**
e00deee347a5 Added first line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
38 * Private member.
e00deee347a5 Added first line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
39 */
e00deee347a5 Added first line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
40 private Element renderer;
e00deee347a5 Added first line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
41 private MultiLayerLineSymbol symbol;
e00deee347a5 Added first line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
42 private MapToXMLUtils util;
e00deee347a5 Added first line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
43
e00deee347a5 Added first line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
44
e00deee347a5 Added first line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
45 public MultiLayerLineSymbolReader(ISymbol symbol)
e00deee347a5 Added first line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
46 throws Exception {
e00deee347a5 Added first line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
47 logger.debug("contructor()");
e00deee347a5 Added first line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
48 if(symbol instanceof MultiLayerLineSymbol) {
e00deee347a5 Added first line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
49 this.symbol = (MultiLayerLineSymbol)symbol;
e00deee347a5 Added first line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
50 }
e00deee347a5 Added first line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
51 else {
e00deee347a5 Added first line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
52 throw new Exception("Not a MultiLayerLineSymbol!");
e00deee347a5 Added first line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
53 }
e00deee347a5 Added first line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
54 }
e00deee347a5 Added first line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
55
67
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 66
diff changeset
56
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 66
diff changeset
57 public MultiLayerLineSymbolReader(ILineSymbol symbol)
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 66
diff changeset
58 throws Exception {
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 66
diff changeset
59 logger.debug("contructor()");
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 66
diff changeset
60 if(symbol instanceof MultiLayerLineSymbol) {
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 66
diff changeset
61 this.symbol = (MultiLayerLineSymbol)symbol;
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 66
diff changeset
62 }
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 66
diff changeset
63 else {
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 66
diff changeset
64 throw new Exception("Not a MultiLayerLineSymbol!");
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 66
diff changeset
65 }
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 66
diff changeset
66 }
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 66
diff changeset
67
61
e00deee347a5 Added first line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
68 /**
e00deee347a5 Added first line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
69 * Setter for the parent XML element.
e00deee347a5 Added first line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
70 *
e00deee347a5 Added first line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
71 * @param parent The XML parent node.
e00deee347a5 Added first line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
72 */
e00deee347a5 Added first line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
73 public void setParent(Element parent) {
e00deee347a5 Added first line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
74 this.renderer = parent;
e00deee347a5 Added first line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
75 }
e00deee347a5 Added first line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
76
e00deee347a5 Added first line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
77 /**
e00deee347a5 Added first line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
78 * Setter for XML document helper.
e00deee347a5 Added first line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
79 *
e00deee347a5 Added first line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
80 * @param util The helper class for storing map information.
e00deee347a5 Added first line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
81 */
e00deee347a5 Added first line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
82 public void setUtil(MapToXMLUtils util) {
e00deee347a5 Added first line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
83 this.util = util;
e00deee347a5 Added first line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
84 }
e00deee347a5 Added first line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
85
e00deee347a5 Added first line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
86 /**
e00deee347a5 Added first line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
87 * Reads the symbol attributes.
e00deee347a5 Added first line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
88 *
e00deee347a5 Added first line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
89 * @return The XML node.
e00deee347a5 Added first line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
90 */
e00deee347a5 Added first line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
91 public Element read()
e00deee347a5 Added first line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
92 throws IOException {
e00deee347a5 Added first line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
93 logger.debug("read()");
e00deee347a5 Added first line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
94 for(int i = 0; i < symbol.getLayerCount(); i++) {
e00deee347a5 Added first line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
95 try {
e00deee347a5 Added first line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
96 ISymbol sym = (ISymbol)symbol.getLayer(i);
e00deee347a5 Added first line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
97
e00deee347a5 Added first line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
98 if(sym instanceof SimpleLineSymbol) {
e00deee347a5 Added first line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
99 ISymbolReader sreader = new SimpleLineSymbolReader(sym);
e00deee347a5 Added first line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
100 sreader.setParent(renderer);
e00deee347a5 Added first line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
101 sreader.setUtil(util);
e00deee347a5 Added first line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
102 sreader.read();
e00deee347a5 Added first line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
103 }
63
5c5ef5768893 Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents: 61
diff changeset
104 else if(sym instanceof MarkerLineSymbol) {
5c5ef5768893 Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents: 61
diff changeset
105 ISymbolReader sreader = new MarkerLineSymbolReader(sym);
5c5ef5768893 Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents: 61
diff changeset
106 sreader.setParent(renderer);
5c5ef5768893 Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents: 61
diff changeset
107 sreader.setUtil(util);
5c5ef5768893 Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents: 61
diff changeset
108 sreader.read();
5c5ef5768893 Added MultiLayerLineSymbolReader.
Raimund Renkert <rrenkert@intevation.de>
parents: 61
diff changeset
109 }
64
c73647bd71c0 Added picture line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 63
diff changeset
110 else if(sym instanceof PictureLineSymbol) {
c73647bd71c0 Added picture line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 63
diff changeset
111 ISymbolReader sreader = new PictureLineSymbolReader(sym);
c73647bd71c0 Added picture line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 63
diff changeset
112 sreader.setParent(renderer);
c73647bd71c0 Added picture line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 63
diff changeset
113 sreader.setUtil(util);
c73647bd71c0 Added picture line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 63
diff changeset
114 sreader.read();
c73647bd71c0 Added picture line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 63
diff changeset
115 }
65
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 64
diff changeset
116 else if(sym instanceof CartographicLineSymbol) {
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 64
diff changeset
117 ISymbolReader sreader = new CartoLineSymbolReader(sym);
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 64
diff changeset
118 sreader.setParent(renderer);
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 64
diff changeset
119 sreader.setUtil(util);
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 64
diff changeset
120 sreader.read();
9fca9e09b966 Added cartographic line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 64
diff changeset
121 }
66
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 65
diff changeset
122 else if(sym instanceof HashLineSymbol) {
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 65
diff changeset
123 ISymbolReader sreader = new HashLineSymbolReader(sym);
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 65
diff changeset
124 sreader.setParent(renderer);
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 65
diff changeset
125 sreader.setUtil(util);
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 65
diff changeset
126 sreader.read();
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 65
diff changeset
127 }
61
e00deee347a5 Added first line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
128 else {
e00deee347a5 Added first line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
129 logger.debug("The type of " + sym.getClass().toString() +
e00deee347a5 Added first line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
130 " is not implemented!");
e00deee347a5 Added first line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
131 }
e00deee347a5 Added first line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
132 }
e00deee347a5 Added first line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
133 catch(Exception e) {
e00deee347a5 Added first line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
134 e.printStackTrace();
e00deee347a5 Added first line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
135 return null;
e00deee347a5 Added first line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
136 }
e00deee347a5 Added first line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
137 }
e00deee347a5 Added first line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
138 return renderer;
e00deee347a5 Added first line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
139 }
e00deee347a5 Added first line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
140 }
e00deee347a5 Added first line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
141 // 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)