comparison flys-client/src/main/java/de/intevation/flys/client/server/MapPrintServiceImpl.java @ 4473:6db783627137

Map print does now submit additional parameters to MapPrintServiceImpl.
author Christian Lins <christian.lins@intevation.de>
date Sat, 10 Nov 2012 23:47:38 +0100
parents dc7e41efd5ba
children bd78d2b0e309
comparison
equal deleted inserted replaced
4472:dc7e41efd5ba 4473:6db783627137
17 import java.io.OutputStream; 17 import java.io.OutputStream;
18 import java.io.UnsupportedEncodingException; 18 import java.io.UnsupportedEncodingException;
19 import java.net.URLEncoder; 19 import java.net.URLEncoder;
20 import java.util.ArrayList; 20 import java.util.ArrayList;
21 import java.util.Collections; 21 import java.util.Collections;
22 import java.util.HashMap;
22 import java.util.LinkedHashMap; 23 import java.util.LinkedHashMap;
23 import java.util.List; 24 import java.util.List;
24 import java.util.Map; 25 import java.util.Map;
25 26
26 import javax.servlet.ServletException; 27 import javax.servlet.ServletException;
120 121
121 protected static String generateSpec( 122 protected static String generateSpec(
122 Document descDocument, 123 Document descDocument,
123 MapConfig mapConfig, 124 MapConfig mapConfig,
124 Double minX, Double minY, 125 Double minX, Double minY,
125 Double maxX, Double maxY 126 Double maxX, Double maxY,
127 Map<String, Object> settings
126 ) { 128 ) {
127 Map<String, Object> spec = new LinkedHashMap<String, Object>(); 129 Map<String, Object> spec = new LinkedHashMap<String, Object>();
128 spec.put("layout", "A4 portrait"); 130 spec.put("layout", "A4 portrait");
129 spec.put("title", "FLYS Druck"); 131 spec.put("title", "FLYS Druck");
130 spec.put("srs", "EPSG:" + mapConfig.getSrid()); 132 spec.put("srs", "EPSG:" + mapConfig.getSrid());
181 */ 183 */
182 184
183 page.put("mapTitle", "FLYS Karte"); 185 page.put("mapTitle", "FLYS Karte");
184 page.put("comment", "Eine mit FLYS gedruckte Karte."); 186 page.put("comment", "Eine mit FLYS gedruckte Karte.");
185 page.put("rotation", Integer.valueOf(0)); 187 page.put("rotation", Integer.valueOf(0));
188
189 // This may overwrite default settings above
190 page.putAll(settings);
186 191
187 pages.add(page); 192 pages.add(page);
188 spec.put("pages", pages); 193 spec.put("pages", pages);
189 194
190 List<Object> legends = new ArrayList<Object>(layers.size()); 195 List<Object> legends = new ArrayList<Object>(layers.size());
248 253
249 if (mapType == null || !mapType.equals("floodmap")) { 254 if (mapType == null || !mapType.equals("floodmap")) {
250 mapType = "map"; 255 mapType = "map";
251 } 256 }
252 257
258 // Retrieve print settings from request
259 Map<String, Object> settings = new HashMap<String, Object>();
260 String pageTitle = req.getParameter("page-title");
261 settings.put("mapTitle", pageTitle);
262
253 String url = getURL(); 263 String url = getURL();
254 264
255 Document requestOut = 265 Document requestOut =
256 ClientProtocolUtils.newOutCollectionDocument( 266 ClientProtocolUtils.newOutCollectionDocument(
257 uuid, mapType, mapType); 267 uuid, mapType, mapType);
312 322
313 String spec = generateSpec( 323 String spec = generateSpec(
314 descDocument, 324 descDocument,
315 mapConfig, 325 mapConfig,
316 minX, minY, 326 minX, minY,
317 maxX, maxY); 327 maxX, maxY,
328 settings);
318 329
319 if (log.isDebugEnabled()) { 330 if (log.isDebugEnabled()) {
320 log.debug("Generated spec:"); 331 log.debug("Generated spec:");
321 log.debug(spec); 332 log.debug(spec);
322 //System.err.println(spec); 333 //System.err.println(spec);

http://dive4elements.wald.intevation.org