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


Ignore:
Timestamp:
04/02/2019 06:30:15 PM (7 years ago)
Author:
jdalbey
Message:

StationComparator?.java added to json output can be ordered by route then postmile.

File:
1 edited

Legend:

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

    r345 r353  
    151151     * Applies specified color to the specified highway stretch. Route number 
    152152     * and direction specify the highway. Postmile and range specify the stretch 
    153      * of specified highway. Dot color is the color to be applied to the 
    154      * stretch. 
    155      * 
     153     * of specified highway.  
     154     * The purpose of this method is to modify the highway state to represent  
     155     * traffic conditions created by the Traffic Manager.  These conditions  
     156     * originate in the traffic events file which specifies traffic congestion arising 
     157     * during the simulation.  NOTE: Since these events describe congestion, 
     158     * the direction that the color should be applied is the REVERSE of the 
     159     * regular flow of traffic.   
     160     * So a request to apply red to 55 S from 8.5 for 2 miles means  
     161     * the stretch 8.5 -> 10.5 because sobo traffic normally flows toward 
     162     * decreasing postmiles and we want to do the reverse. 
    156163     * @param routeNumber highway route number 
    157      * @param direction highway direction 
     164     * @param direction highway direction (for normal traffic flow) 
    158165     * @param postmile origin postmile value 
    159166     * @param range range from origin postmile 
     
    179186        Double startPost; 
    180187        Double endPost; 
     188        double epsilon = 0.001; 
    181189 
    182190        // postmiles increase from s to n and w to e 
    183         // handle increasing postmile directinons (north or east) 
    184         if (direction.equals(Station.DIRECTION.NORTH) || direction.equals(Station.DIRECTION.EAST)) 
     191        // S or W directions backup in a positive postmile direction 
     192        if (direction.equals(Station.DIRECTION.SOUTH) || direction.equals(Station.DIRECTION.WEST)) 
    185193        { 
    186194            // add range value to startPost to get 
     
    191199            //   specifies a highway that doesn't exist in the network. 
    192200            //   Also the case where a desired postmile to color isn't in 
    193             //   the network. 
     201            //   the network.  Ticket 118 
    194202            // iterate through the stations, if within the specified highway 
    195203            // stretch, update the station by direction and apply dot color 
     
    202210            } 
    203211        }  
    204         // handle decreasing postmile directions (south or west)  
     212        // N or E directions backup in a negative postmile direction 
    205213        else 
    206214        { 
     
    581589        pmList.load(s); 
    582590         
     591        Collections.sort(highways);  // Sort the highways for easier inspection 
    583592        String header = "{\n" + 
    584593        "  \"type\": \"FeatureCollection\",\n" + 
     
    590599            // Examine every station on this highway 
    591600            StringBuilder lineout = new StringBuilder(); 
     601            Collections.sort(hwy.stations, new StationComparator()); 
    592602            for (Station stat: hwy.stations) 
    593603            { 
Note: See TracChangeset for help on using the changeset viewer.