class window.OwnMap
constructor: ->
console.log 'initMap'
@my_markers = {}
@trackerIDs = []
@live_view = false
show_markers = Cookies.get 'show_markers'
console.log 'initMap: show_markers = %o', show_markers
@marker_start_icons = {}
@marker_finish_icons = {}
@marker_icons = {}
colours = ['blue', 'red', 'orange', 'green', 'purple', 'cadetblue', 'darkred', 'darkgreen', 'darkpurple']
for fg, i in colours
bg1 = if fg is 'green' then 'darkgreen' else 'green'
bg2 = if fg is 'red' then 'darkred' else 'red'
@marker_start_icons[i] = L.AwesomeMarkers.icon({icon: 'play', prefix: 'fa', markerColor: fg, iconColor: bg1 })
@marker_finish_icons[i] = L.AwesomeMarkers.icon({icon: 'stop', prefix: 'fa', markerColor: fg, iconColor: bg2 })
@marker_icons[i] = L.AwesomeMarkers.icon({icon: 'user', prefix: 'fa', markerColor: fg })
# set checkbox
if show_markers is '1'
# hideMarkers();
# $('#show_markers').prop('checked',false);
$('#show_markers').removeClass('btn-default').addClass('btn-primary').addClass('active')
layers =
'OpenStreetMap': L.tileLayer 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
subdomains: 'abc'
detectRetina: true
attribution: '© OpenStreetMap'
'OSM/DE': L.tileLayer 'https://{s}.tile.openstreetmap.de/tiles/osmde/{z}/{x}/{y}.png',
subdomains: 'abc'
detectRetina: true
attribution: '© OpenStreetMap'
'OpenTopoMap': L.tileLayer 'https://{s}.tile.opentopomap.org/{z}/{x}/{y}.png',
subdomains: 'abc'
detectRetina: true
maxZoom: 17
attribution: 'Map data: © OpenStreetMap-Mitwirkende, SRTM | Map tiles: © OpenTopoMap (CC-BY-SA)'
'Hike&Bike': L.tileLayer 'http://{s}.tiles.wmflabs.org/hikebike/{z}/{x}/{y}.png',
subdomains: 'abc'
detectRetina: true
attribution: '© OpenStreetMap'
'Stamen Toner': L.tileLayer 'http://{s}.tile.stamen.com/toner/{z}/{x}/{y}.png',
subdomains: 'abcd'
detectRetina: true
attribution: 'Map tiles by Stamen Design, under CC BY 3.0. Data by OpenStreetMap, under CC BY SA.'
'Stamen Watercolor': L.tileLayer 'http://{s}.tile.stamen.com/watercolor/{z}/{x}/{y}.jpg',
subdomains: 'abcd'
detectRetina: true
attribution: 'Map tiles by Stamen Design, under CC BY 3.0. Data by OpenStreetMap, under CC BY SA.'
overlays =
'Hillshades': L.tileLayer 'http://{s}.tiles.wmflabs.org/hillshading/{z}/{x}/{y}.png',
subdomains: ['a', 'b', 'c']
@mymap = L.map 'mapid',
center: [52.52, 13.44]
zoom: 11
layers: [layers['OpenStreetMap']]
L.control.layers(layers, overlays).addTo @mymap
@getMarkers()
updateTrackerIDs: (_tid_markers) ->
console.log 'updateTrackerIDs: %o', _tid_markers
try
$("#trackerID_selector option[value!='all']").each ->
$(this).remove()
if _tid_markers?
@trackerIDs = Object.keys _tid_markers
$.each @trackerIDs, (index, value) ->
$('#trackerID_selector').append $ '