annotate src/java/de/intevation/mxd/writer/MarkerStyleWriter.java @ 276:75b8b7112dad

Website: Removed donation hearts.
author Emanuel Schuetze <emanuel@intevation.de>
date Thu, 06 Oct 2011 10:05:41 +0200
parents 6b80e46b8f38
children 08723e89b56b
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 }
7d4cf2db43f1 Added new writer classes to be flexible in creating mapfiles.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
85 if(symbolElement.hasAttribute("color")) {
7d4cf2db43f1 Added new writer classes to be flexible in creating mapfiles.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
86 String c = symbolElement.getAttribute("color");
7d4cf2db43f1 Added new writer classes to be flexible in creating mapfiles.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
87 Color col = Color.decode(c);
7d4cf2db43f1 Added new writer classes to be flexible in creating mapfiles.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
88 colorObj color = new colorObj(
7d4cf2db43f1 Added new writer classes to be flexible in creating mapfiles.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
89 col.getRed(),
7d4cf2db43f1 Added new writer classes to be flexible in creating mapfiles.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
90 col.getGreen(),
7d4cf2db43f1 Added new writer classes to be flexible in creating mapfiles.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
91 col.getBlue(),
7d4cf2db43f1 Added new writer classes to be flexible in creating mapfiles.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
92 -4);
7d4cf2db43f1 Added new writer classes to be flexible in creating mapfiles.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
93 style.setColor(color);
7d4cf2db43f1 Added new writer classes to be flexible in creating mapfiles.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
94 }
7d4cf2db43f1 Added new writer classes to be flexible in creating mapfiles.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
95 if (symbolElement.hasAttribute ("size")) {
145
b2c5a66022f1 Exception handling for number conversions in writer modules.
Raimund Renkert <rrenkert@intevation.de>
parents: 141
diff changeset
96 try {
b2c5a66022f1 Exception handling for number conversions in writer modules.
Raimund Renkert <rrenkert@intevation.de>
parents: 141
diff changeset
97 style.setSize(Double.parseDouble(
b2c5a66022f1 Exception handling for number conversions in writer modules.
Raimund Renkert <rrenkert@intevation.de>
parents: 141
diff changeset
98 symbolElement.getAttribute("size")));
b2c5a66022f1 Exception handling for number conversions in writer modules.
Raimund Renkert <rrenkert@intevation.de>
parents: 141
diff changeset
99 }
b2c5a66022f1 Exception handling for number conversions in writer modules.
Raimund Renkert <rrenkert@intevation.de>
parents: 141
diff changeset
100 catch(NumberFormatException nfe) {
b2c5a66022f1 Exception handling for number conversions in writer modules.
Raimund Renkert <rrenkert@intevation.de>
parents: 141
diff changeset
101 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
102 style.setSize(1);
b2c5a66022f1 Exception handling for number conversions in writer modules.
Raimund Renkert <rrenkert@intevation.de>
parents: 141
diff changeset
103 }
87
7d4cf2db43f1 Added new writer classes to be flexible in creating mapfiles.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
104 }
7d4cf2db43f1 Added new writer classes to be flexible in creating mapfiles.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
105 if(symbolElement.hasAttribute("outline_color")) {
7d4cf2db43f1 Added new writer classes to be flexible in creating mapfiles.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
106 Color oCol = Color.decode(
7d4cf2db43f1 Added new writer classes to be flexible in creating mapfiles.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
107 symbolElement.getAttribute("outline_color"));
7d4cf2db43f1 Added new writer classes to be flexible in creating mapfiles.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
108 colorObj outlineColor = new colorObj(
7d4cf2db43f1 Added new writer classes to be flexible in creating mapfiles.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
109 oCol.getRed(),
7d4cf2db43f1 Added new writer classes to be flexible in creating mapfiles.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
110 oCol.getGreen(),
7d4cf2db43f1 Added new writer classes to be flexible in creating mapfiles.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
111 oCol.getBlue(),
7d4cf2db43f1 Added new writer classes to be flexible in creating mapfiles.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
112 -4);
7d4cf2db43f1 Added new writer classes to be flexible in creating mapfiles.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
113 style.setOutlinecolor(outlineColor);
145
b2c5a66022f1 Exception handling for number conversions in writer modules.
Raimund Renkert <rrenkert@intevation.de>
parents: 141
diff changeset
114 try {
b2c5a66022f1 Exception handling for number conversions in writer modules.
Raimund Renkert <rrenkert@intevation.de>
parents: 141
diff changeset
115 style.setOutlinewidth(Double.parseDouble(
b2c5a66022f1 Exception handling for number conversions in writer modules.
Raimund Renkert <rrenkert@intevation.de>
parents: 141
diff changeset
116 symbolElement.getAttribute("outline_size")));
b2c5a66022f1 Exception handling for number conversions in writer modules.
Raimund Renkert <rrenkert@intevation.de>
parents: 141
diff changeset
117 }
b2c5a66022f1 Exception handling for number conversions in writer modules.
Raimund Renkert <rrenkert@intevation.de>
parents: 141
diff changeset
118 catch(NumberFormatException nfe) {
b2c5a66022f1 Exception handling for number conversions in writer modules.
Raimund Renkert <rrenkert@intevation.de>
parents: 141
diff changeset
119 logger.warn("Error setting outline width.");
b2c5a66022f1 Exception handling for number conversions in writer modules.
Raimund Renkert <rrenkert@intevation.de>
parents: 141
diff changeset
120 }
87
7d4cf2db43f1 Added new writer classes to be flexible in creating mapfiles.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
121 }
191
17b4aaa159ec Added offset attributes to marker style symbols.
raimund renkert <raimund.renkert@intevation.de>
parents: 181
diff changeset
122
17b4aaa159ec Added offset attributes to marker style symbols.
raimund renkert <raimund.renkert@intevation.de>
parents: 181
diff changeset
123 if (symbolElement.hasAttribute("x_offset")) {
17b4aaa159ec Added offset attributes to marker style symbols.
raimund renkert <raimund.renkert@intevation.de>
parents: 181
diff changeset
124 try {
17b4aaa159ec Added offset attributes to marker style symbols.
raimund renkert <raimund.renkert@intevation.de>
parents: 181
diff changeset
125 double val =
17b4aaa159ec Added offset attributes to marker style symbols.
raimund renkert <raimund.renkert@intevation.de>
parents: 181
diff changeset
126 Double.parseDouble(symbolElement.getAttribute("x_offset"));
17b4aaa159ec Added offset attributes to marker style symbols.
raimund renkert <raimund.renkert@intevation.de>
parents: 181
diff changeset
127 double r = Math.round(val);
17b4aaa159ec Added offset attributes to marker style symbols.
raimund renkert <raimund.renkert@intevation.de>
parents: 181
diff changeset
128 style.setOffsetx(r);
17b4aaa159ec Added offset attributes to marker style symbols.
raimund renkert <raimund.renkert@intevation.de>
parents: 181
diff changeset
129 }
17b4aaa159ec Added offset attributes to marker style symbols.
raimund renkert <raimund.renkert@intevation.de>
parents: 181
diff changeset
130 catch (NumberFormatException nfe) {
17b4aaa159ec Added offset attributes to marker style symbols.
raimund renkert <raimund.renkert@intevation.de>
parents: 181
diff changeset
131 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
132 }
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 if (symbolElement.hasAttribute("y_offset")) {
17b4aaa159ec Added offset attributes to marker style symbols.
raimund renkert <raimund.renkert@intevation.de>
parents: 181
diff changeset
135 try {
17b4aaa159ec Added offset attributes to marker style symbols.
raimund renkert <raimund.renkert@intevation.de>
parents: 181
diff changeset
136 double val =
17b4aaa159ec Added offset attributes to marker style symbols.
raimund renkert <raimund.renkert@intevation.de>
parents: 181
diff changeset
137 Double.parseDouble(symbolElement.getAttribute("y_offset"));
17b4aaa159ec Added offset attributes to marker style symbols.
raimund renkert <raimund.renkert@intevation.de>
parents: 181
diff changeset
138 double r = Math.round(val);
17b4aaa159ec Added offset attributes to marker style symbols.
raimund renkert <raimund.renkert@intevation.de>
parents: 181
diff changeset
139 //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
140 //in Mapserver positive values move downwards.
17b4aaa159ec Added offset attributes to marker style symbols.
raimund renkert <raimund.renkert@intevation.de>
parents: 181
diff changeset
141 r = -r;
17b4aaa159ec Added offset attributes to marker style symbols.
raimund renkert <raimund.renkert@intevation.de>
parents: 181
diff changeset
142 style.setOffsety(r);
17b4aaa159ec Added offset attributes to marker style symbols.
raimund renkert <raimund.renkert@intevation.de>
parents: 181
diff changeset
143 }
17b4aaa159ec Added offset attributes to marker style symbols.
raimund renkert <raimund.renkert@intevation.de>
parents: 181
diff changeset
144 catch (NumberFormatException nfe) {
17b4aaa159ec Added offset attributes to marker style symbols.
raimund renkert <raimund.renkert@intevation.de>
parents: 181
diff changeset
145 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
146 }
17b4aaa159ec Added offset attributes to marker style symbols.
raimund renkert <raimund.renkert@intevation.de>
parents: 181
diff changeset
147 }
87
7d4cf2db43f1 Added new writer classes to be flexible in creating mapfiles.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
148 String symType = symbolElement.getAttribute("style");
7d4cf2db43f1 Added new writer classes to be flexible in creating mapfiles.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
149 if(symType.equals("point") ||
7d4cf2db43f1 Added new writer classes to be flexible in creating mapfiles.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
150 symType.equals("arrow") ||
251
6b80e46b8f38 Added picture symbol support to the converter.
raimund renkert <raimund.renkert@intevation.de>
parents: 243
diff changeset
151 symType.equals("char") ||
6b80e46b8f38 Added picture symbol support to the converter.
raimund renkert <raimund.renkert@intevation.de>
parents: 243
diff changeset
152 symType.equals("picture")) {
87
7d4cf2db43f1 Added new writer classes to be flexible in creating mapfiles.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
153 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
154 sw.write(symbolElement);
7d4cf2db43f1 Added new writer classes to be flexible in creating mapfiles.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
155 }
7d4cf2db43f1 Added new writer classes to be flexible in creating mapfiles.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
156 else {
7d4cf2db43f1 Added new writer classes to be flexible in creating mapfiles.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
157 return false;
7d4cf2db43f1 Added new writer classes to be flexible in creating mapfiles.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
158 }
141
8f30f7e802d6 Manage symbol names and symbol comparison.
vc11884admin@VC11884.win.bsh.de
parents: 120
diff changeset
159 String name = symbolElement.getAttribute("name");
8f30f7e802d6 Manage symbol names and symbol comparison.
vc11884admin@VC11884.win.bsh.de
parents: 120
diff changeset
160 style.setSymbolByName(map, name);
8f30f7e802d6 Manage symbol names and symbol comparison.
vc11884admin@VC11884.win.bsh.de
parents: 120
diff changeset
161
87
7d4cf2db43f1 Added new writer classes to be flexible in creating mapfiles.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
162 return true;
7d4cf2db43f1 Added new writer classes to be flexible in creating mapfiles.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
163 }
7d4cf2db43f1 Added new writer classes to be flexible in creating mapfiles.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
164 }
7d4cf2db43f1 Added new writer classes to be flexible in creating mapfiles.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
165 // 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)