{"version":3,"file":"esri-leaflet-renderers.js","sources":["../src/Symbols/Symbol.js","../node_modules/leaflet-shape-markers/src/ShapeMarker.js","../node_modules/leaflet-shape-markers/src/CrossMarker.js","../node_modules/leaflet-shape-markers/src/XMarker.js","../node_modules/leaflet-shape-markers/src/SquareMarker.js","../node_modules/leaflet-shape-markers/src/DiamondMarker.js","../src/Symbols/PointSymbol.js","../src/Symbols/LineSymbol.js","../src/Symbols/PolygonSymbol.js","../src/Renderers/Renderer.js","../src/Renderers/SimpleRenderer.js","../src/Renderers/ClassBreaksRenderer.js","../src/Renderers/UniqueValueRenderer.js","../src/FeatureLayerHook.js"],"sourcesContent":["import { Class } from 'leaflet';\r\n\r\nexport var Symbol = Class.extend({\r\n initialize: function (symbolJson, options) {\r\n this._symbolJson = symbolJson;\r\n this.val = null;\r\n this._styles = {};\r\n this._isDefault = false;\r\n this._layerTransparency = 1;\r\n if (options && options.layerTransparency) {\r\n this._layerTransparency = 1 - (options.layerTransparency / 100.0);\r\n }\r\n },\r\n\r\n // the geojson values returned are in points\r\n pixelValue: function (pointValue) {\r\n return pointValue * 1.333;\r\n },\r\n\r\n // color is an array [r,g,b,a]\r\n colorValue: function (color) {\r\n return 'rgb(' + color[0] + ',' + color[1] + ',' + color[2] + ')';\r\n },\r\n\r\n alphaValue: function (color) {\r\n var alpha = color[3] / 255.0;\r\n return alpha * this._layerTransparency;\r\n },\r\n\r\n getSize: function (feature, sizeInfo) {\r\n var attr = feature.properties;\r\n var field = sizeInfo.field;\r\n var size = 0;\r\n var featureValue = null;\r\n\r\n if (field) {\r\n featureValue = attr[field];\r\n var minSize = sizeInfo.minSize;\r\n var maxSize = sizeInfo.maxSize;\r\n var minDataValue = sizeInfo.minDataValue;\r\n var maxDataValue = sizeInfo.maxDataValue;\r\n var featureRatio;\r\n var normField = sizeInfo.normalizationField;\r\n var normValue = attr ? parseFloat(attr[normField]) : undefined;\r\n\r\n if (featureValue === null || (normField && ((isNaN(normValue) || normValue === 0)))) {\r\n return null;\r\n }\r\n\r\n if (!isNaN(normValue)) {\r\n featureValue /= normValue;\r\n }\r\n\r\n if (minSize !== null && maxSize !== null && minDataValue !== null && maxDataValue !== null) {\r\n if (featureValue <= minDataValue) {\r\n size = minSize;\r\n } else if (featureValue >= maxDataValue) {\r\n size = maxSize;\r\n } else {\r\n featureRatio = (featureValue - minDataValue) / (maxDataValue - minDataValue);\r\n size = minSize + (featureRatio * (maxSize - minSize));\r\n }\r\n }\r\n size = isNaN(size) ? 0 : size;\r\n }\r\n return size;\r\n },\r\n\r\n getColor: function (feature, colorInfo) {\r\n // required information to get color\r\n if (!(feature.properties && colorInfo && colorInfo.field && colorInfo.stops)) {\r\n return null;\r\n }\r\n\r\n var attr = feature.properties;\r\n var featureValue = attr[colorInfo.field];\r\n var lowerBoundColor, upperBoundColor, lowerBound, upperBound;\r\n var normField = colorInfo.normalizationField;\r\n var normValue = attr ? parseFloat(attr[normField]) : undefined;\r\n if (featureValue === null || (normField && ((isNaN(normValue) || normValue === 0)))) {\r\n return null;\r\n }\r\n\r\n if (!isNaN(normValue)) {\r\n featureValue /= normValue;\r\n }\r\n\r\n if (featureValue <= colorInfo.stops[0].value) {\r\n return colorInfo.stops[0].color;\r\n }\r\n var lastStop = colorInfo.stops[colorInfo.stops.length - 1];\r\n if (featureValue >= lastStop.value) {\r\n return lastStop.color;\r\n }\r\n\r\n // go through the stops to find min and max\r\n for (var i = 0; i < colorInfo.stops.length; i++) {\r\n var stopInfo = colorInfo.stops[i];\r\n\r\n if (stopInfo.value <= featureValue) {\r\n lowerBoundColor = stopInfo.color;\r\n lowerBound = stopInfo.value;\r\n } else if (stopInfo.value > featureValue) {\r\n upperBoundColor = stopInfo.color;\r\n upperBound = stopInfo.value;\r\n break;\r\n }\r\n }\r\n\r\n // feature falls between two stops, interplate the colors\r\n if (!isNaN(lowerBound) && !isNaN(upperBound)) {\r\n var range = upperBound - lowerBound;\r\n if (range > 0) {\r\n // more weight the further it is from the lower bound\r\n var upperBoundColorWeight = (featureValue - lowerBound) / range;\r\n if (upperBoundColorWeight) {\r\n // more weight the further it is from the upper bound\r\n var lowerBoundColorWeight = (upperBound - featureValue) / range;\r\n if (lowerBoundColorWeight) {\r\n // interpolate the lower and upper bound color by applying the\r\n // weights to each of the rgba colors and adding them together\r\n var interpolatedColor = [];\r\n for (var j = 0; j < 4; j++) {\r\n interpolatedColor[j] = Math.round((lowerBoundColor[j] * lowerBoundColorWeight) + (upperBoundColor[j] * upperBoundColorWeight));\r\n }\r\n return interpolatedColor;\r\n } else {\r\n // no difference between featureValue and upperBound, 100% of upperBoundColor\r\n return upperBoundColor;\r\n }\r\n } else {\r\n // no difference between featureValue and lowerBound, 100% of lowerBoundColor\r\n return lowerBoundColor;\r\n }\r\n }\r\n }\r\n // if we get to here, none of the cases apply so return null\r\n return null;\r\n }\r\n});\r\n\r\n// export function symbol (symbolJson) {\r\n// return new Symbol(symbolJson);\r\n// }\r\n\r\nexport default Symbol;\r\n","import L from 'leaflet';\n\nexport var ShapeMarker = L.Path.extend({\n\n initialize: function (latlng, size, options) {\n L.setOptions(this, options);\n this._size = size;\n this._latlng = L.latLng(latlng);\n this._svgCanvasIncludes();\n },\n\n toGeoJSON: function () {\n return L.GeoJSON.getFeature(this, {\n type: 'Point',\n coordinates: L.GeoJSON.latLngToCoords(this.getLatLng())\n });\n },\n\n _svgCanvasIncludes: function () {\n // implement in sub class\n },\n\n _project: function () {\n this._point = this._map.latLngToLayerPoint(this._latlng);\n },\n\n _update: function () {\n if (this._map) {\n this._updatePath();\n }\n },\n\n _updatePath: function () {\n // implement in sub class\n },\n\n setLatLng: function (latlng) {\n this._latlng = L.latLng(latlng);\n this.redraw();\n return this.fire('move', {latlng: this._latlng});\n },\n\n getLatLng: function () {\n return this._latlng;\n },\n\n setSize: function (size) {\n this._size = size;\n return this.redraw();\n },\n\n getSize: function () {\n return this._size;\n }\n});\n","import L from 'leaflet';\nimport { ShapeMarker } from './ShapeMarker';\n\nexport var CrossMarker = ShapeMarker.extend({\n\n initialize: function (latlng, size, options) {\n ShapeMarker.prototype.initialize.call(this, latlng, size, options);\n },\n\n _updatePath: function () {\n this._renderer._updateCrossMarker(this);\n },\n\n _svgCanvasIncludes: function () {\n L.Canvas.include({\n _updateCrossMarker: function (layer) {\n var latlng = layer._point;\n var offset = layer._size / 2.0;\n var ctx = this._ctx;\n\n ctx.beginPath();\n ctx.moveTo(latlng.x, latlng.y + offset);\n ctx.lineTo(latlng.x, latlng.y - offset);\n this._fillStroke(ctx, layer);\n\n ctx.moveTo(latlng.x - offset, latlng.y);\n ctx.lineTo(latlng.x + offset, latlng.y);\n this._fillStroke(ctx, layer);\n }\n });\n\n L.SVG.include({\n _updateCrossMarker: function (layer) {\n var latlng = layer._point;\n var offset = layer._size / 2.0;\n\n if (L.Browser.vml) {\n latlng._round();\n offset = Math.round(offset);\n }\n\n var str = 'M' + latlng.x + ',' + (latlng.y + offset) +\n 'L' + latlng.x + ',' + (latlng.y - offset) +\n 'M' + (latlng.x - offset) + ',' + latlng.y +\n 'L' + (latlng.x + offset) + ',' + latlng.y;\n\n this._setPath(layer, str);\n }\n });\n }\n});\n\nexport var crossMarker = function (latlng, size, options) {\n return new CrossMarker(latlng, size, options);\n};\n\nexport default crossMarker;\n","import L from 'leaflet';\nimport { ShapeMarker } from './ShapeMarker';\n\nexport var XMarker = ShapeMarker.extend({\n\n initialize: function (latlng, size, options) {\n ShapeMarker.prototype.initialize.call(this, latlng, size, options);\n },\n\n _updatePath: function () {\n this._renderer._updateXMarker(this);\n },\n\n _svgCanvasIncludes: function () {\n L.Canvas.include({\n _updateXMarker: function (layer) {\n var latlng = layer._point;\n var offset = layer._size / 2.0;\n var ctx = this._ctx;\n\n ctx.beginPath();\n\n ctx.moveTo(latlng.x + offset, latlng.y + offset);\n ctx.lineTo(latlng.x - offset, latlng.y - offset);\n this._fillStroke(ctx, layer);\n }\n });\n\n L.SVG.include({\n _updateXMarker: function (layer) {\n var latlng = layer._point;\n var offset = layer._size / 2.0;\n\n if (L.Browser.vml) {\n latlng._round();\n offset = Math.round(offset);\n }\n\n var str = 'M' + (latlng.x + offset) + ',' + (latlng.y + offset) +\n 'L' + (latlng.x - offset) + ',' + (latlng.y - offset) +\n 'M' + (latlng.x - offset) + ',' + (latlng.y + offset) +\n 'L' + (latlng.x + offset) + ',' + (latlng.y - offset);\n\n this._setPath(layer, str);\n }\n });\n }\n});\n\nexport var xMarker = function (latlng, size, options) {\n return new XMarker(latlng, size, options);\n};\n\nexport default xMarker;\n","import L from 'leaflet';\nimport { ShapeMarker } from './ShapeMarker';\n\nexport var SquareMarker = ShapeMarker.extend({\n options: {\n fill: true\n },\n\n initialize: function (latlng, size, options) {\n ShapeMarker.prototype.initialize.call(this, latlng, size, options);\n },\n\n _updatePath: function () {\n this._renderer._updateSquareMarker(this);\n },\n\n _svgCanvasIncludes: function () {\n L.Canvas.include({\n _updateSquareMarker: function (layer) {\n var latlng = layer._point;\n var offset = layer._size / 2.0;\n var ctx = this._ctx;\n\n ctx.beginPath();\n\n ctx.moveTo(latlng.x + offset, latlng.y + offset);\n ctx.lineTo(latlng.x - offset, latlng.y + offset);\n ctx.lineTo(latlng.x - offset, latlng.y - offset);\n ctx.lineTo(latlng.x + offset, latlng.y - offset);\n\n ctx.closePath();\n\n this._fillStroke(ctx, layer);\n }\n });\n\n L.SVG.include({\n _updateSquareMarker: function (layer) {\n var latlng = layer._point;\n var offset = layer._size / 2.0;\n\n if (L.Browser.vml) {\n latlng._round();\n offset = Math.round(offset);\n }\n\n var str = 'M' + (latlng.x + offset) + ',' + (latlng.y + offset) +\n 'L' + (latlng.x - offset) + ',' + (latlng.y + offset) +\n 'L' + (latlng.x - offset) + ',' + (latlng.y - offset) +\n 'L' + (latlng.x + offset) + ',' + (latlng.y - offset);\n\n str = str + (L.Browser.svg ? 'z' : 'x');\n\n this._setPath(layer, str);\n }\n });\n }\n});\n\nexport var squareMarker = function (latlng, size, options) {\n return new SquareMarker(latlng, size, options);\n};\n\nexport default squareMarker;\n","import L from 'leaflet';\nimport { ShapeMarker } from './ShapeMarker';\n\nexport var DiamondMarker = ShapeMarker.extend({\n options: {\n fill: true\n },\n\n initialize: function (latlng, size, options) {\n ShapeMarker.prototype.initialize.call(this, latlng, size, options);\n },\n\n _updatePath: function () {\n this._renderer._updateDiamondMarker(this);\n },\n\n _svgCanvasIncludes: function () {\n L.Canvas.include({\n _updateDiamondMarker: function (layer) {\n var latlng = layer._point;\n var offset = layer._size / 2.0;\n var ctx = this._ctx;\n\n ctx.beginPath();\n\n ctx.moveTo(latlng.x, latlng.y + offset);\n ctx.lineTo(latlng.x - offset, latlng.y);\n ctx.lineTo(latlng.x, latlng.y - offset);\n ctx.lineTo(latlng.x + offset, latlng.y);\n\n ctx.closePath();\n\n this._fillStroke(ctx, layer);\n }\n });\n\n L.SVG.include({\n _updateDiamondMarker: function (layer) {\n var latlng = layer._point;\n var offset = layer._size / 2.0;\n\n if (L.Browser.vml) {\n latlng._round();\n offset = Math.round(offset);\n }\n\n var str = 'M' + latlng.x + ',' + (latlng.y + offset) +\n 'L' + (latlng.x - offset) + ',' + latlng.y +\n 'L' + latlng.x + ',' + (latlng.y - offset) +\n 'L' + (latlng.x + offset) + ',' + latlng.y;\n\n str = str + (L.Browser.svg ? 'z' : 'x');\n\n this._setPath(layer, str);\n }\n });\n }\n});\n\nexport var diamondMarker = function (latlng, size, options) {\n return new DiamondMarker(latlng, size, options);\n};\n\nexport default diamondMarker;\n","import {\r\n marker,\r\n icon as leafletIcon,\r\n extend,\r\n circleMarker\r\n} from 'leaflet';\r\nimport Symbol from './Symbol';\r\nimport { squareMarker, xMarker, crossMarker, diamondMarker } from 'leaflet-shape-markers';\r\n\r\nexport var PointSymbol = Symbol.extend({\r\n\r\n statics: {\r\n MARKERTYPES: ['esriSMSCircle', 'esriSMSCross', 'esriSMSDiamond', 'esriSMSSquare', 'esriSMSX', 'esriPMS']\r\n },\r\n\r\n initialize: function (symbolJson, options) {\r\n var url;\r\n Symbol.prototype.initialize.call(this, symbolJson, options);\r\n if (options) {\r\n this.serviceUrl = options.url;\r\n }\r\n if (symbolJson) {\r\n if (symbolJson.type === 'esriPMS') {\r\n var imageUrl = this._symbolJson.url;\r\n if ((imageUrl && imageUrl.substr(0, 7) === 'http://') || (imageUrl.substr(0, 8) === 'https://')) {\r\n // web image\r\n url = this.sanitize(imageUrl);\r\n this._iconUrl = url;\r\n } else {\r\n url = this.serviceUrl + 'images/' + imageUrl;\r\n this._iconUrl = options && options.token ? url + '?token=' + options.token : url;\r\n }\r\n if (symbolJson.imageData) {\r\n this._iconUrl = 'data:' + symbolJson.contentType + ';base64,' + symbolJson.imageData;\r\n }\r\n // leaflet does not allow resizing icons so keep a hash of different\r\n // icon sizes to try and keep down on the number of icons created\r\n this._icons = {};\r\n // create base icon\r\n this.icon = this._createIcon(this._symbolJson);\r\n } else {\r\n this._fillStyles();\r\n }\r\n }\r\n },\r\n\r\n // prevent html injection in strings\r\n sanitize: function (str) {\r\n if (!str) {\r\n return '';\r\n }\r\n var text;\r\n try {\r\n // removes html but leaves url link text\r\n text = str.replace(/
/gi, '\\n');\r\n text = text.replace(//gi, '\\n');\r\n text = text.replace(/(.*?)<\\/a>/gi, ' $2 ($1) ');\r\n text = text.replace(/<(?:.|\\s)*?>/g, '');\r\n } catch (ex) {\r\n text = null;\r\n }\r\n return text;\r\n },\r\n\r\n _fillStyles: function () {\r\n if (this._symbolJson.outline && this._symbolJson.size > 0 && this._symbolJson.outline.style !== 'esriSLSNull') {\r\n this._styles.stroke = true;\r\n this._styles.weight = this.pixelValue(this._symbolJson.outline.width);\r\n this._styles.color = this.colorValue(this._symbolJson.outline.color);\r\n this._styles.opacity = this.alphaValue(this._symbolJson.outline.color);\r\n } else {\r\n this._styles.stroke = false;\r\n }\r\n if (this._symbolJson.color) {\r\n this._styles.fillColor = this.colorValue(this._symbolJson.color);\r\n this._styles.fillOpacity = this.alphaValue(this._symbolJson.color);\r\n } else {\r\n this._styles.fillOpacity = 0;\r\n }\r\n\r\n if (this._symbolJson.style === 'esriSMSCircle') {\r\n this._styles.radius = this.pixelValue(this._symbolJson.size) / 2.0;\r\n }\r\n },\r\n\r\n _createIcon: function (options) {\r\n var width = this.pixelValue(options.width);\r\n var height = width;\r\n if (options.height) {\r\n height = this.pixelValue(options.height);\r\n }\r\n var xOffset = width / 2.0;\r\n var yOffset = height / 2.0;\r\n\r\n if (options.xoffset) {\r\n xOffset += this.pixelValue(options.xoffset);\r\n }\r\n if (options.yoffset) {\r\n yOffset += this.pixelValue(options.yoffset);\r\n }\r\n\r\n var icon = leafletIcon({\r\n iconUrl: this._iconUrl,\r\n iconSize: [width, height],\r\n iconAnchor: [xOffset, yOffset]\r\n });\r\n this._icons[options.width.toString()] = icon;\r\n return icon;\r\n },\r\n\r\n _getIcon: function (size) {\r\n // check to see if it is already created by size\r\n var icon = this._icons[size.toString()];\r\n if (!icon) {\r\n icon = this._createIcon({width: size});\r\n }\r\n return icon;\r\n },\r\n\r\n pointToLayer: function (geojson, latlng, visualVariables, options) {\r\n var size = this._symbolJson.size || this._symbolJson.width;\r\n if (!this._isDefault) {\r\n if (visualVariables.sizeInfo) {\r\n var calculatedSize = this.getSize(geojson, visualVariables.sizeInfo);\r\n if (calculatedSize) {\r\n size = calculatedSize;\r\n }\r\n }\r\n if (visualVariables.colorInfo) {\r\n var color = this.getColor(geojson, visualVariables.colorInfo);\r\n if (color) {\r\n this._styles.fillColor = this.colorValue(color);\r\n this._styles.fillOpacity = this.alphaValue(color);\r\n }\r\n }\r\n }\r\n\r\n if (this._symbolJson.type === 'esriPMS') {\r\n var layerOptions = extend({}, {icon: this._getIcon(size)}, options);\r\n return marker(latlng, layerOptions);\r\n }\r\n size = this.pixelValue(size);\r\n\r\n switch (this._symbolJson.style) {\r\n case 'esriSMSSquare':\r\n return squareMarker(latlng, size, extend({}, this._styles, options));\r\n case 'esriSMSDiamond':\r\n return diamondMarker(latlng, size, extend({}, this._styles, options));\r\n case 'esriSMSCross':\r\n return crossMarker(latlng, size, extend({}, this._styles, options));\r\n case 'esriSMSX':\r\n return xMarker(latlng, size, extend({}, this._styles, options));\r\n }\r\n this._styles.radius = size / 2.0;\r\n return circleMarker(latlng, extend({}, this._styles, options));\r\n }\r\n});\r\n\r\nexport function pointSymbol (symbolJson, options) {\r\n return new PointSymbol(symbolJson, options);\r\n}\r\n\r\nexport default pointSymbol;\r\n","import Symbol from './Symbol';\r\n\r\nexport var LineSymbol = Symbol.extend({\r\n statics: {\r\n // Not implemented 'esriSLSNull'\r\n LINETYPES: ['esriSLSDash', 'esriSLSDot', 'esriSLSDashDotDot', 'esriSLSDashDot', 'esriSLSSolid']\r\n },\r\n initialize: function (symbolJson, options) {\r\n Symbol.prototype.initialize.call(this, symbolJson, options);\r\n this._fillStyles();\r\n },\r\n\r\n _fillStyles: function () {\r\n // set the defaults that show up on arcgis online\r\n this._styles.lineCap = 'butt';\r\n this._styles.lineJoin = 'miter';\r\n this._styles.fill = false;\r\n this._styles.weight = 0;\r\n\r\n if (!this._symbolJson) {\r\n return this._styles;\r\n }\r\n\r\n if (this._symbolJson.color) {\r\n this._styles.color = this.colorValue(this._symbolJson.color);\r\n this._styles.opacity = this.alphaValue(this._symbolJson.color);\r\n }\r\n\r\n if (!isNaN(this._symbolJson.width)) {\r\n this._styles.weight = this.pixelValue(this._symbolJson.width);\r\n\r\n var dashValues = [];\r\n\r\n switch (this._symbolJson.style) {\r\n case 'esriSLSDash':\r\n dashValues = [4, 3];\r\n break;\r\n case 'esriSLSDot':\r\n dashValues = [1, 3];\r\n break;\r\n case 'esriSLSDashDot':\r\n dashValues = [8, 3, 1, 3];\r\n break;\r\n case 'esriSLSDashDotDot':\r\n dashValues = [8, 3, 1, 3, 1, 3];\r\n break;\r\n }\r\n\r\n // use the dash values and the line weight to set dash array\r\n if (dashValues.length > 0) {\r\n for (var i = 0; i < dashValues.length; i++) {\r\n dashValues[i] *= this._styles.weight;\r\n }\r\n\r\n this._styles.dashArray = dashValues.join(',');\r\n }\r\n }\r\n },\r\n\r\n style: function (feature, visualVariables) {\r\n if (!this._isDefault && visualVariables) {\r\n if (visualVariables.sizeInfo) {\r\n var calculatedSize = this.pixelValue(this.getSize(feature, visualVariables.sizeInfo));\r\n if (calculatedSize) {\r\n this._styles.weight = calculatedSize;\r\n }\r\n }\r\n if (visualVariables.colorInfo) {\r\n var color = this.getColor(feature, visualVariables.colorInfo);\r\n if (color) {\r\n this._styles.color = this.colorValue(color);\r\n this._styles.opacity = this.alphaValue(color);\r\n }\r\n }\r\n }\r\n return this._styles;\r\n }\r\n});\r\n\r\nexport function lineSymbol (symbolJson, options) {\r\n return new LineSymbol(symbolJson, options);\r\n}\r\n\r\nexport default lineSymbol;\r\n","import Symbol from './Symbol';\r\nimport lineSymbol from './LineSymbol';\r\n\r\nexport var PolygonSymbol = Symbol.extend({\r\n statics: {\r\n // not implemented: 'esriSFSBackwardDiagonal','esriSFSCross','esriSFSDiagonalCross','esriSFSForwardDiagonal','esriSFSHorizontal','esriSFSNull','esriSFSVertical'\r\n POLYGONTYPES: ['esriSFSSolid']\r\n },\r\n initialize: function (symbolJson, options) {\r\n Symbol.prototype.initialize.call(this, symbolJson, options);\r\n if (symbolJson) {\r\n if (symbolJson.outline && symbolJson.outline.style === 'esriSLSNull') {\r\n this._lineStyles = { weight: 0 };\r\n } else {\r\n this._lineStyles = lineSymbol(symbolJson.outline, options).style();\r\n }\r\n this._fillStyles();\r\n }\r\n },\r\n\r\n _fillStyles: function () {\r\n if (this._lineStyles) {\r\n if (this._lineStyles.weight === 0) {\r\n // when weight is 0, setting the stroke to false can still look bad\r\n // (gaps between the polygons)\r\n this._styles.stroke = false;\r\n } else {\r\n // copy the line symbol styles into this symbol's styles\r\n for (var styleAttr in this._lineStyles) {\r\n this._styles[styleAttr] = this._lineStyles[styleAttr];\r\n }\r\n }\r\n }\r\n\r\n // set the fill for the polygon\r\n if (this._symbolJson) {\r\n if (this._symbolJson.color &&\r\n // don't fill polygon if type is not supported\r\n PolygonSymbol.POLYGONTYPES.indexOf(this._symbolJson.style >= 0)) {\r\n this._styles.fill = true;\r\n this._styles.fillColor = this.colorValue(this._symbolJson.color);\r\n this._styles.fillOpacity = this.alphaValue(this._symbolJson.color);\r\n } else {\r\n this._styles.fill = false;\r\n this._styles.fillOpacity = 0;\r\n }\r\n }\r\n },\r\n\r\n style: function (feature, visualVariables) {\r\n if (!this._isDefault && visualVariables && visualVariables.colorInfo) {\r\n var color = this.getColor(feature, visualVariables.colorInfo);\r\n if (color) {\r\n this._styles.fillColor = this.colorValue(color);\r\n this._styles.fillOpacity = this.alphaValue(color);\r\n }\r\n }\r\n return this._styles;\r\n }\r\n});\r\n\r\nexport function polygonSymbol (symbolJson, options) {\r\n return new PolygonSymbol(symbolJson, options);\r\n}\r\n\r\nexport default polygonSymbol;\r\n","import { Class, Util, circleMarker } from 'leaflet';\r\n\r\nimport pointSymbol from '../Symbols/PointSymbol';\r\nimport lineSymbol from '../Symbols/LineSymbol';\r\nimport polygonSymbol from '../Symbols/PolygonSymbol';\r\n\r\nexport var Renderer = Class.extend({\r\n options: {\r\n proportionalPolygon: false,\r\n clickable: true\r\n },\r\n\r\n initialize: function (rendererJson, options) {\r\n this._rendererJson = rendererJson;\r\n this._pointSymbols = false;\r\n this._symbols = [];\r\n this._visualVariables = this._parseVisualVariables(rendererJson.visualVariables);\r\n Util.setOptions(this, options);\r\n },\r\n\r\n _parseVisualVariables: function (visualVariables) {\r\n var visVars = {};\r\n if (visualVariables) {\r\n for (var i = 0; i < visualVariables.length; i++) {\r\n visVars[visualVariables[i].type] = visualVariables[i];\r\n }\r\n }\r\n return visVars;\r\n },\r\n\r\n _createDefaultSymbol: function () {\r\n if (this._rendererJson.defaultSymbol) {\r\n this._defaultSymbol = this._newSymbol(this._rendererJson.defaultSymbol);\r\n this._defaultSymbol._isDefault = true;\r\n }\r\n },\r\n\r\n _newSymbol: function (symbolJson) {\r\n if (symbolJson.type === 'esriSMS' || symbolJson.type === 'esriPMS') {\r\n this._pointSymbols = true;\r\n return pointSymbol(symbolJson, this.options);\r\n }\r\n if (symbolJson.type === 'esriSLS') {\r\n return lineSymbol(symbolJson, this.options);\r\n }\r\n if (symbolJson.type === 'esriSFS') {\r\n return polygonSymbol(symbolJson, this.options);\r\n }\r\n },\r\n\r\n _getSymbol: function () {\r\n // override\r\n },\r\n\r\n attachStylesToLayer: function (layer) {\r\n if (this._pointSymbols) {\r\n layer.options.pointToLayer = Util.bind(this.pointToLayer, this);\r\n } else {\r\n layer.options.style = Util.bind(this.style, this);\r\n layer._originalStyle = layer.options.style;\r\n }\r\n },\r\n\r\n pointToLayer: function (geojson, latlng) {\r\n var sym = this._getSymbol(geojson);\r\n if (sym && sym.pointToLayer) {\r\n // right now custom panes are the only option pushed through\r\n return sym.pointToLayer(geojson, latlng, this._visualVariables, this.options);\r\n }\r\n // invisible symbology\r\n return circleMarker(latlng, {radius: 0, opacity: 0});\r\n },\r\n\r\n style: function (feature) {\r\n var userStyles;\r\n if (this.options.userDefinedStyle) {\r\n userStyles = this.options.userDefinedStyle(feature);\r\n }\r\n // find the symbol to represent this feature\r\n var sym = this._getSymbol(feature);\r\n if (sym) {\r\n return this.mergeStyles(sym.style(feature, this._visualVariables), userStyles);\r\n } else {\r\n // invisible symbology\r\n return this.mergeStyles({opacity: 0, fillOpacity: 0}, userStyles);\r\n }\r\n },\r\n\r\n mergeStyles: function (styles, userStyles) {\r\n var mergedStyles = {};\r\n var attr;\r\n // copy renderer style attributes\r\n for (attr in styles) {\r\n if (styles.hasOwnProperty(attr)) {\r\n mergedStyles[attr] = styles[attr];\r\n }\r\n }\r\n // override with user defined style attributes\r\n if (userStyles) {\r\n for (attr in userStyles) {\r\n if (userStyles.hasOwnProperty(attr)) {\r\n mergedStyles[attr] = userStyles[attr];\r\n }\r\n }\r\n }\r\n return mergedStyles;\r\n }\r\n});\r\n\r\nexport default Renderer;\r\n","import Renderer from './Renderer';\r\n\r\nexport var SimpleRenderer = Renderer.extend({\r\n initialize: function (rendererJson, options) {\r\n Renderer.prototype.initialize.call(this, rendererJson, options);\r\n this._createSymbol();\r\n },\r\n\r\n _createSymbol: function () {\r\n if (this._rendererJson.symbol) {\r\n this._symbols.push(this._newSymbol(this._rendererJson.symbol));\r\n }\r\n },\r\n\r\n _getSymbol: function () {\r\n return this._symbols[0];\r\n }\r\n});\r\n\r\nexport function simpleRenderer (rendererJson, options) {\r\n return new SimpleRenderer(rendererJson, options);\r\n}\r\n\r\nexport default simpleRenderer;\r\n","import Renderer from './Renderer';\r\n\r\nexport var ClassBreaksRenderer = Renderer.extend({\r\n initialize: function (rendererJson, options) {\r\n Renderer.prototype.initialize.call(this, rendererJson, options);\r\n this._field = this._rendererJson.field;\r\n if (this._rendererJson.normalizationType && this._rendererJson.normalizationType === 'esriNormalizeByField') {\r\n this._normalizationField = this._rendererJson.normalizationField;\r\n }\r\n this._createSymbols();\r\n },\r\n\r\n _createSymbols: function () {\r\n var symbol;\r\n var classbreaks = this._rendererJson.classBreakInfos;\r\n\r\n this._symbols = [];\r\n\r\n // create a symbol for each class break\r\n for (var i = classbreaks.length - 1; i >= 0; i--) {\r\n if (this.options.proportionalPolygon && this._rendererJson.backgroundFillSymbol) {\r\n symbol = this._newSymbol(this._rendererJson.backgroundFillSymbol);\r\n } else {\r\n symbol = this._newSymbol(classbreaks[i].symbol);\r\n }\r\n symbol.val = classbreaks[i].classMaxValue;\r\n this._symbols.push(symbol);\r\n }\r\n // sort the symbols in ascending value\r\n this._symbols.sort(function (a, b) {\r\n return a.val > b.val ? 1 : -1;\r\n });\r\n this._createDefaultSymbol();\r\n this._maxValue = this._symbols[this._symbols.length - 1].val;\r\n },\r\n\r\n _getSymbol: function (feature) {\r\n var val = feature.properties[this._field];\r\n if (this._normalizationField) {\r\n var normValue = feature.properties[this._normalizationField];\r\n if (!isNaN(normValue) && normValue !== 0) {\r\n val = val / normValue;\r\n } else {\r\n return this._defaultSymbol;\r\n }\r\n }\r\n\r\n if (val > this._maxValue) {\r\n return this._defaultSymbol;\r\n }\r\n var symbol = this._symbols[0];\r\n for (var i = this._symbols.length - 1; i >= 0; i--) {\r\n if (val > this._symbols[i].val) {\r\n break;\r\n }\r\n symbol = this._symbols[i];\r\n }\r\n return symbol;\r\n }\r\n});\r\n\r\nexport function classBreaksRenderer (rendererJson, options) {\r\n return new ClassBreaksRenderer(rendererJson, options);\r\n}\r\n\r\nexport default classBreaksRenderer;\r\n","import Renderer from './Renderer';\r\n\r\nexport var UniqueValueRenderer = Renderer.extend({\r\n initialize: function (rendererJson, options) {\r\n Renderer.prototype.initialize.call(this, rendererJson, options);\r\n this._field = this._rendererJson.field1;\r\n this._createSymbols();\r\n },\r\n\r\n _createSymbols: function () {\r\n var symbol;\r\n var uniques = this._rendererJson.uniqueValueInfos;\r\n\r\n // create a symbol for each unique value\r\n for (var i = uniques.length - 1; i >= 0; i--) {\r\n symbol = this._newSymbol(uniques[i].symbol);\r\n symbol.val = uniques[i].value;\r\n this._symbols.push(symbol);\r\n }\r\n this._createDefaultSymbol();\r\n },\r\n\r\n _getSymbol: function (feature) {\r\n var val = feature.properties[this._field];\r\n // accumulate values if there is more than one field defined\r\n if (this._rendererJson.fieldDelimiter && this._rendererJson.field2) {\r\n var val2 = feature.properties[this._rendererJson.field2];\r\n if (val2) {\r\n val += this._rendererJson.fieldDelimiter + val2;\r\n var val3 = feature.properties[this._rendererJson.field3];\r\n if (val3) {\r\n val += this._rendererJson.fieldDelimiter + val3;\r\n }\r\n }\r\n }\r\n\r\n var symbol = this._defaultSymbol;\r\n for (var i = this._symbols.length - 1; i >= 0; i--) {\r\n // using the === operator does not work if the field\r\n // of the unique renderer is not a string\r\n /*eslint-disable */\r\n if (this._symbols[i].val == val) {\r\n symbol = this._symbols[i];\r\n }\r\n /*eslint-enable */\r\n }\r\n return symbol;\r\n }\r\n});\r\n\r\nexport function uniqueValueRenderer (rendererJson, options) {\r\n return new UniqueValueRenderer(rendererJson, options);\r\n}\r\n\r\nexport default uniqueValueRenderer;\r\n","import { Util, GeoJSON, geoJson } from 'leaflet';\r\nimport * as EsriLeaflet from 'esri-leaflet';\r\nimport * as EsriLeafletCluster from 'esri-leaflet-cluster';\r\nimport classBreaksRenderer from './Renderers/ClassBreaksRenderer';\r\nimport uniqueValueRenderer from './Renderers/UniqueValueRenderer';\r\nimport simpleRenderer from './Renderers/SimpleRenderer';\r\n\r\nfunction wireUpRenderers () {\r\n if (this.options.ignoreRenderer) {\r\n return;\r\n }\r\n var oldOnAdd = Util.bind(this.onAdd, this);\r\n var oldUnbindPopup = Util.bind(this.unbindPopup, this);\r\n var oldOnRemove = Util.bind(this.onRemove, this);\r\n\r\n Util.bind(this.createNewLayer, this);\r\n\r\n this.onAdd = function (map) {\r\n this.metadata(function (error, response) {\r\n if (error) {\r\n console.warn('failed to load metadata from the service.');\r\n return;\r\n } if (response && response.drawingInfo) {\r\n if (this.options.drawingInfo) {\r\n // allow L.esri.webmap (and others) to override service symbology with info provided in layer constructor\r\n response.drawingInfo = this.options.drawingInfo;\r\n }\r\n\r\n // the default pane for lines and polygons is 'overlayPane', for points it is 'markerPane'\r\n if (this.options.pane === 'overlayPane' && response.geometryType === 'esriGeometryPoint') {\r\n this.options.pane = 'markerPane';\r\n }\r\n\r\n this._setRenderers(response);\r\n oldOnAdd(map);\r\n this._addPointLayer(map);\r\n }\r\n }, this);\r\n };\r\n\r\n this.onRemove = function (map) {\r\n oldOnRemove(map);\r\n if (this._pointLayer) {\r\n var pointLayers = this._pointLayer.getLayers();\r\n for (var i in pointLayers) {\r\n map.removeLayer(pointLayers[i]);\r\n }\r\n }\r\n };\r\n\r\n this.unbindPopup = function () {\r\n oldUnbindPopup();\r\n if (this._pointLayer) {\r\n var pointLayers = this._pointLayer.getLayers();\r\n for (var i in pointLayers) {\r\n pointLayers[i].unbindPopup();\r\n }\r\n }\r\n };\r\n\r\n this._addPointLayer = function (map) {\r\n if (this._pointLayer) {\r\n this._pointLayer.addTo(map);\r\n this._pointLayer.bringToFront();\r\n }\r\n };\r\n\r\n this._createPointLayer = function () {\r\n if (!this._pointLayer) {\r\n this._pointLayer = geoJson();\r\n // store the feature ids that have already been added to the map\r\n this._pointLayerIds = {};\r\n\r\n if (this._popup) {\r\n var popupFunction = function (feature, layer) {\r\n layer.bindPopup(this._popup(feature, layer), this._popupOptions);\r\n };\r\n this._pointLayer.options.onEachFeature = Util.bind(popupFunction, this);\r\n }\r\n }\r\n };\r\n\r\n this.createNewLayer = function (geojson) {\r\n var fLayer = GeoJSON.geometryToLayer(geojson, this.options);\r\n\r\n // add a point layer when the polygon is represented as proportional marker symbols\r\n if (this._hasProportionalSymbols) {\r\n var centroid = this.getPolygonCentroid(geojson.geometry.coordinates);\r\n if (!(isNaN(centroid[0]) || isNaN(centroid[0]))) {\r\n this._createPointLayer();\r\n\r\n var featureId = geojson.id.toString();\r\n // only add the feature if it does not already exist on the map\r\n if (!this._pointLayerIds[featureId]) {\r\n var pointjson = this.getPointJson(geojson, centroid);\r\n\r\n this._pointLayer.addData(pointjson);\r\n this._pointLayerIds[featureId] = true;\r\n }\r\n\r\n this._pointLayer.bringToFront();\r\n }\r\n }\r\n return fLayer;\r\n };\r\n\r\n this.getPolygonCentroid = function (coordinates) {\r\n var pts = coordinates[0][0];\r\n if (pts.length === 2) {\r\n pts = coordinates[0];\r\n }\r\n\r\n var twicearea = 0;\r\n var x = 0;\r\n var y = 0;\r\n var nPts = pts.length;\r\n var p1;\r\n var p2;\r\n var f;\r\n\r\n for (var i = 0, j = nPts - 1; i < nPts; j = i++) {\r\n p1 = pts[i]; p2 = pts[j];\r\n twicearea += p1[0] * p2[1];\r\n twicearea -= p1[1] * p2[0];\r\n f = (p1[0] * p2[1]) - (p2[0] * p1[1]);\r\n x += (p1[0] + p2[0]) * f;\r\n y += (p1[1] + p2[1]) * f;\r\n }\r\n f = twicearea * 3;\r\n return [x / f, y / f];\r\n };\r\n\r\n this.getPointJson = function (geojson, centroid) {\r\n return {\r\n type: 'Feature',\r\n properties: geojson.properties,\r\n id: geojson.id,\r\n geometry: {\r\n type: 'Point',\r\n coordinates: [centroid[0], centroid[1]]\r\n }\r\n };\r\n };\r\n\r\n this._checkForProportionalSymbols = function (geometryType, renderer) {\r\n this._hasProportionalSymbols = false;\r\n if (geometryType === 'esriGeometryPolygon') {\r\n if (renderer.backgroundFillSymbol) {\r\n this._hasProportionalSymbols = true;\r\n }\r\n // check to see if the first symbol in the classbreaks is a marker symbol\r\n if (renderer.classBreakInfos && renderer.classBreakInfos.length) {\r\n var sym = renderer.classBreakInfos[0].symbol;\r\n if (sym && (sym.type === 'esriSMS' || sym.type === 'esriPMS')) {\r\n this._hasProportionalSymbols = true;\r\n }\r\n }\r\n }\r\n };\r\n\r\n this._setRenderers = function (serviceInfo) {\r\n var rend;\r\n var rendererInfo = serviceInfo.drawingInfo.renderer;\r\n\r\n var options = {\r\n url: this.options.url\r\n };\r\n\r\n if (this.options.token) {\r\n options.token = this.options.token;\r\n }\r\n\r\n if (this.options.pane) {\r\n options.pane = this.options.pane;\r\n }\r\n\r\n if (serviceInfo.drawingInfo.transparency) {\r\n options.layerTransparency = serviceInfo.drawingInfo.transparency;\r\n }\r\n\r\n if (this.options.style) {\r\n options.userDefinedStyle = this.options.style;\r\n }\r\n\r\n switch (rendererInfo.type) {\r\n case 'classBreaks':\r\n this._checkForProportionalSymbols(serviceInfo.geometryType, rendererInfo);\r\n if (this._hasProportionalSymbols) {\r\n this._createPointLayer();\r\n var pRend = classBreaksRenderer(rendererInfo, options);\r\n pRend.attachStylesToLayer(this._pointLayer);\r\n options.proportionalPolygon = true;\r\n }\r\n rend = classBreaksRenderer(rendererInfo, options);\r\n break;\r\n case 'uniqueValue':\r\n rend = uniqueValueRenderer(rendererInfo, options);\r\n break;\r\n default:\r\n rend = simpleRenderer(rendererInfo, options);\r\n }\r\n rend.attachStylesToLayer(this);\r\n };\r\n}\r\n\r\nEsriLeaflet.FeatureLayer.addInitHook(wireUpRenderers);\r\n\r\nif (typeof EsriLeafletCluster !== 'undefined') {\r\n EsriLeafletCluster.FeatureLayer.addInitHook(wireUpRenderers);\r\n}\r\n"],"names":["Symbol","Class","extend","initialize","symbolJson","options","this","_symbolJson","val","_styles","_isDefault","_layerTransparency","layerTransparency","pixelValue","pointValue","colorValue","color","alphaValue","getSize","feature","sizeInfo","attr","properties","field","size","featureValue","minSize","maxSize","minDataValue","maxDataValue","normField","normalizationField","normValue","parseFloat","undefined","isNaN","getColor","colorInfo","stops","lowerBoundColor","upperBoundColor","lowerBound","upperBound","value","lastStop","length","i","stopInfo","range","upperBoundColorWeight","lowerBoundColorWeight","interpolatedColor","j","Math","round","ShapeMarker","L","Path","latlng","setOptions","_size","_latlng","latLng","_svgCanvasIncludes","toGeoJSON","GeoJSON","getFeature","type","coordinates","latLngToCoords","getLatLng","_project","_point","_map","latLngToLayerPoint","_update","_updatePath","setLatLng","redraw","fire","setSize","CrossMarker","prototype","call","_renderer","_updateCrossMarker","Canvas","include","layer","offset","ctx","_ctx","beginPath","moveTo","x","y","lineTo","_fillStroke","SVG","Browser","vml","_round","str","_setPath","XMarker","_updateXMarker","SquareMarker","fill","_updateSquareMarker","closePath","svg","DiamondMarker","_updateDiamondMarker","PointSymbol","statics","MARKERTYPES","url","imageUrl","serviceUrl","substr","sanitize","_iconUrl","token","imageData","contentType","_icons","icon","_createIcon","_fillStyles","text","replace","ex","outline","style","stroke","weight","width","opacity","fillColor","fillOpacity","radius","height","xOffset","yOffset","xoffset","yoffset","leafletIcon","iconUrl","iconSize","iconAnchor","toString","_getIcon","pointToLayer","geojson","visualVariables","calculatedSize","layerOptions","marker","circleMarker","pointSymbol","LineSymbol","LINETYPES","lineCap","lineJoin","dashValues","dashArray","join","lineSymbol","PolygonSymbol","POLYGONTYPES","_lineStyles","styleAttr","indexOf","polygonSymbol","Renderer","proportionalPolygon","clickable","rendererJson","_rendererJson","_pointSymbols","_symbols","_visualVariables","_parseVisualVariables","Util","visVars","_createDefaultSymbol","defaultSymbol","_defaultSymbol","_newSymbol","_getSymbol","attachStylesToLayer","bind","_originalStyle","sym","userStyles","userDefinedStyle","mergeStyles","styles","mergedStyles","hasOwnProperty","SimpleRenderer","_createSymbol","symbol","push","simpleRenderer","ClassBreaksRenderer","_field","normalizationType","_normalizationField","_createSymbols","classbreaks","classBreakInfos","backgroundFillSymbol","classMaxValue","sort","a","b","_maxValue","classBreaksRenderer","UniqueValueRenderer","field1","uniques","uniqueValueInfos","val2","val3","fieldDelimiter","field2","field3","uniqueValueRenderer","wireUpRenderers","oldOnAdd","oldUnbindPopup","oldOnRemove","ignoreRenderer","onAdd","unbindPopup","onRemove","createNewLayer","map","metadata","error","response","console","warn","drawingInfo","pane","geometryType","_setRenderers","_addPointLayer","_pointLayer","pointLayers","getLayers","removeLayer","addTo","bringToFront","_createPointLayer","geoJson","_pointLayerIds","_popup","onEachFeature","bindPopup","_popupOptions","centroid","featureId","pointjson","fLayer","geometryToLayer","_hasProportionalSymbols","getPolygonCentroid","geometry","id","getPointJson","addData","pts","p1","p2","f","twicearea","nPts","_checkForProportionalSymbols","renderer","serviceInfo","rend","rendererInfo","transparency","addInitHook","EsriLeafletCluster","EsriLeafletCluster.FeatureLayer"],"mappings":";;;gbAEWA,EAASC,QAAMC,OAAO,CAC/BC,WAAY,SAAUC,EAAYC,GAChCC,KAAKC,YAAcH,EACnBE,KAAKE,IAAM,KACXF,KAAKG,QAAU,GACfH,KAAKI,YAAa,EAClBJ,KAAKK,mBAAqB,EACtBN,GAAWA,EAAQO,oBACrBN,KAAKK,mBAAqB,EAAKN,EAAQO,kBAAoB,MAK/DC,WAAY,SAAUC,GACpB,OAAoB,MAAbA,GAITC,WAAY,SAAUC,GACpB,MAAO,OAASA,EAAM,GAAK,IAAMA,EAAM,GAAK,IAAMA,EAAM,GAAK,KAG/DC,WAAY,SAAUD,GAEpB,OADYA,EAAM,GAAK,IACRV,KAAKK,oBAGtBO,QAAS,SAAUC,EAASC,GAC1B,IAAIC,EAAOF,EAAQG,WACfC,EAAQH,EAASG,MACjBC,EAAO,EACPC,EAAe,KAEnB,G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