annotate src/java/de/intevation/mxd/writer/MarkerStyleWriter.java @ 323:4051c39757db

Bump Version to 1.1
author Andre Heinecke <aheinecke@intevation.de>
date Fri, 12 Oct 2012 16:26:30 +0200
parents 08723e89b56b
children
rev   line source
243
df4e0946ef02 Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents: 191
diff changeset
1 /*
df4e0946ef02 Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents: 191
diff changeset
2 * Copyright (c) 2011 by Intevation GmbH, Germany <info@intevation.de>
df4e0946ef02 Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents: 191
diff changeset
3 *
df4e0946ef02 Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents: 191
diff changeset
4 * This file is part of MXD2map.
df4e0946ef02 Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents: 191
diff changeset
5 *
df4e0946ef02 Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents: 191
diff changeset
6 * This program is free software under the LGPL (>=v2.1)
df4e0946ef02 Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents: 191
diff changeset
7 * Read the file LICENCE.txt coming with the software for details
df4e0946ef02 Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents: 191
diff changeset
8 * or visit http://www.gnu.org/licenses/ if it does not exist.
df4e0946ef02 Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents: 191
diff changeset
9 *
df4e0946ef02 Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents: 191
diff changeset
10 * MXD2map has been developed on behalf of the
df4e0946ef02 Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents: 191
diff changeset
11 * Bundesamt fuer Seeschifffahrt und Hydrographie (BSH) in Hamburg
df4e0946ef02 Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents: 191
diff changeset
12 * by Intevation GmbH.
df4e0946ef02 Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents: 191
diff changeset
13 *
df4e0946ef02 Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents: 191
diff changeset
14 * Authors:
df4e0946ef02 Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents: 191
diff changeset
15 * Raimund Renkert <raimund.renkert@intevation.de>
df4e0946ef02 Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents: 191
diff changeset
16 * Bjoern Schilberg <bjoern.schilberg@intevation.de>
df4e0946ef02 Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents: 191
diff changeset
17 * Stephan Holl <stephan.holl@intevation.de>
df4e0946ef02 Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents: 191
diff changeset
18 */
df4e0946ef02 Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents: 191
diff changeset
19
87
7d4cf2db43f1 Added new writer classes to be flexible in creating mapfiles.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
20 package de.intevation.mxd.writer;
7d4cf2db43f1 Added new writer classes to be flexible in creating mapfiles.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
21
7d4cf2db43f1 Added new writer classes to be flexible in creating mapfiles.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
22 import java.awt.Color;
7d4cf2db43f1 Added new writer classes to be flexible in creating mapfiles.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
23
7d4cf2db43f1 Added new writer classes to be flexible in creating mapfiles.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
24 import org.apache.log4j.Logger;
7d4cf2db43f1 Added new writer classes to be flexible in creating mapfiles.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
25
7d4cf2db43f1 Added new writer classes to be flexible in creating mapfiles.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
26 import org.w3c.dom.Element;
7d4cf2db43f1 Added new writer classes to be flexible in creating mapfiles.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
27
7d4cf2db43f1 Added new writer classes to be flexible in creating mapfiles.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
28 import edu.umn.gis.mapscript.mapObj;
7d4cf2db43f1 Added new writer classes to be flexible in creating mapfiles.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
29 import edu.umn.gis.mapscript.classObj;
7d4cf2db43f1 Added new writer classes to be flexible in creating mapfiles.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
30 import edu.umn.gis.mapscript.styleObj;
7d4cf2db43f1 Added new writer classes to be flexible in creating mapfiles.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
31 import edu.umn.gis.mapscript.colorObj;
7d4cf2db43f1 Added new writer classes to be flexible in creating mapfiles.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
32 import edu.umn.gis.mapscript.symbolSetObj;
7d4cf2db43f1 Added new writer classes to be flexible in creating mapfiles.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
33
7d4cf2db43f1 Added new writer classes to be flexible in creating mapfiles.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
34
7d4cf2db43f1 Added new writer classes to be flexible in creating mapfiles.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
35 /**
7d4cf2db43f1 Added new writer classes to be flexible in creating mapfiles.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
36 * The interface to the mapfile writer.
7d4cf2db43f1 Added new writer classes to be flexible in creating mapfiles.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
37 *
7d4cf2db43f1 Added new writer classes to be flexible in creating mapfiles.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
38 * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a>
7d4cf2db43f1 Added new writer classes to be flexible in creating mapfiles.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
39 */
7d4cf2db43f1 Added new writer classes to be flexible in creating mapfiles.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
40 public class MarkerStyleWriter {
7d4cf2db43f1 Added new writer classes to be flexible in creating mapfiles.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
41
7d4cf2db43f1 Added new writer classes to be flexible in creating mapfiles.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
42 /**
7d4cf2db43f1 Added new writer classes to be flexible in creating mapfiles.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
43 * The Logger.
7d4cf2db43f1 Added new writer classes to be flexible in creating mapfiles.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
44 */
7d4cf2db43f1 Added new writer classes to be flexible in creating mapfiles.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
45 private static final Logger logger = Logger.getLogger(MarkerStyleWriter.class);
7d4cf2db43f1 Added new writer classes to be flexible in creating mapfiles.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
46
181
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 145
diff changeset
47 /**
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 145
diff changeset
48 * Private member.
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 145
diff changeset
49 */
87
7d4cf2db43f1 Added new writer classes to be flexible in creating mapfiles.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
50 private mapObj map;
7d4cf2db43f1 Added new writer classes to be flexible in creating mapfiles.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
51 private classObj cl;
7d4cf2db43f1 Added new writer classes to be flexible in creating mapfiles.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
52 private styleObj style;
7d4cf2db43f1 Added new writer classes to be flexible in creating mapfiles.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
53
181
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 145
diff changeset
54 /**
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 145
diff changeset
55 * Contructor with map object and class object.
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 145
diff changeset
56 *
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 145
diff changeset
57 * @param map The map object.
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 145
diff changeset
58 * @param cl The class object containing the style.
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 145
diff changeset
59 */
87
7d4cf2db43f1 Added new writer classes to be flexible in creating mapfiles.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
60 public MarkerStyleWriter (mapObj map, classObj cl) {
7d4cf2db43f1 Added new writer classes to be flexible in creating mapfiles.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
61 this.map = map;
7d4cf2db43f1 Added new writer classes to be flexible in creating mapfiles.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
62 this.cl = cl;
7d4cf2db43f1 Added new writer classes to be flexible in creating mapfiles.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
63 this.style = new styleObj(cl);
7d4cf2db43f1 Added new writer classes to be flexible in creating mapfiles.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
64 }
7d4cf2db43f1 Added new writer classes to be flexible in creating mapfiles.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
65
7d4cf2db43f1 Added new writer classes to be flexible in creating mapfiles.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
66 /**
7d4cf2db43f1 Added new writer classes to be flexible in creating mapfiles.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
67 * Write the content.
181
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 145
diff changeset
68 *
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 145
diff changeset
69 * @param symbolElement DOM element containing style attributes.
87
7d4cf2db43f1 Added new writer classes to be flexible in creating mapfiles.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
70 */
120
11d63bf00326 Changed exception handling and logging in writer classes.
Raimund Renkert <rrenkert@intevation.de>
parents: 87
diff changeset
71 public boolean write(Element symbolElement) {
87
7d4cf2db43f1 Added new writer classes to be flexible in creating mapfiles.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
72 logger.debug("write(Element)");
7d4cf2db43f1 Added new writer classes to be flexible in creating mapfiles.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
73 symbolSetObj symbolSet = map.getSymbolset();
7d4cf2db43f1 Added new writer classes to be flexible in creating mapfiles.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
74
7d4cf2db43f1 Added new writer classes to be flexible in creating mapfiles.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
75 if (symbolElement.hasAttribute("angle")) {
145
b2c5a66022f1 Exception handling for number conversions in writer modules.
Raimund Renkert <rrenkert@intevation.de>
parents: 141
diff changeset
76 try {
b2c5a66022f1 Exception handling for number conversions in writer modules.
Raimund Renkert <rrenkert@intevation.de>
parents: 141
diff changeset
77 style.setAngle(
b2c5a66022f1 Exception handling for number conversions in writer modules.
Raimund Renkert <rrenkert@intevation.de>
parents: 141
diff changeset
78 Double.parseDouble(symbolElement.getAttribute("angle")));
b2c5a66022f1 Exception handling for number conversions in writer modules.
Raimund Renkert <rrenkert@intevation.de>
parents: 141
diff changeset
79 }
b2c5a66022f1 Exception handling for number conversions in writer modules.
Raimund Renkert <rrenkert@intevation.de>
parents: 141
diff changeset
80 catch(NumberFormatException nfe) {
b2c5a66022f1 Exception handling for number conversions in writer modules.
Raimund Renkert <rrenkert@intevation.de>
parents: 141
diff changeset
81 logger.warn("Error setting angle.");
b2c5a66022f1 Exception handling for number conversions in writer modules.
Raimund Renkert <rrenkert@intevation.de>
parents: 141
diff changeset
82 style.setAngle(0.0);
b2c5a66022f1 Exception handling for number conversions in writer modules.
Raimund Renkert <rrenkert@intevation.de>
parents: 141
diff changeset
83 }
87
7d4cf2db43f1 Added new writer classes to be flexible in creating mapfiles.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
84 }
295
08723e89b56b Set the Angle Binding if available
Andre Heinecke <aheinecke@intevation.de>
parents: 251
diff changeset
85 if(symbolElement.hasAttribute("angleBinding")) {
08723e89b56b Set the Angle Binding if available
Andre Heinecke <aheinecke@intevation.de>
parents: 251
diff changeset
86 style.setBinding(2,
08723e89b56b Set the Angle Binding if available
Andre Heinecke <aheinecke@intevation.de>
parents: 251
diff changeset
87 symbolElement.getAttribute("angleBinding"));
08723e89b56b Set the Angle Binding if available
Andre Heinecke <aheinecke@intevation.de>
parents: 251
diff changeset
88 }
87
7d4cf2db43f1 Added new writer classes to be flexible in creating mapfiles.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
89 if(symbolElement.hasAttribute("color")) {
7d4cf2db43f1 Added new writer classes to be flexible in creating mapfiles.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
90 String c = symbolElement.getAttribute("color");
7d4cf2db43f1 Added new writer classes to be flexible in creating mapfiles.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
91 Color col = Color.decode(c);
7d4cf2db43f1 Added new writer classes to be flexible in creating mapfiles.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
92 colorObj color = new colorObj(
7d4cf2db43f1 Added new writer classes to be flexible in creating mapfiles.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
93 col.getRed(),
7d4cf2db43f1 Added new writer classes to be flexible in creating mapfiles.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
94 col.getGreen(),
7d4cf2db43f1 Added new writer classes to be flexible in creating mapfiles.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
95 col.getBlue(),
7d4cf2db43f1 Added new writer classes to be flexible in creating mapfiles.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
96 -4);
7d4cf2db43f1 Added new writer classes to be flexible in creating mapfiles.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
97 style.setColor(color);
7d4cf2db43f1 Added new writer classes to be flexible in creating mapfiles.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
98 }
7d4cf2db43f1 Added new writer classes to be flexible in creating mapfiles.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
99 if (symbolElement.hasAttribute ("size")) {
145
b2c5a66022f1 Exception handling for number conversions in writer modules.
Raimund Renkert <rrenkert@intevation.de>
parents: 141
diff changeset
100 try {
b2c5a66022f1 Exception handling for number conversions in writer modules.
Raimund Renkert <rrenkert@intevation.de>
parents: 141
diff changeset
101 style.setSize(Double.parseDouble(
b2c5a66022f1 Exception handling for number conversions in writer modules.
Raimund Renkert <rrenkert@intevation.de>
parents: 141
diff changeset
102 symbolElement.getAttribute("size")));
b2c5a66022f1 Exception handling for number conversions in writer modules.
Raimund Renkert <rrenkert@intevation.de>
parents: 141
diff changeset
103 }
b2c5a66022f1 Exception handling for number conversions in writer modules.
Raimund Renkert <rrenkert@intevation.de>
parents: 141
diff changeset
104 catch(NumberFormatException nfe) {
b2c5a66022f1 Exception handling for number conversions in writer modules.
Raimund Renkert <rrenkert@intevation.de>
parents: 141
diff changeset
105 logger.warn("Error setting size. Setting to deafult: 1.");
b2c5a66022f1 Exception handling for number conversions in writer modules.
Raimund Renkert <rrenkert@intevation.de>
parents: 141
diff changeset
106 style.setSize(1);
b2c5a66022f1 Exception handling for number conversions in writer modules.
Raimund Renkert <rrenkert@intevation.de>
parents: 141
diff changeset
107 }
87
7d4cf2db43f1 Added new writer classes to be flexible in creating mapfiles.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
108 }
7d4cf2db43f1 Added new writer classes to be flexible in creating mapfiles.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
109 if(symbolElement.hasAttribute("outline_color")) {
7d4cf2db43f1 Added new writer classes to be flexible in creating mapfiles.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
110 Color oCol = Color.decode(
7d4cf2db43f1 Added new writer classes to be flexible in creating mapfiles.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
111 symbolElement.getAttribute("outline_color"));
7d4cf2db43f1 Added new writer classes to be flexible in creating mapfiles.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
112 colorObj outlineColor = new colorObj(
7d4cf2db43f1 Added new writer classes to be flexible in creating mapfiles.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
113 oCol.getRed(),
7d4cf2db43f1 Added new writer classes to be flexible in creating mapfiles.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
114 oCol.getGreen(),
7d4cf2db43f1 Added new writer classes to be flexible in creating mapfiles.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
115 oCol.getBlue(),
7d4cf2db43f1 Added new writer classes to be flexible in creating mapfiles.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
116 -4);
7d4cf2db43f1 Added new writer classes to be flexible in creating mapfiles.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
117 style.setOutlinecolor(outlineColor);
145
b2c5a66022f1 Exception handling for number conversions in writer modules.
Raimund Renkert <rrenkert@intevation.de>
parents: 141
diff changeset
118 try {
b2c5a66022f1 Exception handling for number conversions in writer modules.
Raimund Renkert <rrenkert@intevation.de>
parents: 141
diff changeset
119 style.setOutlinewidth(Double.parseDouble(
b2c5a66022f1 Exception handling for number conversions in writer modules.
Raimund Renkert <rrenkert@intevation.de>
parents: 141
diff changeset
120 symbolElement.getAttribute("outline_size")));
b2c5a66022f1 Exception handling for number conversions in writer modules.
Raimund Renkert <rrenkert@intevation.de>
parents: 141
diff changeset
121 }
b2c5a66022f1 Exception handling for number conversions in writer modules.
Raimund Renkert <rrenkert@intevation.de>
parents: 141
diff changeset
122 catch(NumberFormatException nfe) {
b2c5a66022f1 Exception handling for number conversions in writer modules.
Raimund Renkert <rrenkert@intevation.de>
parents: 141
diff changeset
123 logger.warn("Error setting outline width.");
b2c5a66022f1 Exception handling for number conversions in writer modules.
Raimund Renkert <rrenkert@intevation.de>
parents: 141
diff changeset
124 }
87
7d4cf2db43f1 Added new writer classes to be flexible in creating mapfiles.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
125 }
191
17b4aaa159ec Added offset attributes to marker style symbols.
raimund renkert <raimund.renkert@intevation.de>
parents: 181
diff changeset
126
17b4aaa159ec Added offset attributes to marker style symbols.
raimund renkert <raimund.renkert@intevation.de>
parents: 181
diff changeset
127 if (symbolElement.hasAttribute("x_offset")) {
17b4aaa159ec Added offset attributes to marker style symbols.
raimund renkert <raimund.renkert@intevation.de>
parents: 181
diff changeset
128 try {
17b4aaa159ec Added offset attributes to marker style symbols.
raimund renkert <raimund.renkert@intevation.de>
parents: 181
diff changeset
129 double val =
17b4aaa159ec Added offset attributes to marker style symbols.
raimund renkert <raimund.renkert@intevation.de>
parents: 181
diff changeset
130 Double.parseDouble(symbolElement.getAttribute("x_offset"));
17b4aaa159ec Added offset attributes to marker style symbols.
raimund renkert <raimund.renkert@intevation.de>
parents: 181
diff changeset
131 double r = Math.round(val);
17b4aaa159ec Added offset attributes to marker style symbols.
raimund renkert <raimund.renkert@intevation.de>
parents: 181
diff changeset
132 style.setOffsetx(r);
17b4aaa159ec Added offset attributes to marker style symbols.
raimund renkert <raimund.renkert@intevation.de>
parents: 181
diff changeset
133 }
17b4aaa159ec Added offset attributes to marker style symbols.
raimund renkert <raimund.renkert@intevation.de>
parents: 181
diff changeset
134 catch (NumberFormatException nfe) {
17b4aaa159ec Added offset attributes to marker style symbols.
raimund renkert <raimund.renkert@intevation.de>
parents: 181
diff changeset
135 logger.warn("Error setting the symbol x-offset");
17b4aaa159ec Added offset attributes to marker style symbols.
raimund renkert <raimund.renkert@intevation.de>
parents: 181
diff changeset
136 }
17b4aaa159ec Added offset attributes to marker style symbols.
raimund renkert <raimund.renkert@intevation.de>
parents: 181
diff changeset
137 }
17b4aaa159ec Added offset attributes to marker style symbols.
raimund renkert <raimund.renkert@intevation.de>
parents: 181
diff changeset
138 if (symbolElement.hasAttribute("y_offset")) {
17b4aaa159ec Added offset attributes to marker style symbols.
raimund renkert <raimund.renkert@intevation.de>
parents: 181
diff changeset
139 try {
17b4aaa159ec Added offset attributes to marker style symbols.
raimund renkert <raimund.renkert@intevation.de>
parents: 181
diff changeset
140 double val =
17b4aaa159ec Added offset attributes to marker style symbols.
raimund renkert <raimund.renkert@intevation.de>
parents: 181
diff changeset
141 Double.parseDouble(symbolElement.getAttribute("y_offset"));
17b4aaa159ec Added offset attributes to marker style symbols.
raimund renkert <raimund.renkert@intevation.de>
parents: 181
diff changeset
142 double r = Math.round(val);
17b4aaa159ec Added offset attributes to marker style symbols.
raimund renkert <raimund.renkert@intevation.de>
parents: 181
diff changeset
143 //In ArcGIS positive y offset values move the symbol upwards,
17b4aaa159ec Added offset attributes to marker style symbols.
raimund renkert <raimund.renkert@intevation.de>
parents: 181
diff changeset
144 //in Mapserver positive values move downwards.
17b4aaa159ec Added offset attributes to marker style symbols.
raimund renkert <raimund.renkert@intevation.de>
parents: 181
diff changeset
145 r = -r;
17b4aaa159ec Added offset attributes to marker style symbols.
raimund renkert <raimund.renkert@intevation.de>
parents: 181
diff changeset
146 style.setOffsety(r);
17b4aaa159ec Added offset attributes to marker style symbols.
raimund renkert <raimund.renkert@intevation.de>
parents: 181
diff changeset
147 }
17b4aaa159ec Added offset attributes to marker style symbols.
raimund renkert <raimund.renkert@intevation.de>
parents: 181
diff changeset
148 catch (NumberFormatException nfe) {
17b4aaa159ec Added offset attributes to marker style symbols.
raimund renkert <raimund.renkert@intevation.de>
parents: 181
diff changeset
149 logger.warn("Error setting the symbol y-offset.");
17b4aaa159ec Added offset attributes to marker style symbols.
raimund renkert <raimund.renkert@intevation.de>
parents: 181
diff changeset
150 }
17b4aaa159ec Added offset attributes to marker style symbols.
raimund renkert <raimund.renkert@intevation.de>
parents: 181
diff changeset
151 }
87
7d4cf2db43f1 Added new writer classes to be flexible in creating mapfiles.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
152 String symType = symbolElement.getAttribute("style");
7d4cf2db43f1 Added new writer classes to be flexible in creating mapfiles.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
153 if(symType.equals("point") ||
7d4cf2db43f1 Added new writer classes to be flexible in creating mapfiles.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
154 symType.equals("arrow") ||
251
6b80e46b8f38 Added picture symbol support to the converter.
raimund renkert <raimund.renkert@intevation.de>
parents: 243
diff changeset
155 symType.equals("char") ||
6b80e46b8f38 Added picture symbol support to the converter.
raimund renkert <raimund.renkert@intevation.de>
parents: 243
diff changeset
156 symType.equals("picture")) {
87
7d4cf2db43f1 Added new writer classes to be flexible in creating mapfiles.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
157 SymbolWriter sw = new SymbolWriter(this.map, this.cl);
7d4cf2db43f1 Added new writer classes to be flexible in creating mapfiles.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
158 sw.write(symbolElement);
7d4cf2db43f1 Added new writer classes to be flexible in creating mapfiles.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
159 }
7d4cf2db43f1 Added new writer classes to be flexible in creating mapfiles.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
160 else {
7d4cf2db43f1 Added new writer classes to be flexible in creating mapfiles.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
161 return false;
7d4cf2db43f1 Added new writer classes to be flexible in creating mapfiles.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
162 }
141
8f30f7e802d6 Manage symbol names and symbol comparison.
vc11884admin@VC11884.win.bsh.de
parents: 120
diff changeset
163 String name = symbolElement.getAttribute("name");
8f30f7e802d6 Manage symbol names and symbol comparison.
vc11884admin@VC11884.win.bsh.de
parents: 120
diff changeset
164 style.setSymbolByName(map, name);
8f30f7e802d6 Manage symbol names and symbol comparison.
vc11884admin@VC11884.win.bsh.de
parents: 120
diff changeset
165
87
7d4cf2db43f1 Added new writer classes to be flexible in creating mapfiles.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
166 return true;
7d4cf2db43f1 Added new writer classes to be flexible in creating mapfiles.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
167 }
7d4cf2db43f1 Added new writer classes to be flexible in creating mapfiles.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
168 }
7d4cf2db43f1 Added new writer classes to be flexible in creating mapfiles.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
169 // 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)