Mercurial > mxd2map
annotate src/java/de/intevation/mxd/utils/MapToXMLUtils.java @ 215:69ec9129ff96
Adopted paths to fonts.
author | Stephan Holl <stephan.holl@intevation.de> |
---|---|
date | Fri, 22 Jul 2011 14:37:49 +0200 |
parents | f4eb506499f5 |
children | df4e0946ef02 |
rev | line source |
---|---|
31
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
1 /* |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
2 * Copyright (c) 2010 by Intevation GmbH |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
3 * |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
4 * This program is free software under the LGPL (>=v2.1) |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
5 * Read the file LGPL.txt coming with the software for details |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
6 * or visit http://www.gnu.org/licenses/ if it does not exist. |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
7 */ |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
8 package de.intevation.mxd.utils; |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
9 |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
10 import org.apache.log4j.Logger; |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
11 |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
12 import org.w3c.dom.Document; |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
13 import org.w3c.dom.Element; |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
14 import org.w3c.dom.NodeList; |
133
6b80d2c7536e
Improved broken layer handling.
vc11884admin@VC11884.win.bsh.de
parents:
43
diff
changeset
|
15 import org.w3c.dom.DOMException; |
31
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
16 |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
17 /** |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
18 * 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
|
19 * |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
20 * @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
|
21 */ |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
22 public class MapToXMLUtils |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
23 { |
43
ef7ca23c4233
Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents:
38
diff
changeset
|
24 /** |
ef7ca23c4233
Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents:
38
diff
changeset
|
25 * The logger. |
ef7ca23c4233
Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents:
38
diff
changeset
|
26 */ |
ef7ca23c4233
Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents:
38
diff
changeset
|
27 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
|
28 |
ef7ca23c4233
Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents:
38
diff
changeset
|
29 /** |
ef7ca23c4233
Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents:
38
diff
changeset
|
30 * Private member. |
ef7ca23c4233
Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents:
38
diff
changeset
|
31 */ |
31
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
32 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
|
33 private Element rootElement; |
31
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
34 private XMLUtils.ElementCreator creator; |
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 |
31
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
37 public MapToXMLUtils() { |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
38 this.root = XMLUtils.newDocument(); |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
39 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
|
40 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
|
41 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
|
42 } |
27577294f9ca
Added root element to document and save the filename in the XML tree.
Raimund Renkert <rrenkert@intevation.de>
parents:
34
diff
changeset
|
43 |
43
ef7ca23c4233
Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents:
38
diff
changeset
|
44 /** |
ef7ca23c4233
Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents:
38
diff
changeset
|
45 * 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
|
46 * @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
|
47 * @return Currently always true. |
ef7ca23c4233
Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents:
38
diff
changeset
|
48 */ |
38
27577294f9ca
Added root element to document and save the filename in the XML tree.
Raimund Renkert <rrenkert@intevation.de>
parents:
34
diff
changeset
|
49 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
|
50 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
|
51 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
|
52 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
|
53 return true; |
31
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
54 } |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
55 |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
56 /** |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
57 * Create the top level map element. |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
58 * @return The new map element. |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
59 */ |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
60 public Element createMap() |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
61 throws Exception { |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
62 Element map; |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
63 NodeList list = root.getElementsByTagName("map"); |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
64 if(list == null || list.getLength() == 0){ |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
65 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
|
66 rootElement.appendChild(map); |
31
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 else if(list.getLength() == 1){ |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
69 map = (Element)list.item(0); |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
70 } |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
71 else{ |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
72 throw new Exception("Error while creating map node."); |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
73 } |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
74 return map; |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
75 } |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
76 |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
77 /** |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
78 * Add a layer element to the map. |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
79 * @param name The layer name. |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
80 * @return The layer element. |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
81 */ |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
82 public Element addLayer() |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
83 throws Exception { |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
84 Element node = creator.create("layer"); |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
85 NodeList list = root.getElementsByTagName("map"); |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
86 if(list == null || list.getLength() == 0){ |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
87 throw new Exception("No map node found!"); |
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 else if(list.getLength() > 1) { |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
90 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
|
91 " This should never happen!"); |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
92 } |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
93 else { |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
94 list.item(0).appendChild(node); |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
95 return node; |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
96 } |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
97 } |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
98 |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
99 /** |
133
6b80d2c7536e
Improved broken layer handling.
vc11884admin@VC11884.win.bsh.de
parents:
43
diff
changeset
|
100 * Remove a layer element from map. |
6b80d2c7536e
Improved broken layer handling.
vc11884admin@VC11884.win.bsh.de
parents:
43
diff
changeset
|
101 * @param name The layer name. |
6b80d2c7536e
Improved broken layer handling.
vc11884admin@VC11884.win.bsh.de
parents:
43
diff
changeset
|
102 */ |
6b80d2c7536e
Improved broken layer handling.
vc11884admin@VC11884.win.bsh.de
parents:
43
diff
changeset
|
103 public void removeLayer(Element layerElement) { |
6b80d2c7536e
Improved broken layer handling.
vc11884admin@VC11884.win.bsh.de
parents:
43
diff
changeset
|
104 NodeList list = root.getElementsByTagName("map"); |
6b80d2c7536e
Improved broken layer handling.
vc11884admin@VC11884.win.bsh.de
parents:
43
diff
changeset
|
105 if(list == null || list.getLength() == 0){ |
6b80d2c7536e
Improved broken layer handling.
vc11884admin@VC11884.win.bsh.de
parents:
43
diff
changeset
|
106 return; |
6b80d2c7536e
Improved broken layer handling.
vc11884admin@VC11884.win.bsh.de
parents:
43
diff
changeset
|
107 } |
6b80d2c7536e
Improved broken layer handling.
vc11884admin@VC11884.win.bsh.de
parents:
43
diff
changeset
|
108 else if(list.getLength() > 1) { |
137
cd55975ba0c4
Done some minor reformatings.
Raimund Renkert <rrenkert@intevation.de>
parents:
133
diff
changeset
|
109 return; |
133
6b80d2c7536e
Improved broken layer handling.
vc11884admin@VC11884.win.bsh.de
parents:
43
diff
changeset
|
110 } |
6b80d2c7536e
Improved broken layer handling.
vc11884admin@VC11884.win.bsh.de
parents:
43
diff
changeset
|
111 else { |
137
cd55975ba0c4
Done some minor reformatings.
Raimund Renkert <rrenkert@intevation.de>
parents:
133
diff
changeset
|
112 try { |
133
6b80d2c7536e
Improved broken layer handling.
vc11884admin@VC11884.win.bsh.de
parents:
43
diff
changeset
|
113 list.item(0).removeChild(layerElement); |
137
cd55975ba0c4
Done some minor reformatings.
Raimund Renkert <rrenkert@intevation.de>
parents:
133
diff
changeset
|
114 } |
cd55975ba0c4
Done some minor reformatings.
Raimund Renkert <rrenkert@intevation.de>
parents:
133
diff
changeset
|
115 catch(DOMException de) { |
cd55975ba0c4
Done some minor reformatings.
Raimund Renkert <rrenkert@intevation.de>
parents:
133
diff
changeset
|
116 return; |
cd55975ba0c4
Done some minor reformatings.
Raimund Renkert <rrenkert@intevation.de>
parents:
133
diff
changeset
|
117 } |
133
6b80d2c7536e
Improved broken layer handling.
vc11884admin@VC11884.win.bsh.de
parents:
43
diff
changeset
|
118 } |
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 |
6b80d2c7536e
Improved broken layer handling.
vc11884admin@VC11884.win.bsh.de
parents:
43
diff
changeset
|
121 /** |
31
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
122 * Add a renderer element to the map. |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
123 * @param layer The parent layer element. |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
124 * @return The renderer element. |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
125 */ |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
126 public Element addRenderer(Element layer) { |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
127 Element node = creator.create("renderer"); |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
128 layer.appendChild(node); |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
129 return node; |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
130 } |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
131 |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
132 /** |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
133 * Add a symbol element to the map. |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
134 * @param renderer The parent renderer element. |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
135 * @return The symbol element. |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
136 */ |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
137 public Element addSymbol(Element renderer) { |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
138 Element node = creator.create("symbol"); |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
139 renderer.appendChild(node); |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
140 return node; |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
141 } |
180
f4eb506499f5
Done some code styling and removed TODOs.
Raimund Renkert <rrenkert@intevation.de>
parents:
179
diff
changeset
|
142 |
179
f3a91cd7440b
Added a first version of feature labeling.
raimund renkert <raimund.renkert@intevation.de>
parents:
137
diff
changeset
|
143 /** |
f3a91cd7440b
Added a first version of feature labeling.
raimund renkert <raimund.renkert@intevation.de>
parents:
137
diff
changeset
|
144 * 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
|
145 * @param layer The parent layer element. |
f3a91cd7440b
Added a first version of feature labeling.
raimund renkert <raimund.renkert@intevation.de>
parents:
137
diff
changeset
|
146 * @return The label element. |
f3a91cd7440b
Added a first version of feature labeling.
raimund renkert <raimund.renkert@intevation.de>
parents:
137
diff
changeset
|
147 */ |
f3a91cd7440b
Added a first version of feature labeling.
raimund renkert <raimund.renkert@intevation.de>
parents:
137
diff
changeset
|
148 public Element addLabel(Element layer) { |
f3a91cd7440b
Added a first version of feature labeling.
raimund renkert <raimund.renkert@intevation.de>
parents:
137
diff
changeset
|
149 Element node = creator.create("label"); |
f3a91cd7440b
Added a first version of feature labeling.
raimund renkert <raimund.renkert@intevation.de>
parents:
137
diff
changeset
|
150 layer.appendChild(node); |
f3a91cd7440b
Added a first version of feature labeling.
raimund renkert <raimund.renkert@intevation.de>
parents:
137
diff
changeset
|
151 return node; |
f3a91cd7440b
Added a first version of feature labeling.
raimund renkert <raimund.renkert@intevation.de>
parents:
137
diff
changeset
|
152 } |
31
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
153 |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
154 /** |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
155 * Print out the XML document. |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
156 */ |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
157 public void print() { |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
158 XMLUtils.toStream(root, System.out); |
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
159 } |
38
27577294f9ca
Added root element to document and save the filename in the XML tree.
Raimund Renkert <rrenkert@intevation.de>
parents:
34
diff
changeset
|
160 |
43
ef7ca23c4233
Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents:
38
diff
changeset
|
161 /** |
ef7ca23c4233
Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents:
38
diff
changeset
|
162 * Get the DOM document. |
ef7ca23c4233
Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents:
38
diff
changeset
|
163 * @return The root document. |
ef7ca23c4233
Added comments, done some code styling and removed typos.
Raimund Renkert <rrenkert@intevation.de>
parents:
38
diff
changeset
|
164 */ |
38
27577294f9ca
Added root element to document and save the filename in the XML tree.
Raimund Renkert <rrenkert@intevation.de>
parents:
34
diff
changeset
|
165 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
|
166 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
|
167 } |
31
40c0b4e5f91a
Added utility class to store map attributes.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
168 } |