Changeset 305 in tmcsimulator for trunk/src/cptms/cptms_map.html
- Timestamp:
- 03/12/2019 09:49:19 AM (7 years ago)
- File:
-
- 1 edited
-
trunk/src/cptms/cptms_map.html (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/cptms/cptms_map.html
r304 r305 4 4 <!-- Launch with python -m CGIHTTPServer 8080 --> 5 5 <meta http-equiv="Content-Type" content="text/html;charset=utf-8"> 6 <title>CPTMS Map v0. 5.6</title>6 <title>CPTMS Map v0.6.0</title> 7 7 <style> 8 8 @font-face { … … 36 36 font-size: large; 37 37 } 38 /*img.resize { 39 max-width:auto; 40 max-height:500px; 41 }*/ 38 42 #search-input { 39 43 background-color: #17263c; /* #CD853F; /*#E6E6FA; /* lavender */ … … 126 130 <body> 127 131 <!-- 132 Version 6.0 Adds speed-dependent images to infowindow for cctv icons 133 Version 5.8 Adds an infowindow with a static image for all cctv icons 128 134 Version 5.7 integrates CCTV icons and button (but empty click handler) 129 135 Version 5.6 integrates CMS features … … 200 206 var blueFlag = "images/CPTMSImages/icon_cmsBlue.png"; 201 207 var yellowFlag = "images/CPTMSImages/icon_cmsYellow.png"; 202 var cctvIcon = "images/CPTMSImages/icon_cctvBlue.png"; 208 var cctvIcon = "images/CPTMSImages/icon_cctvCyan.png"; 209 var cctvIconWhite = "images/CPTMSImages/icon_cctvWhite.png"; 203 210 var messageList; 204 211 var cms_info; … … 578 585 loadJSON(kCCTVfile, function(response) 579 586 { 587 var imgTag = '<IMG WIDTH="700" SRC="images/CPTMSImages/'; 580 588 // Parse JSON string into object 581 589 cctv_info = JSON.parse(response); … … 587 595 var currLong = Number(cctv.location.longitude); 588 596 var locationInfo = cctv.location.locationName; 597 var imgIcon = cctvIcon 598 if ((typeof map.data.getFeatureById(cctv.location.nearVDS)) == "undefined") 599 { 600 imgIcon = cctvIconWhite; 601 } 602 603 var vdsResult = map.data.getFeatureById(cctv.location.nearVDS) 604 //console.log("building "+locationInfo+" near "+cctv.location.nearVDS + " found "+vdsResult); 589 605 cctvList[i] = new google.maps.Marker( 590 606 { … … 595 611 }, 596 612 map: map, 597 icon: cctvIcon,613 icon: imgIcon, 598 614 title: "#"+i+" " +locationInfo, 599 615 cctvid: "" + i, … … 602 618 nearVDS: cctv.location.nearVDS 603 619 }); 620 cctvList[i].info=new google.maps.InfoWindow({ 621 content: locationInfo 622 }); 623 604 624 cctvList[i].setVisible(false); // initially hidden 605 google.maps.event.addListener(cctvList[i],'click',625 cctvList[i].addListener('click', 606 626 function() 607 627 { 608 // fetch the sequential msg #609 628 cctvIndex = this.index; 610 alert("here will be the view of cctv: " + cctvIndex); 629 //console.log(this.title + " is looking for " + this.nearVDS); 630 currentFeature = map.data.getFeatureById(this.nearVDS); 631 currentColor = currentFeature.getProperty("color"); 632 var imgDir = "CCTVFast/"; 633 if (currentColor == "red" || currentColor == "yellow") 634 { 635 imgDir = "CCTVSlow/" 636 } 637 //console.log(currentFeature.getId() + ' ' + currentColor + " " + cctvIndex); 638 this.info.setContent('<div>' + this.location + " nearVDS:" 639 + this.nearVDS + " " + currentColor + "<BR>"+ imgTag + imgDir + cctvIndex + '.jpg">' + "</div>"); 640 this.info.open(map, this); 611 641 }); 612 642 } … … 615 645 616 646 617 647 // Center justify message text in a 16 column field 648 function justifyText(message) 649 { 650 var kBlanks = " "; 651 var padLen = (16 - message.length)/2; 652 var padding = kBlanks.substring(0,padLen); 653 return padding + message; 654 } 618 655 619 656 function handleSubmit() 620 657 { 621 658 // recover the user's response 622 var response1 = document.getElementById('msgcontent1').value;623 var response2 = document.getElementById('msgcontent2').value;624 var response3 = document.getElementById('msgcontent3').value;659 var response1 = justifyText(document.getElementById('msgcontent1').value.trim()); 660 var response2 = justifyText(document.getElementById('msgcontent2').value.trim()); 661 var response3 = justifyText(document.getElementById('msgcontent3').value.trim()); 625 662 var newMsg = response1+response2+response3; 626 663 if (newMsg.length == 0) … … 710 747 getMessage(1); // load the current message file 711 748 setCMSmarkers(); 712 setCCTVmarkers();749 var startTime = setTimeout(setCCTVmarkers, 3000); 713 750 714 751 // Start a timer to refresh the map every 10 seconds
Note: See TracChangeset
for help on using the changeset viewer.
