Changeset 570 in tmcsimulator for trunk/webapps


Ignore:
Timestamp:
01/24/2020 08:14:32 PM (6 years ago)
Author:
jdalbey
Message:

GTEC vdsLayer.js Add time autoincrement.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/webapps/GTEC/js/vdsLayer.js

    r568 r570  
    5858        //var color_arr = [];  
    5959        var white_arr = []; //stores all white dots 
     60        // Initialize the current time to zero 
     61        var currentTime = new Date(0); 
     62        currentTime.setHours(0); 
     63        currentTime.setMinutes(0); 
     64        currentTime.setSeconds(0); 
     65 
    6066        map.data.addListener('click', function(event)  
    6167        { 
     
    101107                }); 
    102108                //color_arr.push(clicked_dots); 
    103                 console.log(clicked_dots); 
    104                 console.log(range); 
     109                //console.log(clicked_dots); 
     110                //console.log(range); 
    105111                // extracts ids for all the white dots 
    106112                var white_arr_ids = white_arr.map(function (marker) { 
     
    113119                // computes difference between the white dots and clicked dots to find the unused dots 
    114120                var unused_ids = white_arr_ids.diff(clicked_dots_ids); 
    115                 console.log("Unused: ",unused_ids, "White: ",white_arr_ids); 
     121                //console.log("Unused: ",unused_ids, "White: ",white_arr_ids); 
    116122                // change the dot color of all the unused white dots back to their previous color 
    117123                unused_ids.forEach(function (id){ 
     
    130136                    }); 
    131137                } 
     138                // Increment the time by one-half minute (30 seconds) 
     139                var millisecs = currentTime.getTime(); 
     140                millisecs += 30000;   
     141                currentTime = new Date(millisecs); 
     142 
     143                // Create a printable string for the time (HH:MM:SS) 
     144                var printableTime = currentTime.toLocaleTimeString('it-IT'); 
    132145 
    133146                // Assemble the line to be written to the events file 
    134                 var lineOut = "181   00:00:00    " + first[0] + "       " +  
    135                 first[1] + "            " + first[2] + "        " + range.toFixed(3) + "         "  
     147                var lineOut = "101   " + printableTime + "\t" + first[0] + "\t" +  
     148                first[1] + "\t" + first[2] + "\t" + range.toFixed(3) + "\t"  
    136149                + getColorAbbr(chosenColor); 
    137150                console.log(lineOut); 
     
    156169                var direction = postmileList[curr].charAt(firstBlank+1); // extract direction 
    157170                target = event.feature.getId().substring(0,secondBlank); // extract target string 
    158                 console.log("making white dots from " + selectedID + " in direction "+direction) 
     171                //console.log("making white dots from " + selectedID + " in direction "+direction) 
    159172                // Decide whether to increment or decrement based on direction of hwy; 
    160173                //  N and E increment,  S and W decrement  
     
    328341        greenColor.style.background = "gray";      
    329342    }); 
     343        // set default button on 
     344    yellowColor.style.background = "yellow";     
    330345} 
Note: See TracChangeset for help on using the changeset viewer.