Mercurial > dive4elements > river
annotate flys-client/src/main/java/de/intevation/flys/client/shared/MapUtils.java @ 5743:80b9218ac007
Add containsTolerant to Range.
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Wed, 17 Apr 2013 14:52:19 +0200 |
parents | f8409fbe3b88 |
children |
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 |
5676
f8409fbe3b88
Request maps from osm.intevation.de by another url and fix dpi handling
Andre Heinecke <aheinecke@intevation.de>
parents:
2440
diff
changeset
|
16 public static String getLegendGraphicUrl(String server, String layer) { |
f8409fbe3b88
Request maps from osm.intevation.de by another url and fix dpi handling
Andre Heinecke <aheinecke@intevation.de>
parents:
2440
diff
changeset
|
17 return getLegendGraphicUrl(server, layer, -1); |
f8409fbe3b88
Request maps from osm.intevation.de by another url and fix dpi handling
Andre Heinecke <aheinecke@intevation.de>
parents:
2440
diff
changeset
|
18 } |
1328
ab93960ac2fb
Added missing MapUtils class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
19 |
5676
f8409fbe3b88
Request maps from osm.intevation.de by another url and fix dpi handling
Andre Heinecke <aheinecke@intevation.de>
parents:
2440
diff
changeset
|
20 public static String getLegendGraphicUrl(String server, String layer, int dpi) { |
1328
ab93960ac2fb
Added missing MapUtils class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
21 if (server == null || layer == null) { |
ab93960ac2fb
Added missing MapUtils class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
22 return null; |
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 |
5676
f8409fbe3b88
Request maps from osm.intevation.de by another url and fix dpi handling
Andre Heinecke <aheinecke@intevation.de>
parents:
2440
diff
changeset
|
25 if (server.contains("osm.intevation.de")) { |
f8409fbe3b88
Request maps from osm.intevation.de by another url and fix dpi handling
Andre Heinecke <aheinecke@intevation.de>
parents:
2440
diff
changeset
|
26 // GetLegend is not implemented at osm.intevation.de |
f8409fbe3b88
Request maps from osm.intevation.de by another url and fix dpi handling
Andre Heinecke <aheinecke@intevation.de>
parents:
2440
diff
changeset
|
27 // This avoids an error in the print log |
f8409fbe3b88
Request maps from osm.intevation.de by another url and fix dpi handling
Andre Heinecke <aheinecke@intevation.de>
parents:
2440
diff
changeset
|
28 return null; |
f8409fbe3b88
Request maps from osm.intevation.de by another url and fix dpi handling
Andre Heinecke <aheinecke@intevation.de>
parents:
2440
diff
changeset
|
29 } |
1328
ab93960ac2fb
Added missing MapUtils class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
30 server = server.indexOf("?") >= 0 ? server : server + "?"; |
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 String url = GET_LEGEND_GRAPHIC_TEMPLATE; |
ab93960ac2fb
Added missing MapUtils class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
33 url = url.replace("${SERVER}", server); |
ab93960ac2fb
Added missing MapUtils class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
34 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
|
35 url = url + "×tamp=" + new Date().getTime(); |
5676
f8409fbe3b88
Request maps from osm.intevation.de by another url and fix dpi handling
Andre Heinecke <aheinecke@intevation.de>
parents:
2440
diff
changeset
|
36 if (dpi != -1) { |
f8409fbe3b88
Request maps from osm.intevation.de by another url and fix dpi handling
Andre Heinecke <aheinecke@intevation.de>
parents:
2440
diff
changeset
|
37 url+="&legend_options=dpi:" + dpi; |
f8409fbe3b88
Request maps from osm.intevation.de by another url and fix dpi handling
Andre Heinecke <aheinecke@intevation.de>
parents:
2440
diff
changeset
|
38 } |
1328
ab93960ac2fb
Added missing MapUtils class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
39 |
ab93960ac2fb
Added missing MapUtils class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
40 return url; |
ab93960ac2fb
Added missing MapUtils class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
41 } |
ab93960ac2fb
Added missing MapUtils class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
42 } |
ab93960ac2fb
Added missing MapUtils class from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
43 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |