annotate gwt-client/src/main/java/org/dive4elements/river/client/server/MapHelper.java @ 8203:238fc722f87a

sed 's/logger/log/g' src/**/*.java
author Sascha L. Teichmann <teichmann@intevation.de>
date Fri, 05 Sep 2014 13:19:22 +0200
parents ea9eef426962
children 0a5239a1e46e
rev   line source
5861
172338b1407f GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
172338b1407f GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
2 * Software engineering by Intevation GmbH
172338b1407f GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
3 *
5993
ea9eef426962 Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5861
diff changeset
4 * This file is Free Software under the GNU AGPL (>=v3)
5861
172338b1407f GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the
5993
ea9eef426962 Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5861
diff changeset
6 * documentation coming with Dive4Elements River for details.
5861
172338b1407f GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
7 */
172338b1407f GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
8
5835
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
9 package org.dive4elements.river.client.server;
1376
28eb4dfe2cbf Call Collection.doOut to retrieve a map config and use this config to build up an OpenLayers map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
10
28eb4dfe2cbf Call Collection.doOut to retrieve a map config and use this config to build up an OpenLayers map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
11 import org.w3c.dom.Document;
28eb4dfe2cbf Call Collection.doOut to retrieve a map config and use this config to build up an OpenLayers map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
12
28eb4dfe2cbf Call Collection.doOut to retrieve a map config and use this config to build up an OpenLayers map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
13 import org.apache.log4j.Logger;
28eb4dfe2cbf Call Collection.doOut to retrieve a map config and use this config to build up an OpenLayers map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
14
5835
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
15 import org.dive4elements.artifacts.common.ArtifactNamespaceContext;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
16 import org.dive4elements.artifacts.common.utils.XMLUtils;
1376
28eb4dfe2cbf Call Collection.doOut to retrieve a map config and use this config to build up an OpenLayers map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
17
5835
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
18 import org.dive4elements.river.client.shared.model.MapConfig;
1376
28eb4dfe2cbf Call Collection.doOut to retrieve a map config and use this config to build up an OpenLayers map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
19
28eb4dfe2cbf Call Collection.doOut to retrieve a map config and use this config to build up an OpenLayers map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
20
28eb4dfe2cbf Call Collection.doOut to retrieve a map config and use this config to build up an OpenLayers map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
21 public class MapHelper {
28eb4dfe2cbf Call Collection.doOut to retrieve a map config and use this config to build up an OpenLayers map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
22
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5993
diff changeset
23 private static final Logger log = Logger.getLogger(MapHelper.class);
1376
28eb4dfe2cbf Call Collection.doOut to retrieve a map config and use this config to build up an OpenLayers map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
24
28eb4dfe2cbf Call Collection.doOut to retrieve a map config and use this config to build up an OpenLayers map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
25
28eb4dfe2cbf Call Collection.doOut to retrieve a map config and use this config to build up an OpenLayers map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
26 public static final String XPATH_SRID =
28eb4dfe2cbf Call Collection.doOut to retrieve a map config and use this config to build up an OpenLayers map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
27 "/art:floodmap/art:srid/text()";
28eb4dfe2cbf Call Collection.doOut to retrieve a map config and use this config to build up an OpenLayers map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
28
28eb4dfe2cbf Call Collection.doOut to retrieve a map config and use this config to build up an OpenLayers map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
29 public static final String XPATH_MAX_EXTENT =
28eb4dfe2cbf Call Collection.doOut to retrieve a map config and use this config to build up an OpenLayers map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
30 "/art:floodmap/art:maxExtent/text()";
28eb4dfe2cbf Call Collection.doOut to retrieve a map config and use this config to build up an OpenLayers map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
31
28eb4dfe2cbf Call Collection.doOut to retrieve a map config and use this config to build up an OpenLayers map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
32 public static final String XPATH_INITIAL_EXTENT =
28eb4dfe2cbf Call Collection.doOut to retrieve a map config and use this config to build up an OpenLayers map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
33 "/art:floodmap/art:initialExtent/text()";
28eb4dfe2cbf Call Collection.doOut to retrieve a map config and use this config to build up an OpenLayers map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
34
28eb4dfe2cbf Call Collection.doOut to retrieve a map config and use this config to build up an OpenLayers map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
35
28eb4dfe2cbf Call Collection.doOut to retrieve a map config and use this config to build up an OpenLayers map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
36 private MapHelper() {
28eb4dfe2cbf Call Collection.doOut to retrieve a map config and use this config to build up an OpenLayers map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
37 }
28eb4dfe2cbf Call Collection.doOut to retrieve a map config and use this config to build up an OpenLayers map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
38
28eb4dfe2cbf Call Collection.doOut to retrieve a map config and use this config to build up an OpenLayers map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
39
28eb4dfe2cbf Call Collection.doOut to retrieve a map config and use this config to build up an OpenLayers map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
40 public static MapConfig parseConfig(Document raw) {
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5993
diff changeset
41 log.debug("MapHelper.parseConfig");
1376
28eb4dfe2cbf Call Collection.doOut to retrieve a map config and use this config to build up an OpenLayers map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
42
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5993
diff changeset
43 if (log.isDebugEnabled()) {
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5993
diff changeset
44 log.debug(XMLUtils.toString(raw));
2503
e3bd1f412421 Added GET parameters to map printer
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1376
diff changeset
45 }
1376
28eb4dfe2cbf Call Collection.doOut to retrieve a map config and use this config to build up an OpenLayers map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
46
28eb4dfe2cbf Call Collection.doOut to retrieve a map config and use this config to build up an OpenLayers map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
47 MapConfig config = new MapConfig();
28eb4dfe2cbf Call Collection.doOut to retrieve a map config and use this config to build up an OpenLayers map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
48
28eb4dfe2cbf Call Collection.doOut to retrieve a map config and use this config to build up an OpenLayers map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
49 setSrid(config, raw);
28eb4dfe2cbf Call Collection.doOut to retrieve a map config and use this config to build up an OpenLayers map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
50 setMaxExtent(config, raw);
28eb4dfe2cbf Call Collection.doOut to retrieve a map config and use this config to build up an OpenLayers map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
51 setInitialExtent(config, raw);
28eb4dfe2cbf Call Collection.doOut to retrieve a map config and use this config to build up an OpenLayers map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
52
28eb4dfe2cbf Call Collection.doOut to retrieve a map config and use this config to build up an OpenLayers map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
53 return config;
28eb4dfe2cbf Call Collection.doOut to retrieve a map config and use this config to build up an OpenLayers map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
54 }
28eb4dfe2cbf Call Collection.doOut to retrieve a map config and use this config to build up an OpenLayers map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
55
28eb4dfe2cbf Call Collection.doOut to retrieve a map config and use this config to build up an OpenLayers map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
56
28eb4dfe2cbf Call Collection.doOut to retrieve a map config and use this config to build up an OpenLayers map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
57 protected static void setSrid(MapConfig config, Document raw) {
28eb4dfe2cbf Call Collection.doOut to retrieve a map config and use this config to build up an OpenLayers map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
58 String srid = (String) XMLUtils.xpathString(
28eb4dfe2cbf Call Collection.doOut to retrieve a map config and use this config to build up an OpenLayers map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
59 raw,
28eb4dfe2cbf Call Collection.doOut to retrieve a map config and use this config to build up an OpenLayers map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
60 XPATH_SRID,
28eb4dfe2cbf Call Collection.doOut to retrieve a map config and use this config to build up an OpenLayers map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
61 ArtifactNamespaceContext.INSTANCE);
28eb4dfe2cbf Call Collection.doOut to retrieve a map config and use this config to build up an OpenLayers map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
62
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5993
diff changeset
63 log.debug("Found srid: '" + srid + "'");
1376
28eb4dfe2cbf Call Collection.doOut to retrieve a map config and use this config to build up an OpenLayers map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
64
28eb4dfe2cbf Call Collection.doOut to retrieve a map config and use this config to build up an OpenLayers map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
65 if (srid != null && srid.length() > 0) {
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5993
diff changeset
66 log.debug("Set srid: '" + srid + "'");
1376
28eb4dfe2cbf Call Collection.doOut to retrieve a map config and use this config to build up an OpenLayers map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
67 config.setSrid(srid);
28eb4dfe2cbf Call Collection.doOut to retrieve a map config and use this config to build up an OpenLayers map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
68 }
28eb4dfe2cbf Call Collection.doOut to retrieve a map config and use this config to build up an OpenLayers map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
69 }
28eb4dfe2cbf Call Collection.doOut to retrieve a map config and use this config to build up an OpenLayers map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
70
28eb4dfe2cbf Call Collection.doOut to retrieve a map config and use this config to build up an OpenLayers map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
71
28eb4dfe2cbf Call Collection.doOut to retrieve a map config and use this config to build up an OpenLayers map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
72 protected static void setMaxExtent(MapConfig config, Document raw) {
28eb4dfe2cbf Call Collection.doOut to retrieve a map config and use this config to build up an OpenLayers map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
73 String maxExtent = (String) XMLUtils.xpathString(
28eb4dfe2cbf Call Collection.doOut to retrieve a map config and use this config to build up an OpenLayers map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
74 raw,
28eb4dfe2cbf Call Collection.doOut to retrieve a map config and use this config to build up an OpenLayers map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
75 XPATH_MAX_EXTENT,
28eb4dfe2cbf Call Collection.doOut to retrieve a map config and use this config to build up an OpenLayers map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
76 ArtifactNamespaceContext.INSTANCE);
28eb4dfe2cbf Call Collection.doOut to retrieve a map config and use this config to build up an OpenLayers map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
77
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5993
diff changeset
78 log.debug("Found max extent: '" + maxExtent + "'");
1376
28eb4dfe2cbf Call Collection.doOut to retrieve a map config and use this config to build up an OpenLayers map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
79
28eb4dfe2cbf Call Collection.doOut to retrieve a map config and use this config to build up an OpenLayers map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
80 if (maxExtent != null && maxExtent.length() > 0) {
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5993
diff changeset
81 log.debug("Set max extent: '" + maxExtent + "'");
1376
28eb4dfe2cbf Call Collection.doOut to retrieve a map config and use this config to build up an OpenLayers map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
82 config.setMaxExtent(maxExtent);
28eb4dfe2cbf Call Collection.doOut to retrieve a map config and use this config to build up an OpenLayers map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
83 }
28eb4dfe2cbf Call Collection.doOut to retrieve a map config and use this config to build up an OpenLayers map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
84 }
28eb4dfe2cbf Call Collection.doOut to retrieve a map config and use this config to build up an OpenLayers map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
85
28eb4dfe2cbf Call Collection.doOut to retrieve a map config and use this config to build up an OpenLayers map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
86
28eb4dfe2cbf Call Collection.doOut to retrieve a map config and use this config to build up an OpenLayers map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
87 protected static void setInitialExtent(MapConfig config, Document raw) {
28eb4dfe2cbf Call Collection.doOut to retrieve a map config and use this config to build up an OpenLayers map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
88 String initialExtent = (String) XMLUtils.xpathString(
28eb4dfe2cbf Call Collection.doOut to retrieve a map config and use this config to build up an OpenLayers map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
89 raw,
28eb4dfe2cbf Call Collection.doOut to retrieve a map config and use this config to build up an OpenLayers map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
90 XPATH_INITIAL_EXTENT,
28eb4dfe2cbf Call Collection.doOut to retrieve a map config and use this config to build up an OpenLayers map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
91 ArtifactNamespaceContext.INSTANCE);
28eb4dfe2cbf Call Collection.doOut to retrieve a map config and use this config to build up an OpenLayers map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
92
28eb4dfe2cbf Call Collection.doOut to retrieve a map config and use this config to build up an OpenLayers map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
93 if (initialExtent != null && initialExtent.length() > 0) {
8203
238fc722f87a sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5993
diff changeset
94 log.debug("Set initial extent: '" + initialExtent + "'");
1376
28eb4dfe2cbf Call Collection.doOut to retrieve a map config and use this config to build up an OpenLayers map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
95 config.setInitialExtent(initialExtent);
28eb4dfe2cbf Call Collection.doOut to retrieve a map config and use this config to build up an OpenLayers map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
96 }
28eb4dfe2cbf Call Collection.doOut to retrieve a map config and use this config to build up an OpenLayers map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
97 }
28eb4dfe2cbf Call Collection.doOut to retrieve a map config and use this config to build up an OpenLayers map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
98 }
28eb4dfe2cbf Call Collection.doOut to retrieve a map config and use this config to build up an OpenLayers map.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
99 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org