Skip to content
Snippets Groups Projects
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
ItsLayerCollection.js 8.78 KiB
'use strict';

Object.defineProperty(exports, "__esModule", {
    value: true
});

var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); /**
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        * Created by gavorhes on 12/14/2015.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        */

var _LayerItsInventory = require('../layers/LayerItsInventory');

var _LayerItsInventory2 = _interopRequireDefault(_LayerItsInventory);

var _colors = require('../util/colors');

var colors = _interopRequireWildcard(_colors);

var _provide = require('../util/provide');

var _provide2 = _interopRequireDefault(_provide);

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _typeof(obj) { return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj; }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

var nm = (0, _provide2.default)('collections');

var itsConfig = [{ name: 'Camera', itsType: 'cctv', minZoom: 11, itsIcon: 'cctv.png' }, {
    name: 'Message Signs',
    itsType: 'DMS',
    minZoom: 11,
    itsIconConfig: {
        prop: 'dmsType',
        defaultName: 'DMS',
        defaultIcon: 'dms.png',
        iconArray: [['pcms', 'PCMS', 'pcms.png']]
    }
}, { name: 'Lighting', itsType: 'light', minZoom: 16, itsIcon: 'streetlight.png', visible: false, onDemand: true }, { name: 'Bluetooth', itsType: 'blue', minZoom: 10, itsIcon: 'bluetooth.png', visible: false }, { name: 'Cabinets', itsType: 'cabinet', minZoom: 10, itsIcon: 'cabinet.png', visible: false }, { name: 'Hut', itsType: 'hut', minZoom: 10, itsIcon: 'hut.png', visible: false }, { name: 'Vault', itsType: 'vault', minZoom: 13, itsIcon: 'vault.png', visible: false }, { name: 'Advisory Radio', itsType: 'har', minZoom: 10, itsIcon: 'har.png', visible: false }, {
    name: 'Loop Detectors',
    itsType: 'loop',
    legendCollapse: true,
    minZoom: 14,
    visible: false,
    itsIconConfig: {
        prop: 'dtctrType',
        defaultName: 'Other',
        defaultIcon: 'loopdetectorother.png',
        iconArray: [['detector', 'Detector', 'loopdetector.png'], ['long', 'Long', 'loopdetectorlong.png'], ['zone', 'Zone', 'loopdetectorzone.png']]
    },
    onDemand: true
}, { name: 'Microwave', itsType: 'microwave', minZoom: 14, itsIcon: 'microwave.png', visible: false }, { name: 'Pull Box', itsType: 'pull', minZoom: 14, itsIcon: 'pullbox.png', visible: false, onDemand: true }, { name: 'RWIS', itsType: 'rwis', minZoom: 7, itsIcon: 'rwis.png', visible: false }, { name: 'Ramp Gates', itsType: 'gate', minZoom: 10, itsIcon: 'rampgate.png', visible: false }, { name: 'Ramp Meter', itsType: 'meter', minZoom: 10, itsIcon: 'rampmeter.png', visible: false }, { name: 'Signal', itsType: 'signal', minZoom: 13, itsIcon: 'signal.png', visible: false, onDemand: true }, { name: 'Tower', itsType: 'tower', minZoom: 10, itsIcon: 'tower.png', visible: false },
//{
//    name: 'Trench',
//    itsType: 'trench',
//    onDemand: true,
//    visible: false,
//    onDemandDelay: 500,
//    minZoom: 15,
//    itsLineConfig: {
//        prop: 'installType',
//        //defaultName: 'Other',
//        //defaultWidth: 7,
//        defaultColor: colors.hexAlphaToRgbOrRgba('#747474', 0.8),
//        lineArray: [
//            ['asc', 'Aerial Strand', colors.hexAlphaToRgbOrRgba('#FF0000', 0.7)],
//            ['udbc', 'Directional Bore', colors.hexAlphaToRgbOrRgba('#0509FF', 0.7)],
//            ['utc', 'Underground', colors.hexAlphaToRgbOrRgba('#FF00ED', 0.7)],
//            ['utd', 'Underground - Design', colors.hexAlphaToRgbOrRgba('#A50095', 0.7)]
//        ]
//    }
//},

{
    name: 'Trench',
    itsType: 'trench',
    onDemand: true,
    visible: false,
    onDemandDelay: 500,
    minZoom: 15,
    legendCollapse: true,
    itsLineConfig: {
        prop: 'owner',
        //defaultName: 'Other',
        //defaultWidth: 7,
        defaultColor: colors.hexAlphaToRgbOrRgba('#747474', 0.8),
        lineArray: [['WisDOT', 'WisDOT', colors.hexAlphaToRgbOrRgba('#FF032F', 0.7)], ['WIN', 'WIN', colors.hexAlphaToRgbOrRgba('#FFC632', 0.7)], ['USXchange', 'USXchange', colors.hexAlphaToRgbOrRgba('#2DFF46', 0.7)], ['AT&T', 'AT&T', colors.hexAlphaToRgbOrRgba('#ff2be5', 0.7)], ['Touch America', 'Touch America', colors.hexAlphaToRgbOrRgba('#52f3ff', 0.7)], ['Qwest', 'Qwest', colors.hexAlphaToRgbOrRgba('#9278ff', 0.7)], ['McLeodUSA', 'McLeodUSA', colors.hexAlphaToRgbOrRgba('#2926FF', 0.7)], ['CINC', 'CINC', colors.hexAlphaToRgbOrRgba('#CB00FF', 0.7)], ['City of Madison', 'Madison', colors.hexAlphaToRgbOrRgba('#000380', 0.7)]]
    }
}

//    {
//    name: 'Trench',
//    itsType: 'trench',
//    onDemand: true,
//    visible: false,
//    onDemandDelay: 500,
//    minZoom: 15,
//    itsLineStyle: {
//        color: '#FF0000',
//        width: 7
//    }
//}

];

