annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/services/MapInfoService.java @ 4221:480de0dbca8e

Extended location input helper. The locationpicker has now an attribute whether the input is distance or location to display one or two clickable columns. Replaced the record click handler with cell click handler.
author Raimund Renkert <rrenkert@intevation.de>
date Tue, 23 Oct 2012 13:17:20 +0200
parents 8e66293c5369
children 6aa1b8abe2d3
rev   line source
1058
c37084f31c84 Implemented a MapInfo service that returns some basic information to create maps for specific rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1 package de.intevation.flys.artifacts.services;
c37084f31c84 Implemented a MapInfo service that returns some basic information to create maps for specific rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
2
c37084f31c84 Implemented a MapInfo service that returns some basic information to create maps for specific rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
3 import org.apache.log4j.Logger;
c37084f31c84 Implemented a MapInfo service that returns some basic information to create maps for specific rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
4
2098
8284c8fca840 Removed security problem when working with map infos.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2097
diff changeset
5 import java.util.Map;
8284c8fca840 Removed security problem when working with map infos.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2097
diff changeset
6 import java.util.HashMap;
8284c8fca840 Removed security problem when working with map infos.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2097
diff changeset
7
1058
c37084f31c84 Implemented a MapInfo service that returns some basic information to create maps for specific rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
8 import org.w3c.dom.Document;
2098
8284c8fca840 Removed security problem when working with map infos.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2097
diff changeset
9 import org.w3c.dom.Node;
1058
c37084f31c84 Implemented a MapInfo service that returns some basic information to create maps for specific rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
10 import org.w3c.dom.Element;
c37084f31c84 Implemented a MapInfo service that returns some basic information to create maps for specific rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
11
2098
8284c8fca840 Removed security problem when working with map infos.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2097
diff changeset
12 import javax.xml.xpath.XPathConstants;
8284c8fca840 Removed security problem when working with map infos.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2097
diff changeset
13
1774
092e1e5020bc Added a new MapGenerator which only returns a map configuration document at the moment (work still in progress).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1061
diff changeset
14 import com.vividsolutions.jts.geom.Envelope;
1058
c37084f31c84 Implemented a MapInfo service that returns some basic information to create maps for specific rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
15
c37084f31c84 Implemented a MapInfo service that returns some basic information to create maps for specific rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
16 import de.intevation.artifacts.CallMeta;
c37084f31c84 Implemented a MapInfo service that returns some basic information to create maps for specific rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
17 import de.intevation.artifacts.GlobalContext;
c37084f31c84 Implemented a MapInfo service that returns some basic information to create maps for specific rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
18
c37084f31c84 Implemented a MapInfo service that returns some basic information to create maps for specific rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
19 import de.intevation.artifacts.common.ArtifactNamespaceContext;
c37084f31c84 Implemented a MapInfo service that returns some basic information to create maps for specific rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
20 import de.intevation.artifacts.common.utils.Config;
c37084f31c84 Implemented a MapInfo service that returns some basic information to create maps for specific rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
21 import de.intevation.artifacts.common.utils.XMLUtils;
c37084f31c84 Implemented a MapInfo service that returns some basic information to create maps for specific rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
22 import de.intevation.artifacts.common.utils.XMLUtils.ElementCreator;
c37084f31c84 Implemented a MapInfo service that returns some basic information to create maps for specific rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
23
2607
247f3e98a14b Abjusted services to new hierachy.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2098
diff changeset
24 import de.intevation.artifactdatabase.XMLService;
1058
c37084f31c84 Implemented a MapInfo service that returns some basic information to create maps for specific rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
25
c37084f31c84 Implemented a MapInfo service that returns some basic information to create maps for specific rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
26 import de.intevation.flys.utils.GeometryUtils;
c37084f31c84 Implemented a MapInfo service that returns some basic information to create maps for specific rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
27
c37084f31c84 Implemented a MapInfo service that returns some basic information to create maps for specific rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
28 /**
c37084f31c84 Implemented a MapInfo service that returns some basic information to create maps for specific rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
29 * This service provides information about the supported rivers by this
c37084f31c84 Implemented a MapInfo service that returns some basic information to create maps for specific rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
30 * application.
c37084f31c84 Implemented a MapInfo service that returns some basic information to create maps for specific rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
31 *
c37084f31c84 Implemented a MapInfo service that returns some basic information to create maps for specific rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
32 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
c37084f31c84 Implemented a MapInfo service that returns some basic information to create maps for specific rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
33 */
2607
247f3e98a14b Abjusted services to new hierachy.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2098
diff changeset
34 public class MapInfoService extends XMLService {
1058
c37084f31c84 Implemented a MapInfo service that returns some basic information to create maps for specific rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
35
c37084f31c84 Implemented a MapInfo service that returns some basic information to create maps for specific rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
36 /** XPath that points to the river.*/
c37084f31c84 Implemented a MapInfo service that returns some basic information to create maps for specific rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
37 public static final String XPATH_RIVER = "/mapinfo/river/text()";
c37084f31c84 Implemented a MapInfo service that returns some basic information to create maps for specific rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
38
c37084f31c84 Implemented a MapInfo service that returns some basic information to create maps for specific rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
39 public static final String XPATH_RIVER_PROJECTION =
2098
8284c8fca840 Removed security problem when working with map infos.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2097
diff changeset
40 "/artifact-database/floodmap/river[@name=$river]/srid/@value";
1058
c37084f31c84 Implemented a MapInfo service that returns some basic information to create maps for specific rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
41
c37084f31c84 Implemented a MapInfo service that returns some basic information to create maps for specific rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
42 public static final String XPATH_RIVER_BACKGROUND =
3264
eb9f7fd77edf Fixed XPath typo
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3076
diff changeset
43 "/artifact-database/floodmap/river[@name=$river]/background-wms";
1058
c37084f31c84 Implemented a MapInfo service that returns some basic information to create maps for specific rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
44
c37084f31c84 Implemented a MapInfo service that returns some basic information to create maps for specific rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
45 public static final String XPATH_RIVER_WMS =
2098
8284c8fca840 Removed security problem when working with map infos.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2097
diff changeset
46 "/artifact-database/floodmap/river[@name=$river]/river-wms/@url";
1058
c37084f31c84 Implemented a MapInfo service that returns some basic information to create maps for specific rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
47
c37084f31c84 Implemented a MapInfo service that returns some basic information to create maps for specific rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
48
c37084f31c84 Implemented a MapInfo service that returns some basic information to create maps for specific rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
49 /** The logger used in this service.*/
c37084f31c84 Implemented a MapInfo service that returns some basic information to create maps for specific rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
50 private static Logger logger = Logger.getLogger(MapInfoService.class);
c37084f31c84 Implemented a MapInfo service that returns some basic information to create maps for specific rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
51
c37084f31c84 Implemented a MapInfo service that returns some basic information to create maps for specific rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
52
c37084f31c84 Implemented a MapInfo service that returns some basic information to create maps for specific rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
53 /**
c37084f31c84 Implemented a MapInfo service that returns some basic information to create maps for specific rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
54 * The default constructor.
c37084f31c84 Implemented a MapInfo service that returns some basic information to create maps for specific rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
55 */
c37084f31c84 Implemented a MapInfo service that returns some basic information to create maps for specific rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
56 public MapInfoService() {
c37084f31c84 Implemented a MapInfo service that returns some basic information to create maps for specific rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
57 }
c37084f31c84 Implemented a MapInfo service that returns some basic information to create maps for specific rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
58
2098
8284c8fca840 Removed security problem when working with map infos.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2097
diff changeset
59 protected static String getStringXPath(
3076
5642a83420f2 FLYS artifacts: Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2607
diff changeset
60 String query,
2098
8284c8fca840 Removed security problem when working with map infos.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2097
diff changeset
61 Map<String, String> variables
8284c8fca840 Removed security problem when working with map infos.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2097
diff changeset
62 ) {
8284c8fca840 Removed security problem when working with map infos.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2097
diff changeset
63 return (String)XMLUtils.xpath(
8284c8fca840 Removed security problem when working with map infos.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2097
diff changeset
64 Config.getConfig(), query, XPathConstants.STRING,
8284c8fca840 Removed security problem when working with map infos.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2097
diff changeset
65 null, variables);
8284c8fca840 Removed security problem when working with map infos.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2097
diff changeset
66 }
8284c8fca840 Removed security problem when working with map infos.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2097
diff changeset
67
8284c8fca840 Removed security problem when working with map infos.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2097
diff changeset
68 protected static Node getNodeXPath(
3076
5642a83420f2 FLYS artifacts: Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2607
diff changeset
69 String query,
2098
8284c8fca840 Removed security problem when working with map infos.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2097
diff changeset
70 Map<String, String> variables
8284c8fca840 Removed security problem when working with map infos.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2097
diff changeset
71 ) {
8284c8fca840 Removed security problem when working with map infos.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2097
diff changeset
72 return (Node)XMLUtils.xpath(
8284c8fca840 Removed security problem when working with map infos.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2097
diff changeset
73 Config.getConfig(), query, XPathConstants.NODE,
8284c8fca840 Removed security problem when working with map infos.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2097
diff changeset
74 null, variables);
8284c8fca840 Removed security problem when working with map infos.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2097
diff changeset
75 }
1058
c37084f31c84 Implemented a MapInfo service that returns some basic information to create maps for specific rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
76
2607
247f3e98a14b Abjusted services to new hierachy.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2098
diff changeset
77 @Override
247f3e98a14b Abjusted services to new hierachy.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2098
diff changeset
78 public Document processXML(
1058
c37084f31c84 Implemented a MapInfo service that returns some basic information to create maps for specific rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
79 Document data,
c37084f31c84 Implemented a MapInfo service that returns some basic information to create maps for specific rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
80 GlobalContext globalContext,
c37084f31c84 Implemented a MapInfo service that returns some basic information to create maps for specific rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
81 CallMeta callMeta
c37084f31c84 Implemented a MapInfo service that returns some basic information to create maps for specific rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
82 ) {
c37084f31c84 Implemented a MapInfo service that returns some basic information to create maps for specific rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
83 logger.debug("MapInfoService.process");
c37084f31c84 Implemented a MapInfo service that returns some basic information to create maps for specific rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
84
c37084f31c84 Implemented a MapInfo service that returns some basic information to create maps for specific rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
85 Document result = XMLUtils.newDocument();
c37084f31c84 Implemented a MapInfo service that returns some basic information to create maps for specific rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
86 ElementCreator cr = new ElementCreator(result, null, null);
c37084f31c84 Implemented a MapInfo service that returns some basic information to create maps for specific rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
87
c37084f31c84 Implemented a MapInfo service that returns some basic information to create maps for specific rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
88 Element mapinfo = cr.create("mapinfo");
c37084f31c84 Implemented a MapInfo service that returns some basic information to create maps for specific rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
89 result.appendChild(mapinfo);
c37084f31c84 Implemented a MapInfo service that returns some basic information to create maps for specific rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
90
c37084f31c84 Implemented a MapInfo service that returns some basic information to create maps for specific rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
91 String river = extractRiver(data);
c37084f31c84 Implemented a MapInfo service that returns some basic information to create maps for specific rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
92 if (river == null || river.length() == 0) {
c37084f31c84 Implemented a MapInfo service that returns some basic information to create maps for specific rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
93 logger.warn("Cannot generate information: river is empty!");
c37084f31c84 Implemented a MapInfo service that returns some basic information to create maps for specific rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
94 return result;
c37084f31c84 Implemented a MapInfo service that returns some basic information to create maps for specific rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
95 }
c37084f31c84 Implemented a MapInfo service that returns some basic information to create maps for specific rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
96
c37084f31c84 Implemented a MapInfo service that returns some basic information to create maps for specific rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
97 Element root = cr.create("river");
c37084f31c84 Implemented a MapInfo service that returns some basic information to create maps for specific rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
98 cr.addAttr(root, "name", river);
c37084f31c84 Implemented a MapInfo service that returns some basic information to create maps for specific rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
99 mapinfo.appendChild(root);
c37084f31c84 Implemented a MapInfo service that returns some basic information to create maps for specific rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
100
2078
cbeeaaad1056 #440 Support river axes that consist of more than a single geometry.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1774
diff changeset
101 Envelope env = GeometryUtils.getRiverBoundary(river);
cbeeaaad1056 #440 Support river axes that consist of more than a single geometry.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1774
diff changeset
102 if (env != null) {
cbeeaaad1056 #440 Support river axes that consist of more than a single geometry.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1774
diff changeset
103 String bounds = GeometryUtils.jtsBoundsToOLBounds(env);
cbeeaaad1056 #440 Support river axes that consist of more than a single geometry.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1774
diff changeset
104 logger.debug("River '" + river + "' bounds: " + bounds);
1058
c37084f31c84 Implemented a MapInfo service that returns some basic information to create maps for specific rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
105
c37084f31c84 Implemented a MapInfo service that returns some basic information to create maps for specific rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
106 Element bbox = cr.create("bbox");
c37084f31c84 Implemented a MapInfo service that returns some basic information to create maps for specific rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
107 cr.addAttr(bbox, "value", bounds);
c37084f31c84 Implemented a MapInfo service that returns some basic information to create maps for specific rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
108 root.appendChild(bbox);
c37084f31c84 Implemented a MapInfo service that returns some basic information to create maps for specific rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
109 }
c37084f31c84 Implemented a MapInfo service that returns some basic information to create maps for specific rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
110
2098
8284c8fca840 Removed security problem when working with map infos.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2097
diff changeset
111 Map<String, String> vars = new HashMap<String, String>();
8284c8fca840 Removed security problem when working with map infos.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2097
diff changeset
112 vars.put("river", river);
8284c8fca840 Removed security problem when working with map infos.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2097
diff changeset
113
8284c8fca840 Removed security problem when working with map infos.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2097
diff changeset
114 String sridStr = getStringXPath(XPATH_RIVER_PROJECTION, vars);
8284c8fca840 Removed security problem when working with map infos.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2097
diff changeset
115
1058
c37084f31c84 Implemented a MapInfo service that returns some basic information to create maps for specific rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
116 if (sridStr != null && sridStr.length() > 0) {
c37084f31c84 Implemented a MapInfo service that returns some basic information to create maps for specific rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
117 Element srid = cr.create("srid");
c37084f31c84 Implemented a MapInfo service that returns some basic information to create maps for specific rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
118 cr.addAttr(srid, "value", sridStr);
c37084f31c84 Implemented a MapInfo service that returns some basic information to create maps for specific rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
119 root.appendChild(srid);
c37084f31c84 Implemented a MapInfo service that returns some basic information to create maps for specific rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
120 }
c37084f31c84 Implemented a MapInfo service that returns some basic information to create maps for specific rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
121
2098
8284c8fca840 Removed security problem when working with map infos.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2097
diff changeset
122 Element back = (Element)getNodeXPath(XPATH_RIVER_BACKGROUND, vars);
1058
c37084f31c84 Implemented a MapInfo service that returns some basic information to create maps for specific rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
123 if (back != null) {
c37084f31c84 Implemented a MapInfo service that returns some basic information to create maps for specific rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
124 Element background = cr.create("background-wms");
c37084f31c84 Implemented a MapInfo service that returns some basic information to create maps for specific rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
125 cr.addAttr(background, "url", back.getAttribute("url"));
c37084f31c84 Implemented a MapInfo service that returns some basic information to create maps for specific rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
126 cr.addAttr(background, "layers", back.getAttribute("layers"));
c37084f31c84 Implemented a MapInfo service that returns some basic information to create maps for specific rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
127 root.appendChild(background);
c37084f31c84 Implemented a MapInfo service that returns some basic information to create maps for specific rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
128 }
c37084f31c84 Implemented a MapInfo service that returns some basic information to create maps for specific rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
129
2098
8284c8fca840 Removed security problem when working with map infos.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2097
diff changeset
130 String wmsStr = getStringXPath(XPATH_RIVER_WMS, vars);
1058
c37084f31c84 Implemented a MapInfo service that returns some basic information to create maps for specific rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
131 if (wmsStr != null && wmsStr.length() > 0) {
c37084f31c84 Implemented a MapInfo service that returns some basic information to create maps for specific rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
132 Element wms = cr.create("river-wms");
c37084f31c84 Implemented a MapInfo service that returns some basic information to create maps for specific rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
133 cr.addAttr(wms, "url", wmsStr);
c37084f31c84 Implemented a MapInfo service that returns some basic information to create maps for specific rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
134 root.appendChild(wms);
c37084f31c84 Implemented a MapInfo service that returns some basic information to create maps for specific rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
135 }
c37084f31c84 Implemented a MapInfo service that returns some basic information to create maps for specific rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
136
c37084f31c84 Implemented a MapInfo service that returns some basic information to create maps for specific rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
137 return result;
c37084f31c84 Implemented a MapInfo service that returns some basic information to create maps for specific rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
138 }
c37084f31c84 Implemented a MapInfo service that returns some basic information to create maps for specific rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
139
c37084f31c84 Implemented a MapInfo service that returns some basic information to create maps for specific rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
140
c37084f31c84 Implemented a MapInfo service that returns some basic information to create maps for specific rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
141 protected String extractRiver(Document data) {
c37084f31c84 Implemented a MapInfo service that returns some basic information to create maps for specific rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
142 return XMLUtils.xpathString(
c37084f31c84 Implemented a MapInfo service that returns some basic information to create maps for specific rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
143 data, XPATH_RIVER, ArtifactNamespaceContext.INSTANCE);
c37084f31c84 Implemented a MapInfo service that returns some basic information to create maps for specific rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
144 }
c37084f31c84 Implemented a MapInfo service that returns some basic information to create maps for specific rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
145 }
c37084f31c84 Implemented a MapInfo service that returns some basic information to create maps for specific rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
146 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org