Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/webapp/webclient/js/GnuBoat.js

    rb8b5e77 r563c04b  
    5454{
    5555        if(GnuBoat.private.serverBaseUrl == null){
    56                 GnuBoat.displayMessage('<span class="error">No server set/found</span>');
     56                GnuBoat.displayMessage("No server set/found");
    5757                return;
    5858        }
    … …  
    6767{
    6868        if(GnuBoat.private.serverBaseUrl == null){
    69                 GnuBoat.displayMessage('<span class="error">No server set/found</span>');
     69                GnuBoat.displayMessage("No server set/found");
    7070                return;
    7171        }
    … …  
    7979{
    8080        if(GnuBoat.private.serverBaseUrl == null){
    81                 GnuBoat.displayMessage('<span class="error">No server set/found</span>');
     81                GnuBoat.displayMessage("No server set/found");
    8282                return;
    8383        }
    8484        $("#logfilesForm").empty();
    8585        $.getJSON(GnuBoat.private.serverBaseUrl +"?request=logfiles", function(data){
    86                 GnuBoat.private.updateMapModus(data);
    8786                if(!Array.isArray(data) || data.length < 1){
    8887                        $("<p>No Logfiles found!</p>").appendTo("#logfilesForm");
    … …  
    9190                }
    9291                if(("error" in data) && data["error"] == 1){
    93                         GnuBoat.displayMessage('<span class="error">Failed to get log files: '+ data["errormessage"] +'</span>');
    94                         $("<p>No Logfiles found!</p>").appendTo("#logfilesForm");
    95                         console.log(data);
     92                        alert("Failed to upload map: "+ data["errormessage"]);
     93                        $("#mapTileUploadProgress").hide();
     94                        $("#mapFileInput").show();
    9695                        return;
    9796                }
    … …  
    109108{
    110109        if(GnuBoat.private.serverBaseUrl == null){
    111                 GnuBoat.displayMessage('<span class="error">No server set/found</span>');
     110                GnuBoat.displayMessage("No server set/found");
    112111                return;
    113112        }
    … …  
    130129{
    131130        if(GnuBoat.private.serverBaseUrl == null){
    132                 displayMessage('<span class="error">No server set/found</span>');
     131                displayMessage("No server set/found");
    133132                return;
    134133        }
    … …  
    143142                success: function(data){
    144143                        if(("error" in data) && data["error"] == 1){
    145                                 GnuBoat.displayMessage('<span class="error">Failed to upload map: '+ data["errormessage"] +'</span>');
     144                                alert("Failed to upload map: "+ data["errormessage"]);
    146145                                $("#mapTileUploadProgress").hide();
    147146                                $("#mapFileInput").show();
    148147                                return;
    149148                        }
    150                         GnuBoat.displayMessage('<span class="error">Map upload successfully</span>');
     149                        alert("Map upload successfully");
    151150                        $("#mapTileUploadProgress").hide();
    152151                        $("#mapFileInput").show();
    … …  
    154153                },
    155154                error: function(jqXHR, exception, errorThrown){
    156                         GnuBoat.displayMessage('<span class="error">Failed to upload map (XHR): '+ exception +'</span>');
     155                        alert("Failed to upload map (XHR): "+ exception);
    157156                        $("#mapTileUploadProgress").hide();
    158157                        $("#mapFileInput").show();
    … …  
    168167GnuBoat.initialize = function()
    169168{
    170         $("#mapModusSelect").change(function(){ GnuBoat.private.mapModusChanged(); });
    171169        $("#mapTileUploadProgress").hide();
    172170        $("#logfilesReload").click(GnuBoat.logfilesLoad);
    … …  
    216214        GnuBoat.private.renderControls = new THREE.OrbitControls( GnuBoat.private.renderCamera, GnuBoat.private.renderRenderer.domElement );
    217215        GnuBoat.private.renderControls.zoomSpeed = 2;
     216       
     217       
     218       
     219        var deep = new THREE.Color(0x347C7C);
     220        var shallow = new THREE.Color(0xBCD9D9);
     221        var size = 5;
     222        GnuBoat.private.renderDepthSteps = 50;
     223
     224        var deltaR = (Math.max(deep.r, shallow.r) - Math.min(deep.r, shallow.r))/GnuBoat.private.renderDepthSteps;
     225        var deltaG = (Math.max(deep.g, shallow.g) - Math.min(deep.g, shallow.g))/GnuBoat.private.renderDepthSteps;
     226        var deltaB = (Math.max(deep.b, shallow.b) - Math.min(deep.b, shallow.b))/GnuBoat.private.renderDepthSteps;
     227        for(var i = 0; i < GnuBoat.private.renderDepthSteps; i++){
     228                var stepColor = new THREE.Color(Math.max(deep.r, shallow.r) - i * deltaR,
     229                                                                                Math.max(deep.g, shallow.g) - i * deltaG,
     230                                                                                Math.max(deep.b, shallow.b) - i * deltaB);
     231                GnuBoat.private.renderDepthMaterials.push(stepColor);
     232        }
     233        GnuBoat.private.renderDepthMaterials.push(shallow);
    218234}
    219235
    … …  
    226242{
    227243        if(GnuBoat.private.serverBaseUrl == null){
    228                 GnuBoat.displayMessage('<span class="error">No server set/found</span>');
     244                GnuBoat.displayMessage("No server set/found");
    229245                return;
    230246        }
    … …  
    234250        if(GnuBoat.private.timerDisplay == null)
    235251                GnuBoat.private.timerDisplay = setInterval(GnuBoat.displayDataGet, 10000);
    236         GnuBoat.logfilesLoad();
     252        GnuBoat.logfilesLoad(); 
    237253       
    238254        GnuBoat.private.animate();
    … …  
    260276        mapsMetadata: null,
    261277        mapBounds: null,
    262         mapModusLive: true,
    263         mapHotlineGradientDefault: { absolute: false, palette: { 0.0: 'green', 0.5: 'yellow', 1.0: 'red' } },
    264278        dataMappings: {
    265279                speedthroughwater: {display: true, map: true, mapActive: false, titleLong: "Speed Through Water", titleShort: "STW", unit: "kts"},
    266280                speedoverground:  {display: true, map: true, mapActive: false, titleLong: "Speed Over Ground", titleShort: "SOG", unit: "kts"},
    267                 waterdepth: {
    268                         display: true, map: true, mapActive: true, titleLong: "Waterdepth", titleShort: "Depth", unit: "m",
    269                         gradient: {
    270                                 absolute: true,
    271                                 palette: { 0: 'DarkBlue', 2: 'DodgerBlue', 6: 'LightBlue', 10: 'AliceBlue'},
    272                         }
    273                 },
     281                waterdepth: {display: true, map: true, mapActive: true, titleLong: "Waterdepth", titleShort: "Depth", unit: "m"},
    274282                watertemperature: {display: true, map: true, mapActive: false, titleLong: "Watertemperature", titleShort: "Water", unit: "°C"},
    275283                gpsfix: {display: true, map: false, mapActive: false, titleLong: "GPS Fix", titleShort: "Fix", unit: ""},
    … …  
    284292        renderControls: null,
    285293        renderCloud: null,
     294        renderDepthMaterials: [],
     295        renderDepthSteps: null,
    286296       
    287297        openLink: function(target)
    … …  
    292302        displayDataSet: function(data)
    293303        {
    294 //              if(!Array.isArray(data) || data.length < 1){
    295 //                      console.log("No data array returned!");
    296 //                      console.log(data);
    297 //                      return;
    298 //              }
    299                 if(("error" in data) && data["error"] == 1){
    300                         GnuBoat.displayMessage('<span class="error">Failed to get display data and tracks: '+ data["errormessage"] +'</span>');
    301                         return;
    302                 }
    303 
    304304                var keysDisplay = [];
    305305                for(var key in GnuBoat.private.dataMappings){
    … …  
    307307                                keysDisplay.push(key);
    308308                }
    309 
     309                if(!Array.isArray(data) && !(data instanceof Object)){
     310                        console.log("No data array returned!");
     311                        console.log(data);
     312                        return;
     313                }
    310314                if(!("lastvalid" in data)){
    311315                                console.log("No last valid values given!");
    … …  
    329333                }
    330334               
    331                 // map displays logged data
    332                 if(!GnuBoat.private.mapModusLive)
    333                         return;
    334                 else if(!("track" in data)){
    335                         console.log("No track given!");
    336                         return;
    337                 }
    338                 GnuBoat.private.mapAddTracks(data["track"]);
     335                if(!("track" in data)){
     336                                console.log("No track given!");
     337                }
     338                else{
     339                        if(GnuBoat.private.map == null){
     340                                console.log("No map in use");
     341                        }
     342                        else{
     343                                var track = data["track"];
     344                                var maximas = [];
     345                                var minimas = [];
     346                                var points = [];
     347                                var densityPoints = [];
     348                               
     349                                var keysMap = [];
     350                                for(var key in GnuBoat.private.dataMappings){
     351                                        if(GnuBoat.private.dataMappings[key]["map"] === true)
     352                                                keysMap.push(key);
     353                                }
     354                                for(var i = 0; i < keysMap.length; i++){
     355                                        if(keysMap[i] == "gpsfix")
     356                                                continue;
     357                                        points[keysMap[i]] = [];
     358                                }
     359                               
     360                                // getting maximas, minimums for normalization and the tracks themselves
     361                                for(var time in track){
     362                                        for(var i = 0; i < keysMap.length; i++){
     363                                                var key = keysMap[i];
     364                                                if(key == "gpsfix")
     365                                                        continue;
     366                                                if(!(key in maximas))
     367                                                        maximas[key] = track[time][key]
     368                                                else if(maximas[key] < track[time][key])
     369                                                        maximas[key] = track[time][key];
     370                                                if(!(key in minimas))
     371                                                        minimas[key] = track[time][key]
     372                                                else if(minimas[key] > track[time][key])
     373                                                        minimas[key] = track[time][key];
     374                                                points[key].push(new L.latLng(track[time]["latitude"], track[time]["longitude"], track[time][key]));
     375                                                densityPoints.push({latitude: track[time]["latitude"], longitude: track[time]["longitude"], depth: track[time]["waterdepth"]});
     376                                        }
     377                                }
     378                                for(var i = 0; i < keysMap.length; i++){
     379                                        var key = keysMap[i];
     380                                        if(key == "gpsfix")
     381                                                continue;
     382                                        if(points[key].length > 0){
     383                                                if(key in GnuBoat.private.mapPolylines)
     384                                                        GnuBoat.private.mapPolylines[key].setLatLngs(points[key]);
     385                                                else{
     386                                                        GnuBoat.private.mapPolylines[key] = L.hotline(points[key], {weight: 3, outlineWidth: 0, min: minimas[key], max: maximas[key]});
     387                                                        if(GnuBoat.private.mapControl){
     388                                                                var name = GnuBoat.private.dataMappings[key]["titleLong"] +" in "+ GnuBoat.private.dataMappings[key]["unit"] +" ("+ GnuBoat.private.dataMappings[key]["titleShort"] +")";
     389                                                                GnuBoat.private.mapControl.addOverlay(GnuBoat.private.mapPolylines[key], name);
     390                                                        }
     391                                                        if(GnuBoat.private.dataMappings[key]["mapActive"] === true)
     392                                                                GnuBoat.private.mapPolylines[key].addTo(GnuBoat.private.map);
     393                                                }
     394                                        }
     395                                }
     396                                GnuBoat.private.drawDensityEstimation(densityPoints, maximas["waterdepth"], minimas["waterdepth"]);
     397                        }
     398                }
    339399        },
    340400       
    … …  
    372432                        // only initialize the map (viewport) once
    373433                        GnuBoat.private.map = L.map('mapViewport');
    374                         GnuBoat.private.map.on('overlayadd', function(layerObject){ GnuBoat.private.mapOverlayLegendSwitch(layerObject.layer); });
    375                         GnuBoat.private.map.on('overlayremove', function(layerObject){ GnuBoat.private.mapOverlayLegendSwitch(layerObject.layer); });
    376434                }
    377435                GnuBoat.private.map.setView([latitudeCenter, longitudeCenter], mapZoomStart);
    … …  
    469527        },
    470528       
    471         drawDensityEstimation: function(densityPoints, gradient, maximum, minimum)
    472         {
    473                 var colors = GnuBoat.private.gradientToRenderColors(gradient, maximum, minimum);
    474                 // converting all indizes into numbers to sort them correctly
    475                 // in descending order e.g. 10, 2, 1, 0 and not 2, 10, 1, 0
    476                 var colorsIndizes = Object.getOwnPropertyNames(colors);
    477                 colorsIndizes.sort(function(a, b){
    478                         a = +a;
    479                         b = +b;
    480                         return a-b;
    481                 });
    482                 var colorsCount = colorsIndizes.length;
    483                
     529        drawDensityEstimation: function(densityPoints, maximum, minimum)
     530        {
    484531                var material = new THREE.PointsMaterial({vertexColors: THREE.VertexColors, size: 5});
    485532                var geometry = new THREE.Geometry();
    … …  
    491538                        var mercator = GnuBoat.private.mercator(densityPoints[i].latitude, densityPoints[i].longitude);
    492539                        var vertex = new THREE.Vector3(mercator.x - mercatorSouthWest.x, mercator.y - mercatorSouthWest.y, (densityPoints[i].depth * -1) + maximum);
    493                         var step = (densityPoints[i].depth - minimum)/(maximum-minimum);
    494540                        var color = new THREE.Color(0x000000);
    495                         for(var j = 0; j < colorsCount; j++){
    496                                 if(j < colorsCount - 1)
    497                                         color = colors[colorsIndizes[j]];
    498                                 if(step <= colorsIndizes[j+1]){
    499                                         color = colors[colorsIndizes[j]];
    500                                         break;
    501                                 }
     541                        if(GnuBoat.private.renderDepthSteps != null){
     542                                var step = Math.floor((densityPoints[i].depth - minimum)/((maximum-minimum)/GnuBoat.private.renderDepthSteps));
     543                                if(step >= 0 && step < GnuBoat.private.renderDepthMaterials.length)
     544                                        color = GnuBoat.private.renderDepthMaterials[step];
    502545                        }
    503546                        geometry.vertices.push(vertex);
    … …  
    535578                return result;
    536579        },
    537        
    538         updateMapModus: function(data)
    539         {
    540                 var selected = $("#mapModusSelect").val();
    541                 $("#mapModusSelect").empty();
    542                 var selectedFound = false;
    543                 if(selected != null && Array.isArray(data)){
    544                         data.forEach(function(value, index){
    545                                 if(value == selected)
    546                                         selectedFound = true;
    547                         });
    548                 }
    549                 var selectedString = "";
    550                 if(!selectedFound)
    551                         selectedString = " selected";
    552                 $('<option value="live"'+ selectedString +'>Live View</option>').appendTo("#mapModusSelect");
    553                 if(!Array.isArray(data) || data.length < 1){
    554                         console.log(data);
    555                         return;
    556                 }
    557                 if(("error" in data) && data["error"] == 1){
    558                         GnuBoat.displayMessage('<span class="error">Failed to upload map: '+ data["errormessage"] +'</span>');
    559                         return;
    560                 }
    561                 data.forEach(function(value, index){
    562                         var selectedString = "";
    563                         if(value == selected)
    564                                 selectedString = " selected";
    565                         $("<option value=\""+ value +"\""+ selected +">"+ value +"</option>").appendTo("#mapModusSelect");
    566                 });
    567         },
    568        
    569         mapModusChanged: function()
    570         {
    571                 var modus = $("#mapModusSelect").val();
    572                 // live modus is automatically activated on displayDataSet
    573                 if(modus == "live"){
    574                         GnuBoat.private.mapModusLive = true;
    575                         return;
    576                 }
    577                 // remove overlays
    578                 if(GnuBoat.private.mapControl != null){
    579                         for(var key in GnuBoat.private.dataMappings){
    580                                 if(GnuBoat.private.dataMappings[key]["map"] === true)
    581                                         if(key in GnuBoat.private.mapPolylines){
    582                                                 GnuBoat.private.mapControl.removeLayer(GnuBoat.private.mapPolylines[key]);
    583                                                 GnuBoat.private.mapPolylines[key].remove();
    584                                                 delete GnuBoat.private.mapPolylines[key];
    585                                         }
    586                         }
    587                 }
    588                 GnuBoat.private.mapModusLive = false;
    589                 $.post({
    590                         url: GnuBoat.private.serverBaseUrl +'?request=replay',
    591                         data: { logfile: modus },
    592                         success: function(data){
    593 //                              if(!Array.isArray(data) || data.length < 1){
    594 //                                      console.log("No data array returned!");
    595 //                                      console.log(data);
    596 //                                      return;
    597 //                              }
    598                                 if(("error" in data) && data["error"] == 1){
    599                                         GnuBoat.displayMessage('<span class="error">Failed to get logged tracks: '+ data["errormessage"] +'</span>');
    600                                         return;
    601                                 }
    602                                 if(!("track" in data)){
    603                                         console.log("No track given!");
    604                                         return;
    605                                 }
    606                                 GnuBoat.private.mapAddTracks(data["track"]);
    607                         }
    608                 });
    609         },
    610        
    611         mapAddTracks: function(track)
    612         {
    613                 if(GnuBoat.private.map == null){
    614                         console.log("No map in use");
    615                         return;
    616                 }
    617                
    618                 $("#mapLegend").empty();
    619                 var maximas = [];
    620                 var minimas = [];
    621                 var points = [];
    622                 var densityPoints = [];
    623                
    624                 var keysMap = [];
    625                 for(var key in GnuBoat.private.dataMappings){
    626                         if(GnuBoat.private.dataMappings[key]["map"] === true)
    627                                 keysMap.push(key);
    628                 }
    629                 for(var i = 0; i < keysMap.length; i++){
    630                         points[keysMap[i]] = [];
    631                 }
    632                
    633                 // getting maximas, minimums for normalization and the tracks themselves
    634                 for(var time in track){
    635                         for(var i = 0; i < keysMap.length; i++){
    636                                 var key = keysMap[i];
    637                                 var value = track[time][key];
    638                                 if(!$.isNumeric(value))
    639                                         continue;
    640                                 if(!(key in maximas))
    641                                         maximas[key] = value
    642                                 else if(maximas[key] < value)
    643                                         maximas[key] = value;
    644                                 if(!(key in minimas))
    645                                         minimas[key] = value
    646                                 else if(minimas[key] > value)
    647                                         minimas[key] = value;
    648                                 points[key].push(new L.latLng(track[time]["latitude"], track[time]["longitude"], value));
    649                                 if(key == "waterdepth")
    650                                         densityPoints.push({latitude: track[time]["latitude"], longitude: track[time]["longitude"], depth: value});
    651                         }
    652                 }
    653                 for(var i = 0; i < keysMap.length; i++){
    654                         var key = keysMap[i];
    655                         if(points[key].length > 0){
    656                                 var palette = GnuBoat.private.mapHotlineGradientDefault.palette;
    657                                 var paletteLegend = GnuBoat.private.mapHotlineGradientDefault.palette;
    658                                 if("gradient" in GnuBoat.private.dataMappings[key]){
    659                                         palette = GnuBoat.private.gradientToPalette(GnuBoat.private.dataMappings[key]["gradient"], maximas[key], minimas[key]);
    660                                         // use original palette, to use absolute values, if possible
    661                                         paletteLegend = GnuBoat.private.dataMappings[key]["gradient"]["palette"];
    662                                 }
    663                                
    664                                 var legendTable = $('<table id="'+ key +'" class="hidden"></table>');
    665                                 $("<tr><th colspan=2>"+ GnuBoat.private.dataMappings[key]["titleShort"] +" in "+ GnuBoat.private.dataMappings[key]["unit"] +"</th></tr>").appendTo(legendTable);
    666                                 $("<tr><th>Level</th><th>Color</th></tr>").appendTo(legendTable);
    667                                 // converting all indizes into numbers to sort them correctly
    668                                 // e.g. 0, 1, 2, 10 and not 0, 1, 10, 2
    669                                 var indizes = Object.getOwnPropertyNames(paletteLegend);
    670                                 indizes.sort(function(a, b){
    671                                         a = +a;
    672                                         b = +b;
    673                                         return a-b;
    674                                 });
    675                                 for(var j=0; j < indizes.length; j++){
    676                                         var index = indizes[j];
    677                                         $('<tr><td class="level">'+ index.toString() +'</td><td style="background-color: '+ paletteLegend[index] +'"></td></tr>').appendTo(legendTable);
    678                                 }
    679                                 $('<tr><td colspan="2">Extrema: '+ maximas[key].toString() +' / '+ minimas[key].toString() +'</td></tr>').appendTo(legendTable);
    680                                
    681                                 var hotlineOptions = {
    682                                         weight: 3,
    683                                         outlineWidth: 0,
    684                                         min: minimas[key],
    685                                         max: maximas[key],
    686                                         palette: palette,
    687                                 };
    688                                
    689                                 legendTable.appendTo("#mapLegend");
    690                        
    691                                 if(key in GnuBoat.private.mapPolylines){
    692                                         GnuBoat.private.mapPolylines[key].setStyle(hotlineOptions);
    693                                         GnuBoat.private.mapPolylines[key].setLatLngs(points[key]);
    694                                         if(GnuBoat.private.map.hasLayer(GnuBoat.private.mapPolylines[key]))
    695                                                 GnuBoat.private.mapOverlayLegendSwitch(GnuBoat.private.mapPolylines[key]);
    696                                         GnuBoat.private.mapPolylines[key].unbindPopup();
    697                                 }
    698                                 else{
    699                                         GnuBoat.private.mapPolylines[key] = L.hotline(points[key], hotlineOptions);
    700                                         if(GnuBoat.private.mapControl){
    701                                                 var name = GnuBoat.private.dataMappings[key]["titleLong"] +" in "+ GnuBoat.private.dataMappings[key]["unit"] +" ("+ GnuBoat.private.dataMappings[key]["titleShort"] +")";
    702                                                 GnuBoat.private.mapControl.addOverlay(GnuBoat.private.mapPolylines[key], name);
    703                                         }
    704                                         if(GnuBoat.private.dataMappings[key]["mapActive"] === true)
    705                                                 GnuBoat.private.mapPolylines[key].addTo(GnuBoat.private.map);
    706                                 }
    707                                 GnuBoat.private.mapPolylines[key].bindPopup(legendTable[0].outerHTML);
    708                         }
    709                 }
    710                 var gradient = GnuBoat.private.mapHotlineGradientDefault.palette;
    711                 if("gradient" in GnuBoat.private.dataMappings["waterdepth"])
    712                         gradient = GnuBoat.private.dataMappings["waterdepth"]["gradient"];
    713                 GnuBoat.private.drawDensityEstimation(densityPoints, gradient, maximas["waterdepth"], minimas["waterdepth"]);
    714         },
    715        
    716         gradientToPalette: function(gradient, maximum, minimum)
    717         {
    718                 if(!("palette" in gradient)){
    719                         return GnuBoat.private.mapHotlineGradientDefault.palette;
    720                 }
    721                 if(!("absolute" in gradient) || !gradient.absolute){
    722                         // palette is already relative
    723                         return gradient.palette;
    724                 }
    725                 var range = maximum - minimum;
    726                 if(range == 0){
    727                         console.log("Range is zero --> Could not make gradient relative");
    728                         return  GnuBoat.private.mapHotlineGradientDefault.palette;
    729                 }
    730                 var palette = {};
    731                 var addedStop = false;
    732                 for(var indexAbs in gradient.palette){
    733                         var indexRel = (indexAbs - minimum)/range;
    734                         if(indexRel < 0){
    735                                 // add the nearest minimum value (which might be configured smaller than minimum)
    736                                 indexRel = 0;
    737                                 palette[indexRel] = gradient.palette[indexAbs];
    738                                 addedStop = true;
    739                         }
    740                         else if(indexRel < 1){
    741                                 palette[indexRel] = gradient.palette[indexAbs];
    742                                 addedStop = true;
    743                         }
    744                         else{
    745                                 // add first index > 1 as the maximum value at 1
    746                                 indexRel = 1;
    747                                 palette[indexRel] = gradient.palette[indexAbs];
    748                                 addedStop = true;
    749                                 break;
    750                         }
    751                 }
    752                 if(!addedStop)
    753                         return GnuBoat.private.mapHotlineGradientDefault.palette;
    754                 return palette;
    755         },
    756        
    757         gradientToRenderColors: function(gradient, maximum, minimum)
    758         {
    759                 var paletteRelative = GnuBoat.private.gradientToPalette(gradient, maximum, minimum);
    760 
    761                 var colors = {};
    762                 for(var index in paletteRelative)
    763                         colors[index] = new THREE.Color(paletteRelative[index].toLowerCase());
    764 
    765                 return colors;
    766         },
    767 
    768         mapOverlayLegendSwitch: function(layer)
    769         {
    770                 var overlayKey = null;
    771                 for(var key in GnuBoat.private.mapPolylines){
    772                         if(GnuBoat.private.mapPolylines.hasOwnProperty(key)){
    773                                 if(GnuBoat.private.mapPolylines[key] === layer){
    774                                         overlayKey = key;
    775                                         break;
    776                                 }
    777                         }
    778                 }
    779                 // ECMAScript 6
    780 //              var overlayKey = Object.keys(GnuBoat.private.mapPolylines).find(key => GnuBoat.private.mapPolylines[key] === overlay);
    781                 if(overlayKey == null)
    782                         return;
    783                 if(overlayKey){
    784                         $("#mapLegend #"+ overlayKey).toggleClass("hidden");
    785                 }
    786         },
    787580};
Note: See TracChangeset for help on using the changeset viewer.