Changeset 248 in tmcsimulator for trunk/src/atmsdriver/model/Highways.java


Ignore:
Timestamp:
02/09/2019 08:18:35 AM (7 years ago)
Author:
jdalbey
Message:

TrafficModelManager?: multi-file commit to enhance Traffic Mgr to output highway status to json file for viewing in Google Map.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/atmsdriver/model/Highways.java

    r243 r248  
    545545        for (Highway hwy: highways) 
    546546        { 
    547             // Consider each route direction 
    548             //for (DIRECTION dir: DIRECTION.values()) 
    549             // TODO: Needs fixing so proper direction is displayed 
    550             Station.DIRECTION dir = Station.DIRECTION.SOUTH; 
    551             if (hwy.routeNumber == 55) 
    552                 dir = Station.DIRECTION.SOUTH; 
    553             if (hwy.routeNumber == 405) 
    554                 dir = Station.DIRECTION.NORTH; 
    555             { 
    556                 String rowLabel = ""+String.format("%3s ",hwy.routeNumber)+dir.getLetter()+' '; 
     547            // For json output we don't care about listing all the stations 
     548            // in order by direction because we are just outputting points not lines. 
     549            { 
     550                // Examine every station on this highway and direction 
    557551                StringBuilder lineout = new StringBuilder(); 
    558                 // Examine every station on this highway and direction 
    559552                for (Station stat: hwy.stations) 
    560553                { 
    561                     String pmID = "" + hwy.routeNumber + " " + stat.postmile; 
     554                    String pmID = "" + hwy.routeNumber + " "  
     555                            + stat.direction.getLetter() + " "  
     556                            + stat.postmile; 
    562557                    PostmileCoords.Postmile currentPM = pmList.find(pmID); 
    563558                    if (currentPM != null) 
     
    566561                    //lineout.append(stat.getColorByDirection(dir)); 
    567562                    String outString = currentPM.toJson(); 
     563                    // replace the color code with the color name 
    568564                    String colorName=""; 
    569                     switch (stat.getColorByDirection(dir)) 
     565                    switch (stat.getColorByDirection(stat.direction)) 
    570566                    { 
    571567                        case '@': colorName = "red";break; 
     
    579575                    } 
    580576                } 
    581                                 // See if there were stations for this direction 
    582                 String checkMe = lineout.toString().trim(); 
    583                 // if any stations were colored, output the line 
    584                 if (checkMe.length() > 1) 
    585                 { 
    586                     //result.append(rowLabel); 
    587                     result.append(lineout + "\n"); 
    588                 } 
     577                //result.append(rowLabel); 
     578                result.append(lineout + "\n"); 
    589579 
    590580            } 
Note: See TracChangeset for help on using the changeset viewer.