comparison flys-client/src/main/java/de/intevation/flys/client/server/MapPrintServiceImpl.java @ 5622:b28a6d05e969

Add a new mechanism in mapfish print call to add arbitary data maps Data properties are identified by starting with mapfish-data and they are then split in info value pairs where info can be the description of the information and value the value of the information to be transported in the data map.
author Andre Heinecke <aheinecke@intevation.de>
date Tue, 09 Apr 2013 19:04:32 +0200
parents 6602be8ca685
children f8409fbe3b88
comparison
equal deleted inserted replaced
5621:bbc85c8f330a 5622:b28a6d05e969
259 mapType = "map"; 259 mapType = "map";
260 } 260 }
261 261
262 // Retrieve print settings from request 262 // Retrieve print settings from request
263 Map<String, Object> pageSpecs = new HashMap<String, Object>(); 263 Map<String, Object> pageSpecs = new HashMap<String, Object>();
264 Map<String, Object> data = new HashMap<String, Object>();
265 List<Object> payload = new ArrayList<Object>();
266 data.put("data", payload);
264 Enumeration<String> paramNames = req.getParameterNames(); 267 Enumeration<String> paramNames = req.getParameterNames();
265 while (paramNames.hasMoreElements()) { 268 while (paramNames.hasMoreElements()) {
266 String paramName = paramNames.nextElement(); 269 String paramName = paramNames.nextElement();
267 if (paramName.startsWith("mapfish-")) { 270 if (paramName.startsWith("mapfish-data-")) {
271 // You can add mapfish-data variables that will be mapped
272 // to a info value pairs to provide meta data for the map
273 String paramValue = req.getParameter(paramName);
274 if (paramValue != null && !paramValue.isEmpty()) {
275 Map<String, Object> data3 = new HashMap<String, Object>();
276 data3.put("info", paramName.substring(13));
277 data3.put("value", paramValue);
278 payload.add(data3);
279 }
280 } else if (paramName.startsWith("mapfish-")) {
268 String paramValue = req.getParameter(paramName); 281 String paramValue = req.getParameter(paramName);
269 pageSpecs.put(paramName.substring(8), paramValue); 282 pageSpecs.put(paramName.substring(8), paramValue);
270 } 283 }
284 }
285 if (!payload.isEmpty()) {
286 pageSpecs.put("data", data);
287 List<Object> columns = new ArrayList<Object>();
288 columns.add("info");
289 columns.add("value");
290 data.put("columns", columns);
271 } 291 }
272 292
273 String url = getURL(); 293 String url = getURL();
274 294
275 Document requestOut = 295 Document requestOut =

http://dive4elements.wald.intevation.org