Changeset 18619 in osm for applications/editors/josm/wmsadapter/orthofotos-bern/src
- Timestamp:
- 2009-11-15T13:51:33+01:00 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/wmsadapter/orthofotos-bern/src/ch/guggis/josm/bern/servlet/OrthofotoBernWMSAdapter.java
r16752 r18619 83 83 static public final String DEFAULT_URL_GEN_SESSION_ID2 = "http://www.stadtplan.bern.ch/TBInternet/WebMapPageLV.aspx"; 84 84 85 /**86 * the default URL to enter Berns map application. The session ID is87 * retrieved from this URL88 */89 static public final String DEFAULT_URL_MAP_APP_ENTRY = "http://www.stadtplan.bern.ch/TBInternet/WebTitlePage.aspx";90 // static public final String DEFAULT_URL_MAP_APP_ENTRY =91 // "http://www.stadtplan.bern.ch/TBInternet/WebMapPageLV.aspx";92 93 /** the default URL to retrieve map tiles from Berns map application */94 static public final String DEFAULT_URL_MAP_REQUESTS = "http://www.stadtplan.bern.ch/TBInternet/WebMapServer.aspx?VERSION=1.0.0&REQUEST=GETMAP&TYPE=11&LAYERS=TBI_orthofoto_08.mwf&FORMAT=image/jpeg&EXCEPTIONS=image/jpeg";95 96 85 /** the logger */ 97 private static Logger logger = Logger 98 .getLogger(OrthofotoBernWMSAdapter.class.getName()); 86 private static Logger logger = Logger.getLogger(OrthofotoBernWMSAdapter.class.getName()); 99 87 100 88 HashMap<String, String> cityMapSessionCookies = new HashMap<String, String>(); 101 89 90 static private final String DEFAULT_LAYER = "TBI_orthofoto_08.mwf"; 91 private String layer = DEFAULT_LAYER; 92 102 93 /** 103 94 * remembers session cookie retrieved from Berns map server … … 312 303 } 313 304 305 protected String buildDefaultUrlForMapRequests() { 306 StringBuffer sb = new StringBuffer(); 307 sb.append("http://www.stadtplan.bern.ch/TBInternet/WebMapServer.aspx?"); 308 sb.append("VERSION=1.0.0").append("&"); 309 sb.append("REQUEST=GETMAP").append("&"); 310 sb.append("TYPE=11").append("&"); 311 sb.append("LAYERS=").append(layer).append("&"); 312 sb.append("FORMAT=image/jpeg").append("&"); 313 sb.append("EXCEPTIONS=image/jpeg"); 314 return sb.toString(); 315 } 316 314 317 /** 315 318 * handles a tile request … … 376 379 // 377 380 StringBuffer sb = new StringBuffer(); 378 sb.append( DEFAULT_URL_MAP_REQUESTS);381 sb.append(buildDefaultUrlForMapRequests()); 379 382 sb.append("&WIDTH="); 380 383 sb.append(width); … … 437 440 } 438 441 442 protected String buildConfigurationForm(HttpServletRequest req) { 443 StringBuffer sb = new StringBuffer(); 444 sb.append("<html><head></head><body>").append("\n"); 445 sb.append("<h1>WMS Adapter for Orthofots of Bern</h1>").append("\n"); 446 sb.append("Please open <a href=\"http://www.stadtplan.bern.ch/TBInternet/default.aspx?User=1\">the city map of Bern</a> in your browser.</br>").append("\n"); 447 sb.append("Then lookup the cookie <strong>ASP.Net_SessionId</strong> for domain <strong>www.stadtplan.bern.ch</strong> in your browser and enter it in the form below.</br>").append("\n"); 448 sb.append("<form action=\"").append(req.getRequestURL()).append("\">").append("\n"); 449 sb.append("<input type=\"hidden\" name=\"action\" value=\"set-session-id\">").append("\n"); 450 sb.append("Session ID: <input type=\"text\" name=\"session-id\" value=\"\"><br/>").append("\n"); 451 sb.append("Select a layer:<br/>").append("\n"); 452 String checked; 453 if (layer == null || layer.equals("TBI_orthofoto_08.mwf")) { 454 checked=" checked "; 455 } else { 456 checked = ""; 457 } 458 sb.append("<input type=\"radio\" name=\"layer\" value=\"TBI_orthofoto_08.mwf\"").append(checked).append(">Luftbilder 2008 Stadt Bern<br>").append("\n"); 459 if (layer != null && layer.equals("orthofoto_Regio_08.mwf")) { 460 checked=" checked "; 461 } else { 462 checked = ""; 463 } 464 sb.append("<input type=\"radio\" name=\"layer\" value=\"orthofoto_Regio_08.mwf\"").append(checked).append(">Luftbilder 2008 Region Bern<br>").append("\n"); 465 sb.append("<input type=\"submit\" value=\"Submit\">").append("\n"); 466 sb.append("</form").append("\n"); 467 sb.append("</body></html>").append("\n"); 468 return sb.toString(); 469 470 } 439 471 protected void renderSessionIDInputForm(HttpServletRequest req, 440 472 HttpServletResponse resp) throws IOException { 441 String msg = "<html><head></head><body>\n"442 + "<h1>WMS Adapter for Orthofots of Bern</h1>"443 + "Please open <a href=\"http://www.stadtplan.bern.ch/TBInternet/default.aspx?User=1\">the city map of Bern</a> in your browser.</br>"444 + "Then lookup the cookie <strong>ASP.Net_SessionId</strong> for domain <strong>www.stadtplan.bern.ch</strong> in your browser and enter it in the form below.</br>\n"445 + "<form action=\""446 + req.getRequestURL()447 + "\">\n"448 + "<input type=\"hidden\" name=\"action\" value=\"set-session-id\">\n"449 + "<input type=\"text\" name=\"session-id\" value=\"\">\n"450 + "<input type=\"submit\" value=\"Submit\">\n" + "</form>\n"451 + "</body></html>";452 453 473 PrintWriter pw = new PrintWriter(resp.getWriter()); 454 pw.println( msg);474 pw.println(buildConfigurationForm(req)); 455 475 } 456 476 … … 460 480 if (req.getParameter("session-id") == null) { 461 481 throw new MissingParameterException("session-id"); 482 } 483 if (req.getParameter("layer") != null) { 484 layer = req.getParameter("layer"); 485 } else { 486 layer = DEFAULT_LAYER; 462 487 } 463 488
Note:
See TracChangeset
for help on using the changeset viewer.