Changeset 557 in tmcsimulator


Ignore:
Timestamp:
01/16/2020 10:17:24 AM (6 years ago)
Author:
jdalbey
Message:

Add crewcontact file to callout layer. Implements #231

Location:
trunk/webapps
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/webapps/common/js/fileutils.js

    r551 r557  
    11// Load the dynamic json file for highways, etc. 
    22// Ref: https://codepen.io/KryptoniteDove/post/load-json-file-locally-using-pure-javascript 
     3// Can also load .csv files 
    34function loadJSON(inFile, callback) 
    45{ 
  • trunk/webapps/cptms/js/calloutLayer.js

    r539 r557  
    1313// a list of infoWindows, one for each region 
    1414var infowindows = []; 
     15// a list of crew contact info, one for each region 
     16// each item contains supervisor name, region number, phone number 
     17var crewcontact = {}; 
    1518 
    1619// Initialize the layer by showing a control button and drawing polygons 
     
    4043 
    4144    }); 
    42     // Go create the polygons 
    43     initPolygons(); 
     45 
     46    // Load the crew contact info from an external file 
     47    loadJSON("data_layers/crewcontact.json", function(response) 
     48    { 
     49        // Parse JSON string into object 
     50        contactjson = JSON.parse(response); 
     51        // Add each contact to a lookup dictionary  
     52        for (var i = 0; i < contactjson.length; i++) 
     53        { 
     54            var item = contactjson[i]; 
     55            crewcontact[item.Region] = item; 
     56        } 
     57        // Go create the polygons (after JSON finishes loading) 
     58        initPolygons(); 
     59    }); 
     60 
    4461} 
    4562// Show the layer (the polygons and markers) 
     
    222239            lng: -117.9475  //-117.91213989257814 
    223240        }, 
    224         infoContent: "Phone numbers crew 12" 
     241        infoContent: crewcontact["12"].Supervisor + " " + crewcontact["12"].Phone 
    225242    },  
    226243    { 
     
    232249            lng: -117.8545  //-117.85858154296876 
    233250        },  
    234         infoContent: "Phone numbers crew 11" 
     251        infoContent: crewcontact["11"].Supervisor + " " + crewcontact["11"].Phone 
    235252    },  
    236253    { 
     
    242259            lng: -117.69790649414064 
    243260        }, 
    244         infoContent: "Phone numbers crew 10" 
     261        infoContent: crewcontact["10"].Supervisor + " " + crewcontact["10"].Phone 
    245262    },  
    246263    { 
     
    252269            lng: -117.9986572265625 
    253270        }, 
    254         infoContent: "Phone numbers crew 22" 
     271        infoContent: crewcontact["22"].Supervisor + " " + crewcontact["22"].Phone 
    255272    },  
    256273    { 
     
    262279            lng: -117.92999267578126 
    263280        },  
    264         infoContent: "Phone numbers crew 21" 
     281        infoContent: crewcontact["21"].Supervisor + " " + crewcontact["21"].Phone 
    265282    },  
    266283    { 
     
    272289            lng: -118.03573608398439 
    273290        },  
    274         infoContent: "Phone numbers crew 20" 
     291        infoContent: crewcontact["20"].Supervisor + " " + crewcontact["20"].Phone 
    275292    },  
    276293    { 
     
    282299            lng: -117.68829345703126 
    283300        }, 
    284         infoContent: "Phone numbers crew 32" 
     301        infoContent: crewcontact["32"].Supervisor + " " + crewcontact["32"].Phone 
    285302    },  
    286303    { 
     
    292309            lng: -117.80364990234376 
    293310        }, 
    294         infoContent: "Phone numbers crew 31" 
     311        infoContent: crewcontact["31"].Supervisor + " " + crewcontact["31"].Phone 
    295312    },  
    296313    { 
     
    302319            lng: -117.5805  //-117.5784 
    303320        }, 
    304         infoContent: "JENNY WELLS 949-462-8102" 
     321        infoContent: crewcontact["30"].Supervisor + " " + crewcontact["30"].Phone 
    305322    },  
    306323    ]; 
Note: See TracChangeset for help on using the changeset viewer.