| 1 | <!DOCTYPE html> |
|---|
| 2 | <html> |
|---|
| 3 | <head> |
|---|
| 4 | <!-- Launch with python -m CGIHTTPServer 80 --> |
|---|
| 5 | <!-- map center button icon from http://icons8.com/. (Obligatory backlink, don't remove ) --> |
|---|
| 6 | <meta http-equiv="Content-Type" content="text/html;charset=utf-8"> |
|---|
| 7 | <title>Graphic Traffic Events Creator</title> |
|---|
| 8 | <link rel="icon" |
|---|
| 9 | type="image/png" |
|---|
| 10 | href="images/favicon.png"> |
|---|
| 11 | <!-- Styles --> |
|---|
| 12 | <link rel="stylesheet" href="css/styles.css"> |
|---|
| 13 | </head> |
|---|
| 14 | <body> |
|---|
| 15 | <!-- |
|---|
| 16 | Visualizer created from CPTMS |
|---|
| 17 | @author tkumar and jdalbey 2019.11.23 |
|---|
| 18 | --> |
|---|
| 19 | |
|---|
| 20 | <!--The div element where the map appears. --> |
|---|
| 21 | <div id="mapdiv"></div> |
|---|
| 22 | <!-- The div element for the popup dialog. Best results when placed here. --> |
|---|
| 23 | <!--The div elements where the buttons appear--> |
|---|
| 24 | <div id="ctrButton"><img width="30" src="images/btn_mapcenter.png"></div> |
|---|
| 25 | <button id="redButton">Red</button> |
|---|
| 26 | <button id="greenButton">Green</button> |
|---|
| 27 | <button id="yellowButton">Yellow</button> |
|---|
| 28 | <!-- <button id="harButton" class="unstyled-button"><img id="harBtnImg" src="images/btnReady_HAR.png"></button> |
|---|
| 29 | <button id="cctvButton" class="unstyled-button"><img id="cctvBtnImg" src="images/btnReady_CCTV.png"></button> |
|---|
| 30 | <button id="cmsButton" class="unstyled-button"><img id="cmsBtnImg" src="images/btnReady_CMS.png"></button>--> |
|---|
| 31 | <!--<button id="vdsButton" class="unstyled-button"><img id="vdsBtnImg" src="images/btnDepressed_VDS.png"></button> |
|---|
| 32 | <p id="time">00:00:00</p> |
|---|
| 33 | <button id="start" >Beginning</button> |
|---|
| 34 | <button id="forward" >Next</button> |
|---|
| 35 | <button id="backward" >Back</button> --> |
|---|
| 36 | <script src="../common/js/fileutils.js"></script> |
|---|
| 37 | <script src="../common/js/revision_number.dat"></script> |
|---|
| 38 | <script src="../common/js/displayutils.js"></script> |
|---|
| 39 | <script src="js/vdsLayer.js"></script> |
|---|
| 40 | <script src="js/controls.js"></script> |
|---|
| 41 | <script src="js/night_mode.js"></script> |
|---|
| 42 | <script> |
|---|
| 43 | showRevision(); |
|---|
| 44 | // a global variable for the google map |
|---|
| 45 | var map; |
|---|
| 46 | // a global dictionary to lookup a station's original coordinates |
|---|
| 47 | var vds_coords = {}; |
|---|
| 48 | // a global variable to hold locations of marked search places |
|---|
| 49 | var placePins = []; |
|---|
| 50 | // Constant for map center location: The John Wayne Airport |
|---|
| 51 | //var centerPoint = {lat: 33.687228, lng: -117.872148}; |
|---|
| 52 | // Constant for map center location in District 12 |
|---|
| 53 | var centerPoint = { |
|---|
| 54 | lat: 33.693385, |
|---|
| 55 | lng: -117.798937 |
|---|
| 56 | }; |
|---|
| 57 | // Initial map zoom |
|---|
| 58 | var initZoom = 11; |
|---|
| 59 | // Dot colors used in traffic model to indicate free-flowing, slowed, and stopped traffic |
|---|
| 60 | // and their associated zvalues so slower traffic dots are more visible. |
|---|
| 61 | // white means a disabled spot |
|---|
| 62 | var colorZvalues = { |
|---|
| 63 | "white": 5, |
|---|
| 64 | "lime": 10, |
|---|
| 65 | "yellow": 20, |
|---|
| 66 | "red": 30 |
|---|
| 67 | }; |
|---|
| 68 | |
|---|
| 69 | var kVDSstatusFile = "../dynamicdata/highway_status.json"; // dynamic json data file created by CADserver |
|---|
| 70 | //var kMapStartupFile = "../dynamicdata/highway_status(1).json"; // initial (static) highways file used once at startup |
|---|
| 71 | var kMapStartupFile = "data_layers/highways_startup.json"; // initial (static) highways file used once at startup |
|---|
| 72 | var trafficEventsFile = "traffic_events.txt"; // traffic events file |
|---|
| 73 | var iconVDSgreen = "images/circle_green.png" |
|---|
| 74 | var iconVDSyellow = "images/circle_yellow.png" |
|---|
| 75 | var iconVDSred = "images/circle_red.png" |
|---|
| 76 | var iconVDSwhite = "images/circle_white.png" |
|---|
| 77 | var vds_showing = true; |
|---|
| 78 | var targetDots = []; // 2d array containing targetDots parsed from each line in traffic events file |
|---|
| 79 | var eventTimes = []; //array to hold times of each traffic event |
|---|
| 80 | eventTimes[0] = "00:00:00"; |
|---|
| 81 | var diff_arr = []; // 2d array containing difference in map state between each event |
|---|
| 82 | var eventIndex = -1; //to index into above array |
|---|
| 83 | |
|---|
| 84 | // Use larger VDS icons if we're being displayed on the video wall |
|---|
| 85 | // at the front of the classroom. Launch page with any non-blank request parameter |
|---|
| 86 | // to trigger larger icons. |
|---|
| 87 | function initVDSicons() |
|---|
| 88 | { |
|---|
| 89 | var param_string = ''; |
|---|
| 90 | |
|---|
| 91 | // get url parameters from the window |
|---|
| 92 | url = window.location.search; // e.g. ?num1=43&num2=23 |
|---|
| 93 | // split into separate parameters |
|---|
| 94 | var parts = url.substring(1).split('&'); |
|---|
| 95 | // Extract the first parameter |
|---|
| 96 | param_string = parts[0]; |
|---|
| 97 | // If we have a non-blank parameter |
|---|
| 98 | if(param_string != undefined && param_string.trim() != "") |
|---|
| 99 | { |
|---|
| 100 | // Use large size circle icons |
|---|
| 101 | iconVDSgreen = "images/circle_green_lg.png"; |
|---|
| 102 | iconVDSyellow = "images/circle_yellow.png" |
|---|
| 103 | iconVDSred = "images/circle_red.png" |
|---|
| 104 | iconVDSwhite = "images/circle_white.png" |
|---|
| 105 | //var parts = param_string.split('&'); |
|---|
| 106 | } |
|---|
| 107 | } |
|---|
| 108 | |
|---|
| 109 | // Initialize the view/hide buttons |
|---|
| 110 | function initLayerButtons() |
|---|
| 111 | { |
|---|
| 112 | // initVDSbutton(); |
|---|
| 113 | //initControlButtons(); |
|---|
| 114 | initColorButtons(); |
|---|
| 115 | initVDSicons(); |
|---|
| 116 | } |
|---|
| 117 | |
|---|
| 118 | // Initialize the map and load the points |
|---|
| 119 | function initMap() |
|---|
| 120 | { |
|---|
| 121 | // Declare the map and where it belongs on the page |
|---|
| 122 | map = new google.maps.Map(document.getElementById('mapdiv'), |
|---|
| 123 | { |
|---|
| 124 | zoom: initZoom, |
|---|
| 125 | center: centerPoint, |
|---|
| 126 | styles: night_mode, |
|---|
| 127 | mapTypeControl: false, |
|---|
| 128 | streetViewControl: false, |
|---|
| 129 | fullscreenControl: false |
|---|
| 130 | }); |
|---|
| 131 | |
|---|
| 132 | // setup the center button |
|---|
| 133 | initCenter(); |
|---|
| 134 | |
|---|
| 135 | loadVDSlayer(); // go load the map data |
|---|
| 136 | |
|---|
| 137 | initLayerButtons(); // setup the show/hide layer buttons |
|---|
| 138 | |
|---|
| 139 | updateVDSlayer(); |
|---|
| 140 | |
|---|
| 141 | // Listen for zoom changes and move the vds dots so as to keep a nice |
|---|
| 142 | // visual distance between them appropriate to the zoom factor |
|---|
| 143 | map.addListener('zoom_changed', function() |
|---|
| 144 | { |
|---|
| 145 | // fetch how much the map is currently zoomed |
|---|
| 146 | currentZoom = map.getZoom(); |
|---|
| 147 | // only bother adjusting within this range |
|---|
| 148 | if ((currentZoom < 16) && (currentZoom > 10)) |
|---|
| 149 | { |
|---|
| 150 | // clever formula controls distance between dots |
|---|
| 151 | adjustCoords(calcDistanceFactor()); |
|---|
| 152 | } |
|---|
| 153 | }); |
|---|
| 154 | |
|---|
| 155 | } |
|---|
| 156 | |
|---|
| 157 | </script> |
|---|
| 158 | |
|---|
| 159 | <!-- Project API Key --> |
|---|
| 160 | <script async defer |
|---|
| 161 | src="https://maps.googleapis.com/maps/api/js?key=AIzaSyCJuoPR3s6_qekC-GA1v5rvTcVocL3AXHE&libraries=places&callback=initMap"></script> |
|---|
| 162 | |
|---|
| 163 | <!-- |
|---|
| 164 | export GOOGLE_APPLICATION_CREDENTIALS="/home/<path to file>/TMC Simulator-c3ae15ddb96b.json" |
|---|
| 165 | --> |
|---|
| 166 | </body> |
|---|
| 167 | </html> |
|---|