annotate src/java/de/intevation/mxd/writer/FillStyleWriter.java @ 250:d10fd4de02aa

Documented a bunch of new features * Support of picture-marker symbol (issue343) * Support for ArcGIS named groups (issue381) * GLOBAL and Layer extents and SRS (issue 379)
author Stephan Holl <stephan.holl@intevation.de>
date Fri, 12 Aug 2011 09:15:34 +0200
parents df4e0946ef02
children 6b80e46b8f38
rev   line source
243
df4e0946ef02 Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents: 242
diff changeset
1 /*
df4e0946ef02 Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents: 242
diff changeset
2 * Copyright (c) 2011 by Intevation GmbH, Germany <info@intevation.de>
df4e0946ef02 Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents: 242
diff changeset
3 *
df4e0946ef02 Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents: 242
diff changeset
4 * This file is part of MXD2map.
df4e0946ef02 Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents: 242
diff changeset
5 *
df4e0946ef02 Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents: 242
diff changeset
6 * This program is free software under the LGPL (>=v2.1)
df4e0946ef02 Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents: 242
diff changeset
7 * Read the file LICENCE.txt coming with the software for details
df4e0946ef02 Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents: 242
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: 242
diff changeset
9 *
df4e0946ef02 Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents: 242
diff changeset
10 * MXD2map has been developed on behalf of the
df4e0946ef02 Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents: 242
diff changeset
11 * Bundesamt fuer Seeschifffahrt und Hydrographie (BSH) in Hamburg
df4e0946ef02 Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents: 242
diff changeset
12 * by Intevation GmbH.
df4e0946ef02 Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents: 242
diff changeset
13 *
df4e0946ef02 Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents: 242
diff changeset
14 * Authors:
df4e0946ef02 Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents: 242
diff changeset
15 * Raimund Renkert <raimund.renkert@intevation.de>
df4e0946ef02 Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents: 242
diff changeset
16 * Bjoern Schilberg <bjoern.schilberg@intevation.de>
df4e0946ef02 Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents: 242
diff changeset
17 * Stephan Holl <stephan.holl@intevation.de>
df4e0946ef02 Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents: 242
diff changeset
18 */
df4e0946ef02 Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents: 242
diff changeset
19
97
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
20 package de.intevation.mxd.writer;
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
21
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
22 import java.io.IOException;
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
23 import java.awt.Color;
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
24 import org.apache.log4j.Logger;
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
25
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
26 import org.w3c.dom.Element;
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
27 import org.w3c.dom.NodeList;
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
28
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
29 import edu.umn.gis.mapscript.mapObj;
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
30 import edu.umn.gis.mapscript.layerObj;
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
31 import edu.umn.gis.mapscript.classObj;
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
32 import edu.umn.gis.mapscript.styleObj;
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
33 import edu.umn.gis.mapscript.colorObj;
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
34 import edu.umn.gis.mapscript.symbolObj;
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
35 import edu.umn.gis.mapscript.symbolSetObj;
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
36 import edu.umn.gis.mapscript.lineObj;
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
37 import edu.umn.gis.mapscript.pointObj;
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
38
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
39
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
40 /**
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
41 * The interface to the mapfile writer.
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
42 *
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
43 * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a>
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
44 */
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
45 public class FillStyleWriter {
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
46
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
47 /**
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
48 * The Logger.
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
49 */
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
50 private static final Logger logger =
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
51 Logger.getLogger(FillStyleWriter.class);
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
52
181
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 180
diff changeset
53 /**
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 180
diff changeset
54 * Private member.
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 180
diff changeset
55 */
97
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
56 private mapObj map;
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
57 private classObj cl;
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
58 private styleObj style;
150
7b1433d3b574 Handle outlines with width < 1 and transparent color.
vc11884admin@VC11884.win.bsh.de
parents: 145
diff changeset
59 private colorObj fill;
97
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
60
181
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 180
diff changeset
61 /**
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 180
diff changeset
62 * Constructor with map object and class object.
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 180
diff changeset
63 *
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 180
diff changeset
64 * @param map The map object.
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 180
diff changeset
65 * @param cl The class object containing the style.
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 180
diff changeset
66 */
97
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
67 public FillStyleWriter (mapObj map, classObj cl) {
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
68 logger.debug("contructor(mapObj, classObj)");
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
69 this.map = map;
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
70 this.cl = cl;
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
71 this.style = new styleObj(cl);
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
72 }
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
73
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
74 /**
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
75 * Write the content.
181
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 180
diff changeset
76 *
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 180
diff changeset
77 * @param symbolElement DOM element containing style attributes.
97
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
78 */
120
11d63bf00326 Changed exception handling and logging in writer classes.
Raimund Renkert <rrenkert@intevation.de>
parents: 101
diff changeset
79 public boolean write(Element symbolElement) {
123
3c792458a716 Write PATTERN for polygon outlines and hatch symbols.
Raimund Renkert <rrenkert@intevation.de>
parents: 120
diff changeset
80 logger.debug("write()Element");
97
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
81 symbolSetObj symbolSet = map.getSymbolset();
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
82
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
83 if(symbolElement.hasChildNodes()) {
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
84 NodeList symbols = symbolElement.getChildNodes();
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
85 for (int i = 0; i < symbols.getLength(); i++) {
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
86 Element nextSym = (Element)symbols.item(i);
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
87 String type = nextSym.getAttribute("type");
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
88
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
89 if(((symbols.getLength() > 1 && i == 0) ||
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
90 (symbols.getLength() == 1 &&
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
91 !symbolElement.hasAttribute("hatch"))) &&
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
92 type.equals("line")) {
150
7b1433d3b574 Handle outlines with width < 1 and transparent color.
vc11884admin@VC11884.win.bsh.de
parents: 145
diff changeset
93 if(symbolElement.hasAttribute("color")) {
7b1433d3b574 Handle outlines with width < 1 and transparent color.
vc11884admin@VC11884.win.bsh.de
parents: 145
diff changeset
94 Color oCol = Color.decode(
7b1433d3b574 Handle outlines with width < 1 and transparent color.
vc11884admin@VC11884.win.bsh.de
parents: 145
diff changeset
95 symbolElement.getAttribute("color"));
7b1433d3b574 Handle outlines with width < 1 and transparent color.
vc11884admin@VC11884.win.bsh.de
parents: 145
diff changeset
96 fill = new colorObj(
7b1433d3b574 Handle outlines with width < 1 and transparent color.
vc11884admin@VC11884.win.bsh.de
parents: 145
diff changeset
97 oCol.getRed(),
7b1433d3b574 Handle outlines with width < 1 and transparent color.
vc11884admin@VC11884.win.bsh.de
parents: 145
diff changeset
98 oCol.getGreen(),
7b1433d3b574 Handle outlines with width < 1 and transparent color.
vc11884admin@VC11884.win.bsh.de
parents: 145
diff changeset
99 oCol.getBlue(),
7b1433d3b574 Handle outlines with width < 1 and transparent color.
vc11884admin@VC11884.win.bsh.de
parents: 145
diff changeset
100 -4);
7b1433d3b574 Handle outlines with width < 1 and transparent color.
vc11884admin@VC11884.win.bsh.de
parents: 145
diff changeset
101 }
97
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
102 writeOutline(nextSym);
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
103 if (symbols.getLength() == 1) {
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
104 writeSimple(symbolElement);
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
105 }
184
c79c3c6fc99a Always save a symbol set, use the mapfile name as prefix for the symbol set and
raimund renkert <raimund.renkert@intevation.de>
parents: 181
diff changeset
106 try {
c79c3c6fc99a Always save a symbol set, use the mapfile name as prefix for the symbol set and
raimund renkert <raimund.renkert@intevation.de>
parents: 181
diff changeset
107 SymbolWriter sw = new SymbolWriter(this.map, this.cl);
c79c3c6fc99a Always save a symbol set, use the mapfile name as prefix for the symbol set and
raimund renkert <raimund.renkert@intevation.de>
parents: 181
diff changeset
108 sw.saveSymbolSet(symbolSet);
c79c3c6fc99a Always save a symbol set, use the mapfile name as prefix for the symbol set and
raimund renkert <raimund.renkert@intevation.de>
parents: 181
diff changeset
109 }
c79c3c6fc99a Always save a symbol set, use the mapfile name as prefix for the symbol set and
raimund renkert <raimund.renkert@intevation.de>
parents: 181
diff changeset
110 catch(Exception e) {
c79c3c6fc99a Always save a symbol set, use the mapfile name as prefix for the symbol set and
raimund renkert <raimund.renkert@intevation.de>
parents: 181
diff changeset
111 logger.warn("Could not save symbol set.");
c79c3c6fc99a Always save a symbol set, use the mapfile name as prefix for the symbol set and
raimund renkert <raimund.renkert@intevation.de>
parents: 181
diff changeset
112 }
97
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
113 }
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
114 else if(nextSym.getTagName().equals("symbol") &&
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
115 !symbolElement.hasAttribute("hatch") ||
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
116 (i == 1 && type.equals("marker"))) {
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
117 double gap = 0;
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
118 if(symbolElement.hasAttribute("xseparation")) {
145
b2c5a66022f1 Exception handling for number conversions in writer modules.
Raimund Renkert <rrenkert@intevation.de>
parents: 131
diff changeset
119 try {
b2c5a66022f1 Exception handling for number conversions in writer modules.
Raimund Renkert <rrenkert@intevation.de>
parents: 131
diff changeset
120 gap = Double.parseDouble(
b2c5a66022f1 Exception handling for number conversions in writer modules.
Raimund Renkert <rrenkert@intevation.de>
parents: 131
diff changeset
121 symbolElement.getAttribute("xseparation"));
b2c5a66022f1 Exception handling for number conversions in writer modules.
Raimund Renkert <rrenkert@intevation.de>
parents: 131
diff changeset
122 }
b2c5a66022f1 Exception handling for number conversions in writer modules.
Raimund Renkert <rrenkert@intevation.de>
parents: 131
diff changeset
123 catch(NumberFormatException nfe) {
b2c5a66022f1 Exception handling for number conversions in writer modules.
Raimund Renkert <rrenkert@intevation.de>
parents: 131
diff changeset
124 gap = 0;
b2c5a66022f1 Exception handling for number conversions in writer modules.
Raimund Renkert <rrenkert@intevation.de>
parents: 131
diff changeset
125 }
97
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
126 }
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
127 writeMarker(nextSym, gap);
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
128 }
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
129 else if (nextSym.getTagName().equals("symbol") &&
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
130 symbolElement.hasAttribute("hatch")) {
168
f3a539ace2a4 Write line width and outline for polygons filled with hatch symbol.
vc11884admin@VC11884.win.bsh.de
parents: 167
diff changeset
131 if(i == 0) {
f3a539ace2a4 Write line width and outline for polygons filled with hatch symbol.
vc11884admin@VC11884.win.bsh.de
parents: 167
diff changeset
132 writeOutline(nextSym);
97
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
133 }
168
f3a539ace2a4 Write line width and outline for polygons filled with hatch symbol.
vc11884admin@VC11884.win.bsh.de
parents: 167
diff changeset
134 else {
f3a539ace2a4 Write line width and outline for polygons filled with hatch symbol.
vc11884admin@VC11884.win.bsh.de
parents: 167
diff changeset
135 if(symbolElement.hasAttribute("angle")) {
f3a539ace2a4 Write line width and outline for polygons filled with hatch symbol.
vc11884admin@VC11884.win.bsh.de
parents: 167
diff changeset
136 nextSym.setAttribute(
f3a539ace2a4 Write line width and outline for polygons filled with hatch symbol.
vc11884admin@VC11884.win.bsh.de
parents: 167
diff changeset
137 "angle",
f3a539ace2a4 Write line width and outline for polygons filled with hatch symbol.
vc11884admin@VC11884.win.bsh.de
parents: 167
diff changeset
138 symbolElement.getAttribute("angle"));
f3a539ace2a4 Write line width and outline for polygons filled with hatch symbol.
vc11884admin@VC11884.win.bsh.de
parents: 167
diff changeset
139 }
f3a539ace2a4 Write line width and outline for polygons filled with hatch symbol.
vc11884admin@VC11884.win.bsh.de
parents: 167
diff changeset
140 if(symbolElement.hasAttribute("separation")) {
f3a539ace2a4 Write line width and outline for polygons filled with hatch symbol.
vc11884admin@VC11884.win.bsh.de
parents: 167
diff changeset
141 nextSym.setAttribute(
f3a539ace2a4 Write line width and outline for polygons filled with hatch symbol.
vc11884admin@VC11884.win.bsh.de
parents: 167
diff changeset
142 "size",
f3a539ace2a4 Write line width and outline for polygons filled with hatch symbol.
vc11884admin@VC11884.win.bsh.de
parents: 167
diff changeset
143 symbolElement.getAttribute("separation"));
f3a539ace2a4 Write line width and outline for polygons filled with hatch symbol.
vc11884admin@VC11884.win.bsh.de
parents: 167
diff changeset
144 }
f3a539ace2a4 Write line width and outline for polygons filled with hatch symbol.
vc11884admin@VC11884.win.bsh.de
parents: 167
diff changeset
145 writeMarker(nextSym, -1);
97
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
146 }
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
147 }
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
148 else {
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
149 writeSimple(symbolElement);
184
c79c3c6fc99a Always save a symbol set, use the mapfile name as prefix for the symbol set and
raimund renkert <raimund.renkert@intevation.de>
parents: 181
diff changeset
150 try {
c79c3c6fc99a Always save a symbol set, use the mapfile name as prefix for the symbol set and
raimund renkert <raimund.renkert@intevation.de>
parents: 181
diff changeset
151 SymbolWriter sw = new SymbolWriter(this.map, this.cl);
c79c3c6fc99a Always save a symbol set, use the mapfile name as prefix for the symbol set and
raimund renkert <raimund.renkert@intevation.de>
parents: 181
diff changeset
152 sw.saveSymbolSet(symbolSet);
c79c3c6fc99a Always save a symbol set, use the mapfile name as prefix for the symbol set and
raimund renkert <raimund.renkert@intevation.de>
parents: 181
diff changeset
153 }
c79c3c6fc99a Always save a symbol set, use the mapfile name as prefix for the symbol set and
raimund renkert <raimund.renkert@intevation.de>
parents: 181
diff changeset
154 catch(Exception e) {
c79c3c6fc99a Always save a symbol set, use the mapfile name as prefix for the symbol set and
raimund renkert <raimund.renkert@intevation.de>
parents: 181
diff changeset
155 logger.warn("Could not save symbol set.");
c79c3c6fc99a Always save a symbol set, use the mapfile name as prefix for the symbol set and
raimund renkert <raimund.renkert@intevation.de>
parents: 181
diff changeset
156 }
97
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
157 }
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
158 }
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
159 }
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
160 else {
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
161 writeSimple(symbolElement);
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
162 if(symbolElement.hasAttribute("outline_color")) {
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
163 Color oCol = Color.decode(
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
164 symbolElement.getAttribute("outline_color"));
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
165 colorObj outlineColor = new colorObj(
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
166 oCol.getRed(),
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
167 oCol.getGreen(),
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
168 oCol.getBlue(),
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
169 -4);
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
170 style.setOutlinecolor(outlineColor);
145
b2c5a66022f1 Exception handling for number conversions in writer modules.
Raimund Renkert <rrenkert@intevation.de>
parents: 131
diff changeset
171 try {
b2c5a66022f1 Exception handling for number conversions in writer modules.
Raimund Renkert <rrenkert@intevation.de>
parents: 131
diff changeset
172 style.setOutlinewidth(Double.parseDouble(
b2c5a66022f1 Exception handling for number conversions in writer modules.
Raimund Renkert <rrenkert@intevation.de>
parents: 131
diff changeset
173 symbolElement.getAttribute("outline_size")));
b2c5a66022f1 Exception handling for number conversions in writer modules.
Raimund Renkert <rrenkert@intevation.de>
parents: 131
diff changeset
174 }
b2c5a66022f1 Exception handling for number conversions in writer modules.
Raimund Renkert <rrenkert@intevation.de>
parents: 131
diff changeset
175 catch(NumberFormatException nfe) {
b2c5a66022f1 Exception handling for number conversions in writer modules.
Raimund Renkert <rrenkert@intevation.de>
parents: 131
diff changeset
176 logger.warn("Error setting outline width.");
b2c5a66022f1 Exception handling for number conversions in writer modules.
Raimund Renkert <rrenkert@intevation.de>
parents: 131
diff changeset
177 style.setOutlinewidth(0.0);
b2c5a66022f1 Exception handling for number conversions in writer modules.
Raimund Renkert <rrenkert@intevation.de>
parents: 131
diff changeset
178 }
97
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
179 }
184
c79c3c6fc99a Always save a symbol set, use the mapfile name as prefix for the symbol set and
raimund renkert <raimund.renkert@intevation.de>
parents: 181
diff changeset
180 try {
c79c3c6fc99a Always save a symbol set, use the mapfile name as prefix for the symbol set and
raimund renkert <raimund.renkert@intevation.de>
parents: 181
diff changeset
181 SymbolWriter sw = new SymbolWriter(this.map, this.cl);
c79c3c6fc99a Always save a symbol set, use the mapfile name as prefix for the symbol set and
raimund renkert <raimund.renkert@intevation.de>
parents: 181
diff changeset
182 sw.saveSymbolSet(symbolSet);
c79c3c6fc99a Always save a symbol set, use the mapfile name as prefix for the symbol set and
raimund renkert <raimund.renkert@intevation.de>
parents: 181
diff changeset
183 }
c79c3c6fc99a Always save a symbol set, use the mapfile name as prefix for the symbol set and
raimund renkert <raimund.renkert@intevation.de>
parents: 181
diff changeset
184 catch(Exception e) {
c79c3c6fc99a Always save a symbol set, use the mapfile name as prefix for the symbol set and
raimund renkert <raimund.renkert@intevation.de>
parents: 181
diff changeset
185 logger.warn("Could not save symbol set.");
c79c3c6fc99a Always save a symbol set, use the mapfile name as prefix for the symbol set and
raimund renkert <raimund.renkert@intevation.de>
parents: 181
diff changeset
186 }
97
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
187 }
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
188 return true;
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
189 }
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
190
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
191 /**
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
192 * Write the outline for a polygon.
181
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 180
diff changeset
193 *
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 180
diff changeset
194 * @param symbolElement Dom element containing the symbol attributes.
97
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
195 */
120
11d63bf00326 Changed exception handling and logging in writer classes.
Raimund Renkert <rrenkert@intevation.de>
parents: 101
diff changeset
196 private void writeOutline(Element symbolElement) {
97
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
197 logger.debug("writeOutline()");
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
198 //write transparent outline
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
199 colorObj color = new colorObj(-1, -1, -1, -4);
150
7b1433d3b574 Handle outlines with width < 1 and transparent color.
vc11884admin@VC11884.win.bsh.de
parents: 145
diff changeset
200 double w = 0;
7b1433d3b574 Handle outlines with width < 1 and transparent color.
vc11884admin@VC11884.win.bsh.de
parents: 145
diff changeset
201 double transp = -1;
131
cd18c61cbcf6 Do not write lines or outlines if their width is smaller than 1.0.
vc11884admin@VC11884.win.bsh.de
parents: 123
diff changeset
202 if(symbolElement.hasAttribute("width")) {
145
b2c5a66022f1 Exception handling for number conversions in writer modules.
Raimund Renkert <rrenkert@intevation.de>
parents: 131
diff changeset
203 try {
b2c5a66022f1 Exception handling for number conversions in writer modules.
Raimund Renkert <rrenkert@intevation.de>
parents: 131
diff changeset
204 w = Double.parseDouble(symbolElement.getAttribute("width"));
167
b1e4a871033e Write special pattern for outlines.
vc11884admin@VC11884.win.bsh.de
parents: 150
diff changeset
205 if(symbolElement.hasAttribute("transparency")) {
b1e4a871033e Write special pattern for outlines.
vc11884admin@VC11884.win.bsh.de
parents: 150
diff changeset
206 transp = Double.parseDouble(
b1e4a871033e Write special pattern for outlines.
vc11884admin@VC11884.win.bsh.de
parents: 150
diff changeset
207 symbolElement.getAttribute("transparency"));
b1e4a871033e Write special pattern for outlines.
vc11884admin@VC11884.win.bsh.de
parents: 150
diff changeset
208 }
b1e4a871033e Write special pattern for outlines.
vc11884admin@VC11884.win.bsh.de
parents: 150
diff changeset
209 else {
b1e4a871033e Write special pattern for outlines.
vc11884admin@VC11884.win.bsh.de
parents: 150
diff changeset
210 transp = -1;
b1e4a871033e Write special pattern for outlines.
vc11884admin@VC11884.win.bsh.de
parents: 150
diff changeset
211 }
145
b2c5a66022f1 Exception handling for number conversions in writer modules.
Raimund Renkert <rrenkert@intevation.de>
parents: 131
diff changeset
212 }
b2c5a66022f1 Exception handling for number conversions in writer modules.
Raimund Renkert <rrenkert@intevation.de>
parents: 131
diff changeset
213 catch(NumberFormatException nfe) {
150
7b1433d3b574 Handle outlines with width < 1 and transparent color.
vc11884admin@VC11884.win.bsh.de
parents: 145
diff changeset
214 logger.warn("Error setting outline width or transparency.");
145
b2c5a66022f1 Exception handling for number conversions in writer modules.
Raimund Renkert <rrenkert@intevation.de>
parents: 131
diff changeset
215 w = 0;
150
7b1433d3b574 Handle outlines with width < 1 and transparent color.
vc11884admin@VC11884.win.bsh.de
parents: 145
diff changeset
216 transp = -1;
131
cd18c61cbcf6 Do not write lines or outlines if their width is smaller than 1.0.
vc11884admin@VC11884.win.bsh.de
parents: 123
diff changeset
217 }
cd18c61cbcf6 Do not write lines or outlines if their width is smaller than 1.0.
vc11884admin@VC11884.win.bsh.de
parents: 123
diff changeset
218 }
180
f4eb506499f5 Done some code styling and removed TODOs.
Raimund Renkert <rrenkert@intevation.de>
parents: 168
diff changeset
219
97
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
220 Color oCol = Color.decode(
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
221 symbolElement.getAttribute("color"));
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
222
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
223 styleObj outline = new styleObj (cl);
242
bb25c7a4553e Refactored outline handling for polygons.
raimund renkert <raimund.renkert@intevation.de>
parents: 240
diff changeset
224 if (w < 1.0) {
150
7b1433d3b574 Handle outlines with width < 1 and transparent color.
vc11884admin@VC11884.win.bsh.de
parents: 145
diff changeset
225 symbolElement.setAttribute("width", "1");
7b1433d3b574 Handle outlines with width < 1 and transparent color.
vc11884admin@VC11884.win.bsh.de
parents: 145
diff changeset
226 }
242
bb25c7a4553e Refactored outline handling for polygons.
raimund renkert <raimund.renkert@intevation.de>
parents: 240
diff changeset
227 colorObj outlinecolor = new colorObj(
bb25c7a4553e Refactored outline handling for polygons.
raimund renkert <raimund.renkert@intevation.de>
parents: 240
diff changeset
228 oCol.getRed(),
bb25c7a4553e Refactored outline handling for polygons.
raimund renkert <raimund.renkert@intevation.de>
parents: 240
diff changeset
229 oCol.getGreen(),
bb25c7a4553e Refactored outline handling for polygons.
raimund renkert <raimund.renkert@intevation.de>
parents: 240
diff changeset
230 oCol.getBlue(),
bb25c7a4553e Refactored outline handling for polygons.
raimund renkert <raimund.renkert@intevation.de>
parents: 240
diff changeset
231 -4);
bb25c7a4553e Refactored outline handling for polygons.
raimund renkert <raimund.renkert@intevation.de>
parents: 240
diff changeset
232 outline.setOutlinecolor(outlinecolor);
bb25c7a4553e Refactored outline handling for polygons.
raimund renkert <raimund.renkert@intevation.de>
parents: 240
diff changeset
233 if(transp >= 0) {
bb25c7a4553e Refactored outline handling for polygons.
raimund renkert <raimund.renkert@intevation.de>
parents: 240
diff changeset
234 int opacity = (int)((1 - (transp/255)) * 100);
bb25c7a4553e Refactored outline handling for polygons.
raimund renkert <raimund.renkert@intevation.de>
parents: 240
diff changeset
235 outline.setOpacity(opacity);
150
7b1433d3b574 Handle outlines with width < 1 and transparent color.
vc11884admin@VC11884.win.bsh.de
parents: 145
diff changeset
236 }
145
b2c5a66022f1 Exception handling for number conversions in writer modules.
Raimund Renkert <rrenkert@intevation.de>
parents: 131
diff changeset
237 try {
b2c5a66022f1 Exception handling for number conversions in writer modules.
Raimund Renkert <rrenkert@intevation.de>
parents: 131
diff changeset
238 outline.setOutlinewidth(Double.parseDouble(
b2c5a66022f1 Exception handling for number conversions in writer modules.
Raimund Renkert <rrenkert@intevation.de>
parents: 131
diff changeset
239 symbolElement.getAttribute("width")));
b2c5a66022f1 Exception handling for number conversions in writer modules.
Raimund Renkert <rrenkert@intevation.de>
parents: 131
diff changeset
240 }
b2c5a66022f1 Exception handling for number conversions in writer modules.
Raimund Renkert <rrenkert@intevation.de>
parents: 131
diff changeset
241 catch(NumberFormatException nfe) {
b2c5a66022f1 Exception handling for number conversions in writer modules.
Raimund Renkert <rrenkert@intevation.de>
parents: 131
diff changeset
242 logger.warn("Error setting outline width.");
b2c5a66022f1 Exception handling for number conversions in writer modules.
Raimund Renkert <rrenkert@intevation.de>
parents: 131
diff changeset
243 outline.setOutlinewidth(0.0);
b2c5a66022f1 Exception handling for number conversions in writer modules.
Raimund Renkert <rrenkert@intevation.de>
parents: 131
diff changeset
244 }
123
3c792458a716 Write PATTERN for polygon outlines and hatch symbols.
Raimund Renkert <rrenkert@intevation.de>
parents: 120
diff changeset
245 if(symbolElement.hasAttribute("linestyle")) {
181
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 180
diff changeset
246 //Write predefined dashed or dotted lines.
123
3c792458a716 Write PATTERN for polygon outlines and hatch symbols.
Raimund Renkert <rrenkert@intevation.de>
parents: 120
diff changeset
247 String ls = symbolElement.getAttribute("linestyle");
3c792458a716 Write PATTERN for polygon outlines and hatch symbols.
Raimund Renkert <rrenkert@intevation.de>
parents: 120
diff changeset
248 double[] vals;
3c792458a716 Write PATTERN for polygon outlines and hatch symbols.
Raimund Renkert <rrenkert@intevation.de>
parents: 120
diff changeset
249 if(ls.equals("dash")) {
3c792458a716 Write PATTERN for polygon outlines and hatch symbols.
Raimund Renkert <rrenkert@intevation.de>
parents: 120
diff changeset
250 outline.setPatternlength(2);
3c792458a716 Write PATTERN for polygon outlines and hatch symbols.
Raimund Renkert <rrenkert@intevation.de>
parents: 120
diff changeset
251 vals = new double[] {4.0, 4.0, 0, 0, 0, 0, 0, 0, 0, 0};
3c792458a716 Write PATTERN for polygon outlines and hatch symbols.
Raimund Renkert <rrenkert@intevation.de>
parents: 120
diff changeset
252 outline.setPattern(vals);
3c792458a716 Write PATTERN for polygon outlines and hatch symbols.
Raimund Renkert <rrenkert@intevation.de>
parents: 120
diff changeset
253 }
3c792458a716 Write PATTERN for polygon outlines and hatch symbols.
Raimund Renkert <rrenkert@intevation.de>
parents: 120
diff changeset
254 else if(ls.equals("dot")) {
3c792458a716 Write PATTERN for polygon outlines and hatch symbols.
Raimund Renkert <rrenkert@intevation.de>
parents: 120
diff changeset
255 outline.setPatternlength(2);
3c792458a716 Write PATTERN for polygon outlines and hatch symbols.
Raimund Renkert <rrenkert@intevation.de>
parents: 120
diff changeset
256 vals = new double[] {1.0, 3.0, 0, 0, 0, 0, 0, 0, 0, 0};
3c792458a716 Write PATTERN for polygon outlines and hatch symbols.
Raimund Renkert <rrenkert@intevation.de>
parents: 120
diff changeset
257 outline.setPattern(vals);
3c792458a716 Write PATTERN for polygon outlines and hatch symbols.
Raimund Renkert <rrenkert@intevation.de>
parents: 120
diff changeset
258 }
3c792458a716 Write PATTERN for polygon outlines and hatch symbols.
Raimund Renkert <rrenkert@intevation.de>
parents: 120
diff changeset
259 else if(ls.equals("dashdot")) {
3c792458a716 Write PATTERN for polygon outlines and hatch symbols.
Raimund Renkert <rrenkert@intevation.de>
parents: 120
diff changeset
260 outline.setPatternlength(4);
3c792458a716 Write PATTERN for polygon outlines and hatch symbols.
Raimund Renkert <rrenkert@intevation.de>
parents: 120
diff changeset
261 vals = new double[] {4.0, 3.0, 1.0, 3.0, 0, 0, 0, 0, 0, 0, 0};
3c792458a716 Write PATTERN for polygon outlines and hatch symbols.
Raimund Renkert <rrenkert@intevation.de>
parents: 120
diff changeset
262 outline.setPattern(vals);
3c792458a716 Write PATTERN for polygon outlines and hatch symbols.
Raimund Renkert <rrenkert@intevation.de>
parents: 120
diff changeset
263 }
3c792458a716 Write PATTERN for polygon outlines and hatch symbols.
Raimund Renkert <rrenkert@intevation.de>
parents: 120
diff changeset
264 else if (ls.equals("dashdotdot")) {
3c792458a716 Write PATTERN for polygon outlines and hatch symbols.
Raimund Renkert <rrenkert@intevation.de>
parents: 120
diff changeset
265 outline.setPatternlength(6);
3c792458a716 Write PATTERN for polygon outlines and hatch symbols.
Raimund Renkert <rrenkert@intevation.de>
parents: 120
diff changeset
266 vals = new double[] {5.0, 3.0, 1.0, 3.0, 1.0, 4.0, 0, 0, 0, 0};
3c792458a716 Write PATTERN for polygon outlines and hatch symbols.
Raimund Renkert <rrenkert@intevation.de>
parents: 120
diff changeset
267 outline.setPattern(vals);
3c792458a716 Write PATTERN for polygon outlines and hatch symbols.
Raimund Renkert <rrenkert@intevation.de>
parents: 120
diff changeset
268 }
3c792458a716 Write PATTERN for polygon outlines and hatch symbols.
Raimund Renkert <rrenkert@intevation.de>
parents: 120
diff changeset
269 }
167
b1e4a871033e Write special pattern for outlines.
vc11884admin@VC11884.win.bsh.de
parents: 150
diff changeset
270 else if(symbolElement.hasAttribute("pattern_count")) {
181
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 180
diff changeset
271 //Write dashed or dotted lines defined with a template.
167
b1e4a871033e Write special pattern for outlines.
vc11884admin@VC11884.win.bsh.de
parents: 150
diff changeset
272 int count = 0;
b1e4a871033e Write special pattern for outlines.
vc11884admin@VC11884.win.bsh.de
parents: 150
diff changeset
273 try {
b1e4a871033e Write special pattern for outlines.
vc11884admin@VC11884.win.bsh.de
parents: 150
diff changeset
274 count = Integer.parseInt(
b1e4a871033e Write special pattern for outlines.
vc11884admin@VC11884.win.bsh.de
parents: 150
diff changeset
275 symbolElement.getAttribute("pattern_count"));
b1e4a871033e Write special pattern for outlines.
vc11884admin@VC11884.win.bsh.de
parents: 150
diff changeset
276 double[] vals = new double[10];
b1e4a871033e Write special pattern for outlines.
vc11884admin@VC11884.win.bsh.de
parents: 150
diff changeset
277 double move = 0.0;
b1e4a871033e Write special pattern for outlines.
vc11884admin@VC11884.win.bsh.de
parents: 150
diff changeset
278 int pos = 0;
b1e4a871033e Write special pattern for outlines.
vc11884admin@VC11884.win.bsh.de
parents: 150
diff changeset
279 for(int i = 0; i < count; i++) {
b1e4a871033e Write special pattern for outlines.
vc11884admin@VC11884.win.bsh.de
parents: 150
diff changeset
280 double mark =
b1e4a871033e Write special pattern for outlines.
vc11884admin@VC11884.win.bsh.de
parents: 150
diff changeset
281 Double.parseDouble(symbolElement.getAttribute("mark_" + i));
b1e4a871033e Write special pattern for outlines.
vc11884admin@VC11884.win.bsh.de
parents: 150
diff changeset
282 double gap =
b1e4a871033e Write special pattern for outlines.
vc11884admin@VC11884.win.bsh.de
parents: 150
diff changeset
283 Double.parseDouble(symbolElement.getAttribute("gap_" + i));
b1e4a871033e Write special pattern for outlines.
vc11884admin@VC11884.win.bsh.de
parents: 150
diff changeset
284 if(i == 0 && mark == 0.0) {
b1e4a871033e Write special pattern for outlines.
vc11884admin@VC11884.win.bsh.de
parents: 150
diff changeset
285 move = gap;
b1e4a871033e Write special pattern for outlines.
vc11884admin@VC11884.win.bsh.de
parents: 150
diff changeset
286 }
b1e4a871033e Write special pattern for outlines.
vc11884admin@VC11884.win.bsh.de
parents: 150
diff changeset
287 else if(i == count - 1 && move > 0.0) {
b1e4a871033e Write special pattern for outlines.
vc11884admin@VC11884.win.bsh.de
parents: 150
diff changeset
288 vals[pos++] = mark;
b1e4a871033e Write special pattern for outlines.
vc11884admin@VC11884.win.bsh.de
parents: 150
diff changeset
289 vals[pos++] = gap + move;
b1e4a871033e Write special pattern for outlines.
vc11884admin@VC11884.win.bsh.de
parents: 150
diff changeset
290 }
b1e4a871033e Write special pattern for outlines.
vc11884admin@VC11884.win.bsh.de
parents: 150
diff changeset
291 else {
b1e4a871033e Write special pattern for outlines.
vc11884admin@VC11884.win.bsh.de
parents: 150
diff changeset
292 vals[pos++] = mark;
b1e4a871033e Write special pattern for outlines.
vc11884admin@VC11884.win.bsh.de
parents: 150
diff changeset
293 vals[pos++] = gap;
b1e4a871033e Write special pattern for outlines.
vc11884admin@VC11884.win.bsh.de
parents: 150
diff changeset
294 }
b1e4a871033e Write special pattern for outlines.
vc11884admin@VC11884.win.bsh.de
parents: 150
diff changeset
295 }
b1e4a871033e Write special pattern for outlines.
vc11884admin@VC11884.win.bsh.de
parents: 150
diff changeset
296 if(move > 0.0) {
b1e4a871033e Write special pattern for outlines.
vc11884admin@VC11884.win.bsh.de
parents: 150
diff changeset
297 outline.setPatternlength((count*2) -2);
b1e4a871033e Write special pattern for outlines.
vc11884admin@VC11884.win.bsh.de
parents: 150
diff changeset
298 }
b1e4a871033e Write special pattern for outlines.
vc11884admin@VC11884.win.bsh.de
parents: 150
diff changeset
299 else {
b1e4a871033e Write special pattern for outlines.
vc11884admin@VC11884.win.bsh.de
parents: 150
diff changeset
300 outline.setPatternlength(count*2);
b1e4a871033e Write special pattern for outlines.
vc11884admin@VC11884.win.bsh.de
parents: 150
diff changeset
301 }
b1e4a871033e Write special pattern for outlines.
vc11884admin@VC11884.win.bsh.de
parents: 150
diff changeset
302 outline.setPattern(vals);
123
3c792458a716 Write PATTERN for polygon outlines and hatch symbols.
Raimund Renkert <rrenkert@intevation.de>
parents: 120
diff changeset
303
167
b1e4a871033e Write special pattern for outlines.
vc11884admin@VC11884.win.bsh.de
parents: 150
diff changeset
304 }
b1e4a871033e Write special pattern for outlines.
vc11884admin@VC11884.win.bsh.de
parents: 150
diff changeset
305 catch(NumberFormatException nfe) {
b1e4a871033e Write special pattern for outlines.
vc11884admin@VC11884.win.bsh.de
parents: 150
diff changeset
306 logger.warn("Could not write PATTERN.");
b1e4a871033e Write special pattern for outlines.
vc11884admin@VC11884.win.bsh.de
parents: 150
diff changeset
307 }
b1e4a871033e Write special pattern for outlines.
vc11884admin@VC11884.win.bsh.de
parents: 150
diff changeset
308 }
97
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
309 }
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
310
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
311 /**
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
312 * Write marker attributes and a symbol for the polygon fill.
181
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 180
diff changeset
313 *
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 180
diff changeset
314 * @param symbolElement DOM element containingg the symbol attributes.
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 180
diff changeset
315 * @param gap The initial gap at the begining of a line.
97
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
316 */
120
11d63bf00326 Changed exception handling and logging in writer classes.
Raimund Renkert <rrenkert@intevation.de>
parents: 101
diff changeset
317 private void writeMarker(Element symbolElement, double gap) {
97
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
318 logger.debug("writeMarker()");
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
319 String name = symbolElement.getAttribute("name");
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
320 String type = symbolElement.getAttribute("type");
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
321 if (symbolElement.hasAttribute("angle")) {
145
b2c5a66022f1 Exception handling for number conversions in writer modules.
Raimund Renkert <rrenkert@intevation.de>
parents: 131
diff changeset
322 try {
b2c5a66022f1 Exception handling for number conversions in writer modules.
Raimund Renkert <rrenkert@intevation.de>
parents: 131
diff changeset
323 style.setAngle(
b2c5a66022f1 Exception handling for number conversions in writer modules.
Raimund Renkert <rrenkert@intevation.de>
parents: 131
diff changeset
324 Double.parseDouble(symbolElement.getAttribute("angle")));
b2c5a66022f1 Exception handling for number conversions in writer modules.
Raimund Renkert <rrenkert@intevation.de>
parents: 131
diff changeset
325 }
b2c5a66022f1 Exception handling for number conversions in writer modules.
Raimund Renkert <rrenkert@intevation.de>
parents: 131
diff changeset
326 catch(NumberFormatException nfe) {
b2c5a66022f1 Exception handling for number conversions in writer modules.
Raimund Renkert <rrenkert@intevation.de>
parents: 131
diff changeset
327 logger.warn("Error setting angle.");
b2c5a66022f1 Exception handling for number conversions in writer modules.
Raimund Renkert <rrenkert@intevation.de>
parents: 131
diff changeset
328 style.setAngle(0.0);
b2c5a66022f1 Exception handling for number conversions in writer modules.
Raimund Renkert <rrenkert@intevation.de>
parents: 131
diff changeset
329 }
97
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
330 }
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
331 if(symbolElement.hasAttribute("color")) {
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
332 String c = symbolElement.getAttribute("color");
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
333 Color col = Color.decode(c);
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
334 colorObj color = new colorObj(
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
335 col.getRed(),
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
336 col.getGreen(),
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
337 col.getBlue(),
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
338 -4);
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
339 style.setColor(color);
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
340 }
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
341 if (symbolElement.hasAttribute ("size")) {
145
b2c5a66022f1 Exception handling for number conversions in writer modules.
Raimund Renkert <rrenkert@intevation.de>
parents: 131
diff changeset
342 double size = 1;
b2c5a66022f1 Exception handling for number conversions in writer modules.
Raimund Renkert <rrenkert@intevation.de>
parents: 131
diff changeset
343 try {
b2c5a66022f1 Exception handling for number conversions in writer modules.
Raimund Renkert <rrenkert@intevation.de>
parents: 131
diff changeset
344 size = Double.parseDouble(symbolElement.getAttribute("size"));
b2c5a66022f1 Exception handling for number conversions in writer modules.
Raimund Renkert <rrenkert@intevation.de>
parents: 131
diff changeset
345 }
b2c5a66022f1 Exception handling for number conversions in writer modules.
Raimund Renkert <rrenkert@intevation.de>
parents: 131
diff changeset
346 catch(NumberFormatException nfe) {
b2c5a66022f1 Exception handling for number conversions in writer modules.
Raimund Renkert <rrenkert@intevation.de>
parents: 131
diff changeset
347 size = 1.0;
b2c5a66022f1 Exception handling for number conversions in writer modules.
Raimund Renkert <rrenkert@intevation.de>
parents: 131
diff changeset
348 }
97
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
349 style.setSize(size);
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
350 //In arcgis the separation goes from center to center, so the gap is
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
351 //the separation - size
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
352 if (gap > 0) {
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
353 style.setGap(gap - size);
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
354 }
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
355 }
168
f3a539ace2a4 Write line width and outline for polygons filled with hatch symbol.
vc11884admin@VC11884.win.bsh.de
parents: 167
diff changeset
356 if(symbolElement.hasAttribute("width")) {
f3a539ace2a4 Write line width and outline for polygons filled with hatch symbol.
vc11884admin@VC11884.win.bsh.de
parents: 167
diff changeset
357 double width = 1;
f3a539ace2a4 Write line width and outline for polygons filled with hatch symbol.
vc11884admin@VC11884.win.bsh.de
parents: 167
diff changeset
358 try {
f3a539ace2a4 Write line width and outline for polygons filled with hatch symbol.
vc11884admin@VC11884.win.bsh.de
parents: 167
diff changeset
359 width = Double.parseDouble(symbolElement.getAttribute("width"));
f3a539ace2a4 Write line width and outline for polygons filled with hatch symbol.
vc11884admin@VC11884.win.bsh.de
parents: 167
diff changeset
360 }
f3a539ace2a4 Write line width and outline for polygons filled with hatch symbol.
vc11884admin@VC11884.win.bsh.de
parents: 167
diff changeset
361 catch(NumberFormatException nfe) {
f3a539ace2a4 Write line width and outline for polygons filled with hatch symbol.
vc11884admin@VC11884.win.bsh.de
parents: 167
diff changeset
362 width = 1.0;
f3a539ace2a4 Write line width and outline for polygons filled with hatch symbol.
vc11884admin@VC11884.win.bsh.de
parents: 167
diff changeset
363 }
f3a539ace2a4 Write line width and outline for polygons filled with hatch symbol.
vc11884admin@VC11884.win.bsh.de
parents: 167
diff changeset
364 style.setWidth(width);
f3a539ace2a4 Write line width and outline for polygons filled with hatch symbol.
vc11884admin@VC11884.win.bsh.de
parents: 167
diff changeset
365 }
97
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
366 if(symbolElement.hasAttribute("outline_color")) {
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
367 Color oCol = Color.decode(
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
368 symbolElement.getAttribute("outline_color"));
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
369 colorObj outlineColor = new colorObj(
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
370 oCol.getRed(),
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
371 oCol.getGreen(),
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
372 oCol.getBlue(),
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
373 -4);
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
374 style.setOutlinecolor(outlineColor);
145
b2c5a66022f1 Exception handling for number conversions in writer modules.
Raimund Renkert <rrenkert@intevation.de>
parents: 131
diff changeset
375 try {
b2c5a66022f1 Exception handling for number conversions in writer modules.
Raimund Renkert <rrenkert@intevation.de>
parents: 131
diff changeset
376 style.setOutlinewidth(Double.parseDouble(
b2c5a66022f1 Exception handling for number conversions in writer modules.
Raimund Renkert <rrenkert@intevation.de>
parents: 131
diff changeset
377 symbolElement.getAttribute("outline_size")));
b2c5a66022f1 Exception handling for number conversions in writer modules.
Raimund Renkert <rrenkert@intevation.de>
parents: 131
diff changeset
378 }
b2c5a66022f1 Exception handling for number conversions in writer modules.
Raimund Renkert <rrenkert@intevation.de>
parents: 131
diff changeset
379 catch(NumberFormatException nfe) {
b2c5a66022f1 Exception handling for number conversions in writer modules.
Raimund Renkert <rrenkert@intevation.de>
parents: 131
diff changeset
380 logger.warn("Error setting angle.");
b2c5a66022f1 Exception handling for number conversions in writer modules.
Raimund Renkert <rrenkert@intevation.de>
parents: 131
diff changeset
381 style.setOutlinewidth(0.0);
b2c5a66022f1 Exception handling for number conversions in writer modules.
Raimund Renkert <rrenkert@intevation.de>
parents: 131
diff changeset
382 }
97
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
383 }
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
384 if(type.equals("marker")) {
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
385 style.setSymbolByName(map, name);
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
386 SymbolWriter sw = new SymbolWriter(this.map, this.cl);
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
387 sw.write(symbolElement);
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
388 }
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
389 else if(type.equals("line")) {
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
390 style.setSymbolByName(map, "hatch");
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
391 SymbolWriter sw = new SymbolWriter(this.map, this.cl);
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
392 symbolElement.setAttribute("name", "hatch");
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
393 sw.write(symbolElement);
123
3c792458a716 Write PATTERN for polygon outlines and hatch symbols.
Raimund Renkert <rrenkert@intevation.de>
parents: 120
diff changeset
394 if(symbolElement.hasAttribute("linestyle")) {
3c792458a716 Write PATTERN for polygon outlines and hatch symbols.
Raimund Renkert <rrenkert@intevation.de>
parents: 120
diff changeset
395 String ls = symbolElement.getAttribute("linestyle");
3c792458a716 Write PATTERN for polygon outlines and hatch symbols.
Raimund Renkert <rrenkert@intevation.de>
parents: 120
diff changeset
396 double[] vals;
3c792458a716 Write PATTERN for polygon outlines and hatch symbols.
Raimund Renkert <rrenkert@intevation.de>
parents: 120
diff changeset
397 if(ls.equals("dash")) {
3c792458a716 Write PATTERN for polygon outlines and hatch symbols.
Raimund Renkert <rrenkert@intevation.de>
parents: 120
diff changeset
398 style.setPatternlength(2);
3c792458a716 Write PATTERN for polygon outlines and hatch symbols.
Raimund Renkert <rrenkert@intevation.de>
parents: 120
diff changeset
399 vals = new double[] {4.0, 4.0, 0, 0, 0, 0, 0, 0, 0, 0};
3c792458a716 Write PATTERN for polygon outlines and hatch symbols.
Raimund Renkert <rrenkert@intevation.de>
parents: 120
diff changeset
400 style.setPattern(vals);
3c792458a716 Write PATTERN for polygon outlines and hatch symbols.
Raimund Renkert <rrenkert@intevation.de>
parents: 120
diff changeset
401 }
3c792458a716 Write PATTERN for polygon outlines and hatch symbols.
Raimund Renkert <rrenkert@intevation.de>
parents: 120
diff changeset
402 else if(ls.equals("dot")) {
3c792458a716 Write PATTERN for polygon outlines and hatch symbols.
Raimund Renkert <rrenkert@intevation.de>
parents: 120
diff changeset
403 style.setPatternlength(2);
3c792458a716 Write PATTERN for polygon outlines and hatch symbols.
Raimund Renkert <rrenkert@intevation.de>
parents: 120
diff changeset
404 vals = new double[] {1.0, 3.0, 0, 0, 0, 0, 0, 0, 0, 0};
3c792458a716 Write PATTERN for polygon outlines and hatch symbols.
Raimund Renkert <rrenkert@intevation.de>
parents: 120
diff changeset
405 style.setPattern(vals);
3c792458a716 Write PATTERN for polygon outlines and hatch symbols.
Raimund Renkert <rrenkert@intevation.de>
parents: 120
diff changeset
406 }
3c792458a716 Write PATTERN for polygon outlines and hatch symbols.
Raimund Renkert <rrenkert@intevation.de>
parents: 120
diff changeset
407 else if(ls.equals("dashdot")) {
3c792458a716 Write PATTERN for polygon outlines and hatch symbols.
Raimund Renkert <rrenkert@intevation.de>
parents: 120
diff changeset
408 style.setPatternlength(4);
3c792458a716 Write PATTERN for polygon outlines and hatch symbols.
Raimund Renkert <rrenkert@intevation.de>
parents: 120
diff changeset
409 vals = new double[] {4.0, 3.0, 1.0, 3.0, 0, 0, 0, 0, 0, 0, 0};
3c792458a716 Write PATTERN for polygon outlines and hatch symbols.
Raimund Renkert <rrenkert@intevation.de>
parents: 120
diff changeset
410 style.setPattern(vals);
3c792458a716 Write PATTERN for polygon outlines and hatch symbols.
Raimund Renkert <rrenkert@intevation.de>
parents: 120
diff changeset
411 }
3c792458a716 Write PATTERN for polygon outlines and hatch symbols.
Raimund Renkert <rrenkert@intevation.de>
parents: 120
diff changeset
412 else if (ls.equals("dashdotdot")) {
3c792458a716 Write PATTERN for polygon outlines and hatch symbols.
Raimund Renkert <rrenkert@intevation.de>
parents: 120
diff changeset
413 style.setPatternlength(6);
3c792458a716 Write PATTERN for polygon outlines and hatch symbols.
Raimund Renkert <rrenkert@intevation.de>
parents: 120
diff changeset
414 vals = new double[] {5.0, 3.0, 1.0, 3.0, 1.0, 4.0, 0, 0, 0, 0};
3c792458a716 Write PATTERN for polygon outlines and hatch symbols.
Raimund Renkert <rrenkert@intevation.de>
parents: 120
diff changeset
415 style.setPattern(vals);
3c792458a716 Write PATTERN for polygon outlines and hatch symbols.
Raimund Renkert <rrenkert@intevation.de>
parents: 120
diff changeset
416 }
3c792458a716 Write PATTERN for polygon outlines and hatch symbols.
Raimund Renkert <rrenkert@intevation.de>
parents: 120
diff changeset
417 }
97
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
418 }
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
419 }
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
420
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
421 /**
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
422 * Write simple fill attributes.
181
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 180
diff changeset
423 *
0bde090506f9 Added comments.
Raimund Renkert <rrenkert@intevation.de>
parents: 180
diff changeset
424 * @param symbolElement DOM element containing the symbol attributes.
97
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
425 */
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
426 private void writeSimple(Element symbolElement) {
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
427 logger.debug("writeSimple(Element)");
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
428 if(symbolElement.hasAttribute("transparency")) {
145
b2c5a66022f1 Exception handling for number conversions in writer modules.
Raimund Renkert <rrenkert@intevation.de>
parents: 131
diff changeset
429 double value = 0;
b2c5a66022f1 Exception handling for number conversions in writer modules.
Raimund Renkert <rrenkert@intevation.de>
parents: 131
diff changeset
430 try {
b2c5a66022f1 Exception handling for number conversions in writer modules.
Raimund Renkert <rrenkert@intevation.de>
parents: 131
diff changeset
431 value = Double.parseDouble(
b2c5a66022f1 Exception handling for number conversions in writer modules.
Raimund Renkert <rrenkert@intevation.de>
parents: 131
diff changeset
432 symbolElement.getAttribute("transparency"));
b2c5a66022f1 Exception handling for number conversions in writer modules.
Raimund Renkert <rrenkert@intevation.de>
parents: 131
diff changeset
433 }
b2c5a66022f1 Exception handling for number conversions in writer modules.
Raimund Renkert <rrenkert@intevation.de>
parents: 131
diff changeset
434 catch(NumberFormatException nfe) {
b2c5a66022f1 Exception handling for number conversions in writer modules.
Raimund Renkert <rrenkert@intevation.de>
parents: 131
diff changeset
435 value = 0;
b2c5a66022f1 Exception handling for number conversions in writer modules.
Raimund Renkert <rrenkert@intevation.de>
parents: 131
diff changeset
436 }
240
b54afdbc5892 Set opacity for simple polygons in a range from 0 - 100.
raimund renkert <raimund.renkert@intevation.de>
parents: 184
diff changeset
437 int opacity = (int)(1 - (value/255)) * 100;
b54afdbc5892 Set opacity for simple polygons in a range from 0 - 100.
raimund renkert <raimund.renkert@intevation.de>
parents: 184
diff changeset
438 style.setOpacity(opacity);
97
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
439 }
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
440 if(symbolElement.hasAttribute("color")) {
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
441 String c = symbolElement.getAttribute("color");
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
442 Color col = Color.decode(c);
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
443 colorObj color = new colorObj(
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
444 col.getRed(),
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
445 col.getGreen(),
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
446 col.getBlue(),
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
447 -4);
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
448 style.setColor(color);
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
449 }
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
450 }
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
451 }
18e4f143896b Added polygon writer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
452 // 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)