Changeset 580 in tmcsimulator for trunk/webapps/visualizer


Ignore:
Timestamp:
02/06/2020 01:40:17 PM (6 years ago)
Author:
jdalbey
Message:

Fix visualizer so it ignores blank lines in traffic events file, and enables Next button when Beginning is clicked.

Location:
trunk/webapps/visualizer
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/webapps/visualizer/index.html

    r530 r580  
    6363    //var kMapStartupFile = "../dynamicdata/highway_status(1).json"; // initial (static) highways file used once at startup 
    6464    var kMapStartupFile = "data_layers/highways_startup.json"; // initial (static) highways file used once at startup 
    65     var trafficEventsFile = "traffic_events.txt"; // traffic events file 
     65    var trafficEventsFile = "../dynamicdata/traffic_events.txt"; // traffic events file 
    6666    var iconVDSgreen = "images/circle_green.png" 
    6767    var iconVDSyellow = "images/circle_yellow.png" 
  • trunk/webapps/visualizer/js/vdsLayer.js

    r530 r580  
    160160                    var lines = eventsFile.toString().split("\n"); 
    161161                    // For each line in the events file 
    162                     for (var line = 1; line < lines.length; line++)  
     162                    for (var line = 0; line < lines.length; line++)  
    163163                    { 
    164164                        var trimmedLine = lines[line].trim(); 
    165                         if (trimmedLine[0] !== '#') //ignores lines with # 
     165                        if (trimmedLine.length>0 && trimmedLine[0] !== '#' ) //ignores lines with # 
    166166                        { 
     167                            console.log(trimmedLine); 
    167168                            var dots = [];                             
    168                             var event = trimmedLine.split(/[ ,]+/); 
     169                            var event = trimmedLine.split(/[ ,\t]+/); 
    169170                            var start = parseFloat(event[4]); // extract postmile field 
    170171                            var range = parseFloat(event[5]); // extract distance 
     
    321322        i = 0; 
    322323        time.innerHTML = "00:00:00"; 
     324        forward.disabled = false; 
    323325    }); 
    324326} 
Note: See TracChangeset for help on using the changeset viewer.