Mercurial > dive4elements > river
comparison 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 |
comparison
equal
deleted
inserted
replaced
5675:10aac4ec2d76 | 5676:f8409fbe3b88 |
---|---|
9 import de.intevation.artifacts.httpclient.http.HttpClient; | 9 import de.intevation.artifacts.httpclient.http.HttpClient; |
10 import de.intevation.artifacts.httpclient.http.HttpClientImpl; | 10 import de.intevation.artifacts.httpclient.http.HttpClientImpl; |
11 import de.intevation.artifacts.httpclient.http.response.DocumentResponseHandler; | 11 import de.intevation.artifacts.httpclient.http.response.DocumentResponseHandler; |
12 import de.intevation.flys.client.shared.MapUtils; | 12 import de.intevation.flys.client.shared.MapUtils; |
13 import de.intevation.flys.client.shared.model.MapConfig; | 13 import de.intevation.flys.client.shared.model.MapConfig; |
14 import de.intevation.flys.client.client.FLYSConstants; | |
15 | 14 |
16 import java.io.IOException; | 15 import java.io.IOException; |
17 import java.io.InputStream; | 16 import java.io.InputStream; |
18 import java.io.OutputStream; | 17 import java.io.OutputStream; |
19 import java.io.UnsupportedEncodingException; | 18 import java.io.UnsupportedEncodingException; |
105 | 104 |
106 layer.put("type", "WMS"); | 105 layer.put("type", "WMS"); |
107 List<Object> subLayers = new ArrayList<Object>(1); | 106 List<Object> subLayers = new ArrayList<Object>(1); |
108 subLayers.add(layers); | 107 subLayers.add(layers); |
109 layer.put("layers", subLayers); | 108 layer.put("layers", subLayers); |
110 layer.put("baseURL", url); | 109 // XXX: osm.intevation.de mapache only offers low dpi maps |
110 // so we need to use the uncached service | |
111 layer.put("baseURL", url.replace("http://osm.intevation.de/mapcache/?", | |
112 "http://osm.intevation.de/cgi-bin/germany.fcgi?")); | |
111 layer.put("format", "image/png"); // TODO: Make configurable. | 113 layer.put("format", "image/png"); // TODO: Make configurable. |
112 | 114 |
113 return layer; | 115 return layer; |
114 } | 116 } |
115 | 117 |
127 Double minX, Double minY, | 129 Double minX, Double minY, |
128 Double maxX, Double maxY, | 130 Double maxX, Double maxY, |
129 Map<String, Object> pageSpecs | 131 Map<String, Object> pageSpecs |
130 ) { | 132 ) { |
131 Map<String, Object> spec = new LinkedHashMap<String, Object>(); | 133 Map<String, Object> spec = new LinkedHashMap<String, Object>(); |
134 int dpi = 254; | |
132 spec.put("layout", "A4 landscape"); | 135 spec.put("layout", "A4 landscape"); |
133 spec.put("pageSize", "A4"); | 136 spec.put("pageSize", "A4"); |
134 spec.put("landscape", "false"); | 137 spec.put("landscape", "true"); |
135 spec.put("title", "FLYS Druck"); | |
136 spec.put("srs", "EPSG:" + mapConfig.getSrid()); | 138 spec.put("srs", "EPSG:" + mapConfig.getSrid()); |
137 spec.put("dpi", Integer.valueOf(254)); | 139 spec.put("dpi", dpi); |
138 spec.put("units", "m"); | 140 spec.put("units", "m"); |
139 spec.put("geodaetic", "true"); | 141 spec.put("geodaetic", "true"); |
140 spec.put("outputFormat", "pdf"); | 142 spec.put("outputFormat", "pdf"); |
141 | 143 |
142 spec.putAll(pageSpecs); | 144 spec.putAll(pageSpecs); |
200 | 202 |
201 for (Layer layer: ls) { | 203 for (Layer layer: ls) { |
202 Map<String, Object> legend = new LinkedHashMap<String, Object>(); | 204 Map<String, Object> legend = new LinkedHashMap<String, Object>(); |
203 List<Object> classes = new ArrayList<Object>(1); | 205 List<Object> classes = new ArrayList<Object>(1); |
204 Map<String, Object> clazz = new LinkedHashMap<String, Object>(); | 206 Map<String, Object> clazz = new LinkedHashMap<String, Object>(); |
205 String lgu = MapUtils.getLegendGraphicUrl(layer.url, layer.layers); | 207 String lgu = MapUtils.getLegendGraphicUrl(layer.url, layer.layers, dpi); |
206 clazz.put("icon", lgu); | 208 clazz.put("icon", lgu); |
207 clazz.put("name", layer.description); | 209 clazz.put("name", layer.description); |
208 classes.add(clazz); | 210 classes.add(clazz); |
209 legend.put("classes", classes); | 211 legend.put("classes", classes); |
210 legend.put("name", layer.description); | 212 legend.put("name", layer.description); |