Changeset 579 in tmcsimulator
- Timestamp:
- 02/02/2020 08:09:33 AM (6 years ago)
- Location:
- trunk/webapps/GTEC
- Files:
-
- 3 edited
-
css/styles.css (modified) (1 diff)
-
index.html (modified) (1 diff)
-
js/vdsLayer.js (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/webapps/GTEC/css/styles.css
r569 r579 55 55 border:1px red solid; 56 56 } 57 #time {57 #timebox { 58 58 background: #E6E6FA; 59 59 font-family: Roboto; -
trunk/webapps/GTEC/index.html
r572 r579 26 26 <button id="greenButton">Green</button> 27 27 <button id="yellowButton">Yellow</button> 28 <input type = "text" 29 id = "timebox" 30 value = "00:00:00" 31 autocomplete=off 32 onchange = "saveTime()"/> 28 33 <!-- <button id="harButton" class="unstyled-button"><img id="harBtnImg" src="images/btnReady_HAR.png"></button> 29 34 <button id="cctvButton" class="unstyled-button"><img id="cctvBtnImg" src="images/btnReady_CCTV.png"></button> -
trunk/webapps/GTEC/js/vdsLayer.js
r570 r579 1 /** Logic for traffic events creator. 2 Based on vdsLayer from CPTMS. 3 @author T. Kumar, J. Dalbey Feb 2020 4 See wiki for user documentation. 5 */ 1 6 var postmileList = []; // the list of postmiles saved from the json file. 2 7 var chosenColor = "yellow"; // stores color that user picks, initial default yellow 8 var currentTime; // the current event time 3 9 4 10 // function to find differences between two arrays … … 27 33 anchor: new google.maps.Point(6, 6) 28 34 }; 35 } 36 37 function saveTime() 38 { 39 var timeOverride = document.getElementById("timebox").value; 40 var d = new Date(); // creates a Date Object using the clients current time 41 42 let [hours,minutes,seconds] = timeOverride.split(':'); // using ES6 destructuring 43 44 d.setHours(+hours); // set the hours, using implicit type coercion 45 d.setMinutes(minutes); // you can pass Number or String, it doesn't really matter 46 d.setSeconds(seconds); 47 currentTime = d; // save as new current time 48 } 49 50 // Refresh the time display 51 function updateTime(time) 52 { 53 document.getElementById("timebox").value = time; 29 54 } 30 55 … … 56 81 var first = []; // stores first dot 57 82 var asc = false; //ascending 58 //var color_arr = [];59 83 var white_arr = []; //stores all white dots 60 84 // Initialize the current time to zero 61 varcurrentTime = new Date(0);85 currentTime = new Date(0); 62 86 currentTime.setHours(0); 63 87 currentTime.setMinutes(0); … … 76 100 // checks highway direction to determine if postmiles are ascending or descending 77 101 if (parseFloat(event_arr[2]) < parseFloat(first[2])) 78 { 102 { 79 103 asc = false; 80 104 } … … 106 130 } 107 131 }); 108 //color_arr.push(clicked_dots);109 //console.log(clicked_dots);110 //console.log(range);111 132 // extracts ids for all the white dots 112 133 var white_arr_ids = white_arr.map(function (marker) { … … 136 157 }); 137 158 } 138 // Increment the time by one-half minute (30 seconds)139 var millisecs = currentTime.getTime();140 millisecs += 30000;141 currentTime = new Date(millisecs);142 159 143 160 // Create a printable string for the time (HH:MM:SS) … … 148 165 first[1] + "\t" + first[2] + "\t" + range.toFixed(3) + "\t" 149 166 + getColorAbbr(chosenColor); 150 console.log(lineOut);151 167 152 168 // Using Ajax POST to send the data … … 156 172 // send the collected data 157 173 xhr.send("msg="+lineOut + "\n") 174 175 // Increment the time by one-half minute (30 seconds) 176 var millisecs = currentTime.getTime(); 177 millisecs += 30000; 178 currentTime = new Date(millisecs); 179 // Refresh the time display 180 updateTime(currentTime.toLocaleTimeString('it-IT')); 181 158 182 } 159 183 // if user has not yet clicked on a dot … … 317 341 var greenColor = document.getElementById('greenButton'); 318 342 var yellowColor = document.getElementById('yellowButton'); 343 var time = document.getElementById('timebox'); 344 map.controls[google.maps.ControlPosition.BOTTOM_CENTER].push(time); 319 345 map.controls[google.maps.ControlPosition.BOTTOM_CENTER].push(redColor); 320 346 map.controls[google.maps.ControlPosition.BOTTOM_CENTER].push(greenColor);
Note: See TracChangeset
for help on using the changeset viewer.
