annotate src/java/de/intevation/mxd/reader/HashLineSymbolReader.java @ 78:df17d4c2f9eb

Merged in Raimunds changes
author Stephan Holl <stephan.holl@intevation.de>
date Thu, 26 May 2011 16:13:50 +0200
parents b41fcf268827
children 7eba97e8201b
rev   line source
66
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
1 package de.intevation.mxd.reader;
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
2
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
3 import java.io.IOException;
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
4
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
5 import java.awt.Color;
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
6
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
7 import org.apache.log4j.Logger;
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
8
6bfebb7eb1df Added hash 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;
66
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
11 import com.esri.arcgis.display.HashLineSymbol;
67
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 66
diff changeset
12 import com.esri.arcgis.display.SimpleLineSymbol;
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 66
diff changeset
13 import com.esri.arcgis.display.MarkerLineSymbol;
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 66
diff changeset
14 import com.esri.arcgis.display.PictureLineSymbol;
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 66
diff changeset
15 import com.esri.arcgis.display.CartographicLineSymbol;
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 66
diff changeset
16 import com.esri.arcgis.display.MultiLayerLineSymbol;
66
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
17 import com.esri.arcgis.display.esriSimpleLineStyle;
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
18 import com.esri.arcgis.display.IRgbColor;
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
19 import com.esri.arcgis.display.RgbColor;
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
20
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
21 import com.esri.arcgis.display.esriLineCapStyle;
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
22 import com.esri.arcgis.display.esriLineJoinStyle;
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
23
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
24 import org.w3c.dom.Element;
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
25 import de.intevation.mxd.utils.MapToXMLUtils;
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
26
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
27 /**
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
28 * Reads cartoline symbol information.
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
29 *
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
30 * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a>
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
31 */
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
32 public class HashLineSymbolReader implements ISymbolReader{
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
33
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
34 /**
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
35 * The logger.
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
36 */
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
37 private static final Logger logger =
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
38 Logger.getLogger(HashLineSymbolReader.class);
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
39
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
40 /**
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
41 * Private member.
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
42 */
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
43 private Element renderer;
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
44 private HashLineSymbol symbol;
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
45 private MapToXMLUtils util;
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
46
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
47
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
48 public HashLineSymbolReader(ISymbol symbol)
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
49 throws Exception {
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
50 logger.debug("contructor()");
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
51 if(symbol instanceof HashLineSymbol) {
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
52 this.symbol = (HashLineSymbol)symbol;
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
53 }
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
54 else {
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
55 throw new Exception("Not a HashLineSymbol!");
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
56 }
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
57 }
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
58
67
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 66
diff changeset
59
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 66
diff changeset
60 public HashLineSymbolReader(ILineSymbol symbol)
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 66
diff changeset
61 throws Exception {
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 66
diff changeset
62 logger.debug("contructor()");
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 66
diff changeset
63 if(symbol instanceof HashLineSymbol) {
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 66
diff changeset
64 this.symbol = (HashLineSymbol)symbol;
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 else {
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 66
diff changeset
67 throw new Exception("Not a HashLineSymbol!");
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 66
diff changeset
68 }
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 66
diff changeset
69 }
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 66
diff changeset
70
66
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
71 /**
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
72 * Setter for the parent XML element.
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
73 *
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
74 * @param parent The XML parent node.
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
75 */
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
76 public void setParent(Element parent) {
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
77 this.renderer = parent;
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
78 }
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
79
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
80 /**
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
81 * Setter for XML document helper.
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
82 *
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
83 * @param util The helper class for storing map information.
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
84 */
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
85 public void setUtil(MapToXMLUtils util) {
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
86 this.util = util;
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
87 }
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
88
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
89 /**
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
90 * Reads the symbol attributes.
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
91 *
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
92 * @return The XML node.
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
93 */
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
94 public Element read()
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
95 throws IOException {
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
96 logger.debug("read()");
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
97 Element symbolElement;
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
98 try {
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
99 symbolElement = util.addSymbol(renderer);
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
100 }
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
101 catch(Exception e) {
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
102 e.printStackTrace();
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
103 return null;
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
104 }
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
105
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
106 symbolElement.setAttribute("name", symbol.getNameString());
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
107 symbolElement.setAttribute("style", "line");
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
108 if(symbol.getColor() instanceof IRgbColor) {
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
109 IRgbColor color = (IRgbColor)symbol.getColor();
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
110 Color c = new Color (
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
111 color.getRed(),
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
112 color.getGreen(),
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
113 color.getBlue());
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
114 symbolElement.setAttribute("color", String.valueOf(c.getRGB()));
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
115 }
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
116 else {
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
117 RgbColor col = new RgbColor();
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
118 col.setRGB(symbol.getColor().getRGB());
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
119 Color c = new Color (
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
120 col.getRed(),
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
121 col.getGreen(),
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
122 col.getBlue());
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
123 symbolElement.setAttribute("color", String.valueOf(c.getRGB()));
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
124 }
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
125 int cap = symbol.getCap();
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
126 String capStyle = "butt";
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
127 switch(cap) {
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
128 case esriLineCapStyle.esriLCSRound: capStyle = "round"; break;
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
129 case esriLineCapStyle.esriLCSSquare: capStyle = "square"; break;
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
130 default: break;
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
131 }
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
132 int join = symbol.getJoin();
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
133 String joinStyle = "bevel";
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
134 switch(join) {
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
135 case esriLineJoinStyle.esriLJSRound: joinStyle = "round"; break;
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
136 case esriLineJoinStyle.esriLJSMitre: joinStyle = "miter"; break;
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
137 default: break;
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
138 }
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
139 symbolElement.setAttribute("cap", capStyle);
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
140 symbolElement.setAttribute("join", joinStyle);
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
141 symbolElement.setAttribute(
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
142 "linestart",
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
143 String.valueOf(symbol.getLineStartOffset()));
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
144 symbolElement.setAttribute(
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
145 "miterlimit",
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
146 String.valueOf(symbol.getMiterLimit()));
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
147 symbolElement.setAttribute(
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
148 "offset",
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
149 String.valueOf(symbol.getOffset()));
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
150 symbolElement.setAttribute("width", String.valueOf(symbol.getWidth()));
67
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 66
diff changeset
151 ILineSymbol ls = symbol.getHashSymbol();
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 66
diff changeset
152 readHashSymbol(ls, symbolElement);
66
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
153
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
154 //TODO Read further HashLine specific attributes:
67
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 66
diff changeset
155 // LineDecoration, Template.
66
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
156
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
157 return symbolElement;
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
158 }
67
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 66
diff changeset
159
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 66
diff changeset
160 private void readHashSymbol(ILineSymbol ls, Element parent) {
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 66
diff changeset
161 try {
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 66
diff changeset
162 if (ls instanceof MultiLayerLineSymbol) {
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 66
diff changeset
163 ISymbolReader sr = new MultiLayerLineSymbolReader(ls);
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 66
diff changeset
164 sr.setParent(parent);
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 66
diff changeset
165 sr.setUtil(util);
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 66
diff changeset
166 sr.read();
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 66
diff changeset
167 }
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 66
diff changeset
168 else if(ls instanceof MarkerLineSymbol) {
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 66
diff changeset
169 ISymbolReader sreader = new MarkerLineSymbolReader(ls);
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 66
diff changeset
170 sreader.setParent(parent);
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 66
diff changeset
171 sreader.setUtil(util);
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 66
diff changeset
172 sreader.read();
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 66
diff changeset
173 }
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 66
diff changeset
174 else if(ls instanceof PictureLineSymbol) {
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 66
diff changeset
175 ISymbolReader sreader = new PictureLineSymbolReader(ls);
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 66
diff changeset
176 sreader.setParent(parent);
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 66
diff changeset
177 sreader.setUtil(util);
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 66
diff changeset
178 sreader.read();
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 66
diff changeset
179 }
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 66
diff changeset
180 else if(ls instanceof CartographicLineSymbol) {
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 66
diff changeset
181 ISymbolReader sreader = new CartoLineSymbolReader(ls);
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 66
diff changeset
182 sreader.setParent(parent);
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 66
diff changeset
183 sreader.setUtil(util);
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 66
diff changeset
184 sreader.read();
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 66
diff changeset
185 }
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 66
diff changeset
186 else if(ls instanceof HashLineSymbol) {
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 66
diff changeset
187 ISymbolReader sreader = new HashLineSymbolReader(ls);
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 66
diff changeset
188 sreader.setParent(parent);
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 66
diff changeset
189 sreader.setUtil(util);
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 66
diff changeset
190 sreader.read();
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 66
diff changeset
191 }
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 66
diff changeset
192 else {
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 66
diff changeset
193 logger.debug("The type of " + ls.getClass().toString() +
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 66
diff changeset
194 " is not implemented!");
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 66
diff changeset
195 }
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 66
diff changeset
196 }
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 66
diff changeset
197 catch(Exception e) {
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 66
diff changeset
198 e.printStackTrace();
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 66
diff changeset
199 }
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 66
diff changeset
200
5ed9e720b6cd Read the hash symbol in the hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents: 66
diff changeset
201 }
66
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
202 }
6bfebb7eb1df Added hash line symbol reader.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
203 // 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)