diff --git a/tomcat/webapps/Trawl/index.jsp b/tomcat/webapps/Trawl/index.jsp index b68baf8e00cfd36a1343525346d3d7c30a6e966c..5ce74032f21d76e354841e7e89782a5e6dda87c8 100644 --- a/tomcat/webapps/Trawl/index.jsp +++ b/tomcat/webapps/Trawl/index.jsp @@ -1,8 +1,3 @@ -<%@ page import="java.util.*" %> -<!-- -Double Handle Slider Modified from: http://jqueryui.com/slider/#range ---> - <!DOCTYPE html> <html lang="en"> <head> diff --git a/tomcat/webapps/Trawl/infoWindow.js b/tomcat/webapps/Trawl/infoWindow.js index 5f48cdb4e919799efe6a646f1e0f2eafaece64e9..69cb16c750862f436614f2808c6541764b5a5cbc 100644 --- a/tomcat/webapps/Trawl/infoWindow.js +++ b/tomcat/webapps/Trawl/infoWindow.js @@ -3,56 +3,49 @@ // Displays markers on a map centred at the Laurentian Great Lakes // When the user clicks the marker, an info window opens +var openWindow; <<<<<<< HEAD -function initInfo(lati, longi,info) { - for(var i=0; i < lati.length; i++){ - - // Generate map centred at Great Lakes - var map = new google.maps.Map(document.getElementById('map'), { - zoom: 5.5, - center: {lat: 45.0349575, lng: -88.6941305}; - }); - +function initInfo(lati, longi,name, date, individualCount) { ======= + + function initInfo(lati, longi,name, date, count ) { console.log("Trying to gen. info map"); +>>>>>>> origin/web // Generate map centred at Great Lakes var map = new google.maps.Map(document.getElementById('map'), { zoom: 5.5, - center: {lat: 45.0349575, lng: -88.6941305} + center: {lat: 45.0349575, lng: -88.6941305} }); console.log("Gened info map"); + setMarkers(map, lati, longi,name, date, individualCount); +} ->>>>>>> d1f7464b4ffda020ccd6a1dc06a4f3b8386384ee // Set info window contents to input string +function setMarkers(map, lati, longi,name, date, individualCount) { + for (var i = 0; i < lati.length; i++) + { + var marker = new google.maps.Marker({position: new google.maps.LatLng(lati[i], longi[i]), map: map}); + // var content = "point numero" + i; + var content = '<div>' + + 'Name:' + name[i] + + '<br>Date:' + findMonth(date[i].month) + ' ' + date[i].day + ', ' + date[i].year + + '<br>Count:' + individualCount[i] + '</div></div>'; + var infowindow = new google.maps.InfoWindow(); + + google.maps.event.addListener(marker,'click', (function(marker,content,infowindow){ + return function() { + console.log("Clicked!!!!"); + if (openWindow) + openWindow.close(); + infowindow.setContent(content); + openWindow = infowindow; + infowindow.open(map,marker); + }; + })(marker,content,infowindow)); + console.log(i); + } +} - var infowindow = new google.maps.InfoWindow(); - var marker, i; - for (i = 0; i < lati.length; i++) { - marker = new google.maps.Marker({ - position: new google.maps.LatLng(lati[i], longi[i]), - map: map - }); - - - google.maps.event.addListener(marker, 'click', (function (marker, i) { - return function () { - infowindow.setContent('<div id=“contentâ€>' + - '<div id=“siteNoticeâ€>' + - '</div>' + - '<h1 id=“firstHeading†class=“firstHeadingâ€>' + name[i] + '</h1>' + - '<div id=“bodyContentâ€>' + - '<p><b>Name: </b>' + name[i] + '</p>' + - '<p><b>Date: </b>' + findMonth(date[i].month) + ' ' + date[i].day + ', ' + date[i].year + '</p>' + - '<p><b>Count: </b>' + count[i] + '</p>' + - '</div>' + - '</div>'); - infowindow.open(map, marker); - } - })(marker, i)); - - console.log("Plotted" + i + " markers"); - } -} \ No newline at end of file diff --git a/tomcat/webapps/Trawl/script.js b/tomcat/webapps/Trawl/script.js index 7f9087918f7babc95b589f0cb41297cf51663e23..35aa1c52040c0073b194f77d0564b39e74bde88a 100644 --- a/tomcat/webapps/Trawl/script.js +++ b/tomcat/webapps/Trawl/script.js @@ -1,4 +1,4 @@ -<<<<<<< HEAD + // Initialization function init() { callUpdateSci({id:"pickAnimalia", value:2}); // Propagate Dropdowns on Startup @@ -479,7 +479,7 @@ function reqMap(params){ if (xhr.readyState == XMLHttpRequest.DONE && xhr.status == 200) { var nodeList = JSON.parse(this.responseText); console.log(nodeList); - initInfo(nodeList["latitude"], nodeList["longitude"], nodeList["name"], nodeList["date"], nodeList["individual count"]); + initInfo(nodeList["latitude"], nodeList["longitude"], nodeList["name"], nodeList["date"], nodeList["individualCount"]); } else { console.log("Server Response: Error"); //RME @@ -564,5 +564,3 @@ $( function() { $( "#fromtoYear" ).html($( "#slider-range" ).slider( "values", 0 ) + " - " + $( "#slider-range" ).slider( "values", 1 )) } ); ->>>>>>> d1f7464b4ffda020ccd6a1dc06a4f3b8386384ee -window.onload=init; \ No newline at end of file