Changeset 351 in tmcsimulator for trunk/webapps/js
- Timestamp:
- 03/31/2019 10:20:47 AM (7 years ago)
- Location:
- trunk/webapps/js
- Files:
-
- 3 edited
-
cctvLayer.js (modified) (1 diff)
-
cmsLayer.js (modified) (5 diffs)
-
harLayer.js (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/webapps/js/cctvLayer.js
r341 r351 68 68 imgDir = "CCTVSlow/" 69 69 } 70 var label = "freeflow"; 71 if (currentColor == "red") 72 { 73 label = "stopped"; 74 } 75 if (currentColor == "yellow") 76 { 77 label = "slow"; 78 } 79 70 80 // Demo of video embed - only on highway 241 locations 71 81 if (cctvIndex.startsWith("12-241")) 72 82 { 73 cctv_infowindow.setContent('<div style="font-weight:bold;font-family: monospace">' + cctvIndex + " " + cctvLocation + " " + currentColor + '<BR><video width="320" height="240" autoplay controlsloop><source src="images/TrafficFreeflow.ogv" type="video/ogg"></div>');83 cctv_infowindow.setContent('<div style="font-weight:bold;font-family: monospace">' + cctvIndex + " " + cctvLocation + " " + '<BR><video autoplay loop><source src="images/TrafficFreeflow.ogv" type="video/ogg"></div>'); 74 84 } 75 85 else 76 86 // image from fast or slow directories 77 87 { 78 cctv_infowindow.setContent('<div style="font-weight:bold;font-family: monospace">' + cctvIndex + " " + cctvLocation + " " + currentColor+ "<BR>" + imgTag + imgDir + cctvIndex + '.jpg">' + "</div>");88 cctv_infowindow.setContent('<div style="font-weight:bold;font-family: monospace">' + cctvIndex + " " + cctvLocation + " " +label+ "<BR>" + imgTag + imgDir + cctvIndex + '.jpg">' + "</div>"); 79 89 } 80 90 cctv_infowindow.setPosition(event.feature.getGeometry().get()); -
trunk/webapps/js/cmsLayer.js
r335 r351 115 115 document.getElementById('msgdisplay5').value = response5; 116 116 document.getElementById('msgdisplay6').value = response6; 117 save Message(response1 + "|" + response2 + "|" + response3 + "|" +117 saveCMSMessage(response1 + "|" + response2 + "|" + response3 + "|" + 118 118 response4 + "|" + response5 + "|" + response6); 119 119 } … … 128 128 document.getElementById('msgdisplay5').value = ""; 129 129 document.getElementById('msgdisplay6').value = ""; 130 save Message("|||||");130 saveCMSMessage("|||||"); 131 131 } 132 132 133 133 // Save an updated cms message to the file 134 function save Message(outMessage)134 function saveCMSMessage(outMessage) 135 135 { 136 136 // Fetch cmsID from hidden field where it was put when dialog opened. … … 144 144 messageDict[cmsID].cms.message.phase2.Line2 = msgParts[4]; 145 145 messageDict[cmsID].cms.message.phase2.Line3 = msgParts[5]; 146 // Check if there was any messages to save and 146 147 // Set icon to reflect message state 147 148 if (outMessage == "|||||") … … 155 156 cmsLayer.overrideStyle(cmsLayer.getFeatureById(cmsID), currentIcon) 156 157 // break the json string into lines for readability 157 jsonstring = JSON.stringify(Object.values(messageDict)); // ,null,4);158 jsonstring = JSON.stringify(Object.values(messageDict)); //Can't use these in GET parameter ,null,4); 158 159 outString = "{\"data\":" + jsonstring + "}"; 159 160 console.log("outString = " + outString); 160 161 var xhttp = new XMLHttpRequest(); 161 162 xhttp.open("GET", "cgi-bin/saveCMSmessage.py?msg=" + outString, true); … … 163 164 // Using POST might be a better idea ... haven't tried this yet 164 165 // var xhr = new XMLHttpRequest(); 165 // xhr.open("POST", "/cgi-bin/save Message.py?", true);166 // xhr.open("POST", "/cgi-bin/saveCMSmessage.py?", true); 166 167 // xhr.setRequestHeader('Content-Type', 'application/json; charset=UTF-8'); 167 168 // send the collected data as JSON -
trunk/webapps/js/harLayer.js
r338 r351 93 93 { 94 94 document.getElementById('har-msgdisplay1').value = ""; 95 save Message("");95 saveHARMessage(""); 96 96 } 97 97 … … 102 102 var harID = document.getElementById('harID').value; 103 103 HARmessageDict[harID].har.message.phase1.Line1 = outMessage; 104 105 // TODO Set icon to reflect message state 104 // Set icon to reflect message state 106 105 if (outMessage == "") 107 106 { 107 currentIcon = {icon: iconHARidle}; 108 108 } 109 109 else 110 110 { 111 currentIcon = {icon: iconHARactive}; 111 112 } 112 //harLayer.overrideStyle(harLayer.getFeatureById(harID), currentIcon)113 // break the json string into lines for readability113 harLayer.overrideStyle(harLayer.getFeatureById(harID), currentIcon) 114 // convert messasge to json string 114 115 jsonstring = JSON.stringify(Object.values(HARmessageDict)); 115 116 outString = "{\"data\":" + jsonstring + "}"; … … 147 148 var item = messagejson.data[i]; 148 149 HARmessageDict[item.har.index] = item; 149 // TODOSet the appropriate icon on the har icon150 // Set the appropriate icon on the har icon 150 151 // if there's currently no message 151 152 if (item.har.message.phase1.Line1 == "") 152 153 { 154 cmsLayer.overrideStyle(cmsLayer.getFeatureById(item.har.index), {icon: iconHARidle}) 153 155 } 154 156 else 155 157 { 156 } 158 cmsLayer.overrideStyle(cmsLayer.getFeatureById(item.har.index), {icon: iconHARactive}) 159 } 157 160 } 158 161 });
Note: See TracChangeset
for help on using the changeset viewer.