var ItsLayerCollection = (function () {

    /**
     * Create a collection of all ITS layers
     * @param {ol.Map} theMap the openlayers map
     * @param {Array} [exclude=[]] array of Its layer identifiers to exclude
     *
     * BLUE Bluetooth Detector - Bluetooth Detector
     * CABINET Cabinets - The cabinets
     * CCTV Camera - Traffic Cameras
     * HUT Communication Hut - Communication Hut
     * VAULT Communication Vault - The communication vaults
     * HAR Highway Advisory Radio - Advisory Radios
     * LIGHT Lighting - Lighting
     * LOOP Loop Detectors - Loop Detectors
     * DMS Message Board - Message Boards and Signs
     * MICROWAVE Microwave Detector - Microwave Detectors
     * PULL Pull Box - A pull box
     * RWIS RWIS - Road weather information system
     * GATE Ramp Gate - The ramp Gates
     * METER Ramp Meter - The ramp meters
     * SIGNAL Signal - Traffic Signal
     * TOWER Tower - The towers
     * TRENCH
     */

    function ItsLayerCollection(theMap, exclude) {
        _classCallCheck(this, ItsLayerCollection);

        this.map = theMap;
        this._layers = [];

        exclude = (typeof exclude === 'undefined' ? 'undefined' : _typeof(exclude)) == 'object' ? exclude : [];

        for (var i = 0; i < itsConfig.length; i++) {
            var lyrConfig = itsConfig[i];
            var addLayer = true;

            for (var j = 0; j < exclude.length; j++) {
                if (exclude[j] == lyrConfig.itsType) {
                    addLayer = false;
                    break;
                }
            }

            if (addLayer) {
                var inventLyr = new _LayerItsInventory2.default(lyrConfig);
                this['map'].addLayer(inventLyr.olLayer);
                this._layers.push(inventLyr);
            }
        }
    }

    /**
     * Return the array of layers in this collection
     * @returns {Array<LayerItsInventory>} an array of layers
     */

    _createClass(ItsLayerCollection, [{
        key: 'layers',
        get: function get() {
            return this._layers;
        }
    }]);

    return ItsLayerCollection;
})();

nm.ItsLayerCollection = ItsLayerCollection;
exports.default = ItsLayerCollection;
module.exports = exports['default'];