annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/services/MapInfoService.java @ 2138:59bb5c895be3

Improved HYK/Zones- handling. flys-artifacts/trunk@3716 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Thu, 19 Jan 2012 11:00:27 +0000
parents 8284c8fca840
children 247f3e98a14b
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
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
24 import de.intevation.artifactdatabase.DefaultService;
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.model.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
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 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
29
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 /**
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 * 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
32 * 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
33 *
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
34 * @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
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 public class MapInfoService extends DefaultService {
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
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 /** 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
39 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
40
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 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
42 "/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
43
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 public static final String XPATH_RIVER_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
45 "/artifact-database/floodmap/river[@name='%RIVER%']/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
46
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 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
48 "/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
49
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
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 /** 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
52 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
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
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 * 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
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 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
59 }
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
60
2098
8284c8fca840 Removed security problem when working with map infos.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2097
diff changeset
61 protected static String getStringXPath(
8284c8fca840 Removed security problem when working with map infos.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2097
diff changeset
62 String query,
8284c8fca840 Removed security problem when working with map infos.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2097
diff changeset
63 Map<String, String> variables
8284c8fca840 Removed security problem when working with map infos.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2097
diff changeset
64 ) {
8284c8fca840 Removed security problem when working with map infos.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2097
diff changeset
65 return (String)XMLUtils.xpath(
8284c8fca840 Removed security problem when working with map infos.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2097
diff changeset
66 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
67 null, variables);
8284c8fca840 Removed security problem when working with map infos.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2097
diff changeset
68 }
8284c8fca840 Removed security problem when working with map infos.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2097
diff changeset
69
8284c8fca840 Removed security problem when working with map infos.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2097
diff changeset
70 protected static Node getNodeXPath(
8284c8fca840 Removed security problem when working with map infos.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2097
diff changeset
71 String query,
8284c8fca840 Removed security problem when working with map infos.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2097
diff changeset
72 Map<String, String> variables
8284c8fca840 Removed security problem when working with map infos.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2097
diff changeset
73 ) {
8284c8fca840 Removed security problem when working with map infos.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2097
diff changeset
74 return (Node)XMLUtils.xpath(
8284c8fca840 Removed security problem when working with map infos.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2097
diff changeset
75 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
76 null, variables);
8284c8fca840 Removed security problem when working with map infos.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2097
diff changeset
77 }
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
78
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 public Document 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
80 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
81 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
82 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
83 ) {
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 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
85
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 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
87 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
88
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 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
90 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
91
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 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
93 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
94 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
95 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
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
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 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
99 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
100 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
101
2078
cbeeaaad1056 #440 Support river axes that consist of more than a single geometry.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1774
diff changeset
102 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
103 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
104 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
105 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
106
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 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
108 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
109 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
110 }
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
111
2098
8284c8fca840 Removed security problem when working with map infos.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2097
diff changeset
112 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
113 vars.put("river", river);
8284c8fca840 Removed security problem when working with map infos.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2097
diff changeset
114
8284c8fca840 Removed security problem when working with map infos.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2097
diff changeset
115 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
116
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
117 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
118 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
119 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
120 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
121 }
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
122
2098
8284c8fca840 Removed security problem when working with map infos.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2097
diff changeset
123 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
124 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
125 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
126 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
127 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
128 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
129 }
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
130
2098
8284c8fca840 Removed security problem when working with map infos.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2097
diff changeset
131 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
132 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
133 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
134 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
135 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
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
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 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
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
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 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
143 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
144 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
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 }
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
147 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org