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IAAI,CAAC,YAAY,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;QAC5F,IAAI,CAAC,uBAAuB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAExC,YAAY,GAAG,OAAO,YAAY,IAAI,SAAS,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC;QAEtE,IAAI,YAAY,EAAE;YACd,IAAI,IAAI,CAAC,UAAU,KAAK,SAAS,EAAE;gBAC/B,IAAI,CAAC,gBAAgB,EAAE,CAAC;aAC3B;YACD,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,iBAAiB,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;SAC/D;IACL,CAAC;IACL,iBAAC;AAAD,CAAC,AAlQD,CAAgC,4BAAkB,GAkQjD;AAlQY,gCAAU;AAoQvB,EAAE,CAAC,UAAU,GAAG,UAAU,CAAC;AAC3B,kBAAe,UAAU,CAAC","sourcesContent":["import LayerBaseVector from \"../layers/LayerBaseVector\";\r\nimport MapInteractionBase from './mapInteractionBase';\r\nimport * as checkDefined from '../util/checkDefined';\r\nimport provide from '../util/provide';\r\nimport makeGuid from '../util/makeGuid';\r\nimport {} from 'ol/coordinate';\r\nimport $ = require('jquery');\r\nimport Map from 'ol/Map';\r\nconst nm = provide('olHelpers');\r\n\r\n\r\nexport interface extentObject{\r\n minX: number;\r\n minY: number;\r\n maxX: number;\r\n maxY: number;\r\n}\r\n\r\nexport interface mapMoveCallbackFunction{\r\n /**\r\n *\r\n * @param extent extent as predefined object minX, minX, maxX, maxY\r\n * @param zoomLevel current zoom level\r\n * @param evtType the event type 'change:center', 'change:resolution'\r\n */\r\n (extent: extentObject, zoomLevel: number, evtType?: string): any\r\n}\r\n\r\n\r\n/**\r\n * assists with map move interactions, trigger callback functions\r\n * @augments MapInteractionBase\r\n */\r\nexport class MapMoveCls extends MapInteractionBase {\r\n _mapExtent: extentObject;\r\n _zoomLevel: number;\r\n _lookupLayer: {[s: string]: LayerBaseVector};\r\n _arrLayer: Array<LayerBaseVector>;\r\n _arrLyrTimeout: Array<number>;\r\n _mapMoveCallbackTimeout: Array<number>;\r\n _mapMoveCallbackDelays: Array<number>;\r\n _mapMoveCallbacksLookup: {[s: string]: mapMoveCallbackFunction};\r\n _mapMoveCallbackContext: Array<Object>;\r\n _mapMoveCallbacks: Array<mapMoveCallbackFunction>;\r\n _arrLyrRequest: Array<any>;\r\n\r\n /**\r\n * constructor called implicitly\r\n */\r\n constructor() {\r\n super('map move');\r\n this._arrLyrRequest = [];\r\n this._arrLyrTimeout = [];\r\n this._arrLayer = [];\r\n this._lookupLayer = {};\r\n\r\n this._mapMoveCallbacks = [];\r\n this._mapMoveCallbacksLookup = {};\r\n this._mapMoveCallbackDelays = [];\r\n this._mapMoveCallbackContext = [];\r\n this._mapMoveCallbackTimeout = [];\r\n\r\n this._mapExtent = undefined;\r\n this._zoomLevel = undefined;\r\n\r\n }\r\n\r\n /**\r\n * initialize the map move object\r\n * @param theMap - the ol map\r\n */\r\n init(theMap: Map){\r\n super.init(theMap);\r\n\r\n this.map.getView().on(['change:center', 'change:resolution'], (e: {type: string}) =>{\r\n\r\n this._updateMapExtent();\r\n\r\n // trigger the layer updates\r\n for (let i = 0; i < this._arrLayer.length; i++) {\r\n this.triggerLyrLoad(this._arrLayer[i], i, e.type);\r\n }\r\n\r\n // trigger the map callbacks\r\n for (let i = 0; i < this._mapMoveCallbacks.length; i++) {\r\n this.triggerMoveCallback(i, e.type);\r\n }\r\n });\r\n }\r\n\r\n _updateMapExtent() {\r\n let theView = this.map.getView();\r\n this._zoomLevel = theView.getZoom();\r\n\r\n let extentArray = theView.calculateExtent(this.map.getSize());\r\n\r\n this._mapExtent = {\r\n minX: extentArray[0],\r\n minY: extentArray[1],\r\n maxX: extentArray[2],\r\n maxY: extentArray[3]\r\n };\r\n }\r\n\r\n /**\r\n * return the map extent\r\n */\r\n get mapExtent() {\r\n if (!this._mapExtent) {\r\n this._updateMapExtent();\r\n }\r\n\r\n return this._mapExtent;\r\n }\r\n\r\n /**\r\n * Trigger the layer load\r\n * @param lyr the layer being acted on\r\n * @param index index of the layer\r\n * @param eventType the event triggering the load, as 'change:center' or 'change:resolution'\r\n */\r\n triggerLyrLoad(lyr: LayerBaseVector, index?: number, eventType?: string) {\r\n\r\n if (checkDefined.undefinedOrNull(lyr) && checkDefined.undefinedOrNull(index)) {\r\n throw 'need to define lyr or index';\r\n } else if (checkDefined.definedAndNotNull(lyr) && checkDefined.undefinedOrNull(index)) {\r\n index = this._arrLayer.indexOf(lyr);\r\n } else if (checkDefined.undefinedOrNull(lyr) && checkDefined.definedAndNotNull(index)) {\r\n lyr = this._arrLayer[index];\r\n }\r\n\r\n // clear the timeout\r\n if (this._arrLyrTimeout[index] != null) {\r\n clearTimeout(this._arrLyrTimeout[index]);\r\n this._arrLyrTimeout[index] = null;\r\n }\r\n\r\n // abort if necessary and clear the request\r\n if (this._arrLyrRequest[index] != null && this._arrLyrRequest[index] != 4) {\r\n this._arrLyrRequest[index].abort();\r\n this._arrLyrRequest[index] = null;\r\n }\r\n\r\n // dummy callback used if before load returns false\r\n let callbackFunc = function () {};\r\n\r\n if (lyr.mapMoveBefore(this._zoomLevel, eventType)) {\r\n lyr.mapMoveMakeGetParams(this._mapExtent, this._zoomLevel);\r\n\r\n let __this = this;\r\n\r\n callbackFunc = function () {\r\n function innerFunction(theLayer: LayerBaseVector, theIndex: number) {\r\n let _innerThis = this;\r\n this._arrLyrRequest[theIndex] = $.get(\r\n theLayer.url,\r\n theLayer.mapMoveParams,\r\n function (d) {\r\n /**\r\n * @type {LayerBaseVector}\r\n */\r\n theLayer.mapMoveCallback(d);\r\n theLayer.loadCallback();\r\n }, 'json').fail(\r\n function (jqXHR) {\r\n if (jqXHR.statusText != 'abort') {\r\n console.log('failed');\r\n console.log(theLayer.url);\r\n console.log(theLayer.mapMoveParams);\r\n }\r\n }).always(\r\n function () {\r\n _innerThis._arrLyrTimeout[theIndex] = null;\r\n _innerThis._arrLyrRequest[theIndex] = null;\r\n });\r\n }\r\n innerFunction.call(__this, lyr, index);\r\n };\r\n } else {\r\n lyr.clear();\r\n }\r\n this._arrLyrTimeout[index] = setTimeout(callbackFunc, lyr.onDemandDelay);\r\n }\r\n\r\n /**\r\n * trigger the map move call back at the given index\r\n * @param ind - the index of the layer\r\n * @param eventType=undefined the event triggering the load as 'change:center' or 'change:resolution'\r\n * @param functionId=undefined the function id used to reference the added callback function\r\n */\r\n triggerMoveCallback(ind: number, eventType?: string, functionId?: string) {\r\n\r\n if (typeof ind == 'undefined' && typeof functionId == 'undefined'){\r\n throw 'either the function index or the id must be defined';\r\n }\r\n\r\n if (typeof ind !== 'number'){\r\n ind = this._mapMoveCallbacks.indexOf(this._mapMoveCallbacksLookup[functionId]);\r\n }\r\n\r\n if (ind < 0){\r\n console.log('function not found');\r\n\r\n return;\r\n }\r\n\r\n // clear the timeout\r\n if (this._mapMoveCallbackTimeout[ind] != null) {\r\n clearTimeout(this._mapMoveCallbackTimeout[ind]);\r\n this._mapMoveCallbackTimeout[ind] = null;\r\n }\r\n\r\n let ctx = this._mapMoveCallbackContext[ind];\r\n let theFunc = this._mapMoveCallbacks[ind];\r\n\r\n let __this = this;\r\n\r\n let f = function () {\r\n if (ctx !== null) {\r\n theFunc.call(ctx, __this._mapExtent, __this._zoomLevel, eventType);\r\n } else {\r\n theFunc(__this._mapExtent, __this._zoomLevel, eventType);\r\n }\r\n };\r\n\r\n this._mapMoveCallbackTimeout[ind] = setTimeout(f, this._mapMoveCallbackDelays[ind]);\r\n }\r\n\r\n /**\r\n * Add a layer to the interaction\r\n * @param lyr - layer to add\r\n * @param triggerOnAdd - if the layer should be loaded on add\r\n */\r\n addVectorLayer(lyr: LayerBaseVector, triggerOnAdd: boolean = true) {\r\n if (this._arrLayer.indexOf(lyr) > -1) {\r\n console.log('already added ' + lyr.name + ' to map move');\r\n\r\n return;\r\n }\r\n this._checkInit();\r\n\r\n this._arrLyrRequest.push(null);\r\n this._arrLyrTimeout.push(null);\r\n this._arrLayer.push(lyr);\r\n this._lookupLayer[lyr.id] = lyr;\r\n\r\n triggerOnAdd = typeof triggerOnAdd == 'boolean' ? triggerOnAdd : true;\r\n\r\n if (triggerOnAdd) {\r\n if (this._mapExtent === undefined) {\r\n this._updateMapExtent();\r\n }\r\n this.triggerLyrLoad(lyr, this._arrLayer.length - 1);\r\n }\r\n }\r\n\r\n\r\n /**\r\n * add a callback to the map move event\r\n * @param func - callback function\r\n * @param context - the context to use for this function\r\n * @param delay=50 the delay before call load\r\n * @param triggerOnAdd if the layer should be loaded on add to mapMove\r\n * @param functionId optional id to reference the function later for outside triggering\r\n */\r\n addCallback(func: mapMoveCallbackFunction, context?: any, delay?: number, triggerOnAdd? : boolean, functionId?: string) {\r\n\r\n if (this._mapMoveCallbacks.indexOf(func) > -1) {\r\n console.log('this function already added to map move');\r\n return;\r\n }\r\n this._checkInit();\r\n if (!functionId){\r\n functionId = makeGuid();\r\n }\r\n\r\n this._mapMoveCallbacks.push(func);\r\n this._mapMoveCallbacksLookup[functionId] = func;\r\n this._mapMoveCallbackDelays.push(typeof delay == 'number' ? delay : 50);\r\n this._mapMoveCallbackContext.push(checkDefined.definedAndNotNull(context) ? context : null);\r\n this._mapMoveCallbackTimeout.push(null);\r\n\r\n triggerOnAdd = typeof triggerOnAdd == 'boolean' ? triggerOnAdd : true;\r\n\r\n if (triggerOnAdd) {\r\n if (this._mapExtent === undefined) {\r\n this._updateMapExtent();\r\n }\r\n this.triggerMoveCallback(this._mapMoveCallbacks.length - 1);\r\n }\r\n }\r\n}\r\n\r\nnm.MapMoveCls = MapMoveCls;\r\nexport default MapMoveCls;\r\n"]}