annotate src/java/de/intevation/mxd/utils/MapToXMLUtils.java @ 269:7c8ae43bc465 release-0.9

* HowTo-Release.txt: Added some more hints for releses. * doku/source/conf.py: Bumped version-number to 0.9 * website/development-de.htm4, website/development.htm4, website/download-de.htm4, website/download.htm4, website/header.m4: Updated links to version 0.9
author Stephan Holl <stephan.holl@intevation.de>
date Thu, 08 Sep 2011 17:13:31 +0200
parents 10e0aa283217
children 1d77ea6a915d
rev   line source
31
40c0b4e5f91a Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
1 /*
243
df4e0946ef02 Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents: 180
diff changeset
2 * Copyright (c) 2011 by Intevation GmbH, Germany <info@intevation.de>
df4e0946ef02 Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents: 180
diff changeset
3 *
df4e0946ef02 Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents: 180
diff changeset
4 * This file is part of MXD2map.
31
40c0b4e5f91a Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
5 *
40c0b4e5f91a Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
6 * This program is free software under the LGPL (>=v2.1)
243
df4e0946ef02 Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents: 180
diff changeset
7 * Read the file LICENCE.txt coming with the software for details
31
40c0b4e5f91a Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
8 * or visit http://www.gnu.org/licenses/ if it does not exist.
243
df4e0946ef02 Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents: 180
diff changeset
9 *
df4e0946ef02 Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents: 180
diff changeset
10 * MXD2map has been developed on behalf of the
df4e0946ef02 Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents: 180
diff changeset
11 * Bundesamt fuer Seeschifffahrt und Hydrographie (BSH) in Hamburg
df4e0946ef02 Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents: 180
diff changeset
12 * by Intevation GmbH.
df4e0946ef02 Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents: 180
diff changeset
13 *
df4e0946ef02 Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents: 180
diff changeset
14 * Authors:
df4e0946ef02 Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents: 180
diff changeset
15 * Raimund Renkert <raimund.renkert@intevation.de>
df4e0946ef02 Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents: 180
diff changeset
16 * Bjoern Schilberg <bjoern.schilberg@intevation.de>
df4e0946ef02 Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents: 180
diff changeset
17 * Stephan Holl <stephan.holl@intevation.de>
31
40c0b4e5f91a Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
18 */
243
df4e0946ef02 Added LGPL header.
Raimund Renkert <rrenkert@intevation.de>
parents: 180
diff changeset
19
31
40c0b4e5f91a Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
20 package de.intevation.mxd.utils;
40c0b4e5f91a Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
21
40c0b4e5f91a Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
22 import org.apache.log4j.Logger;
40c0b4e5f91a Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
23
40c0b4e5f91a Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
24 import org.w3c.dom.Document;
40c0b4e5f91a Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
25 import org.w3c.dom.Element;
40c0b4e5f91a Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
26 import org.w3c.dom.NodeList;
133
6b80d2c7536e Improved broken layer handling.
vc11884admin@VC11884.win.bsh.de
parents: 43
diff changeset
27 import org.w3c.dom.DOMException;
31
40c0b4e5f91a Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
28
40c0b4e5f91a Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
29 /**
40c0b4e5f91a Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
30 * Utility class to store map information in a XML structure.
40c0b4e5f91a Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
31 *
40c0b4e5f91a Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
32 * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a>
40c0b4e5f91a Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
33 */
40c0b4e5f91a Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
34 public class MapToXMLUtils
40c0b4e5f91a Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
35 {
43
ef7ca23c4233 Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents: 38
diff changeset
36 /**
ef7ca23c4233 Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents: 38
diff changeset
37 * The logger.
ef7ca23c4233 Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents: 38
diff changeset
38 */
ef7ca23c4233 Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents: 38
diff changeset
39 private static final Logger logger = Logger.getLogger(MapToXMLUtils.class);
ef7ca23c4233 Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents: 38
diff changeset
40
ef7ca23c4233 Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents: 38
diff changeset
41 /**
ef7ca23c4233 Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents: 38
diff changeset
42 * Private member.
ef7ca23c4233 Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents: 38
diff changeset
43 */
31
40c0b4e5f91a Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
44 private Document root;
38
27577294f9ca Added root element to document and save the filename in the XML tree.
Raimund Renkert <rrenkert@intevation.de>
parents: 34
diff changeset
45 private Element rootElement;
31
40c0b4e5f91a Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
46 private XMLUtils.ElementCreator creator;
40c0b4e5f91a Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
47
43
ef7ca23c4233 Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents: 38
diff changeset
48
31
40c0b4e5f91a Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
49 public MapToXMLUtils() {
40c0b4e5f91a Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
50 this.root = XMLUtils.newDocument();
40c0b4e5f91a Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
51 creator = new XMLUtils.ElementCreator(root, "", "");
38
27577294f9ca Added root element to document and save the filename in the XML tree.
Raimund Renkert <rrenkert@intevation.de>
parents: 34
diff changeset
52 rootElement = creator.create("mxd");
27577294f9ca Added root element to document and save the filename in the XML tree.
Raimund Renkert <rrenkert@intevation.de>
parents: 34
diff changeset
53 root.appendChild(rootElement);
27577294f9ca Added root element to document and save the filename in the XML tree.
Raimund Renkert <rrenkert@intevation.de>
parents: 34
diff changeset
54 }
27577294f9ca Added root element to document and save the filename in the XML tree.
Raimund Renkert <rrenkert@intevation.de>
parents: 34
diff changeset
55
43
ef7ca23c4233 Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents: 38
diff changeset
56 /**
ef7ca23c4233 Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents: 38
diff changeset
57 * Add the mxd filename to the dom.
ef7ca23c4233 Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents: 38
diff changeset
58 * @param path Path to the mxdfile.
ef7ca23c4233 Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents: 38
diff changeset
59 * @return Currently always true.
ef7ca23c4233 Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents: 38
diff changeset
60 */
38
27577294f9ca Added root element to document and save the filename in the XML tree.
Raimund Renkert <rrenkert@intevation.de>
parents: 34
diff changeset
61 public boolean addFilename(String path) {
27577294f9ca Added root element to document and save the filename in the XML tree.
Raimund Renkert <rrenkert@intevation.de>
parents: 34
diff changeset
62 Element file = creator.create("file");
27577294f9ca Added root element to document and save the filename in the XML tree.
Raimund Renkert <rrenkert@intevation.de>
parents: 34
diff changeset
63 file.setAttribute("name", path);
27577294f9ca Added root element to document and save the filename in the XML tree.
Raimund Renkert <rrenkert@intevation.de>
parents: 34
diff changeset
64 rootElement.appendChild(file);
27577294f9ca Added root element to document and save the filename in the XML tree.
Raimund Renkert <rrenkert@intevation.de>
parents: 34
diff changeset
65 return true;
31
40c0b4e5f91a Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
66 }
40c0b4e5f91a Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
67
40c0b4e5f91a Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
68 /**
40c0b4e5f91a Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
69 * Create the top level map element.
40c0b4e5f91a Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
70 * @return The new map element.
40c0b4e5f91a Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
71 */
40c0b4e5f91a Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
72 public Element createMap()
40c0b4e5f91a Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
73 throws Exception {
40c0b4e5f91a Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
74 Element map;
40c0b4e5f91a Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
75 NodeList list = root.getElementsByTagName("map");
40c0b4e5f91a Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
76 if(list == null || list.getLength() == 0){
40c0b4e5f91a Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
77 map = creator.create("map");
38
27577294f9ca Added root element to document and save the filename in the XML tree.
Raimund Renkert <rrenkert@intevation.de>
parents: 34
diff changeset
78 rootElement.appendChild(map);
31
40c0b4e5f91a Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
79 }
40c0b4e5f91a Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
80 else if(list.getLength() == 1){
40c0b4e5f91a Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
81 map = (Element)list.item(0);
40c0b4e5f91a Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
82 }
40c0b4e5f91a Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
83 else{
40c0b4e5f91a Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
84 throw new Exception("Error while creating map node.");
40c0b4e5f91a Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
85 }
40c0b4e5f91a Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
86 return map;
40c0b4e5f91a Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
87 }
40c0b4e5f91a Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
88
40c0b4e5f91a Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
89 /**
40c0b4e5f91a Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
90 * Add a layer element to the map.
260
10e0aa283217 Updated documentation and added ant task for javadoc generation.
raimund renkert <raimund.renkert@intevation.de>
parents: 243
diff changeset
91 *
31
40c0b4e5f91a Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
92 * @return The layer element.
40c0b4e5f91a Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
93 */
40c0b4e5f91a Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
94 public Element addLayer()
40c0b4e5f91a Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
95 throws Exception {
40c0b4e5f91a Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
96 Element node = creator.create("layer");
40c0b4e5f91a Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
97 NodeList list = root.getElementsByTagName("map");
40c0b4e5f91a Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
98 if(list == null || list.getLength() == 0){
40c0b4e5f91a Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
99 throw new Exception("No map node found!");
40c0b4e5f91a Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
100 }
40c0b4e5f91a Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
101 else if(list.getLength() > 1) {
40c0b4e5f91a Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
102 throw new Exception("Found more than one map node." +
40c0b4e5f91a Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
103 " This should never happen!");
40c0b4e5f91a Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
104 }
40c0b4e5f91a Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
105 else {
40c0b4e5f91a Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
106 list.item(0).appendChild(node);
40c0b4e5f91a Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
107 return node;
40c0b4e5f91a Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
108 }
40c0b4e5f91a Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
109 }
40c0b4e5f91a Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
110
40c0b4e5f91a Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
111 /**
133
6b80d2c7536e Improved broken layer handling.
vc11884admin@VC11884.win.bsh.de
parents: 43
diff changeset
112 * Remove a layer element from map.
260
10e0aa283217 Updated documentation and added ant task for javadoc generation.
raimund renkert <raimund.renkert@intevation.de>
parents: 243
diff changeset
113 * @param layerElement The layer element.
133
6b80d2c7536e Improved broken layer handling.
vc11884admin@VC11884.win.bsh.de
parents: 43
diff changeset
114 */
6b80d2c7536e Improved broken layer handling.
vc11884admin@VC11884.win.bsh.de
parents: 43
diff changeset
115 public void removeLayer(Element layerElement) {
6b80d2c7536e Improved broken layer handling.
vc11884admin@VC11884.win.bsh.de
parents: 43
diff changeset
116 NodeList list = root.getElementsByTagName("map");
6b80d2c7536e Improved broken layer handling.
vc11884admin@VC11884.win.bsh.de
parents: 43
diff changeset
117 if(list == null || list.getLength() == 0){
6b80d2c7536e Improved broken layer handling.
vc11884admin@VC11884.win.bsh.de
parents: 43
diff changeset
118 return;
6b80d2c7536e Improved broken layer handling.
vc11884admin@VC11884.win.bsh.de
parents: 43
diff changeset
119 }
6b80d2c7536e Improved broken layer handling.
vc11884admin@VC11884.win.bsh.de
parents: 43
diff changeset
120 else if(list.getLength() > 1) {
137
cd55975ba0c4 Done some minor reformatings.
Raimund Renkert <rrenkert@intevation.de>
parents: 133
diff changeset
121 return;
133
6b80d2c7536e Improved broken layer handling.
vc11884admin@VC11884.win.bsh.de
parents: 43
diff changeset
122 }
6b80d2c7536e Improved broken layer handling.
vc11884admin@VC11884.win.bsh.de
parents: 43
diff changeset
123 else {
137
cd55975ba0c4 Done some minor reformatings.
Raimund Renkert <rrenkert@intevation.de>
parents: 133
diff changeset
124 try {
133
6b80d2c7536e Improved broken layer handling.
vc11884admin@VC11884.win.bsh.de
parents: 43
diff changeset
125 list.item(0).removeChild(layerElement);
137
cd55975ba0c4 Done some minor reformatings.
Raimund Renkert <rrenkert@intevation.de>
parents: 133
diff changeset
126 }
cd55975ba0c4 Done some minor reformatings.
Raimund Renkert <rrenkert@intevation.de>
parents: 133
diff changeset
127 catch(DOMException de) {
cd55975ba0c4 Done some minor reformatings.
Raimund Renkert <rrenkert@intevation.de>
parents: 133
diff changeset
128 return;
cd55975ba0c4 Done some minor reformatings.
Raimund Renkert <rrenkert@intevation.de>
parents: 133
diff changeset
129 }
133
6b80d2c7536e Improved broken layer handling.
vc11884admin@VC11884.win.bsh.de
parents: 43
diff changeset
130 }
6b80d2c7536e Improved broken layer handling.
vc11884admin@VC11884.win.bsh.de
parents: 43
diff changeset
131 }
6b80d2c7536e Improved broken layer handling.
vc11884admin@VC11884.win.bsh.de
parents: 43
diff changeset
132
6b80d2c7536e Improved broken layer handling.
vc11884admin@VC11884.win.bsh.de
parents: 43
diff changeset
133 /**
31
40c0b4e5f91a Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
134 * Add a renderer element to the map.
40c0b4e5f91a Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
135 * @param layer The parent layer element.
40c0b4e5f91a Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
136 * @return The renderer element.
40c0b4e5f91a Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
137 */
40c0b4e5f91a Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
138 public Element addRenderer(Element layer) {
40c0b4e5f91a Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
139 Element node = creator.create("renderer");
40c0b4e5f91a Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
140 layer.appendChild(node);
40c0b4e5f91a Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
141 return node;
40c0b4e5f91a Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
142 }
40c0b4e5f91a Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
143
40c0b4e5f91a Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
144 /**
40c0b4e5f91a Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
145 * Add a symbol element to the map.
40c0b4e5f91a Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
146 * @param renderer The parent renderer element.
40c0b4e5f91a Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
147 * @return The symbol element.
40c0b4e5f91a Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
148 */
40c0b4e5f91a Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
149 public Element addSymbol(Element renderer) {
40c0b4e5f91a Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
150 Element node = creator.create("symbol");
40c0b4e5f91a Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
151 renderer.appendChild(node);
40c0b4e5f91a Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
152 return node;
40c0b4e5f91a Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
153 }
180
f4eb506499f5 Done some code styling and removed TODOs.
Raimund Renkert <rrenkert@intevation.de>
parents: 179
diff changeset
154
179
f3a91cd7440b Added a first version of feature labeling.
raimund renkert <raimund.renkert@intevation.de>
parents: 137
diff changeset
155 /**
f3a91cd7440b Added a first version of feature labeling.
raimund renkert <raimund.renkert@intevation.de>
parents: 137
diff changeset
156 * Add a label element to the map.
f3a91cd7440b Added a first version of feature labeling.
raimund renkert <raimund.renkert@intevation.de>
parents: 137
diff changeset
157 * @param layer The parent layer element.
f3a91cd7440b Added a first version of feature labeling.
raimund renkert <raimund.renkert@intevation.de>
parents: 137
diff changeset
158 * @return The label element.
f3a91cd7440b Added a first version of feature labeling.
raimund renkert <raimund.renkert@intevation.de>
parents: 137
diff changeset
159 */
f3a91cd7440b Added a first version of feature labeling.
raimund renkert <raimund.renkert@intevation.de>
parents: 137
diff changeset
160 public Element addLabel(Element layer) {
f3a91cd7440b Added a first version of feature labeling.
raimund renkert <raimund.renkert@intevation.de>
parents: 137
diff changeset
161 Element node = creator.create("label");
f3a91cd7440b Added a first version of feature labeling.
raimund renkert <raimund.renkert@intevation.de>
parents: 137
diff changeset
162 layer.appendChild(node);
f3a91cd7440b Added a first version of feature labeling.
raimund renkert <raimund.renkert@intevation.de>
parents: 137
diff changeset
163 return node;
f3a91cd7440b Added a first version of feature labeling.
raimund renkert <raimund.renkert@intevation.de>
parents: 137
diff changeset
164 }
31
40c0b4e5f91a Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
165
40c0b4e5f91a Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
166 /**
40c0b4e5f91a Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
167 * Print out the XML document.
40c0b4e5f91a Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
168 */
40c0b4e5f91a Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
169 public void print() {
40c0b4e5f91a Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
170 XMLUtils.toStream(root, System.out);
40c0b4e5f91a Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
171 }
38
27577294f9ca Added root element to document and save the filename in the XML tree.
Raimund Renkert <rrenkert@intevation.de>
parents: 34
diff changeset
172
43
ef7ca23c4233 Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents: 38
diff changeset
173 /**
ef7ca23c4233 Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents: 38
diff changeset
174 * Get the DOM document.
ef7ca23c4233 Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents: 38
diff changeset
175 * @return The root document.
ef7ca23c4233 Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents: 38
diff changeset
176 */
38
27577294f9ca Added root element to document and save the filename in the XML tree.
Raimund Renkert <rrenkert@intevation.de>
parents: 34
diff changeset
177 public Document getDocument() {
27577294f9ca Added root element to document and save the filename in the XML tree.
Raimund Renkert <rrenkert@intevation.de>
parents: 34
diff changeset
178 return root;
27577294f9ca Added root element to document and save the filename in the XML tree.
Raimund Renkert <rrenkert@intevation.de>
parents: 34
diff changeset
179 }
31
40c0b4e5f91a Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
180 }
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)