Skip to content

Commit

Permalink
api stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
drewtu2 committed Apr 23, 2017
1 parent 644e1a9 commit 1ddf8c5
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 22 deletions.
10 changes: 8 additions & 2 deletions static/css/mystyle.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,15 @@
body,html {
height:100%;
}

/*removes google logo from maps*/
a[href^="http://maps.google.com/maps"]{display:none !important}
a[href^="https://maps.google.com/maps"]{display:none !important}
a[href^="http://maps.google.com/maps"]{
display:none !important
}

a[href^="https://maps.google.com/maps"]{
display:none !important
}

.gmnoprint a, .gmnoprint span, .gm-style-cc {
display:none;
Expand Down
16 changes: 12 additions & 4 deletions static/js/Heatmap.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@
*/

var map;
var myLatLng
var myLatLng;

// Global Map only to be used in special occasions
var SuperSecretMap;

/*
* List of Friends
Expand Down Expand Up @@ -82,9 +85,9 @@
mapTypeId: google.maps.MapTypeId.ROADMAP
}
map = new google.maps.Map(document.getElementById("map_box"), myOptions);

SuperSecretMap = map;
addHeatmap(map);
setListMarkers(map, recList, "../images/wine.png");
//setListMarkers(map, recList, "../images/wine.png");
setListMarkers(map, friendList, "../images/friend.png");
//setMarker(map, testObj, "../images/friend.png")
}
Expand Down Expand Up @@ -135,6 +138,10 @@
}
}

function apiDropMarker(inObj) {
return setMarker(SuperSecretMap, inObj, "../images/wine.png");
}

function setMarker(map, inObj, imageUrl) {
console.log(inObj)
var markerPlace = {
Expand All @@ -146,6 +153,7 @@
position: inObj.location,
place: markerPlace,
map: map,
animation: google.maps.Animation.DROP,
icon: imageUrl
}
var marker = new google.maps.Marker(markerOptions)
Expand All @@ -160,6 +168,6 @@
marker.addListener('click', function() {
infoWindow.open(map, marker);
});

return marker
}

33 changes: 33 additions & 0 deletions static/js/notificationEvents.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
var recList = [{name:"Toscis", location:new google.maps.LatLng(42.363424, -71.099379)},
{name:"Ben and Jerys", location:new google.maps.LatLng(42.348133, -71.084497)},
{name:"JP Licks", location:new google.maps.LatLng(42.346997, -71.088657)}];
var count = 0;
var recMarkerList= []

function handleNotification(message){


if (message == "displayOn") {

} else if (message == "displayOff") {

} else if (message == "dropLocation") {
index = count
recMarkerList.push(apiDropMarker(recList[index]))

if (count == recList.length - 1){
count = 0;
} else{
count = count + 1;
}
} else if (message == "removeMarkers") {
setMapOnAll(null);
recMarkerList= []
}
}

function setMapOnAll(map) {
for (var i = 0; i < recList.length; i++) {
recMarkerList[i].setMap(map);
}
}
28 changes: 12 additions & 16 deletions templates/index.html
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
<script type="text/javascript"
src="https://maps.googleapis.com/maps/api/js?&libraries=visualization">
</script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/socket.io/1.3.6/socket.io.min.js"></script>
<script type="text/javascript" src="{{ url_for('static', filename='js/notificationEvents.js') }}"></script>
<script type="text/javascript" charset="utf-8">
console.log("HERE WE ARE");
var socket = io.connect('http://' + document.domain + ':' + location.port);
socket.on('channel-a', function(message) {
if (message == "displayOn") {

} else if (message == "displayOff") {

}
});
console.log("HERE WE ARE");
var socket = io.connect('http://' + document.domain + ':' + location.port);
socket.on('channel-a', function(message) {
handleNotification(message)
});
</script>

<!--
-->
Expand All @@ -35,13 +34,10 @@

<link rel="stylesheet"
href="{{ url_for('static', filename='css/mystyle.css') }}">

<script type="text/javascript"
src="https://maps.googleapis.com/maps/api/js?&libraries=visualization">
</script>
<script
src="{{ url_for('static', filename='data/filteredCrimeData.json') }}"></script>
<script src="{{ url_for('static', filename='js/Heatmap.js') }}"></script>

</head>

<body onload="javascript:initGeolocation()">
Expand All @@ -57,8 +53,8 @@

<div id="video">
<!-- Uncomment to allow background to be set -->
<img id="stream"
src="http://192.168.1.9:88/cgi-bin/CGIStream.cgi?cmd=GetMJStream&usr=nuvision&pwd=nuvision"></img>
<!--<img id="stream"
src="http://192.168.1.9:88/cgi-bin/CGIStream.cgi?cmd=GetMJStream&usr=nuvision&pwd=nuvision"></img>-->
</div>

<div class="container no-margin content full-height">
Expand Down

0 comments on commit 1ddf8c5

Please sign in to comment.