| Line 530... |
Line 530... |
| 530 |
strokeWeight: 3,
|
530 |
strokeWeight: 3,
|
| 531 |
zIndex: 50,
|
531 |
zIndex: 50,
|
| 532 |
map: liveTrackingMap
|
532 |
map: liveTrackingMap
|
| 533 |
});
|
533 |
});
|
| 534 |
|
534 |
|
| 535 |
// Red dots for each GPS point
|
535 |
// Direction arrows for each GPS point
|
| 536 |
liveTrackingMap._gpsDots = [];
|
536 |
liveTrackingMap._gpsDots = [];
|
| 537 |
for (var gi = 0; gi < validPoints.length; gi++) {
|
537 |
for (var gi = 0; gi < validPoints.length; gi++) {
|
| 538 |
var gp = validPoints[gi];
|
538 |
var gp = validPoints[gi];
|
| - |
|
539 |
var heading = 0;
|
| - |
|
540 |
if (gi < validPoints.length - 1) {
|
| - |
|
541 |
heading = google.maps.geometry.spherical.computeHeading(
|
| - |
|
542 |
new google.maps.LatLng(gp.lat, gp.lng),
|
| - |
|
543 |
new google.maps.LatLng(validPoints[gi + 1].lat, validPoints[gi + 1].lng)
|
| - |
|
544 |
);
|
| - |
|
545 |
} else if (gi > 0) {
|
| - |
|
546 |
heading = google.maps.geometry.spherical.computeHeading(
|
| - |
|
547 |
new google.maps.LatLng(validPoints[gi - 1].lat, validPoints[gi - 1].lng),
|
| - |
|
548 |
new google.maps.LatLng(gp.lat, gp.lng)
|
| - |
|
549 |
);
|
| - |
|
550 |
}
|
| 539 |
var dot = new google.maps.Marker({
|
551 |
var dot = new google.maps.Marker({
|
| 540 |
position: { lat: gp.lat, lng: gp.lng },
|
552 |
position: { lat: gp.lat, lng: gp.lng },
|
| 541 |
map: liveTrackingMap,
|
553 |
map: liveTrackingMap,
|
| 542 |
icon: {
|
554 |
icon: {
|
| 543 |
path: google.maps.SymbolPath.CIRCLE,
|
555 |
path: google.maps.SymbolPath.FORWARD_CLOSED_ARROW,
|
| 544 |
scale: 4,
|
556 |
scale: 3,
|
| 545 |
fillColor: '#e74c3c',
|
557 |
fillColor: '#e74c3c',
|
| 546 |
fillOpacity: 1,
|
558 |
fillOpacity: 1,
|
| 547 |
strokeColor: '#b71c1c',
|
559 |
strokeColor: '#b71c1c',
|
| 548 |
strokeWeight: 1
|
560 |
strokeWeight: 1,
|
| - |
|
561 |
rotation: heading
|
| 549 |
},
|
562 |
},
|
| 550 |
zIndex: 80
|
563 |
zIndex: 80
|
| 551 |
});
|
564 |
});
|
| 552 |
(function(marker, point, idx) {
|
565 |
(function(marker, point, idx) {
|
| 553 |
var iw = new google.maps.InfoWindow({
|
566 |
var iw = new google.maps.InfoWindow({
|
| Line 597... |
Line 610... |
| 597 |
marker.addListener('click', function() { iw.open(liveTrackingMap, marker); });
|
610 |
marker.addListener('click', function() { iw.open(liveTrackingMap, marker); });
|
| 598 |
})(stopMarker, stop);
|
611 |
})(stopMarker, stop);
|
| 599 |
liveTrackingMap._stopMarkers.push(stopMarker);
|
612 |
liveTrackingMap._stopMarkers.push(stopMarker);
|
| 600 |
}
|
613 |
}
|
| 601 |
|
614 |
|
| 602 |
// Last known location marker
|
615 |
// Last known location marker (bike icon)
|
| 603 |
var lastPoint = pathCoords[pathCoords.length - 1];
|
616 |
var lastPoint = pathCoords[pathCoords.length - 1];
|
| 604 |
liveTrackingMap._currentMarker = new google.maps.Marker({
|
617 |
liveTrackingMap._currentMarker = new google.maps.Marker({
|
| 605 |
position: lastPoint,
|
618 |
position: lastPoint,
|
| 606 |
map: liveTrackingMap,
|
619 |
map: liveTrackingMap,
|
| 607 |
icon: {
|
620 |
icon: {
|
| 608 |
path: google.maps.SymbolPath.CIRCLE,
|
621 |
url: context + '/resources/images/Bike-Icon-SD.png',
|
| 609 |
scale: 10,
|
- |
|
| 610 |
fillColor: '#27ae60',
|
622 |
scaledSize: new google.maps.Size(40, 40),
|
| 611 |
fillOpacity: 1,
|
- |
|
| 612 |
strokeColor: '#ffffff',
|
623 |
anchor: new google.maps.Point(20, 20)
|
| 613 |
strokeWeight: 3
|
- |
|
| 614 |
},
|
624 |
},
|
| 615 |
title: 'Last Known Location',
|
625 |
title: 'Last Known Location',
|
| 616 |
zIndex: 999
|
626 |
zIndex: 999
|
| 617 |
});
|
627 |
});
|
| 618 |
var lastGp = validPoints[validPoints.length - 1];
|
628 |
var lastGp = validPoints[validPoints.length - 1];
|
| Line 660... |
Line 670... |
| 660 |
infoHtml += ' | Accuracy: <span class="label" style="' + accuracyBadge + ' color:white; padding:2px 8px; border-radius:3px; font-size:11px;">' + accuracyLabel + '</span> (' + avgAccuracy + 'm)';
|
670 |
infoHtml += ' | Accuracy: <span class="label" style="' + accuracyBadge + ' color:white; padding:2px 8px; border-radius:3px; font-size:11px;">' + accuracyLabel + '</span> (' + avgAccuracy + 'm)';
|
| 661 |
}
|
671 |
}
|
| 662 |
if (stopsDetected.length > 0) {
|
672 |
if (stopsDetected.length > 0) {
|
| 663 |
infoHtml += ' | <span style="color:#f39c12;"><i class="fa fa-pause-circle"></i></span> Stops: <strong>' + stopsDetected.length + '</strong>';
|
673 |
infoHtml += ' | <span style="color:#f39c12;"><i class="fa fa-pause-circle"></i></span> Stops: <strong>' + stopsDetected.length + '</strong>';
|
| 664 |
}
|
674 |
}
|
| 665 |
infoHtml += ' | <span style="color:#27ae60;"><i class="fa fa-circle"></i></span> Last Known';
|
675 |
infoHtml += ' | <img src="' + context + '/resources/images/Bike-Icon-SD.png" style="height:16px; vertical-align:middle;"> Last Known';
|
| 666 |
} else {
|
676 |
} else {
|
| 667 |
infoHtml += ' | <span style="color:#999;"><i class="fa fa-exclamation-triangle"></i> No GPS data yet</span>';
|
677 |
infoHtml += ' | <span style="color:#999;"><i class="fa fa-exclamation-triangle"></i> No GPS data yet</span>';
|
| 668 |
}
|
678 |
}
|
| 669 |
|
679 |
|
| 670 |
infoHtml += ' | <span style="color:#e74c3c;"><i class="fa fa-circle" style="font-size:8px;"></i></span> GPS Trail';
|
680 |
infoHtml += ' | <span style="color:#e74c3c;"><i class="fa fa-arrow-right" style="font-size:10px;"></i></span> GPS Trail';
|
| 671 |
if (visitCoords.length > 1) {
|
681 |
if (visitCoords.length > 1) {
|
| 672 |
infoHtml += ' | <span style="background:#8e44ad; display:inline-block; width:14px; height:3px; vertical-align:middle; margin:0 2px;"></span> Route';
|
682 |
infoHtml += ' | <span style="background:#8e44ad; display:inline-block; width:14px; height:3px; vertical-align:middle; margin:0 2px;"></span> Route';
|
| 673 |
}
|
683 |
}
|
| 674 |
infoHtml += ' | <span style="color:#999;">Updated: ' + timeStr + '</span>';
|
684 |
infoHtml += ' | <span style="color:#999;">Updated: ' + timeStr + '</span>';
|
| 675 |
|
685 |
|
| Line 690... |
Line 700... |
| 690 |
if (window.google && window.google.maps) {
|
700 |
if (window.google && window.google.maps) {
|
| 691 |
callback();
|
701 |
callback();
|
| 692 |
return;
|
702 |
return;
|
| 693 |
}
|
703 |
}
|
| 694 |
var s = document.createElement('script');
|
704 |
var s = document.createElement('script');
|
| 695 |
s.src = 'https://maps.googleapis.com/maps/api/js?key=AIzaSyAckO0y4Z6WhBOuMjNjioWLSYZDhGEvGBc&v=weekly';
|
705 |
s.src = 'https://maps.googleapis.com/maps/api/js?key=AIzaSyAckO0y4Z6WhBOuMjNjioWLSYZDhGEvGBc&libraries=geometry&v=weekly';
|
| 696 |
s.onload = callback;
|
706 |
s.onload = callback;
|
| 697 |
document.head.appendChild(s);
|
707 |
document.head.appendChild(s);
|
| 698 |
}
|
708 |
}
|
| 699 |
|
709 |
|
| 700 |
var liveTrackingUsername = '';
|
710 |
var liveTrackingUsername = '';
|