|
|
@ -5,6 +5,7 @@ |
|
|
|
{{ super() }} |
|
|
|
{{ super() }} |
|
|
|
<link rel="stylesheet" href="{{ url_for('static', filename='assets/leaflet/leaflet.css') }}" /> |
|
|
|
<link rel="stylesheet" href="{{ url_for('static', filename='assets/leaflet/leaflet.css') }}" /> |
|
|
|
<script src="{{ url_for('static', filename='assets/leaflet/leaflet.js') }}"></script> |
|
|
|
<script src="{{ url_for('static', filename='assets/leaflet/leaflet.js') }}"></script> |
|
|
|
|
|
|
|
<script src="{{ url_for('static', filename='assets/leaflet/utils.js') }}"></script> |
|
|
|
{% endblock %} |
|
|
|
{% endblock %} |
|
|
|
|
|
|
|
|
|
|
|
{% block app_content %} |
|
|
|
{% block app_content %} |
|
|
@ -76,47 +77,15 @@ |
|
|
|
<script type="text/javascript" , crossorigin="anonymous"> |
|
|
|
<script type="text/javascript" , crossorigin="anonymous"> |
|
|
|
// Leaflet Map |
|
|
|
// Leaflet Map |
|
|
|
'{% set last_location = player.last_location() %}' |
|
|
|
'{% set last_location = player.last_location() %}' |
|
|
|
var map = L.map('map', { |
|
|
|
map = getMap() |
|
|
|
center: ['{{ last_location.latitude or 52.2 }}', '{{ last_location.longitude or 5.3 }}'], |
|
|
|
|
|
|
|
minZoom: 6, |
|
|
|
|
|
|
|
maxZoom: 18, |
|
|
|
|
|
|
|
bounds: [ |
|
|
|
|
|
|
|
[50.5, 3.25], |
|
|
|
|
|
|
|
[54, 7.6] |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
zoom: 9 |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
L.control.scale().addTo(map); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
L.tileLayer( |
|
|
|
|
|
|
|
'https://geodata.nationaalgeoregister.nl/tiles/service/wmts/brtachtergrondkaartpastel/EPSG:3857/{z}/{x}/{y}.png', { |
|
|
|
|
|
|
|
attribution: 'Kaartgegevens © <a href="https://kadaster.nl">Kadaster</a>' |
|
|
|
|
|
|
|
}).addTo(map); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var greenIcon = new L.Icon({ |
|
|
|
|
|
|
|
iconUrl: "{{ url_for('static', filename='assets/leaflet/images/marker-icon-2x-green.png') }}", |
|
|
|
|
|
|
|
shadowUrl: "{{ url_for('static', filename='assets/leaflet/images/marker-shadow.png') }}", |
|
|
|
|
|
|
|
iconSize: [25, 41], |
|
|
|
|
|
|
|
iconAnchor: [12, 41], |
|
|
|
|
|
|
|
popupAnchor: [1, -34], |
|
|
|
|
|
|
|
shadowSize: [41, 41] |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var locations = JSON.parse('{{ json.dumps(player.locations_during_game(), cls=location_encoder)|safe }}') |
|
|
|
var locations = JSON.parse('{{ json.dumps(player.locations_during_game(), cls=location_encoder)|safe }}') |
|
|
|
if (locations == null) { |
|
|
|
if (locations == null) { |
|
|
|
locations = [] |
|
|
|
locations = [] |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
for (var i = 0; i < locations.length; i++) { |
|
|
|
for (var i = 0; i < locations.length; i++) { |
|
|
|
var playerMarker = L.marker([ |
|
|
|
addPlayerMarker(map, locations[i]) |
|
|
|
locations[i]['latitude'], |
|
|
|
|
|
|
|
locations[i]['longitude'] |
|
|
|
|
|
|
|
], { |
|
|
|
|
|
|
|
icon: greenIcon |
|
|
|
|
|
|
|
}).addTo(map); |
|
|
|
|
|
|
|
var timestamp_utc = moment.utc(locations[i]['timestamp_utc']).toDate() |
|
|
|
|
|
|
|
var timestamp_local = moment(timestamp_utc).local().format('YYYY-MM-DD HH:mm'); |
|
|
|
|
|
|
|
playerMarker.bindTooltip(`<b>${locations[i]['username']}</b><br> |
|
|
|
|
|
|
|
${timestamp_local}`).openPopup(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (locations.length > 0) { |
|
|
|
if (locations.length > 0) { |
|
|
@ -124,7 +93,9 @@ |
|
|
|
color: 'red' |
|
|
|
color: 'red' |
|
|
|
}).addTo(map); |
|
|
|
}).addTo(map); |
|
|
|
// zoom the map to the polyline |
|
|
|
// zoom the map to the polyline |
|
|
|
map.fitBounds(polyline.getBounds()); |
|
|
|
map.fitBounds(polyline.getBounds(), { |
|
|
|
|
|
|
|
maxZoom : 13 |
|
|
|
|
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//Ajax for Generate Code button |
|
|
|
//Ajax for Generate Code button |
|
|
|