Strabon

changeset 1199:cbe4d2c6253b

strabon endpoint displays now the bounds of the map
author Kallirroi Dogani <kallirroi@di.uoa.gr>
date Tue Jul 09 21:14:06 2013 +0300 (2013-07-09)
parents faf2ee0185df
children 97c43139f15c
files endpoint/WebContent/WEB-INF/connection.properties endpoint/WebContent/query.jsp
line diff
     1.1 --- a/endpoint/WebContent/WEB-INF/connection.properties	Tue Jul 09 19:13:01 2013 +0300
     1.2 +++ b/endpoint/WebContent/WEB-INF/connection.properties	Tue Jul 09 21:14:06 2013 +0300
     1.3 @@ -1,6 +1,6 @@
     1.4 -hostname=manolee.di.uoa.gr
     1.5 +hostname=localhost
     1.6  port=5432
     1.7  dbengine=postgis
     1.8  password=postgres
     1.9 -dbname=DLRDemo-y3
    1.10 +dbname=endpoint
    1.11  username=postgres
     2.1 --- a/endpoint/WebContent/query.jsp	Tue Jul 09 19:13:01 2013 +0300
     2.2 +++ b/endpoint/WebContent/query.jsp	Tue Jul 09 21:14:06 2013 +0300
     2.3 @@ -123,12 +123,40 @@
     2.4  	<link href="http://code.google.com/apis/maps/documentation/javascript/examples/default.css" rel="stylesheet" type="text/css" />
     2.5  	<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false"></script>
     2.6  	<script type="text/javascript">
     2.7 +		
     2.8 +		//listener for the event 'bounds_changed'
     2.9 +		function addListener(map){
    2.10 +			
    2.11 +			google.maps.event.addListener(map, 'bounds_changed', function() {
    2.12 +			    // get the new bounds
    2.13 +				var bounds = map.getBounds();
    2.14 +			    var northEast = bounds.getNorthEast();
    2.15 +			    var southWest = bounds.getSouthWest();
    2.16 +			    
    2.17 +			    var x1 = northEast.lng().toFixed(2);
    2.18 +				var y1 = northEast.lat().toFixed(2);
    2.19 +				
    2.20 +				var x2 = southWest.lng().toFixed(2);
    2.21 +				var y2 = southWest.lat().toFixed(2);
    2.22 +				
    2.23 +				var polygon = "\"POLYGON((" +
    2.24 +				x1 + " " + y2 + ", " +
    2.25 +				x2 + " " + y2 + ", " +
    2.26 +				x2 + " " + y1 + ", " +
    2.27 +				x1 + " " + y1 + ", " +
    2.28 +				x1 + " " + y2 + "))\"";
    2.29 +			 
    2.30 +			    document.getElementById('bounds').value=polygon;
    2.31 +			    
    2.32 +			  });	
    2.33 +		}
    2.34 +	
    2.35  		function initialize() {
    2.36  			var myOptions = {
    2.37  				zoom: 11,
    2.38  				mapTypeId: google.maps.MapTypeId.ROADMAP
    2.39  			};
    2.40 -			
    2.41 +						
    2.42  			// get KML filename
    2.43  			var kml = '<%=request.getAttribute("pathToKML")%>';
    2.44  			
    2.45 @@ -138,12 +166,14 @@
    2.46  				// center at Brahames
    2.47  				map.setCenter(new google.maps.LatLng(37.92253, 23.72275));
    2.48  			<%}%>
    2.49 +		
    2.50 +			addListener(map);
    2.51 +
    2.52  			
    2.53  		<%if ("map_local".equals(request.getAttribute("handle"))) {%>
    2.54  			// display using geoxml3
    2.55  			var myParser = new geoXML3.parser({map: map});
    2.56 -			myParser.parse(kml);
    2.57 -			
    2.58 +			myParser.parse(kml);			
    2.59  		<%} else {%>
    2.60  			var ctaLayer = new google.maps.KmlLayer(kml);
    2.61  			ctaLayer.setMap(map);
    2.62 @@ -153,7 +183,10 @@
    2.63  			$('html, body').animate({
    2.64  				scrollTop: $("#divResultsStart").offset().top
    2.65  			}, 1500);
    2.66 +			
    2.67  		<%}%>
    2.68 +		
    2.69 +		
    2.70  		}
    2.71  	</script>
    2.72  	<%	} else { %>
    2.73 @@ -358,12 +391,21 @@
    2.74  	</td>
    2.75  </tr>
    2.76  
    2.77 +<tr>
    2.78 +	<td id="output">Map Bounds:</td>
    2.79 +	<td id="output">
    2.80 +		<textarea readonly id='bounds' rows="1" cols="100"></textarea>
    2.81 +	</td>
    2.82 +</tr>
    2.83 +
    2.84  <tr>	
    2.85  <td colspan=2 id="output"><br/><center>
    2.86  <input type="submit" title="execute query" value="Query" name="submit" style="width: 350px" />
    2.87  <input type="submit" title="execute update" value="Update" name="submit" style="width: 350px"/></center><br/></td>
    2.88  </tr>
    2.89  
    2.90 +
    2.91 +
    2.92  <% if (request.getAttribute("error") != null) {%>
    2.93  	<!-- Error Message -->
    2.94  	<TR>