Skip to content

Commit

Permalink
added icons
Browse files Browse the repository at this point in the history
  • Loading branch information
Nick Davis committed Mar 7, 2013
1 parent 08d4aac commit b37effa
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
Binary file modified .DS_Store
Binary file not shown.
Binary file added where/assets/carmen_icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added where/assets/waldo_icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 8 additions & 6 deletions where/where.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ var redBranchBraintree = [];
var markers = [];
var results;
var infowindow = new google.maps.InfoWindow();
var distanceWindow = new google.maps.InfoWindow();
var places;

var C_W = [];
Expand Down Expand Up @@ -88,8 +89,7 @@ function drawW_C(map)

for(var i = 0; i < obj.length; i++) {
lat = obj[i].loc.latitude;
lon = obj[i].loc.longitude;
find_waldo(userLat, userLng, lat, lon);
lon = obj[i].loc.longitude;
if(obj[i].name == "Waldo"){
pt = new google.maps.LatLng(lat, lon);
C_W.push(new google.maps.Marker({position: pt, title: "Waldo", icon: "assets/waldo_icon.png"}));
Expand All @@ -98,6 +98,11 @@ function drawW_C(map)
pt = new google.maps.LatLng(lat, lon);
C_W.push(new google.maps.Marker({position: pt, title: "Carmen Sandiego", icon: "assets/carmen_icon.png"}));
}
var dist = find_waldo(userLat, userLng, lat, lon);
name = this.name;
content = 'Distance to ' + name + ' is: ' + dist
distanceWindow.setContent(content);
distanceWindow.open(map, pt);
}
for (var m in C_W) {
C_W[m].setMap(map);
Expand Down Expand Up @@ -302,7 +307,6 @@ function find_closest_marker(userLat, userLng)
closest = i;
}
}
console.log(closest);
try {
realTime.open("GET", "http://mbtamap-cedar.herokuapp.com/mapper/redline.json", true);
} catch (error) {}
Expand All @@ -313,7 +317,6 @@ function find_closest_marker(userLat, userLng)
{
if(realTime.readyState == 4 && realTime.status == 200)
{
console.log(markers[closest].title);
content = "CLOSEST STATION: " + markers[closest].title;
results = JSON.parse(realTime.responseText);
if (results.length > 0) {
Expand Down Expand Up @@ -354,7 +357,6 @@ function find_waldo(userLat, userLng, wcLat, wcLong)
var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));
var d = R * c;
distances = d;
alert("The distance between you and carmen/waldo is: " + distances);

return distances;
}

0 comments on commit b37effa

Please sign in to comment.