annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/services/MapInfoService.java @ 3781:8e713e9bb4d7

Defined colors for bed quality themes. flys-artifacts/trunk@5488 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Mon, 17 Sep 2012 09:40:00 +0000
parents eb9f7fd77edf
children 8e66293c5369
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.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 */
2607
247f3e98a14b Abjusted services to new hierachy.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2098
diff changeset
36 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
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 =
3264
eb9f7fd77edf Fixed XPath typo
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3076
diff changeset
45 "/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
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(
3076
5642a83420f2 FLYS artifacts: Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2607
diff changeset
62 String query,
2098
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(
3076
5642a83420f2 FLYS artifacts: Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2607
diff changeset
71 String query,
2098
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
2607
247f3e98a14b Abjusted services to new hierachy.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2098
diff changeset
79 @Override
247f3e98a14b Abjusted services to new hierachy.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2098
diff changeset
80 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
81 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
82 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
83 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
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 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
86
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 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
88 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
89
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 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
91 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
92
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 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
94 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
95 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
96 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
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
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 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
100 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
101 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
102
2078
cbeeaaad1056 #440 Support river axes that consist of more than a single geometry.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1774
diff changeset
103 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
104 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
105 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
106 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
107
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 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
109 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
110 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
111 }
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
112
2098
8284c8fca840 Removed security problem when working with map infos.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2097
diff changeset
113 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
114 vars.put("river", river);
8284c8fca840 Removed security problem when working with map infos.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2097
diff changeset
115
8284c8fca840 Removed security problem when working with map infos.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2097
diff changeset
116 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
117
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
118 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
119 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
120 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
121 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
122 }
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
2098
8284c8fca840 Removed security problem when working with map infos.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2097
diff changeset
124 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
125 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
126 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
127 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
128 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
129 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
130 }
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
2098
8284c8fca840 Removed security problem when working with map infos.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2097
diff changeset
132 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
133 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
134 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
135 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
136 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
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
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 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
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
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 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
144 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
145 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
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 }
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
148 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org