Changeset 248 in tmcsimulator for trunk/src/tmcsim
- Timestamp:
- 02/09/2019 08:18:35 AM (7 years ago)
- Location:
- trunk/src/tmcsim
- Files:
-
- 2 edited
-
application.properties (modified) (1 diff)
-
cadsimulator/managers/TrafficModelManager.java (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/tmcsim/application.properties
r246 r248 1 # Thu, 07 Feb 2019 15:47:33-08001 #Sat, 09 Feb 2019 09:41:52 -0800 2 2 3 Application.revision=24 23 Application.revision=247 4 4 5 5 Application.buildnumber=91 -
trunk/src/tmcsim/cadsimulator/managers/TrafficModelManager.java
r228 r248 1 1 package tmcsim.cadsimulator.managers; 2 2 3 import atmsdriver.GoogleMapAnimator; 3 4 import atmsdriver.model.Highways; 4 5 import atmsdriver.model.LoopDetector; … … 8 9 import java.io.FileInputStream; 9 10 import java.io.FileNotFoundException; 11 import java.io.PrintWriter; 10 12 import java.rmi.RemoteException; 11 13 import java.text.ParseException; … … 208 210 wtConsole.start(); 209 211 } 212 // Always write to json for google map display 213 Thread wtJson = new WriteToJsonThread(); 214 wtJson.start(); 210 215 } 211 216 /** Accessor to event queue … … 403 408 while (true) 404 409 { 405 // Write the highway network status to the FEP Simulator410 // Write the highway network status to the Console 406 411 System.out.println(highways.toString()); 407 408 // Wait for FEP Sim to process the data we just sent 412 // Output the highway model 413 String geojson = highways.toJson(); 414 //System.out.println(geojson); // diagnostic 415 PrintWriter out; 416 try 417 { 418 out = new PrintWriter("highways.json"); 419 out.print(geojson); 420 out.close(); 421 } 422 catch (FileNotFoundException ex) 423 { 424 Logger.getLogger(GoogleMapAnimator.class.getName()).log(Level.SEVERE, null, ex); 425 } 426 // Wait for Google Map to process the data we just sent 409 427 try 410 428 { 411 429 Thread.sleep(5000); 430 } 431 catch (InterruptedException ie) 432 { 433 ie.printStackTrace(); 434 } 435 } 436 437 } 438 } 439 /** Writes the highway model to a GeoJson file for reading 440 * by Google Maps. 441 */ 442 class WriteToJsonThread extends Thread 443 { 444 445 public void run() 446 { 447 System.out.println("WriteToJson Thread starting."); 448 // Run indefinitely 449 while (true) 450 { 451 // Write the highway network status to Json 452 String geojson = highways.toJson(); 453 PrintWriter out; 454 try 455 { 456 // currently writes to local file 457 out = new PrintWriter("highways.json"); 458 out.print(geojson); 459 out.close(); 460 } 461 catch (FileNotFoundException ex) 462 { 463 Logger.getLogger(GoogleMapAnimator.class.getName()).log(Level.SEVERE, null, ex); 464 } 465 // Wait for Google Map to process the data we just sent 466 try 467 { 468 Thread.sleep(30000); 412 469 } 413 470 catch (InterruptedException ie)
Note: See TracChangeset
for help on using the changeset viewer.
