Strabon

changeset 1240:89d7b54da9b1

added additional handles:timemap and timemap(localhost) for displaying results on a timemap. TODO: only "localhost" options work now, fix the other ones (map, timemap)
author Konstantina Bereta <Konstantina.Bereta@di.uoa.gr>
date Mon Jul 29 23:13:43 2013 +0300 (2013-07-29)
parents 469141eefa5f
children 08dfd00b8324
files endpoint/WebContent/query.jsp endpoint/src/main/java/eu/earthobservatory/org/StrabonEndpoint/QueryBean.java
line diff
     1.1 --- a/endpoint/WebContent/query.jsp	Mon Jul 29 21:46:50 2013 +0300
     1.2 +++ b/endpoint/WebContent/query.jsp	Mon Jul 29 23:13:43 2013 +0300
     1.3 @@ -120,7 +120,7 @@
     1.4  	}
     1.5  
     1.6  	if (request.getAttribute("pathToKML") != null) {
     1.7 -	if ("map_local".equals(request.getAttribute("handle"))) {
     1.8 +	if ("map_local".equals(request.getAttribute("handle")) || ("timemap_local".equals(request.getAttribute("handle")))) {
     1.9  %>
    1.10  	<link href="http://code.google.com/apis/maps/documentation/javascript/examples/default.css" rel="stylesheet" type="text/css" />
    1.11  	<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false"></script>
    1.12 @@ -168,10 +168,13 @@
    1.13  						
    1.14  			// get KML filename
    1.15  			var kml = '<%=request.getAttribute("pathToKML")%>';
    1.16 -			
    1.17 +			var map;
    1.18  			// create map
    1.19 -			//var map = new google.maps.Map(document.getElementById("map"), myOptions);
    1.20 -			var map = tm.map;
    1.21 +			<%if(request.getAttribute("handle").toString().contains("timemap")){ %>	
    1.22 +			map = tm.map;
    1.23 +			<%} else {%>
    1.24 +			var map = new google.maps.Map(document.getElementById("map"), myOptions);
    1.25 +			<%}%>
    1.26  			<% if (request.getAttribute("pathToKML") == null) {%>
    1.27  				center at Brahames
    1.28  				map.setCenter(new google.maps.LatLng(37.92253, 23.72275));
    1.29 @@ -180,7 +183,7 @@
    1.30  			addListener(map);
    1.31  
    1.32  			
    1.33 -		<%if ("map_local".equals(request.getAttribute("handle"))) {%>
    1.34 +		<%if ("map_local".equals(request.getAttribute("handle")) || ("timemap_local".equals(request.getAttribute("handle")))) {%>
    1.35  			// display using geoxml3
    1.36  			var myParser = new geoXML3.parser({map: map});
    1.37  			myParser.parse(kml);			
    1.38 @@ -189,7 +192,8 @@
    1.39  			ctaLayer.setMap(map);
    1.40  		<%}%>
    1.41  		
    1.42 -		<%if ("map".equals(request.getAttribute("handle")) || "map_local".equals(request.getAttribute("handle"))) {%>	
    1.43 +		<%if (("map".equals(request.getAttribute("handle"))) || ("map_local".equals(request.getAttribute("handle")))
    1.44 +		|| ("timemap".equals(request.getAttribute("handle"))) || ("timemap_local".equals(request.getAttribute("handle")))) {%>	
    1.45  			$('html, body').animate({
    1.46  				scrollTop: $("#divResultsStart").offset().top
    1.47  			}, 1500);
    1.48 @@ -292,7 +296,7 @@
    1.49      <link href="js/timemap/examples.css" type="text/css" rel="stylesheet"/>
    1.50      <style>
    1.51      div#timelinecontainer{ height: 310px; }
    1.52 -    div#mapcontainer{ height: 300px; }
    1.53 +    div#mapcontainer{ height: 600px; }
    1.54      </style>
    1.55      
    1.56   	<!-- jQuery end -->
    1.57 @@ -447,6 +451,8 @@
    1.58  		<OPTION value="download"<%= ("download".equals(handle)) ? "selected":""%>>Download</OPTION>
    1.59  		<OPTION value="map"<%= ("map".equals(handle)) ? "selected":""%>>On a map</OPTION>
    1.60  		<OPTION value="map_local"<%= ("map_local".equals(handle)) ? "selected":""%>>On a map (localhost)</OPTION>
    1.61 +		<OPTION value="timemap"<%= ("timemap".equals(handle)) ? "selected":""%>>On a timemap</OPTION>
    1.62 +		<OPTION value="timemap_local"<%= ("timemap_local".equals(handle)) ? "selected":""%>>On a timemap (localhost)</OPTION>
    1.63  	</SELECT>
    1.64  	</td>
    1.65  </tr>
    1.66 @@ -487,7 +493,7 @@
    1.67  	<%}%>
    1.68  <%}}%>
    1.69  	<!-- Response -->
    1.70 -<% if (request.getAttribute("pathToKML") != null) { %>
    1.71 +<% if (request.getAttribute("pathToKML") != null && request.getAttribute("handle").toString().contains("timemap")) { %>
    1.72    <div id="timemap">
    1.73          <div id="timelinecontainer">
    1.74            <div id="timeline"></div>
    1.75 @@ -497,6 +503,7 @@
    1.76          </div>
    1.77      </div>
    1.78  <%}%>
    1.79 +          <div id="map"></div>
    1.80  <div id="divResultsEnd" style="height: 1px; width 1px"></div>
    1.81   <div id="chart_div"></div>
    1.82  </body>
     2.1 --- a/endpoint/src/main/java/eu/earthobservatory/org/StrabonEndpoint/QueryBean.java	Mon Jul 29 21:46:50 2013 +0300
     2.2 +++ b/endpoint/src/main/java/eu/earthobservatory/org/StrabonEndpoint/QueryBean.java	Mon Jul 29 23:13:43 2013 +0300
     2.3 @@ -270,7 +270,8 @@
     2.4  				    
     2.5  				    out.flush();
     2.6  				    
     2.7 -				} else if (("map".equals(handle) || "map_local".equals(handle)) && 
     2.8 +				} else if (("map".equals(handle) || "map_local".equals(handle) ||
     2.9 +				"timemap".equals(handle) || "timemap_local".equals(handle) ) && 
    2.10  						(queryResultFormat == stSPARQLQueryResultFormat.KML || 
    2.11  						 queryResultFormat == stSPARQLQueryResultFormat.KMZ) ) {
    2.12  					// show map (only valid for KML/KMZ)