src/pyams_gis/resources/js/leaflet-esri-gp-2.0.3.js
changeset 75 a430cc4ae715
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/pyams_gis/resources/js/leaflet-esri-gp-2.0.3.js	Wed Jan 27 15:39:14 2021 +0100
@@ -0,0 +1,2 @@
+!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("leaflet"),require("esri-leaflet")):"function"==typeof define&&define.amd?define(["exports","leaflet","esri-leaflet"],t):t((e.L=e.L||{},e.L.esri=e.L.esri||{},e.L.esri.GP=e.L.esri.GP||{}),e.L,e.L.esri)}(this,function(e,t,s){"use strict";function o(e){return new r(e)}function i(e){return new n(e)}t="default"in t?t.default:t;var r=s.Task.extend({includes:t.Evented.prototype,params:{},resultParams:{},initialize:function(e){s.Task.prototype.initialize.call(this,e),this.options.path||void 0!==this.options.async?(this.options.async&&(this.options.path=this.options.path?this.options.path:"submitJob"),this.options.async||(this.options.path=this.options.path?this.options.path:"execute")):(this.options.async=!1,this.options.path="execute",this._service.metadata(function(e,t){e||("esriExecutionTypeSynchronous"===t.executionType?(this.options.async=!1,this.options.path="execute"):(this.options.async=!0,this.options.path="submitJob"),this.fire("initialized"))},this))},setParam:function(e,t){if("boolean"==typeof t||"object"!=typeof t)return void(this.params[e]=t);if("object"==typeof t&&t.units)return void(this.params[e]=t);if("geometry"===e)this.params[e]=this._setGeometry(t);else{var o=this._setGeometryType(t),i={features:[]};if(o&&(i.geometryType=o),"FeatureCollection"===t.type&&"Feature"===t.features[0].type)for(var r=0;r<t.features.length;r++)"Feature"===t.features[r].type?i.features.push(s.Util.geojsonToArcGIS(t.features[r])):i.features.push({geometry:s.Util.geojsonToArcGIS(t.features[r].geometry)});else i.features.push({geometry:this._setGeometry(t)});this.params[e]=i}},setOutputParam:function(e){this.params.outputParam=e},gpAsyncResultParam:function(e,t){this.resultParams[e]=t},_setGeometry:function(e){return e instanceof t.LatLngBounds?t.esri.Util.boundsToExtent(e):(e.getLatLng&&(e=e.getLatLng()),e instanceof t.LatLng&&(e={type:"Point",coordinates:[e.lng,e.lat]}),e instanceof t.GeoJSON?(e=e.getLayers()[0].feature.geometry,s.Util.geojsonToArcGIS(e)):(e.toGeoJSON&&(e=e.toGeoJSON()),"Feature"===e.type&&(e=e.geometry),"Point"===e.type||"LineString"===e.type||"Polygon"===e.type?s.Util.geojsonToArcGIS(e):void s.Util.warn("invalid geometry passed as GP input. Should be an L.LatLng, L.LatLngBounds, L.Marker or GeoJSON Point Line or Polygon object")))},_setGeometryType:function(e){return e instanceof t.LatLngBounds?"esriGeometryEnvelope":e.getLatLng||e instanceof t.LatLng?"esriGeometryPoint":e instanceof t.GeoJSON?(e=e.getLayers()[0].feature.geometry,s.Util.geojsonTypeToArcGIS(e.type)):(e.toGeoJSON&&(e=e.toGeoJSON()),"Feature"===e.type&&(e=e.geometry),"Point"===e.type||"LineString"===e.type||"Polygon"===e.type?s.Util.geojsonTypeToArcGIS(e.type):"FeatureCollection"===e.type?s.Util.geojsonTypeToArcGIS(e.features[0].type):null)},run:function(e,t){if(this._done=!1,!0!==this.options.async)return this._service.request(this.options.path,this.params,function(s,o){s?e.call(t,s,null,null):o.results?e.call(t,s,o&&this._processGPOutput(o),o):o.histograms?e.call(t,s,o,o):o.routes&&e.call(t,s,o&&this._processNetworkAnalystOutput(o),o)},this);this._service.request(this.options.path,this.params,function(s,o){this._currentJobId=o.jobId,this.checkJob(this._currentJobId,e,t)},this)},checkJob:function(e,t,s){var o=function(){this._service.request("jobs/"+e,{},function(o,r){"esriJobSucceeded"===r.jobStatus?(this._done||(this._done=!0,this._service.request("jobs/"+e+"/results/"+this.params.outputParam,this.resultParams,function(e,o){t.call(s,e,o&&this._processAsyncOutput(o),o)},this)),window.clearInterval(i)):"esriJobFailed"===r.jobStatus&&(t.call(s,"Job Failed",null),window.clearInterval(i))},this)}.bind(this),i=window.setInterval(o,1e3*this._service.options.asyncInterval)},_processGPOutput:function(e){var t={},o=e.results;if(!1===this.options.async)for(var i=0;i<o.length;i++)if(t[o[i].paramName],"GPFeatureRecordSetLayer"===o[i].dataType){var r=s.Util.responseToFeatureCollection(o[i].value);t[o[i].paramName]=r}else t[o[i].paramName]=o[i].value;else t.jobId=this._currentJobId;if(!0===this.options.async&&"GPRasterDataLayer"===e.dataType){var n=this.options.url,a=n.indexOf("GPServer"),u=n.slice(0,a)+"MapServer/";t.outputMapService=u+"jobs/"+this._currentJobId}return t},_processNetworkAnalystOutput:function(e){var t={};if(e.routes.features.length>0){var o=s.Util.responseToFeatureCollection(e.routes);t.routes=o}return t},_processAsyncOutput:function(e){var t={};if(t.jobId=this._currentJobId,!0===this.options.async&&"GPRasterDataLayer"===e.dataType){var o=this.options.url,i=o.indexOf("GPServer"),r=o.slice(0,i)+"MapServer/";t.outputMapService=r+"jobs/"+this._currentJobId}if("GPFeatureRecordSetLayer"===e.dataType){var n=s.Util.responseToFeatureCollection(e.value);t[e.paramName]=n}else t[e.paramName]=e.value;return t}}),n=s.Service.extend({options:{asyncInterval:1},createTask:function(){return new r(this,this.options)}});e.VERSION="2.0.3",e.Task=r,e.task=o,e.Service=n,e.service=i});
+//# sourceMappingURL=esri-leaflet-gp.js.map
\ No newline at end of file