Changeset 285 in tmcsimulator for trunk/src/atmsdriver/model
- Timestamp:
- 02/28/2019 10:21:36 AM (7 years ago)
- Location:
- trunk/src/atmsdriver/model
- Files:
-
- 2 edited
-
Highways.java (modified) (3 diffs)
-
Station.java (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/atmsdriver/model/Highways.java
r274 r285 510 510 { 511 511 //lineout.append("" + dir.getLetter() + stat.postmile); 512 lineout.append(stat.getColor ByDirection(dir));512 lineout.append(stat.getColor()); 513 513 //lineout.append(" "); 514 514 } … … 543 543 Scanner s = new Scanner(fis).useDelimiter("\\A"); 544 544 pmList.load(s); 545 545 546 String header = "{\n" + 546 547 " \"type\": \"FeatureCollection\",\n" + … … 573 574 String outString = currentPM.toJson(); 574 575 // replace the color code with the color name 575 String colorName=""; 576 switch (stat.getColorByDirection(stat.direction)) 577 { 578 case '@': colorName = "red";break; 579 case '+': colorName = "yellow"; break; 580 case '-': colorName = "lime";break; 581 case ' ': colorName = "lime";break; 582 } 576 String colorName=stat.getColorName(); 583 577 outString = outString.replace("desiredcolor",colorName); 584 578 lineout.append(outString); -
trunk/src/atmsdriver/model/Station.java
r278 r285 202 202 /** 203 203 * Return the color for the lanes in a given direction. 204 * 205 * @param direction 206 * @return character representing color of lanes in given direction '@' = 207 * red, '+' = yellow, '-' = green 208 */ 209 public char getColorByDirection(DIRECTION direction) 204 * @return character representing color of this station's traffic flow 205 * '@' = red, '+' = yellow, '-' = green 206 */ 207 public char getColor() 210 208 { 211 209 /* For now just use the color of the first lane. … … 213 211 214 212 String laneDir = ""; 215 if (direction.equals(this.direction)) 216 { 217 laneDir = "ML"; 218 } 219 else if (direction.equals(this.direction.getOpposite())) 220 { 221 laneDir = "OS"; 222 } 213 214 // THIS DECISION ISN'T NEEDED after JD's BuildHighwayFile pgm 215 // creates a highway map based on VDS instead of Controller (LDS). 216 // if (direction.equals(this.direction)) 217 // { 218 // laneDir = "ML"; 219 // } 220 // else if (direction.equals(this.direction.getOpposite())) 221 // { 222 // laneDir = "OS"; 223 // } 223 224 // Search lanes to find specified direction 224 225 for (LoopDetector loop : loops) … … 245 246 // Default case for when the route is not on this direction 246 247 return ' '; 247 248 } 249 248 } 249 /** 250 * Return the color name for the traffic volume of this station. 251 */ 252 public String getColorName() 253 { 254 String colorName = ""; 255 switch (this.getColor()) 256 { 257 case '@': colorName = "red";break; 258 case '+': colorName = "yellow"; break; 259 case '-': colorName = "lime";break; 260 case ' ': colorName = "lime";break; 261 } 262 return colorName; 263 } 250 264 /** 251 265 * Output for updateByDirection. Logs the update to the console.
Note: See TracChangeset
for help on using the changeset viewer.
