Changeset 353 in tmcsimulator for trunk/src/atmsdriver/model/Highways.java
- Timestamp:
- 04/02/2019 06:30:15 PM (7 years ago)
- File:
-
- 1 edited
-
trunk/src/atmsdriver/model/Highways.java (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/atmsdriver/model/Highways.java
r345 r353 151 151 * Applies specified color to the specified highway stretch. Route number 152 152 * 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. 156 163 * @param routeNumber highway route number 157 * @param direction highway direction 164 * @param direction highway direction (for normal traffic flow) 158 165 * @param postmile origin postmile value 159 166 * @param range range from origin postmile … … 179 186 Double startPost; 180 187 Double endPost; 188 double epsilon = 0.001; 181 189 182 190 // 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)) 185 193 { 186 194 // add range value to startPost to get … … 191 199 // specifies a highway that doesn't exist in the network. 192 200 // Also the case where a desired postmile to color isn't in 193 // the network. 201 // the network. Ticket 118 194 202 // iterate through the stations, if within the specified highway 195 203 // stretch, update the station by direction and apply dot color … … 202 210 } 203 211 } 204 // handle decreasing postmile directions (south or west)212 // N or E directions backup in a negative postmile direction 205 213 else 206 214 { … … 581 589 pmList.load(s); 582 590 591 Collections.sort(highways); // Sort the highways for easier inspection 583 592 String header = "{\n" + 584 593 " \"type\": \"FeatureCollection\",\n" + … … 590 599 // Examine every station on this highway 591 600 StringBuilder lineout = new StringBuilder(); 601 Collections.sort(hwy.stations, new StationComparator()); 592 602 for (Station stat: hwy.stations) 593 603 {
Note: See TracChangeset
for help on using the changeset viewer.
