diff flys-client/src/main/java/de/intevation/flys/client/server/MapPrintServiceImpl.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 b28a6d05e969
children 413798463dfe
line wrap: on
line diff
--- a/flys-client/src/main/java/de/intevation/flys/client/server/MapPrintServiceImpl.java	Fri Apr 12 12:56:25 2013 +0200
+++ b/flys-client/src/main/java/de/intevation/flys/client/server/MapPrintServiceImpl.java	Fri Apr 12 12:57:57 2013 +0200
@@ -11,7 +11,6 @@
 import de.intevation.artifacts.httpclient.http.response.DocumentResponseHandler;
 import de.intevation.flys.client.shared.MapUtils;
 import de.intevation.flys.client.shared.model.MapConfig;
-import de.intevation.flys.client.client.FLYSConstants;
 
 import java.io.IOException;
 import java.io.InputStream;
@@ -107,7 +106,10 @@
             List<Object> subLayers = new ArrayList<Object>(1);
             subLayers.add(layers);
             layer.put("layers", subLayers);
-            layer.put("baseURL", url);
+            // XXX: osm.intevation.de mapache only offers low dpi maps
+            // so we need to use the uncached service
+            layer.put("baseURL", url.replace("http://osm.intevation.de/mapcache/?",
+                        "http://osm.intevation.de/cgi-bin/germany.fcgi?"));
             layer.put("format", "image/png"); // TODO: Make configurable.
 
             return layer;
@@ -129,12 +131,12 @@
         Map<String, Object> pageSpecs
     ) {
         Map<String, Object> spec = new LinkedHashMap<String, Object>();
+        int dpi = 254;
         spec.put("layout",       "A4 landscape");
         spec.put("pageSize",     "A4");
-        spec.put("landscape",    "false");
-        spec.put("title",        "FLYS Druck");
+        spec.put("landscape",    "true");
         spec.put("srs",          "EPSG:" + mapConfig.getSrid());
-        spec.put("dpi",          Integer.valueOf(254));
+        spec.put("dpi",          dpi);
         spec.put("units",        "m");
         spec.put("geodaetic",    "true");
         spec.put("outputFormat", "pdf");
@@ -202,7 +204,7 @@
             Map<String, Object> legend = new LinkedHashMap<String, Object>();
             List<Object> classes = new ArrayList<Object>(1);
             Map<String, Object> clazz = new LinkedHashMap<String, Object>();
-            String lgu = MapUtils.getLegendGraphicUrl(layer.url, layer.layers);
+            String lgu = MapUtils.getLegendGraphicUrl(layer.url, layer.layers, dpi);
             clazz.put("icon", lgu);
             clazz.put("name", layer.description);
             classes.add(clazz);

http://dive4elements.wald.intevation.org