diff flys-client/src/main/java/de/intevation/flys/client/shared/MapUtils.java @ 5676:f8409fbe3b88

Request maps from osm.intevation.de by another url and fix dpi handling
author Andre Heinecke <aheinecke@intevation.de>
date Fri, 12 Apr 2013 12:57:57 +0200
parents 661e3ae77c8a
children
line wrap: on
line diff
--- a/flys-client/src/main/java/de/intevation/flys/client/shared/MapUtils.java	Fri Apr 12 12:56:25 2013 +0200
+++ b/flys-client/src/main/java/de/intevation/flys/client/shared/MapUtils.java	Fri Apr 12 12:57:57 2013 +0200
@@ -13,18 +13,29 @@
     private MapUtils() {
     }
 
+    public static String getLegendGraphicUrl(String server, String layer) {
+        return getLegendGraphicUrl(server, layer, -1);
+    }
 
-    public static String getLegendGraphicUrl(String server, String layer) {
+    public static String getLegendGraphicUrl(String server, String layer, int dpi) {
         if (server == null || layer == null) {
             return null;
         }
 
+        if (server.contains("osm.intevation.de")) {
+            // GetLegend is not implemented at osm.intevation.de
+            // This avoids an error in the print log
+            return null;
+        }
         server = server.indexOf("?") >= 0 ? server : server + "?";
 
         String url = GET_LEGEND_GRAPHIC_TEMPLATE;
         url = url.replace("${SERVER}", server);
         url = url.replace("${LAYER}", layer);
         url = url + "&timestamp=" + new Date().getTime();
+        if (dpi != -1) {
+            url+="&legend_options=dpi:" + dpi;
+        }
 
         return url;
     }

http://dive4elements.wald.intevation.org