comparison flys-client/src/main/java/org/dive4elements/river/client/shared/MapUtils.java @ 5834:f507086aa94b

Repaired internal references.
author Sascha L. Teichmann <teichmann@intevation.de>
date Thu, 25 Apr 2013 12:31:32 +0200
parents flys-client/src/main/java/de/intevation/flys/client/shared/MapUtils.java@f8409fbe3b88
children 821a02bbfb4e
comparison
equal deleted inserted replaced
5833:a2bdc0f524e8 5834:f507086aa94b
1 package de.intevation.flys.client.shared;
2
3 import java.util.Date;
4
5
6 public class MapUtils {
7
8 public static final String GET_LEGEND_GRAPHIC_TEMPLATE =
9 "${SERVER}SERVICE=WMS&VERSION=1.1.1&layer=${LAYER}" +
10 "&REQUEST=getLegendGraphic&FORMAT=image/png";
11
12
13 private MapUtils() {
14 }
15
16 public static String getLegendGraphicUrl(String server, String layer) {
17 return getLegendGraphicUrl(server, layer, -1);
18 }
19
20 public static String getLegendGraphicUrl(String server, String layer, int dpi) {
21 if (server == null || layer == null) {
22 return null;
23 }
24
25 if (server.contains("osm.intevation.de")) {
26 // GetLegend is not implemented at osm.intevation.de
27 // This avoids an error in the print log
28 return null;
29 }
30 server = server.indexOf("?") >= 0 ? server : server + "?";
31
32 String url = GET_LEGEND_GRAPHIC_TEMPLATE;
33 url = url.replace("${SERVER}", server);
34 url = url.replace("${LAYER}", layer);
35 url = url + "&timestamp=" + new Date().getTime();
36 if (dpi != -1) {
37 url+="&legend_options=dpi:" + dpi;
38 }
39
40 return url;
41 }
42 }
43 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org