annotate flys-client/src/main/java/de/intevation/flys/client/shared/MapUtils.java @ 4697:52068f1231da

Fixed NPE in empty style editor window.
author Raimund Renkert <rrenkert@intevation.de>
date Mon, 17 Dec 2012 17:54:26 +0100
parents 661e3ae77c8a
children f8409fbe3b88
rev   line source
1328
ab93960ac2fb Added missing MapUtils class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1 package de.intevation.flys.client.shared;
ab93960ac2fb Added missing MapUtils class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
2
2440
661e3ae77c8a #558 Reload GetLegendGraphics images when changing the style of a map layer.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1328
diff changeset
3 import java.util.Date;
661e3ae77c8a #558 Reload GetLegendGraphics images when changing the style of a map layer.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1328
diff changeset
4
1328
ab93960ac2fb Added missing MapUtils class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
5
ab93960ac2fb Added missing MapUtils class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
6 public class MapUtils {
ab93960ac2fb Added missing MapUtils class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
7
ab93960ac2fb Added missing MapUtils class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
8 public static final String GET_LEGEND_GRAPHIC_TEMPLATE =
ab93960ac2fb Added missing MapUtils class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
9 "${SERVER}SERVICE=WMS&VERSION=1.1.1&layer=${LAYER}" +
ab93960ac2fb Added missing MapUtils class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
10 "&REQUEST=getLegendGraphic&FORMAT=image/png";
ab93960ac2fb Added missing MapUtils class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
11
ab93960ac2fb Added missing MapUtils class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
12
ab93960ac2fb Added missing MapUtils class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
13 private MapUtils() {
ab93960ac2fb Added missing MapUtils class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
14 }
ab93960ac2fb Added missing MapUtils class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
15
ab93960ac2fb Added missing MapUtils class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
16
ab93960ac2fb Added missing MapUtils class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
17 public static String getLegendGraphicUrl(String server, String layer) {
ab93960ac2fb Added missing MapUtils class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
18 if (server == null || layer == null) {
ab93960ac2fb Added missing MapUtils class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
19 return null;
ab93960ac2fb Added missing MapUtils class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
20 }
ab93960ac2fb Added missing MapUtils class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
21
ab93960ac2fb Added missing MapUtils class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
22 server = server.indexOf("?") >= 0 ? server : server + "?";
ab93960ac2fb Added missing MapUtils class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
23
ab93960ac2fb Added missing MapUtils class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
24 String url = GET_LEGEND_GRAPHIC_TEMPLATE;
ab93960ac2fb Added missing MapUtils class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
25 url = url.replace("${SERVER}", server);
ab93960ac2fb Added missing MapUtils class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
26 url = url.replace("${LAYER}", layer);
2440
661e3ae77c8a #558 Reload GetLegendGraphics images when changing the style of a map layer.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1328
diff changeset
27 url = url + "&timestamp=" + new Date().getTime();
1328
ab93960ac2fb Added missing MapUtils class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
28
ab93960ac2fb Added missing MapUtils class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
29 return url;
ab93960ac2fb Added missing MapUtils class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
30 }
ab93960ac2fb Added missing MapUtils class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
31 }
ab93960ac2fb Added missing MapUtils class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
32 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org