hi-ucs/front/public/leaflet/libs/mapbox-gl-js/plugins/mapbox-gl-draw/1.0.9/mapbox-gl-draw.js

7 lines
109 KiB
Vue
Raw Normal View History

2022-06-14 09:32:49 +08:00
/**
* github: https://github.com/mapbox/mapbox-gl-draw
* license: ISC License
* version: 1.0.9
*/
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).MapboxDraw=e()}}(function(){return function e(t,n,o){function r(s,a){if(!n[s]){if(!t[s]){var c="function"==typeof require&&require;if(!a&&c)return c(s,!0);if(i)return i(s,!0);var u=new Error("Cannot find module '"+s+"'");throw u.code="MODULE_NOT_FOUND",u}var l=n[s]={exports:{}};t[s][0].call(l.exports,function(e){var n=t[s][1][e];return r(n||e)},l,l.exports,e,t,n,o)}return n[s].exports}for(var i="function"==typeof require&&require,s=0;s<o.length;s++)r(o[s]);return r}({1:[function(e,t,n){"use strict";var o=e("./src/setup"),r=e("./src/options"),i=e("./src/api"),s=e("./src/constants");t.exports=function(e){!function(e,t){var n={options:e=r(e)};t=i(n,t),n.api=t;var a=o(n);t.onAdd=a.onAdd,t.onRemove=a.onRemove,t.types=s.types,t.options=e}(e,this)},t.exports.modes=e("./src/modes")},{"./src/api":22,"./src/constants":23,"./src/modes":56,"./src/options":61,"./src/setup":63}],2:[function(e,t,n){function o(e){if(!(this instanceof o))return new o(e);this._bbox=e||[1/0,1/0,-1/0,-1/0],this._valid=!!e}t.exports=o,o.prototype.include=function(e){return this._valid=!0,this._bbox[0]=Math.min(this._bbox[0],e[0]),this._bbox[1]=Math.min(this._bbox[1],e[1]),this._bbox[2]=Math.max(this._bbox[2],e[0]),this._bbox[3]=Math.max(this._bbox[3],e[1]),this},o.prototype.equals=function(e){var t;return t=e instanceof o?e.bbox():e,this._bbox[0]==t[0]&&this._bbox[1]==t[1]&&this._bbox[2]==t[2]&&this._bbox[3]==t[3]},o.prototype.center=function(e){return this._valid?[(this._bbox[0]+this._bbox[2])/2,(this._bbox[1]+this._bbox[3])/2]:null},o.prototype.union=function(e){var t;return this._valid=!0,t=e instanceof o?e.bbox():e,this._bbox[0]=Math.min(this._bbox[0],t[0]),this._bbox[1]=Math.min(this._bbox[1],t[1]),this._bbox[2]=Math.max(this._bbox[2],t[2]),this._bbox[3]=Math.max(this._bbox[3],t[3]),this},o.prototype.bbox=function(){return this._valid?this._bbox:null},o.prototype.contains=function(e){if(!e)return this._fastContains();if(!this._valid)return null;var t=e[0],n=e[1];return this._bbox[0]<=t&&this._bbox[1]<=n&&this._bbox[2]>=t&&this._bbox[3]>=n},o.prototype.intersect=function(e){return this._valid?(t=e instanceof o?e.bbox():e,!(this._bbox[0]>t[2]||this._bbox[2]<t[0]||this._bbox[3]<t[1]||this._bbox[1]>t[3])):null;var t},o.prototype._fastContains=function(){if(!this._valid)return new Function("return null;");var e="return "+this._bbox[0]+"<= ll[0] &&"+this._bbox[1]+"<= ll[1] &&"+this._bbox[2]+">= ll[0] &&"+this._bbox[3]+">= ll[1]";return new Function("ll",e)},o.prototype.polygon=function(){return this._valid?{type:"Polygon",coordinates:[[[this._bbox[0],this._bbox[1]],[this._bbox[2],this._bbox[1]],[this._bbox[2],this._bbox[3]],[this._bbox[0],this._bbox[3]],[this._bbox[0],this._bbox[1]]]]}:null}},{}],3:[function(e,t,n){var o=e("wgs84");function r(e){var t=0;if(e&&e.length>0){t+=Math.abs(i(e[0]));for(var n=1;n<e.length;n++)t-=Math.abs(i(e[n]))}return t}function i(e){var t,n,r,i,a,c,u=0,l=e.length;if(l>2){for(c=0;c<l;c++)c===l-2?(r=l-2,i=l-1,a=0):c===l-1?(r=l-1,i=0,a=1):(r=c,i=c+1,a=c+2),t=e[r],n=e[i],u+=(s(e[a][0])-s(t[0]))*Math.sin(s(n[1]));u=u*o.RADIUS*o.RADIUS/2}return u}function s(e){return e*Math.PI/180}t.exports.geometry=function e(t){var n,o=0;switch(t.type){case"Polygon":return r(t.coordinates);case"MultiPolygon":for(n=0;n<t.coordinates.length;n++)o+=r(t.coordinates[n]);return o;case"Point":case"MultiPoint":case"LineString":case"MultiLineString":return 0;case"GeometryCollection":for(n=0;n<t.geometries.length;n++)o+=e(t.geometries[n]);return o}},t.exports.ring=i},{wgs84:20}],4:[function(e,t,n){t.exports=function(e){return function e(t){if(Array.isArray(t)&&t.length&&"number"==typeof t[0])return[t];return t.reduce(function(t,n){return Array.isArray(n)&&Array.isArray(n[0])?t.concat(e(n)):(t.push(n),t)},[])}(e)}},{}],5:[function(e,t,n){var o=e("@mapbox/geojson-normalize"),r=e("geojson-flatten"),i=e("./flatt