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C,CAAC,CAAC;QAC/D,UAAU,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,eAAe,CAAC,CAAC;QACzD,IAAI,qBAAqB,GAAG,UAAU,CAAC,cAAc,EAAE,CAAC;QAExD,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,aAAa,EACvB;YACI,CAAC,EAAE,oBAAoB,CAAC,CAAC,CAAC;YAC1B,CAAC,EAAE,qBAAqB,CAAC,CAAC,CAAC;YAC3B,CAAC,EAAE,oBAAoB,CAAC,CAAC,CAAC;YAC1B,CAAC,EAAE,qBAAqB,CAAC,CAAC,CAAC;SAC9B,CAAC,CAAC;IACX,CAAC;IACL,wBAAC;AAAD,CAAC,AA9GD,CAAgC,gCAAsB,GA8GrD;AAED,EAAE,CAAC,iBAAiB,GAAG,iBAAiB,CAAC;AACzC,kBAAe,iBAAiB,CAAC","sourcesContent":["/**\r\n * Created by gavorhes on 12/8/2015.\r\n */\r\n\r\nimport LayerBaseVectorGeoJson from './LayerBaseVectorGeoJson';\r\nimport mapPopup from '../olHelpers/mapPopup';\r\nimport provide from '../util/provide';\r\nimport ol = require('custom-ol');\r\nimport $ = require('jquery');\r\nimport {proj4326, proj3857} from '../olHelpers/projections'\r\n\r\nlet nm = provide('layers');\r\n\r\n\r\nfunction checkStyleNumber(itsIcon, itsLineStyle, itsIconConfig, itsLineConfig) {\r\n \"use strict\";\r\n\r\n //make sure one and only one configuration is defined;\r\n let configCount = 0;\r\n if (typeof itsIcon == 'string') {\r\n configCount++;\r\n }\r\n\r\n if (typeof itsLineStyle == 'object') {\r\n itsLineStyle.width = typeof itsLineStyle.width == 'number' ? itsLineStyle.width : 5;\r\n itsLineStyle.color = typeof itsLineStyle.color == 'string' ? itsLineStyle.color : 'red';\r\n configCount++;\r\n }\r\n\r\n if (typeof itsIconConfig == 'object') {\r\n itsIconConfig.defaultName = itsIconConfig.defaultName || 'Other';\r\n\r\n if (typeof itsIconConfig.iconArray == 'undefined') {\r\n itsIconConfig.iconArray = [];\r\n }\r\n\r\n configCount++;\r\n }\r\n\r\n if (typeof itsLineConfig == 'object') {\r\n itsLineConfig.defaultName = itsLineConfig.defaultName || 'Other';\r\n itsLineConfig.defaultWidth = itsLineConfig.defaultWidth || 5;\r\n itsLineConfig.defaultColor = itsLineConfig.defaultColor || 'red';\r\n\r\n\r\n if (typeof itsLineConfig.lineArray == 'undefined') {\r\n itsLineConfig.lineArray = [];\r\n }\r\n\r\n // set the width if not defined\r\n for (let i = 0; i < itsLineConfig.lineArray.length; i++) {\r\n if (itsLineConfig.lineArray[i].length == 3) {\r\n itsLineConfig.lineArray[i].push(5);\r\n }\r\n }\r\n\r\n configCount++;\r\n }\r\n\r\n if (configCount > 1) {\r\n throw 'Only one style config can be defined';\r\n }\r\n}\r\n\r\n/**\r\n *\r\n * @param {string} [itsIcon=undefined] the ITS device type icon image see https://transportal.cee.wisc.edu/its/inventory/icons/\r\n *\r\n * @param {object} [itsLineStyle=undefined] A single line style\r\n * @param {string} itsLineStyle.color the line color as rgb or hex\r\n * @param {number} [itsLineStyle.width=5] the line width\r\n *\r\n * @param {object} [itsIconConfig=undefined] The icon subtype configuration\r\n * @param {string} itsIconConfig.prop The property used to define icon attribute symbolization\r\n * @param {string} itsIconConfig.defaultName The default name to be used if no other match is found\r\n * @param {string} itsIconConfig.defaultIcon The default icon to be used for no other matches\r\n * @param {object} [itsIconConfig.iconArray=[]] an array, items with format [property, name, img]\r\n *\r\n * @param {object} [itsLineConfig=undefined] The property used to define icon attribute symbolization\r\n * @param {string} itsLineConfig.prop The property used to define icon attribute symbolization\r\n * @param {string} [itsLineConfig.defaultName=Other] The default name to be used if no other match is found\r\n * @param {string} [itsLineConfig.defaultColor=red] The default line color to be used for no other matches\r\n * @param {number} [itsLineConfig.defaultWidth=5] The default line width to be used for no other matches\r\n * @param {object} [itsLineConfig.lineArray=[]] an array, items with format [property, name, color, optional width]\r\n * @returns {*} undefined, style, or style function\r\n */\r\nfunction defineStyle(itsIcon, itsLineStyle, itsIconConfig, itsLineConfig) : ol.style.Style|Array<ol.style.Style>|ol.StyleFunction{\r\n \"use strict\";\r\n checkStyleNumber(itsIcon, itsLineStyle, itsIconConfig, itsLineConfig);\r\n\r\n let _iconUrlRoot = 'https://transportal.cee.wisc.edu/its/inventory/icons/';\r\n\r\n if (itsIcon) {\r\n return new ol.style.Style({\r\n image: new ol.style.Icon(\r\n {\r\n src: _iconUrlRoot + itsIcon,\r\n crossOrigin: 'anonymous'\r\n }\r\n )\r\n });\r\n } else if (itsLineStyle) {\r\n return new ol.style.Style({\r\n stroke: new ol.style.Stroke({\r\n color: itsLineStyle.color,\r\n width: itsLineStyle.width\r\n })\r\n });\r\n } else if (itsIconConfig) {\r\n return function (feature: ol.Feature) {\r\n let symbolProp = feature.getProperties()[itsIconConfig.prop];\r\n let iconUrl = _iconUrlRoot + itsIconConfig.defaultIcon;\r\n\r\n for (let i = 0; i < itsIconConfig.iconArray.length; i++) {\r\n let thisProp = itsIconConfig.iconArray[i];\r\n\r\n if (symbolProp.trim().toLocaleLowerCase() == thisProp[0].trim().toLocaleLowerCase()) {\r\n iconUrl = _iconUrlRoot + thisProp[2];\r\n break;\r\n }\r\n }\r\n\r\n return [new ol.style.Style({\r\n image: new ol.style.Icon(\r\n {\r\n src: iconUrl,\r\n crossOrigin: 'anonymous'\r\n }\r\n )\r\n })];\r\n };\r\n } else if (itsLineConfig) {\r\n return function (feature: ol.Feature) {\r\n let symbolProp = feature.getProperties()[itsLineConfig.prop];\r\n let colr = itsLineConfig.defaultColor || 'red';\r\n let width = itsLineConfig.defaultWidth || 5;\r\n\r\n for (let i = 0; i < itsLineConfig.lineArray.length; i++) {\r\n let thisProp = itsLineConfig.lineArray[i];\r\n\r\n if (symbolProp.trim().toLocaleLowerCase() == thisProp[0].trim().toLocaleLowerCase()) {\r\n colr = thisProp[2];\r\n width = thisProp[3];\r\n break;\r\n }\r\n }\r\n\r\n return [new ol.style.Style({\r\n stroke: new ol.style.Stroke({\r\n color: colr,\r\n width: width\r\n })\r\n })];\r\n };\r\n } else {\r\n return undefined;\r\n }\r\n}\r\n\r\n/**\r\n *\r\n * @param {string} [itsIcon=undefined] the ITS device type icon image see https://transportal.cee.wisc.edu/its/inventory/icons/\r\n *\r\n * @param {object} [itsLineStyle=undefined] A single line style\r\n * @param {string} itsLineStyle.color the line color as rgb or hex\r\n * @param {number} [itsLineStyle.width=5] the line width\r\n *\r\n * @param {object} [itsIconConfig=undefined] The icon subtype configuration\r\n * @param {string} itsIconConfig.prop The property used to define icon attribute symbolization\r\n * @param {string} itsIconConfig.defaultName The default name to be used if no other match is found\r\n * @param {string} itsIconConfig.defaultIcon The default icon to be used for no other matches\r\n * @param {object} [itsIconConfig.iconArray=[]] an array, items with format [property, name, img]\r\n *\r\n * @param {object} [itsLineConfig=undefined] The property used to define icon attribute symbolization\r\n * @param {string} itsLineConfig.prop The property used to define icon attribute symbolization\r\n * @param {string} [itsLineConfig.defaultName=Other] The default name to be used if no other match is found\r\n * @param {string} [itsLineConfig.defaultColor=red] The default line color to be used for no other matches\r\n * @param {number} [itsLineConfig.defaultWidth=5] The default line width to be used for no other matches\r\n * @param {object} [itsLineConfig.lineArray=[]] an array, items with format [property, name, color, optional width]\r\n * @returns {string} html to be added to the legend\r\n */\r\nfunction defineLegend(itsIcon, itsLineStyle, itsIconConfig, itsLineConfig) {\r\n \"use strict\";\r\n\r\n let iconHeight = 17;\r\n\r\n checkStyleNumber(itsIcon, itsLineStyle, itsIconConfig, itsLineConfig);\r\n\r\n let _iconUrlRoot = 'https://transportal.cee.wisc.edu/its/inventory/icons/';\r\n\r\n if (itsIcon) {\r\n return `<img src=\"${_iconUrlRoot + itsIcon}\" class=\"legend-layer-icon\" height=\"${iconHeight}\">`;\r\n } else if (itsLineStyle) {\r\n return `<hr style=\"height: ${itsLineStyle.width}px; background-color: ${itsLineStyle.color}\">`;\r\n } else if (itsIconConfig) {\r\n let outHtml = '';\r\n outHtml += '<ul>';\r\n\r\n for (let a of itsIconConfig.iconArray) {\r\n outHtml += `<li><span class=\"legend-layer-subitem\">${a[1]}</span><img src=\"${_iconUrlRoot + a[2]}\" class=\"legend-layer-icon\" height=\"${iconHeight}\">`;\r\n }\r\n outHtml += `<li><span class=\"legend-layer-subitem\">${itsIconConfig.defaultName}</span>` +\r\n `<img src=\"${_iconUrlRoot + itsIconConfig.defaultIcon}\" class=\"legend-layer-icon\" height=\"${iconHeight}\"></li>`;\r\n outHtml += '</ul>';\r\n\r\n return outHtml;\r\n } else if (itsLineConfig) {\r\n let outHtml = '';\r\n outHtml += '<ul>';\r\n for (let ls of itsLineConfig.lineArray) {\r\n outHtml += `<li><span class=\"legend-layer-subitem\">${ls[1]}</span>` +\r\n `<hr style=\"height: ${ls[3]}px; background-color: ${ls[2]}\">`;\r\n }\r\n outHtml += `<li><span class=\"legend-layer-subitem\">${itsLineConfig.defaultName}</span>` +\r\n `<hr style=\"height: ${itsLineConfig.defaultWidth}px; background-color: ${itsLineConfig.defaultColor}\"></li>`;\r\n outHtml += '</ul>';\r\n\r\n return outHtml;\r\n } else {\r\n return '';\r\n }\r\n}\r\n\r\n/**\r\n * Its Layer class\r\n * @augments LayerBaseVectorGeoJson\r\n */\r\nclass LayerItsInventory extends LayerBaseVectorGeoJson {\r\n\r\n /**\r\n * ITS device layer, types available at https://transportal.cee.wisc.edu/its/inventory/\r\n * @param {object} options - config\r\n * @param {string} [options.id] - layer id\r\n * @param {string} [options.name=Unnamed Layer] - layer name\r\n * @param {number} [options.opacity=1] - opacity\r\n * @param {boolean} [options.visible=true] - default visible\r\n * @param {number} [options.minZoom=undefined] - min zoom level, 0 - 28\r\n * @param {number} [options.maxZoom=undefined] - max zoom level, 0 - 28\r\n * @param {object} [options.params={}] the get parameters to include to retrieve the layer\r\n * @param {number} [options.zIndex=0] the z index for the layer\r\n * @param {function} [options.loadCallback] function to call on load, context this is the layer object\r\n * @param {boolean} [options.legendCollapse=false] if the legend item should be initially collapsed\r\n * @param {boolean} [options.legendCheckbox=true] if the legend item should have a checkbox for visibility\r\n * @param {boolean} [options.legendContent] additional content to add to the legend\r\n *\r\n * @param {boolean} [options.autoLoad=false] if the layer should auto load if not visible\r\n * @param {object|*} [options.style=undefined] the layer style, use openlayers default style if not defined\r\n * @param {boolean} [options.onDemand=false] if the layer should be loaded by extent on map move\r\n * @param {number} [options.onDemandDelay=300] delay before the map move callback should be called\r\n * @param {MapMoveCls} [options.mapMoveObj=mapMove] alternate map move object for use with multi map pages\r\n *\r\n * @param {string} options.itsType the ITS device type, use the url flag at https://transportal.cee.wisc.edu/its/inventory/\r\n * @param {boolean} [options.addPopup=true] if the popup should be added automatically\r\n *\r\n * @param {string} [options.itsIcon=undefined] the ITS device type icon image see https://transportal.cee.wisc.edu/its/inventory/icons/\r\n *\r\n * @param {object} [options.itsLineStyle=undefined] A single line style\r\n * @param {string} options.itsLineStyle.color the line color as rgb or hex\r\n * @param {number} [options.itsLineStyle.width=5] the line width\r\n *\r\n * @param {object} [options.itsIconConfig=undefined] The icon subtype configuration\r\n * @param {string} options.itsIconConfig.prop The property used to define icon attribute symbolization\r\n * @param {string} options.itsIconConfig.defaultName The default name to be used if no other match is found\r\n * @param {string} options.itsIconConfig.defaultIcon The default icon to be used for no other matches\r\n * @param {object} [options.itsIconConfig.iconArray=[]] an array, items with format [property, name, img]\r\n *\r\n * @param {object} [options.itsLineConfig=undefined] The property used to define icon attribute symbolization\r\n * @param {string} options.itsLineConfig.prop The property used to define icon attribute symbolization\r\n * @param {string} [options.itsLineConfig.defaultName=Other] The default name to be used if no other match is found\r\n * @param {string} [options.itsLineConfig.defaultColor=red] The default line color to be used for no other matches\r\n * @param {number} [options.itsLineConfig.defaultWidth] The default line width to be used for no other matches\r\n * @param {object} [options.itsLineConfig.lineArray=[]] an array, items with format [property, name, color, optional width = 5]\r\n */\r\n constructor(options) {\r\n if (typeof options.itsType !== 'string') {\r\n throw 'its type must be defined';\r\n }\r\n\r\n options.transform = {dataProjection: proj4326, featureProjection: proj3857};\r\n\r\n let addToLegend = '';\r\n\r\n // define a style with the helper function if it is not explicitly defined\r\n if (typeof options.style == 'undefined') {\r\n options.style = defineStyle(\r\n options.itsIcon, options.itsLineStyle, options.itsIconConfig, options.itsLineConfig\r\n );\r\n addToLegend = defineLegend(\r\n options.itsIcon, options.itsLineStyle, options.itsIconConfig, options.itsLineConfig\r\n );\r\n }\r\n\r\n options.params = typeof options.params == 'object' ? options.params : {};\r\n $.extend(options.params, {format: 'JSON', resource: options.itsType});\r\n\r\n super('https://transportal.cee.wisc.edu/its/inventory/', options);\r\n\r\n //add any additional content to the legend\r\n this.addLegendContent(addToLegend);\r\n\r\n options.addPopup = typeof options.addPopup == 'boolean' ? options.addPopup : true;\r\n\r\n if (options.addPopup) {\r\n mapPopup.addVectorPopup(this, function (props) {\r\n return `<iframe src=\"https://transportal.cee.wisc.edu/its/inventory/?feature=${props['featureGuid']}\" ` +\r\n `height=\"250\" width=\"350\"></iframe>`;\r\n });\r\n }\r\n }\r\n\r\n /**\r\n * callback to generate the parameters passed in the get request\r\n * @callback makeGetParams\r\n * @param {object} extent - extent object\r\n * @param {number} extent.minX - minX\r\n * @param {number} extent.minY - minY\r\n * @param {number} extent.maxX - maxX\r\n * @param {number} extent.maxY - maxY\r\n * @param {number} zoomLevel - zoom level\r\n */\r\n mapMoveMakeGetParams(extent, zoomLevel) {\r\n super.mapMoveMakeGetParams(extent, zoomLevel);\r\n let lowerLeft = new ol.geom.Point([extent.minX, extent.minY]);\r\n lowerLeft.transform(this.mapProj, this._projection4326);\r\n let lowerLeftCoordinates = lowerLeft.getCoordinates();\r\n let upperRight = new ol.geom.Point([extent.maxX, extent.maxY]);\r\n upperRight.transform(this.mapProj, this._projection4326);\r\n let upperRightCoordinates = upperRight.getCoordinates();\r\n\r\n $.extend(this.mapMoveParams,\r\n {\r\n L: lowerLeftCoordinates[0],\r\n R: upperRightCoordinates[0],\r\n B: lowerLeftCoordinates[1],\r\n T: upperRightCoordinates[1]\r\n });\r\n }\r\n}\r\n\r\nnm.LayerItsInventory = LayerItsInventory;\r\nexport default LayerItsInventory;\r\n"]}
{"version":3,"file":"LayerItsInventory.js","sourceRoot":"","sources":["../../src/layers/LayerItsInventory.ts"],"names":[],"mappings":"AAAA;;GAEG;;;;;;;;;;;;;AAEH,mEAA8D;AAC9D,kDAA6C;AAC7C,2CAAsC;AACtC,8BAAiC;AACjC,0BAA6B;AAC7B,wDAA2D;AAE3D,IAAI,EAAE,GAAG,iBAAO,CAAC,QAAQ,CAAC,CAAC;AAG3B,0BAA0B,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,aAAa;IACzE,YAAY,CAAC;IAEb,sDAAsD;IACtD,IAAI,WAAW,GAAG,CAAC,CAAC;IACpB,EAAE,CAAC,CAAC,OAAO,OAAO,IAAI,QAAQ,CAAC,CAAC,CAAC;QAC7B,WAAW,EAAE,CAAC;IAClB,CAAC;IAED,EAAE,CAAC,CAAC,OAAO,YAAY,IAAI,QAAQ,CAAC,CAAC,CAAC;QAClC,YAAY,CAAC,KAAK,GAAG,OAAO,YAAY,CAAC,KAAK,IAAI,QAAQ,GAAG,YAAY,CAAC,KAAK,GAAG,CAAC,CAAC;QACpF,YAAY,CAAC,KAAK,GAAG,OAAO,YAAY,CAAC,KAAK,IAAI,QAAQ,GAAG,YAAY,CAAC,KAAK,GAAG,KAAK,CAAC;QACxF,WAAW,EAAE,CAAC;IAClB,CAAC;IAED,EAAE,CAAC,CAAC,OAAO,aAAa,IAAI,QAAQ,CAAC,CAAC,CAAC;QACnC,aAAa,CAAC,WAAW,GAAG,aAAa,CAAC,WAAW,IAAI,OAAO,CAAC;QAEjE,EAAE,CAAC,CAAC,OAAO,aAAa,CAAC,SAAS,IAAI,WAAW,CAAC,CAAC,CAAC;YAChD,aAAa,CAAC,SAAS,GAAG,EAAE,CAAC;QACjC,CAAC;QAED,WAAW,EAAE,CAAC;IAClB,CAAC;IAED,EAAE,CAAC,CAAC,OAAO,aAAa,IAAI,QAAQ,CAAC,CAAC,C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,IAAI,UAAU,GAAG,IAAI,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;QAC/D,UAAU,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,eAAe,CAAC,CAAC;QACzD,IAAI,qBAAqB,GAAG,UAAU,CAAC,cAAc,EAAE,CAAC;QAExD,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,aAAa,EACvB;YACI,CAAC,EAAE,oBAAoB,CAAC,CAAC,CAAC;YAC1B,CAAC,EAAE,qBAAqB,CAAC,CAAC,CAAC;YAC3B,CAAC,EAAE,oBAAoB,CAAC,CAAC,CAAC;YAC1B,CAAC,EAAE,qBAAqB,CAAC,CAAC,CAAC;SAC9B,CAAC,CAAC;IACX,CAAC;IACL,wBAAC;AAAD,CAAC,AA/GD,CAAgC,gCAAsB,GA+GrD;AAED,EAAE,CAAC,iBAAiB,GAAG,iBAAiB,CAAC;AACzC,kBAAe,iBAAiB,CAAC","sourcesContent":["/**\r\n * Created by gavorhes on 12/8/2015.\r\n */\r\n\r\nimport LayerBaseVectorGeoJson from './LayerBaseVectorGeoJson';\r\nimport mapPopup from '../olHelpers/mapPopup';\r\nimport provide from '../util/provide';\r\nimport ol = require('custom-ol');\r\nimport $ = require('jquery');\r\nimport {proj4326, proj3857} from '../olHelpers/projections'\r\n\r\nlet nm = provide('layers');\r\n\r\n\r\nfunction checkStyleNumber(itsIcon, itsLineStyle, itsIconConfig, itsLineConfig) {\r\n \"use strict\";\r\n\r\n //make sure one and only one configuration is defined;\r\n let configCount = 0;\r\n if (typeof itsIcon == 'string') {\r\n configCount++;\r\n }\r\n\r\n if (typeof itsLineStyle == 'object') {\r\n itsLineStyle.width = typeof itsLineStyle.width == 'number' ? itsLineStyle.width : 5;\r\n itsLineStyle.color = typeof itsLineStyle.color == 'string' ? itsLineStyle.color : 'red';\r\n configCount++;\r\n }\r\n\r\n if (typeof itsIconConfig == 'object') {\r\n itsIconConfig.defaultName = itsIconConfig.defaultName || 'Other';\r\n\r\n if (typeof itsIconConfig.iconArray == 'undefined') {\r\n itsIconConfig.iconArray = [];\r\n }\r\n\r\n configCount++;\r\n }\r\n\r\n if (typeof itsLineConfig == 'object') {\r\n itsLineConfig.defaultName = itsLineConfig.defaultName || 'Other';\r\n itsLineConfig.defaultWidth = itsLineConfig.defaultWidth || 5;\r\n itsLineConfig.defaultColor = itsLineConfig.defaultColor || 'red';\r\n\r\n\r\n if (typeof itsLineConfig.lineArray == 'undefined') {\r\n itsLineConfig.lineArray = [];\r\n }\r\n\r\n // set the width if not defined\r\n for (let i = 0; i < itsLineConfig.lineArray.length; i++) {\r\n if (itsLineConfig.lineArray[i].length == 3) {\r\n itsLineConfig.lineArray[i].push(5);\r\n }\r\n }\r\n\r\n configCount++;\r\n }\r\n\r\n if (configCount > 1) {\r\n throw 'Only one style config can be defined';\r\n }\r\n}\r\n\r\n/**\r\n *\r\n * @param {string} [itsIcon=undefined] the ITS device type icon image see https://transportal.cee.wisc.edu/its/inventory/icons/\r\n *\r\n * @param {object} [itsLineStyle=undefined] A single line style\r\n * @param {string} itsLineStyle.color the line color as rgb or hex\r\n * @param {number} [itsLineStyle.width=5] the line width\r\n *\r\n * @param {object} [itsIconConfig=undefined] The icon subtype configuration\r\n * @param {string} itsIconConfig.prop The property used to define icon attribute symbolization\r\n * @param {string} itsIconConfig.defaultName The default name to be used if no other match is found\r\n * @param {string} itsIconConfig.defaultIcon The default icon to be used for no other matches\r\n * @param {object} [itsIconConfig.iconArray=[]] an array, items with format [property, name, img]\r\n *\r\n * @param {object} [itsLineConfig=undefined] The property used to define icon attribute symbolization\r\n * @param {string} itsLineConfig.prop The property used to define icon attribute symbolization\r\n * @param {string} [itsLineConfig.defaultName=Other] The default name to be used if no other match is found\r\n * @param {string} [itsLineConfig.defaultColor=red] The default line color to be used for no other matches\r\n * @param {number} [itsLineConfig.defaultWidth=5] The default line width to be used for no other matches\r\n * @param {object} [itsLineConfig.lineArray=[]] an array, items with format [property, name, color, optional width]\r\n * @returns {*} undefined, style, or style function\r\n */\r\nfunction defineStyle(itsIcon, itsLineStyle, itsIconConfig, itsLineConfig) : ol.style.Style|Array<ol.style.Style>|ol.StyleFunction{\r\n \"use strict\";\r\n checkStyleNumber(itsIcon, itsLineStyle, itsIconConfig, itsLineConfig);\r\n\r\n let _iconUrlRoot = 'https://transportal.cee.wisc.edu/its/inventory/icons/';\r\n\r\n if (itsIcon) {\r\n return new ol.style.Style({\r\n image: new ol.style.Icon(\r\n {\r\n src: _iconUrlRoot + itsIcon,\r\n crossOrigin: 'anonymous'\r\n }\r\n )\r\n });\r\n } else if (itsLineStyle) {\r\n return new ol.style.Style({\r\n stroke: new ol.style.Stroke({\r\n color: itsLineStyle.color,\r\n width: itsLineStyle.width\r\n })\r\n });\r\n } else if (itsIconConfig) {\r\n return function (feature: ol.Feature) {\r\n let symbolProp = feature.getProperties()[itsIconConfig.prop];\r\n let iconUrl = _iconUrlRoot + itsIconConfig.defaultIcon;\r\n\r\n for (let i = 0; i < itsIconConfig.iconArray.length; i++) {\r\n let thisProp = itsIconConfig.iconArray[i];\r\n\r\n if (symbolProp.trim().toLocaleLowerCase() == thisProp[0].trim().toLocaleLowerCase()) {\r\n iconUrl = _iconUrlRoot + thisProp[2];\r\n break;\r\n }\r\n }\r\n\r\n return [new ol.style.Style({\r\n image: new ol.style.Icon(\r\n {\r\n src: iconUrl,\r\n crossOrigin: 'anonymous'\r\n }\r\n )\r\n })];\r\n };\r\n } else if (itsLineConfig) {\r\n return function (feature: ol.Feature) {\r\n let symbolProp = feature.getProperties()[itsLineConfig.prop];\r\n let colr = itsLineConfig.defaultColor || 'red';\r\n let width = itsLineConfig.defaultWidth || 5;\r\n\r\n for (let i = 0; i < itsLineConfig.lineArray.length; i++) {\r\n let thisProp = itsLineConfig.lineArray[i];\r\n\r\n if (symbolProp.trim().toLocaleLowerCase() == thisProp[0].trim().toLocaleLowerCase()) {\r\n colr = thisProp[2];\r\n width = thisProp[3];\r\n break;\r\n }\r\n }\r\n\r\n return [new ol.style.Style({\r\n stroke: new ol.style.Stroke({\r\n color: colr,\r\n width: width\r\n })\r\n })];\r\n };\r\n } else {\r\n return undefined;\r\n }\r\n}\r\n\r\n/**\r\n *\r\n * @param {string} [itsIcon=undefined] the ITS device type icon image see https://transportal.cee.wisc.edu/its/inventory/icons/\r\n *\r\n * @param {object} [itsLineStyle=undefined] A single line style\r\n * @param {string} itsLineStyle.color the line color as rgb or hex\r\n * @param {number} [itsLineStyle.width=5] the line width\r\n *\r\n * @param {object} [itsIconConfig=undefined] The icon subtype configuration\r\n * @param {string} itsIconConfig.prop The property used to define icon attribute symbolization\r\n * @param {string} itsIconConfig.defaultName The default name to be used if no other match is found\r\n * @param {string} itsIconConfig.defaultIcon The default icon to be used for no other matches\r\n * @param {object} [itsIconConfig.iconArray=[]] an array, items with format [property, name, img]\r\n *\r\n * @param {object} [itsLineConfig=undefined] The property used to define icon attribute symbolization\r\n * @param {string} itsLineConfig.prop The property used to define icon attribute symbolization\r\n * @param {string} [itsLineConfig.defaultName=Other] The default name to be used if no other match is found\r\n * @param {string} [itsLineConfig.defaultColor=red] The default line color to be used for no other matches\r\n * @param {number} [itsLineConfig.defaultWidth=5] The default line width to be used for no other matches\r\n * @param {object} [itsLineConfig.lineArray=[]] an array, items with format [property, name, color, optional width]\r\n * @returns {string} html to be added to the legend\r\n */\r\nfunction defineLegend(itsIcon, itsLineStyle, itsIconConfig, itsLineConfig) {\r\n \"use strict\";\r\n\r\n let iconHeight = 17;\r\n\r\n checkStyleNumber(itsIcon, itsLineStyle, itsIconConfig, itsLineConfig);\r\n\r\n let _iconUrlRoot = 'https://transportal.cee.wisc.edu/its/inventory/icons/';\r\n\r\n if (itsIcon) {\r\n return `<img src=\"${_iconUrlRoot + itsIcon}\" class=\"legend-layer-icon\" height=\"${iconHeight}\">`;\r\n } else if (itsLineStyle) {\r\n return `<hr style=\"height: ${itsLineStyle.width}px; background-color: ${itsLineStyle.color}\">`;\r\n } else if (itsIconConfig) {\r\n let outHtml = '';\r\n outHtml += '<ul>';\r\n\r\n for (let a of itsIconConfig.iconArray) {\r\n outHtml += `<li><span class=\"legend-layer-subitem\">${a[1]}</span><img src=\"${_iconUrlRoot + a[2]}\" class=\"legend-layer-icon\" height=\"${iconHeight}\">`;\r\n }\r\n outHtml += `<li><span class=\"legend-layer-subitem\">${itsIconConfig.defaultName}</span>` +\r\n `<img src=\"${_iconUrlRoot + itsIconConfig.defaultIcon}\" class=\"legend-layer-icon\" height=\"${iconHeight}\"></li>`;\r\n outHtml += '</ul>';\r\n\r\n return outHtml;\r\n } else if (itsLineConfig) {\r\n let outHtml = '';\r\n outHtml += '<ul>';\r\n for (let ls of itsLineConfig.lineArray) {\r\n outHtml += `<li><span class=\"legend-layer-subitem\">${ls[1]}</span>` +\r\n `<hr style=\"height: ${ls[3]}px; background-color: ${ls[2]}\">`;\r\n }\r\n outHtml += `<li><span class=\"legend-layer-subitem\">${itsLineConfig.defaultName}</span>` +\r\n `<hr style=\"height: ${itsLineConfig.defaultWidth}px; background-color: ${itsLineConfig.defaultColor}\"></li>`;\r\n outHtml += '</ul>';\r\n\r\n return outHtml;\r\n } else {\r\n return '';\r\n }\r\n}\r\n\r\n/**\r\n * Its Layer class\r\n * @augments LayerBaseVectorGeoJson\r\n */\r\nclass LayerItsInventory extends LayerBaseVectorGeoJson {\r\n\r\n /**\r\n * ITS device layer, types available at https://transportal.cee.wisc.edu/its/inventory/\r\n * @param {object} options - config\r\n * @param {string} [options.id] - layer id\r\n * @param {string} [options.name=Unnamed Layer] - layer name\r\n * @param {number} [options.opacity=1] - opacity\r\n * @param {boolean} [options.visible=true] - default visible\r\n * @param {number} [options.minZoom=undefined] - min zoom level, 0 - 28\r\n * @param {number} [options.maxZoom=undefined] - max zoom level, 0 - 28\r\n * @param {object} [options.params={}] the get parameters to include to retrieve the layer\r\n * @param {number} [options.zIndex=0] the z index for the layer\r\n * @param {function} [options.loadCallback] function to call on load, context this is the layer object\r\n * @param {boolean} [options.legendCollapse=false] if the legend item should be initially collapsed\r\n * @param {boolean} [options.legendCheckbox=true] if the legend item should have a checkbox for visibility\r\n * @param {boolean} [options.legendContent] additional content to add to the legend\r\n *\r\n * @param {boolean} [options.autoLoad=false] if the layer should auto load if not visible\r\n * @param {object|*} [options.style=undefined] the layer style, use openlayers default style if not defined\r\n * @param {boolean} [options.onDemand=false] if the layer should be loaded by extent on map move\r\n * @param {number} [options.onDemandDelay=300] delay before the map move callback should be called\r\n * @param {MapMoveCls} [options.mapMoveObj=mapMove] alternate map move object for use with multi map pages\r\n *\r\n * @param {string} options.itsType the ITS device type, use the url flag at https://transportal.cee.wisc.edu/its/inventory/\r\n * @param {boolean} [options.addPopup=true] if the popup should be added automatically\r\n *\r\n * @param {string} [options.itsIcon=undefined] the ITS device type icon image see https://transportal.cee.wisc.edu/its/inventory/icons/\r\n *\r\n * @param {object} [options.itsLineStyle=undefined] A single line style\r\n * @param {string} options.itsLineStyle.color the line color as rgb or hex\r\n * @param {number} [options.itsLineStyle.width=5] the line width\r\n *\r\n * @param {object} [options.itsIconConfig=undefined] The icon subtype configuration\r\n * @param {string} options.itsIconConfig.prop The property used to define icon attribute symbolization\r\n * @param {string} options.itsIconConfig.defaultName The default name to be used if no other match is found\r\n * @param {string} options.itsIconConfig.defaultIcon The default icon to be used for no other matches\r\n * @param {object} [options.itsIconConfig.iconArray=[]] an array, items with format [property, name, img]\r\n *\r\n * @param {object} [options.itsLineConfig=undefined] The property used to define icon attribute symbolization\r\n * @param {string} options.itsLineConfig.prop The property used to define icon attribute symbolization\r\n * @param {string} [options.itsLineConfig.defaultName=Other] The default name to be used if no other match is found\r\n * @param {string} [options.itsLineConfig.defaultColor=red] The default line color to be used for no other matches\r\n * @param {number} [options.itsLineConfig.defaultWidth] The default line width to be used for no other matches\r\n * @param {object} [options.itsLineConfig.lineArray=[]] an array, items with format [property, name, color, optional width = 5]\r\n */\r\n constructor(options) {\r\n if (typeof options.itsType !== 'string') {\r\n throw 'its type must be defined';\r\n }\r\n console.log('its');\r\n\r\n options.transform = {dataProjection: proj4326, featureProjection: proj3857};\r\n\r\n let addToLegend = '';\r\n\r\n // define a style with the helper function if it is not explicitly defined\r\n if (typeof options.style == 'undefined') {\r\n options.style = defineStyle(\r\n options.itsIcon, options.itsLineStyle, options.itsIconConfig, options.itsLineConfig\r\n );\r\n addToLegend = defineLegend(\r\n options.itsIcon, options.itsLineStyle, options.itsIconConfig, options.itsLineConfig\r\n );\r\n }\r\n\r\n options.params = typeof options.params == 'object' ? options.params : {};\r\n $.extend(options.params, {format: 'JSON', resource: options.itsType});\r\n\r\n super('https://transportal.cee.wisc.edu/its/inventory/', options);\r\n\r\n //add any additional content to the legend\r\n this.addLegendContent(addToLegend);\r\n\r\n options.addPopup = typeof options.addPopup == 'boolean' ? options.addPopup : true;\r\n\r\n if (options.addPopup) {\r\n mapPopup.addVectorPopup(this, function (props) {\r\n return `<iframe src=\"https://transportal.cee.wisc.edu/its/inventory/?feature=${props['featureGuid']}\" ` +\r\n `height=\"250\" width=\"350\"></iframe>`;\r\n });\r\n }\r\n }\r\n\r\n /**\r\n * callback to generate the parameters passed in the get request\r\n * @callback makeGetParams\r\n * @param {object} extent - extent object\r\n * @param {number} extent.minX - minX\r\n * @param {number} extent.minY - minY\r\n * @param {number} extent.maxX - maxX\r\n * @param {number} extent.maxY - maxY\r\n * @param {number} zoomLevel - zoom level\r\n */\r\n mapMoveMakeGetParams(extent, zoomLevel) {\r\n super.mapMoveMakeGetParams(extent, zoomLevel);\r\n let lowerLeft = new ol.geom.Point([extent.minX, extent.minY]);\r\n lowerLeft.transform(this.mapProj, this._projection4326);\r\n let lowerLeftCoordinates = lowerLeft.getCoordinates();\r\n let upperRight = new ol.geom.Point([extent.maxX, extent.maxY]);\r\n upperRight.transform(this.mapProj, this._projection4326);\r\n let upperRightCoordinates = upperRight.getCoordinates();\r\n\r\n $.extend(this.mapMoveParams,\r\n {\r\n L: lowerLeftCoordinates[0],\r\n R: upperRightCoordinates[0],\r\n B: lowerLeftCoordinates[1],\r\n T: upperRightCoordinates[1]\r\n });\r\n }\r\n}\r\n\r\nnm.LayerItsInventory = LayerItsInventory;\r\nexport default LayerItsInventory;\r\n"]}