1<%-- $HeadURL: svn+ssh://jwilden@svn.wald.intevation.org/deegree/apps/igeoportal-standard/branches/2.5_testing/scaleswitcherproxy.jsp $ --%> 2<%-- 3 This file is part of deegree, http://deegree.org/ 4 Copyright (C) 2001-2009 by: 5 - Department of Geography, University of Bonn - 6 and 7 - lat/lon GmbH - 8 9 This library is free software; you can redistribute it and/or modify it under 10 the terms of the GNU Lesser General Public License as published by the Free 11 Software Foundation; either version 2.1 of the License, or (at your option) 12 any later version. 13 This library is distributed in the hope that it will be useful, but WITHOUT 14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 15 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 16 details. 17 You should have received a copy of the GNU Lesser General Public License 18 along with this library; if not, write to the Free Software Foundation, Inc., 19 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 21 Contact information: 22 23 lat/lon GmbH 24 Aennchenstr. 19, 53177 Bonn 25 Germany 26 http://lat-lon.de/ 27 28 Department of Geography, University of Bonn 29 Prof. Dr. Klaus Greve 30 Postfach 1147, 53001 Bonn 31 Germany 32 http://www.geographie.uni-bonn.de/deegree/ 33 34 e-mail: info@deegree.org 35--%> 36<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %> 37<%@ page import="org.deegree.portal.standard.wms.control.ScaleSwitcherListener" %> 38<%@ page import="org.deegree.portal.PortalException" %> 39<% 40 //task represents the task just executed by the listener 41 String task = (String)request.getAttribute(ScaleSwitcherListener.TASK_FROM_LISTENER); 42%> 43<html> 44 <head> 45 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 46 <meta name="author" content="lat/lon GmbH" /> 47 <meta name="KeyWords" content="deegree iGeoPortal lat/lon" /> 48 <title>deegree iGeoPortal - scaleswitcherproxy</title> 49 <link href="css/deegree.css" rel="stylesheet" type="text/css" /> 50 <script language="JavaScript1.2" type="text/javascript"> 51 52 /** 53 * The method sets this document has the proxy of the HTML 54 * part of the ScaleSwitcher Module 55 */ 56 function registerProxy() { 57 parent.setProxy(document); 58<% 59 if (task != null) { 60 out.println("updateScaleSwitcher();"); 61 } 62%> 63 } 64 65 /** 66 * The method will either update the map of igeoportal or update the 67 * scaleValue depending on whether the listener calculated or new BBox or not 68 */ 69 function updateScaleSwitcher() { 70<% 71 if (ScaleSwitcherListener.FULL_EXTENT.equals(task)) {////listener requested callZoomToFullExtent 72 out.println("parent.setScale(-1);"); 73 //out.println("parent.callPaintNow();"); 74 out.println("parent.callZoomToFullExtent();"); 75 } else { 76 //actual scaleValue 77 Integer scaleInteger = (Integer)request.getAttribute( ScaleSwitcherListener.SCALE_VALUE ); 78 79 if ((scaleInteger != null) && (scaleInteger.intValue() > 0 )) { 80 out.println("var value ="+ scaleInteger.intValue()+";"); 81 //out.println("alert('value='+value);"); 82 out.println("parent.setScale(value);"); 83 } else { 84 out.println("parent.setScale(-1);"); 85 } 86 87 if ( ScaleSwitcherListener.NEW_BBOX.equals(task) ) { //listener calculated newBBox 88 double[] bbox = (double[])request.getAttribute( ScaleSwitcherListener.BBOX ); 89 if ( bbox != null ) { 90 out.println("var minx ="+ bbox[0]+";"); 91 out.println("var miny ="+ bbox[1]+";"); 92 out.println("var maxx ="+ bbox[2]+";"); 93 out.println("var maxy ="+ bbox[3]+";"); 94 out.println("parent.callUpdateMap(minx, miny, maxx, maxy);"); 95 } else { 96 //System.out.println("Unexpected: servlet bbox is null"); 97 throw new PortalException("Unexpected: servlet bbox is null"); 98 } 99 } else if (ScaleSwitcherListener.NEW_SCALE_VALUE.equals(task)) { //listener calculated newScaleValue 100 out.println("parent.callPaintNow();"); 101 } 102 } 103%> 104 } 105 </script> 106 </head> 107 <body onload="registerProxy()"> 108 <form action="" id="form" method="post"></form> 109 </body> 110</html> 111