Changeset 351 in tmcsimulator for trunk/webapps/js


Ignore:
Timestamp:
03/31/2019 10:20:47 AM (7 years ago)
Author:
jdalbey
Message:

updated ei notebook proof of concepts

Location:
trunk/webapps/js
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/webapps/js/cctvLayer.js

    r341 r351  
    6868            imgDir = "CCTVSlow/" 
    6969        } 
     70        var label = "freeflow"; 
     71        if (currentColor == "red") 
     72        { 
     73            label = "stopped"; 
     74        } 
     75        if (currentColor == "yellow") 
     76        { 
     77            label = "slow"; 
     78        } 
     79 
    7080        // Demo of video embed - only on highway 241 locations 
    7181        if (cctvIndex.startsWith("12-241")) 
    7282        { 
    73             cctv_infowindow.setContent('<div style="font-weight:bold;font-family: monospace">' +  cctvIndex + "&nbsp;" + cctvLocation + "&nbsp;" +currentColor + '<BR><video width="320" height="240" autoplay  controls loop><source src="images/TrafficFreeflow.ogv" type="video/ogg"></div>'); 
     83            cctv_infowindow.setContent('<div style="font-weight:bold;font-family: monospace">' +  cctvIndex + "&nbsp;" + cctvLocation + "&nbsp;" + '<BR><video  autoplay loop><source src="images/TrafficFreeflow.ogv" type="video/ogg"></div>'); 
    7484        } 
    7585        else  
    7686        // image from fast or slow directories 
    7787        { 
    78             cctv_infowindow.setContent('<div style="font-weight:bold;font-family: monospace">' +  cctvIndex + "&nbsp;" + cctvLocation + "&nbsp;" +currentColor + "<BR>" + imgTag + imgDir + cctvIndex + '.jpg">' + "</div>"); 
     88            cctv_infowindow.setContent('<div style="font-weight:bold;font-family: monospace">' +  cctvIndex + "&nbsp;" + cctvLocation + "&nbsp;" +label+ "<BR>" + imgTag + imgDir + cctvIndex + '.jpg">' + "</div>"); 
    7989        } 
    8090        cctv_infowindow.setPosition(event.feature.getGeometry().get()); 
  • trunk/webapps/js/cmsLayer.js

    r335 r351  
    115115            document.getElementById('msgdisplay5').value = response5; 
    116116            document.getElementById('msgdisplay6').value = response6; 
    117             saveMessage(response1 + "|" + response2 + "|" + response3 + "|" + 
     117            saveCMSMessage(response1 + "|" + response2 + "|" + response3 + "|" + 
    118118                        response4 + "|" + response5 + "|" + response6); 
    119119        } 
     
    128128        document.getElementById('msgdisplay5').value = ""; 
    129129        document.getElementById('msgdisplay6').value = ""; 
    130         saveMessage("|||||"); 
     130        saveCMSMessage("|||||"); 
    131131    } 
    132132 
    133133    // Save an updated cms message to the file 
    134     function saveMessage(outMessage) 
     134    function saveCMSMessage(outMessage) 
    135135    { 
    136136        // Fetch cmsID from hidden field where it was put when dialog opened. 
     
    144144        messageDict[cmsID].cms.message.phase2.Line2 = msgParts[4]; 
    145145        messageDict[cmsID].cms.message.phase2.Line3 = msgParts[5]; 
     146        // Check if there was any messages to save and 
    146147        // Set icon to reflect message state 
    147148        if (outMessage == "|||||") 
     
    155156        cmsLayer.overrideStyle(cmsLayer.getFeatureById(cmsID), currentIcon) 
    156157        // 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); 
    158159        outString = "{\"data\":" + jsonstring + "}"; 
    159  
     160        console.log("outString = " + outString); 
    160161        var xhttp = new XMLHttpRequest(); 
    161162        xhttp.open("GET", "cgi-bin/saveCMSmessage.py?msg=" + outString, true); 
     
    163164        // Using POST might be a better idea ... haven't tried this yet 
    164165        //      var xhr = new XMLHttpRequest(); 
    165         //      xhr.open("POST", "/cgi-bin/saveMessage.py?", true); 
     166        //      xhr.open("POST", "/cgi-bin/saveCMSmessage.py?", true); 
    166167        //      xhr.setRequestHeader('Content-Type', 'application/json; charset=UTF-8'); 
    167168        // send the collected data as JSON 
  • trunk/webapps/js/harLayer.js

    r338 r351  
    9393    { 
    9494        document.getElementById('har-msgdisplay1').value = ""; 
    95         saveMessage(""); 
     95        saveHARMessage(""); 
    9696    } 
    9797 
     
    102102        var harID = document.getElementById('harID').value; 
    103103        HARmessageDict[harID].har.message.phase1.Line1 = outMessage; 
    104  
    105         // TODO Set icon to reflect message state 
     104        // Set icon to reflect message state 
    106105        if (outMessage == "") 
    107106        { 
     107            currentIcon = {icon: iconHARidle}; 
    108108        } 
    109109        else 
    110110        { 
     111            currentIcon = {icon: iconHARactive}; 
    111112        } 
    112         //harLayer.overrideStyle(harLayer.getFeatureById(harID), currentIcon) 
    113         // break the json string into lines for readability 
     113        harLayer.overrideStyle(harLayer.getFeatureById(harID), currentIcon) 
     114        // convert messasge to json string  
    114115        jsonstring = JSON.stringify(Object.values(HARmessageDict)); 
    115116        outString = "{\"data\":" + jsonstring + "}"; 
     
    147148                var item = messagejson.data[i]; 
    148149                HARmessageDict[item.har.index] = item; 
    149                 // TODO Set the appropriate icon on the har icon 
     150                // Set the appropriate icon on the har icon 
    150151                //  if there's currently no message 
    151152                if (item.har.message.phase1.Line1 == "") 
    152153                { 
     154                    cmsLayer.overrideStyle(cmsLayer.getFeatureById(item.har.index), {icon: iconHARidle}) 
    153155                } 
    154156                else 
    155157                { 
    156                 } 
     158                    cmsLayer.overrideStyle(cmsLayer.getFeatureById(item.har.index), {icon: iconHARactive}) 
     159                }    
    157160            } 
    158161        }); 
Note: See TracChangeset for help on using the changeset viewer.