mars2d-esri 3.0.14 → 3.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,window.L||require("leaflet"),window.mars2d||require("mars2d")):"function"==typeof define&&define.amd?define(["exports","leaflet","mars2d"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self)["mars2d-esri"]={},t.L,t.mars2d)}(this,(function(t,e,i){"use strict";function r(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}function s(t){if(t&&t.__esModule)return t;var e=Object.create(null);return t&&Object.keys(t).forEach((function(i){if("default"!==i){var r=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(e,i,r.get?r:{enumerable:!0,get:function(){return t[i]}})}})),e.default=t,e}var n=r(e),o=s(i),a="3.0.7",l=window.XMLHttpRequest&&"withCredentials"in new window.XMLHttpRequest,u=""===document.documentElement.style.pointerEvents,h={cors:l,pointerEvents:u},p={attributionWidthOffset:55},c=0;function d(t){var e="";for(var i in t.f=t.f||"json",t)if(t.hasOwnProperty(i)){var r,s=t[i],n=Object.prototype.toString.call(s);e.length&&(e+="&"),r="[object Array]"===n?"[object Object]"===Object.prototype.toString.call(s[0])?JSON.stringify(s):s.join(","):"[object Object]"===n?JSON.stringify(s):"[object Date]"===n?s.valueOf():s,e+=encodeURIComponent(i)+"="+encodeURIComponent(r)}return e}function f(t,i){var r=new window.XMLHttpRequest;return r.onerror=function(s){r.onreadystatechange=e.Util.falseFn,t.call(i,{error:{code:500,message:"XMLHttpRequest error"}},null)},r.onreadystatechange=function(){var s,n;if(4===r.readyState){try{s=JSON.parse(r.responseText)}catch(t){s=null,n={code:500,message:"Could not parse response as JSON. This could also be caused by a CORS or XMLHttpRequest error."}}!n&&s.error&&(n=s.error,s=null),r.onerror=e.Util.falseFn,t.call(i,n,s)}},r.ontimeout=function(){this.onerror()},r}function m(t,e,i,r){var s=f(i,r);return s.open("POST",t),null!=r&&void 0!==r.options&&(s.timeout=r.options.timeout),s.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8"),s.send(d(e)),s}function y(t,e,i,r){var s=f(i,r);return s.open("GET",t+"?"+d(e),!0),null!=r&&void 0!==r.options&&(s.timeout=r.options.timeout,r.options.withCredentials&&(s.withCredentials=!0)),s.send(null),s}function g(t,e,i,r){var s=d(e),n=f(i,r),o=(t+"?"+s).length;if(o<=2e3&&h.cors?n.open("GET",t+"?"+s):o>2e3&&h.cors&&(n.open("POST",t),n.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8")),null!=r&&void 0!==r.options&&(n.timeout=r.options.timeout,r.options.withCredentials&&(n.withCredentials=!0)),o<=2e3&&h.cors)n.send(null);else{if(!(o>2e3&&h.cors))return o<=2e3&&!h.cors?_(t,e,i,r):void b("a request to "+t+" was longer then 2000 characters and this browser cannot make a cross-domain post request. Please use a proxy http://esri.github.io/esri-leaflet/api-reference/request.html");n.send(s)}return n}function _(t,i,r,s){window._EsriLeafletCallbacks=window._EsriLeafletCallbacks||{};var n="c"+c;i.callback="window._EsriLeafletCallbacks."+n,window._EsriLeafletCallbacks[n]=function(t){if(!0!==window._EsriLeafletCallbacks[n]){var e,i=Object.prototype.toString.call(t);"[object Object]"!==i&&"[object Array]"!==i&&(e={error:{code:500,message:"Expected array or object as JSONP response"}},t=null),!e&&t.error&&(e=t,t=null),r.call(s,e,t),window._EsriLeafletCallbacks[n]=!0}};var o=e.DomUtil.create("script",null,document.body);return o.type="text/javascript",o.src=t+"?"+d(i),o.id=n,o.onerror=function(t){if(t&&!0!==window._EsriLeafletCallbacks[n]){r.call(s,{error:{code:500,message:"An unknown error occurred"}}),window._EsriLeafletCallbacks[n]=!0}},e.DomUtil.addClass(o,"esri-leaflet-jsonp"),c++,{id:n,url:o.src,abort:function(){window._EsriLeafletCallbacks._callback[n]({code:0,message:"Request aborted."})}}}var v=h.cors?y:_;function b(){console&&console.warn&&console.warn.apply(console,arguments)}v.CORS=y,v.JSONP=_;var x={request:g,get:v,post:m},L=function(t,e,i,r){var s=(r[0]-i[0])*(t[1]-i[1])-(r[1]-i[1])*(t[0]-i[0]),n=(e[0]-t[0])*(t[1]-i[1])-(e[1]-t[1])*(t[0]-i[0]),o=(r[1]-i[1])*(e[0]-t[0])-(r[0]-i[0])*(e[1]-t[1]);if(0!==o){var a=s/o,l=n/o;if(a>=0&&a<=1&&l>=0&&l<=1)return!0}return!1},S=function(t,e){for(var i=0;i<t.length-1;i++)for(var r=0;r<e.length-1;r++)if(L(t[i],t[i+1],e[r],e[r+1]))return!0;return!1},A=function(t){return function(t,e){for(var i=0;i<t.length;i++)if(t[i]!==e[i])return!1;return!0}(t[0],t[t.length-1])||t.push(t[0]),t},T=function(t){for(var e,i=0,r=0,s=t.length,n=t[r];r<s-1;r++)i+=((e=t[r+1])[0]-n[0])*(e[1]+n[1]),n=e;return i>=0},I=function(t){var e={};for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i]);return e},w=function(t,e){var i=S(t,e),r=function(t,e){for(var i=!1,r=-1,s=t.length,n=s-1;++r<s;n=r)(t[r][1]<=e[1]&&e[1]<t[n][1]||t[n][1]<=e[1]&&e[1]<t[r][1])&&e[0]<(t[n][0]-t[r][0])*(e[1]-t[r][1])/(t[n][1]-t[r][1])+t[r][0]&&(i=!i);return i}(t,e[0]);return!(i||!r)},C=function t(e,i){var r={};if(e.features){r.type="FeatureCollection",r.features=[];for(var s=0;s<e.features.length;s++)r.features.push(t(e.features[s],i))}if("number"==typeof e.x&&"number"==typeof e.y&&(r.type="Point",r.coordinates=[e.x,e.y],"number"==typeof e.z&&r.coordinates.push(e.z)),e.points&&(r.type="MultiPoint",r.coordinates=e.points.slice(0)),e.paths&&(1===e.paths.length?(r.type="LineString",r.coordinates=e.paths[0].slice(0)):(r.type="MultiLineString",r.coordinates=e.paths.slice(0))),e.rings&&(r=function(t){for(var e,i,r,s=[],n=[],o=0;o<t.length;o++){var a=A(t[o].slice(0));if(!(a.length<4))if(T(a)){var l=[a.slice().reverse()];s.push(l)}else n.push(a.slice().reverse())}for(var u=[];n.length;){r=n.pop();var h=!1;for(e=s.length-1;e>=0;e--)if(i=s[e][0],w(i,r)){s[e].push(r),h=!0;break}h||u.push(r)}for(;u.length;){r=u.pop();var p=!1;for(e=s.length-1;e>=0;e--)if(i=s[e][0],S(i,r)){s[e].push(r),p=!0;break}p||s.push([r.reverse()])}return 1===s.length?{type:"Polygon",coordinates:s[0]}:{type:"MultiPolygon",coordinates:s}}(e.rings.slice(0))),"number"==typeof e.xmin&&"number"==typeof e.ymin&&"number"==typeof e.xmax&&"number"==typeof e.ymax&&(r.type="Polygon",r.coordinates=[[[e.xmax,e.ymax],[e.xmin,e.ymax],[e.xmin,e.ymin],[e.xmax,e.ymin],[e.xmax,e.ymax]]]),(e.geometry||e.attributes)&&(r.type="Feature",r.geometry=e.geometry?t(e.geometry):null,r.properties=e.attributes?I(e.attributes):null,e.attributes))try{r.id=function(t,e){for(var i=e?[e,"OBJECTID","FID"]:["OBJECTID","FID"],r=0;r<i.length;r++){var s=i[r];if(s in t&&("string"==typeof t[s]||"number"==typeof t[s]))return t[s]}throw Error("No valid id attribute found")}(e.attributes,i)}catch(t){}return JSON.stringify(r.geometry)===JSON.stringify({})&&(r.geometry=null),e.spatialReference&&e.spatialReference.wkid&&4326!==e.spatialReference.wkid&&console.warn("Object converted in non-standard crs - "+JSON.stringify(e.spatialReference)),r},O=function(t){var e=[],i=t.slice(0),r=A(i.shift().slice(0));if(r.length>=4){T(r)||r.reverse(),e.push(r);for(var s=0;s<i.length;s++){var n=A(i[s].slice(0));n.length>=4&&(T(n)&&n.reverse(),e.push(n))}}return e},P=function t(e,i){i=i||"OBJECTID";var r,s={wkid:4326},n={};switch(e.type){case"Point":n.x=e.coordinates[0],n.y=e.coordinates[1],e.coordinates[2]&&(n.z=e.coordinates[2]),n.spatialReference=s;break;case"MultiPoint":n.points=e.coordinates.slice(0),e.coordinates[0][2]&&(n.hasZ=!0),n.spatialReference=s;break;case"LineString":n.paths=[e.coordinates.slice(0)],e.coordinates[0][2]&&(n.hasZ=!0),n.spatialReference=s;break;case"MultiLineString":n.paths=e.coordinates.slice(0),e.coordinates[0][0][2]&&(n.hasZ=!0),n.spatialReference=s;break;case"Polygon":n.rings=O(e.coordinates.slice(0)),e.coordinates[0][0][2]&&(n.hasZ=!0),n.spatialReference=s;break;case"MultiPolygon":n.rings=function(t){for(var e=[],i=0;i<t.length;i++)for(var r=O(t[i]),s=r.length-1;s>=0;s--){var n=r[s].slice(0);e.push(n)}return e}(e.coordinates.slice(0)),e.coordinates[0][0][0][2]&&(n.hasZ=!0),n.spatialReference=s;break;case"Feature":e.geometry&&(n.geometry=t(e.geometry,i)),n.attributes=e.properties?I(e.properties):{},e.id&&(n.attributes[i]=e.id);break;case"FeatureCollection":for(n=[],r=0;r<e.features.length;r++)n.push(t(e.features[r],i));break;case"GeometryCollection":for(n=[],r=0;r<e.geometries.length;r++)n.push(t(e.geometries[r],i))}return n},R='<a href="http://leafletjs.com" title="A JS library for interactive maps">Leaflet</a>';
1
+ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("leaflet"),require("mars2d")):"function"==typeof define&&define.amd?define(["exports","leaflet","mars2d"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self)["mars2d-esri"]={},t.L,t.mars2d)}(this,(function(t,e,i){"use strict";function r(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}function s(t){if(t&&t.__esModule)return t;var e=Object.create(null);return t&&Object.keys(t).forEach((function(i){if("default"!==i){var r=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(e,i,r.get?r:{enumerable:!0,get:function(){return t[i]}})}})),e.default=t,e}var n=r(e),o=s(i),a="3.0.7",l=window.XMLHttpRequest&&"withCredentials"in new window.XMLHttpRequest,u=""===document.documentElement.style.pointerEvents,h={cors:l,pointerEvents:u},p={attributionWidthOffset:55},c=0;function d(t){var e="";for(var i in t.f=t.f||"json",t)if(t.hasOwnProperty(i)){var r,s=t[i],n=Object.prototype.toString.call(s);e.length&&(e+="&"),r="[object Array]"===n?"[object Object]"===Object.prototype.toString.call(s[0])?JSON.stringify(s):s.join(","):"[object Object]"===n?JSON.stringify(s):"[object Date]"===n?s.valueOf():s,e+=encodeURIComponent(i)+"="+encodeURIComponent(r)}return e}function f(t,i){var r=new window.XMLHttpRequest;return r.onerror=function(s){r.onreadystatechange=e.Util.falseFn,t.call(i,{error:{code:500,message:"XMLHttpRequest error"}},null)},r.onreadystatechange=function(){var s,n;if(4===r.readyState){try{s=JSON.parse(r.responseText)}catch(t){s=null,n={code:500,message:"Could not parse response as JSON. This could also be caused by a CORS or XMLHttpRequest error."}}!n&&s.error&&(n=s.error,s=null),r.onerror=e.Util.falseFn,t.call(i,n,s)}},r.ontimeout=function(){this.onerror()},r}function m(t,e,i,r){var s=f(i,r);return s.open("POST",t),null!=r&&void 0!==r.options&&(s.timeout=r.options.timeout),s.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8"),s.send(d(e)),s}function y(t,e,i,r){var s=f(i,r);return s.open("GET",t+"?"+d(e),!0),null!=r&&void 0!==r.options&&(s.timeout=r.options.timeout,r.options.withCredentials&&(s.withCredentials=!0)),s.send(null),s}function g(t,e,i,r){var s=d(e),n=f(i,r),o=(t+"?"+s).length;if(o<=2e3&&h.cors?n.open("GET",t+"?"+s):o>2e3&&h.cors&&(n.open("POST",t),n.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8")),null!=r&&void 0!==r.options&&(n.timeout=r.options.timeout,r.options.withCredentials&&(n.withCredentials=!0)),o<=2e3&&h.cors)n.send(null);else{if(!(o>2e3&&h.cors))return o<=2e3&&!h.cors?_(t,e,i,r):void b("a request to "+t+" was longer then 2000 characters and this browser cannot make a cross-domain post request. Please use a proxy http://esri.github.io/esri-leaflet/api-reference/request.html");n.send(s)}return n}function _(t,i,r,s){window._EsriLeafletCallbacks=window._EsriLeafletCallbacks||{};var n="c"+c;i.callback="window._EsriLeafletCallbacks."+n,window._EsriLeafletCallbacks[n]=function(t){if(!0!==window._EsriLeafletCallbacks[n]){var e,i=Object.prototype.toString.call(t);"[object Object]"!==i&&"[object Array]"!==i&&(e={error:{code:500,message:"Expected array or object as JSONP response"}},t=null),!e&&t.error&&(e=t,t=null),r.call(s,e,t),window._EsriLeafletCallbacks[n]=!0}};var o=e.DomUtil.create("script",null,document.body);return o.type="text/javascript",o.src=t+"?"+d(i),o.id=n,o.onerror=function(t){if(t&&!0!==window._EsriLeafletCallbacks[n]){r.call(s,{error:{code:500,message:"An unknown error occurred"}}),window._EsriLeafletCallbacks[n]=!0}},e.DomUtil.addClass(o,"esri-leaflet-jsonp"),c++,{id:n,url:o.src,abort:function(){window._EsriLeafletCallbacks._callback[n]({code:0,message:"Request aborted."})}}}var v=h.cors?y:_;function b(){console&&console.warn&&console.warn.apply(console,arguments)}v.CORS=y,v.JSONP=_;var x={request:g,get:v,post:m},L=function(t,e,i,r){var s=(r[0]-i[0])*(t[1]-i[1])-(r[1]-i[1])*(t[0]-i[0]),n=(e[0]-t[0])*(t[1]-i[1])-(e[1]-t[1])*(t[0]-i[0]),o=(r[1]-i[1])*(e[0]-t[0])-(r[0]-i[0])*(e[1]-t[1]);if(0!==o){var a=s/o,l=n/o;if(a>=0&&a<=1&&l>=0&&l<=1)return!0}return!1},S=function(t,e){for(var i=0;i<t.length-1;i++)for(var r=0;r<e.length-1;r++)if(L(t[i],t[i+1],e[r],e[r+1]))return!0;return!1},A=function(t){return function(t,e){for(var i=0;i<t.length;i++)if(t[i]!==e[i])return!1;return!0}(t[0],t[t.length-1])||t.push(t[0]),t},T=function(t){for(var e,i=0,r=0,s=t.length,n=t[r];r<s-1;r++)i+=((e=t[r+1])[0]-n[0])*(e[1]+n[1]),n=e;return i>=0},I=function(t){var e={};for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i]);return e},w=function(t,e){var i=S(t,e),r=function(t,e){for(var i=!1,r=-1,s=t.length,n=s-1;++r<s;n=r)(t[r][1]<=e[1]&&e[1]<t[n][1]||t[n][1]<=e[1]&&e[1]<t[r][1])&&e[0]<(t[n][0]-t[r][0])*(e[1]-t[r][1])/(t[n][1]-t[r][1])+t[r][0]&&(i=!i);return i}(t,e[0]);return!(i||!r)},C=function t(e,i){var r={};if(e.features){r.type="FeatureCollection",r.features=[];for(var s=0;s<e.features.length;s++)r.features.push(t(e.features[s],i))}if("number"==typeof e.x&&"number"==typeof e.y&&(r.type="Point",r.coordinates=[e.x,e.y],"number"==typeof e.z&&r.coordinates.push(e.z)),e.points&&(r.type="MultiPoint",r.coordinates=e.points.slice(0)),e.paths&&(1===e.paths.length?(r.type="LineString",r.coordinates=e.paths[0].slice(0)):(r.type="MultiLineString",r.coordinates=e.paths.slice(0))),e.rings&&(r=function(t){for(var e,i,r,s=[],n=[],o=0;o<t.length;o++){var a=A(t[o].slice(0));if(!(a.length<4))if(T(a)){var l=[a.slice().reverse()];s.push(l)}else n.push(a.slice().reverse())}for(var u=[];n.length;){r=n.pop();var h=!1;for(e=s.length-1;e>=0;e--)if(i=s[e][0],w(i,r)){s[e].push(r),h=!0;break}h||u.push(r)}for(;u.length;){r=u.pop();var p=!1;for(e=s.length-1;e>=0;e--)if(i=s[e][0],S(i,r)){s[e].push(r),p=!0;break}p||s.push([r.reverse()])}return 1===s.length?{type:"Polygon",coordinates:s[0]}:{type:"MultiPolygon",coordinates:s}}(e.rings.slice(0))),"number"==typeof e.xmin&&"number"==typeof e.ymin&&"number"==typeof e.xmax&&"number"==typeof e.ymax&&(r.type="Polygon",r.coordinates=[[[e.xmax,e.ymax],[e.xmin,e.ymax],[e.xmin,e.ymin],[e.xmax,e.ymin],[e.xmax,e.ymax]]]),(e.geometry||e.attributes)&&(r.type="Feature",r.geometry=e.geometry?t(e.geometry):null,r.properties=e.attributes?I(e.attributes):null,e.attributes))try{r.id=function(t,e){for(var i=e?[e,"OBJECTID","FID"]:["OBJECTID","FID"],r=0;r<i.length;r++){var s=i[r];if(s in t&&("string"==typeof t[s]||"number"==typeof t[s]))return t[s]}throw Error("No valid id attribute found")}(e.attributes,i)}catch(t){}return JSON.stringify(r.geometry)===JSON.stringify({})&&(r.geometry=null),e.spatialReference&&e.spatialReference.wkid&&4326!==e.spatialReference.wkid&&console.warn("Object converted in non-standard crs - "+JSON.stringify(e.spatialReference)),r},O=function(t){var e=[],i=t.slice(0),r=A(i.shift().slice(0));if(r.length>=4){T(r)||r.reverse(),e.push(r);for(var s=0;s<i.length;s++){var n=A(i[s].slice(0));n.length>=4&&(T(n)&&n.reverse(),e.push(n))}}return e},P=function t(e,i){i=i||"OBJECTID";var r,s={wkid:4326},n={};switch(e.type){case"Point":n.x=e.coordinates[0],n.y=e.coordinates[1],e.coordinates[2]&&(n.z=e.coordinates[2]),n.spatialReference=s;break;case"MultiPoint":n.points=e.coordinates.slice(0),e.coordinates[0][2]&&(n.hasZ=!0),n.spatialReference=s;break;case"LineString":n.paths=[e.coordinates.slice(0)],e.coordinates[0][2]&&(n.hasZ=!0),n.spatialReference=s;break;case"MultiLineString":n.paths=e.coordinates.slice(0),e.coordinates[0][0][2]&&(n.hasZ=!0),n.spatialReference=s;break;case"Polygon":n.rings=O(e.coordinates.slice(0)),e.coordinates[0][0][2]&&(n.hasZ=!0),n.spatialReference=s;break;case"MultiPolygon":n.rings=function(t){for(var e=[],i=0;i<t.length;i++)for(var r=O(t[i]),s=r.length-1;s>=0;s--){var n=r[s].slice(0);e.push(n)}return e}(e.coordinates.slice(0)),e.coordinates[0][0][0][2]&&(n.hasZ=!0),n.spatialReference=s;break;case"Feature":e.geometry&&(n.geometry=t(e.geometry,i)),n.attributes=e.properties?I(e.properties):{},e.id&&(n.attributes[i]=e.id);break;case"FeatureCollection":for(n=[],r=0;r<e.features.length;r++)n.push(t(e.features[r],i));break;case"GeometryCollection":for(n=[],r=0;r<e.geometries.length;r++)n.push(t(e.geometries[r],i))}return n},R='<a href="http://leafletjs.com" title="A JS library for interactive maps">Leaflet</a>';
2
2
  /* @preserve
3
3
  * @terraformer/arcgis - v2.0.7 - MIT
4
4
  * Copyright (c) 2012-2021 Environmental Systems Research Institute, Inc.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mars2d-esri",
3
- "version": "3.0.14",
3
+ "version": "3.1.2",
4
4
  "description": "Mars2D平台插件,ArcGIS Server功能支持插件",
5
5
  "main": "dist/mars2d-esri.js",
6
6
  "files": [
@@ -8,7 +8,7 @@
8
8
  ],
9
9
  "dependencies": {},
10
10
  "devDependencies": {
11
- "mars2d": "^3.0.14"
11
+ "mars2d": "^3.1.2"
12
12
  },
13
13
  "scripts": {
14
14
  "lint": "eslint ./src/**/*.{js,ts} --fix"