UNPKG

76.3 kBJavaScriptView Raw
1!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@antv/l7")):"function"==typeof define&&define.amd?define(["exports","@antv/l7"],t):t(((e=e||self).L7=e.L7||{},e.L7.Draw={}),e.L7)}(this,(function(e,t){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e,t){for(var r=0;t.length>r;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function i(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),e}function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function u(e){for(var t=1;arguments.length>t;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?a(Object(r),!0).forEach((function(t){o(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):a(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&l(e,t)}function c(e){return(c=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function l(e,t){return(l=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function d(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function f(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?d(e):t}function h(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=c(e);if(t){var i=c(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return f(this,r)}}function y(e,t,r){return(y="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=c(e)););return e}(e,t);if(n){var i=Object.getOwnPropertyDescriptor(n,t);return i.get?i.get.call(r):i.value}})(e,t,r||e)}function v(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);t>r;r++)n[r]=e[r];return n}function p(e,t){var r;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return v(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?v(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return e.length>n?{done:!1,value:e[n++]}:{done:!0}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,u=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return a=e.done,e},e:function(e){u=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw o}}}}var M="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function g(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function w(e,t){return e(t={exports:{}},t.exports),t.exports}var b=w((function(e,t){function r(e,t,r){void 0===r&&(r={});var n={type:"Feature"};return(0===r.id||r.id)&&(n.id=r.id),r.bbox&&(n.bbox=r.bbox),n.properties=t||{},n.geometry=e,n}function n(e,t,n){return void 0===n&&(n={}),r({type:"Point",coordinates:e},t,n)}function i(e,t,n){void 0===n&&(n={});for(var i=0,o=e;o.length>i;i++){var a=o[i];if(4>a.length)throw Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var u=0;a[a.length-1].length>u;u++)if(a[a.length-1][u]!==a[0][u])throw Error("First and last Position are not equivalent.")}return r({type:"Polygon",coordinates:e},t,n)}function o(e,t,n){if(void 0===n&&(n={}),2>e.length)throw Error("coordinates must be an array of two or more positions");return r({type:"LineString",coordinates:e},t,n)}function a(e,t){void 0===t&&(t={});var r={type:"FeatureCollection"};return t.id&&(r.id=t.id),t.bbox&&(r.bbox=t.bbox),r.features=e,r}function u(e,t,n){return void 0===n&&(n={}),r({type:"MultiLineString",coordinates:e},t,n)}function s(e,t,n){return void 0===n&&(n={}),r({type:"MultiPoint",coordinates:e},t,n)}function c(e,t,n){return void 0===n&&(n={}),r({type:"MultiPolygon",coordinates:e},t,n)}function l(e,r){void 0===r&&(r="kilometers");var n=t.factors[r];if(!n)throw Error(r+" units is invalid");return e*n}function d(e,r){void 0===r&&(r="kilometers");var n=t.factors[r];if(!n)throw Error(r+" units is invalid");return e/n}function f(e){return 180*(e%(2*Math.PI))/Math.PI}function h(e){return!isNaN(e)&&null!==e&&!Array.isArray(e)&&!/^\s*$/.test(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.earthRadius=6371008.8,t.factors={centimeters:100*t.earthRadius,centimetres:100*t.earthRadius,degrees:t.earthRadius/111325,feet:3.28084*t.earthRadius,inches:39.37*t.earthRadius,kilometers:t.earthRadius/1e3,kilometres:t.earthRadius/1e3,meters:t.earthRadius,metres:t.earthRadius,miles:t.earthRadius/1609.344,millimeters:1e3*t.earthRadius,millimetres:1e3*t.earthRadius,nauticalmiles:t.earthRadius/1852,radians:1,yards:t.earthRadius/1.0936},t.unitsFactors={centimeters:100,centimetres:100,degrees:1/111325,feet:3.28084,inches:39.37,kilometers:.001,kilometres:.001,meters:1,metres:1,miles:1/1609.344,millimeters:1e3,millimetres:1e3,nauticalmiles:1/1852,radians:1/t.earthRadius,yards:1/1.0936},t.areaFactors={acres:247105e-9,centimeters:1e4,centimetres:1e4,feet:10.763910417,inches:1550.003100006,kilometers:1e-6,kilometres:1e-6,meters:1,metres:1,miles:386e-9,millimeters:1e6,millimetres:1e6,yards:1.195990046},t.feature=r,t.geometry=function(e,t,r){switch(e){case"Point":return n(t).geometry;case"LineString":return o(t).geometry;case"Polygon":return i(t).geometry;case"MultiPoint":return s(t).geometry;case"MultiLineString":return u(t).geometry;case"MultiPolygon":return c(t).geometry;default:throw Error(e+" is invalid")}},t.point=n,t.points=function(e,t,r){return void 0===r&&(r={}),a(e.map((function(e){return n(e,t)})),r)},t.polygon=i,t.polygons=function(e,t,r){return void 0===r&&(r={}),a(e.map((function(e){return i(e,t)})),r)},t.lineString=o,t.lineStrings=function(e,t,r){return void 0===r&&(r={}),a(e.map((function(e){return o(e,t)})),r)},t.featureCollection=a,t.multiLineString=u,t.multiPoint=s,t.multiPolygon=c,t.geometryCollection=function(e,t,n){return void 0===n&&(n={}),r({type:"GeometryCollection",geometries:e},t,n)},t.round=function(e,t){if(void 0===t&&(t=0),t&&t<0)throw Error("precision must be a positive number");var r=Math.pow(10,t||0);return Math.round(e*r)/r},t.radiansToLength=l,t.lengthToRadians=d,t.lengthToDegrees=function(e,t){return f(d(e,t))},t.bearingToAzimuth=function(e){var t=e%360;return 0>t&&(t+=360),t},t.radiansToDegrees=f,t.degreesToRadians=function(e){return e%360*Math.PI/180},t.convertLength=function(e,t,r){if(void 0===t&&(t="kilometers"),void 0===r&&(r="kilometers"),e<0)throw Error("length must be a positive number");return l(d(e,t),r)},t.convertArea=function(e,r,n){if(void 0===r&&(r="meters"),void 0===n&&(n="kilometers"),e<0)throw Error("area must be a positive number");var i=t.areaFactors[r];if(!i)throw Error("invalid original units");var o=t.areaFactors[n];if(!o)throw Error("invalid final units");return e/i*o},t.isNumber=h,t.isObject=function(e){return!!e&&e.constructor===Object},t.validateBBox=function(e){if(!e)throw Error("bbox is required");if(!Array.isArray(e))throw Error("bbox must be an Array");if(4!==e.length&&6!==e.length)throw Error("bbox must be an Array of 4 or 6 numbers");e.forEach((function(e){if(!h(e))throw Error("bbox must only contain numbers")}))},t.validateId=function(e){if(!e)throw Error("id is required");if(-1===["string","number"].indexOf(typeof e))throw Error("id must be a number or a string")},t.radians2degrees=function(){throw Error("method has been renamed to `radiansToDegrees`")},t.degrees2radians=function(){throw Error("method has been renamed to `degreesToRadians`")},t.distanceToDegrees=function(){throw Error("method has been renamed to `lengthToDegrees`")},t.distanceToRadians=function(){throw Error("method has been renamed to `lengthToRadians`")},t.radiansToDistance=function(){throw Error("method has been renamed to `radiansToLength`")},t.bearingToAngle=function(){throw Error("method has been renamed to `bearingToAzimuth`")},t.convertDistance=function(){throw Error("method has been renamed to `convertLength`")}}));g(b);var D,L,j,E=b.point,m=b.polygon,N=b.lineString,I=b.featureCollection,A=b.isObject;!function(e){e.CREATE="draw.create",e.DELETE="draw.delete",e.Move="draw.move",e.Edit="draw.edit",e.UPDATE="draw.update",e.CHANGE="draw.change",e.SELECTION_CHANGE="draw.selectionchange",e.MODE_CHANGE="draw.modechange",e.ACTIONABLE="draw.actionable",e.RENDER="draw.render",e.COMBINE_FEATURES="draw.combine",e.UNCOMBINE_FEATURES="draw.uncombine"}(D||(D={})),function(e){e.DRAW_Circle="draw_circle",e.DRAW_Rect="draw_react",e.DRAW_LINE_STRING="draw_line_string",e.DRAW_POLYGON="draw_polygon",e.DRAW_POINT="draw_point",e.SIMPLE_SELECT="simple_select",e.DIRECT_SELECT="direct_select",e.STATIC="static"}(L||(L={})),function(e){e.FEATURE="Feature",e.POLYGON="Polygon",e.LINE_STRING="LineString",e.POINT="Point",e.FEATURE_COLLECTION="FeatureCollection",e.MULTI_PREFIX="Multi",e.MULTI_POINT="MultiPoint",e.MULTI_LINE_STRING="MultiLineString",e.MULTI_POLYGON="MultiPolygon"}(j||(j={}));var T=w((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.getCoord=function(e){if(!e)throw Error("coord is required");if(!Array.isArray(e)){if("Feature"===e.type&&null!==e.geometry&&"Point"===e.geometry.type)return e.geometry.coordinates;if("Point"===e.type)return e.coordinates}if(Array.isArray(e)&&e.length>=2&&!Array.isArray(e[0])&&!Array.isArray(e[1]))return e;throw Error("coord must be GeoJSON Point or an Array of numbers")},t.getCoords=function(e){if(Array.isArray(e))return e;if("Feature"===e.type){if(null!==e.geometry)return e.geometry.coordinates}else if(e.coordinates)return e.coordinates;throw Error("coords must be GeoJSON Feature, Geometry Object or an Array")},t.containsNumber=function e(t){if(t.length>1&&b.isNumber(t[0])&&b.isNumber(t[1]))return!0;if(Array.isArray(t[0])&&t[0].length)return e(t[0]);throw Error("coordinates must only contain numbers")},t.geojsonType=function(e,t,r){if(!t||!r)throw Error("type and name required");if(!e||e.type!==t)throw Error("Invalid input to "+r+": must be a "+t+", given "+e.type)},t.featureOf=function(e,t,r){if(!e)throw Error("No feature passed");if(!r)throw Error(".featureOf() requires a name");if(!e||"Feature"!==e.type||!e.geometry)throw Error("Invalid input to "+r+", Feature with geometry required");if(!e.geometry||e.geometry.type!==t)throw Error("Invalid input to "+r+": must be a "+t+", given "+e.geometry.type)},t.collectionOf=function(e,t,r){if(!e)throw Error("No featureCollection passed");if(!r)throw Error(".collectionOf() requires a name");if(!e||"FeatureCollection"!==e.type)throw Error("Invalid input to "+r+", FeatureCollection required");for(var n=0,i=e.features;i.length>n;n++){var o=i[n];if(!o||"Feature"!==o.type||!o.geometry)throw Error("Invalid input to "+r+", Feature with geometry required");if(!o.geometry||o.geometry.type!==t)throw Error("Invalid input to "+r+": must be a "+t+", given "+o.geometry.type)}},t.getGeom=function(e){return"Feature"===e.type?e.geometry:e},t.getType=function(e,t){return"FeatureCollection"===e.type?"FeatureCollection":"GeometryCollection"===e.type?"GeometryCollection":"Feature"===e.type&&null!==e.geometry?e.geometry.type:e.type}}));g(T);var O=w((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t,r,n){void 0===n&&(n={});var i=T.getCoord(e),o=b.degreesToRadians(i[0]),a=b.degreesToRadians(i[1]),u=b.degreesToRadians(r),s=b.lengthToRadians(t,n.units),c=Math.asin(Math.sin(a)*Math.cos(s)+Math.cos(a)*Math.sin(s)*Math.cos(u)),l=b.radiansToDegrees(o+Math.atan2(Math.sin(u)*Math.sin(s)*Math.cos(a),Math.cos(s)-Math.sin(a)*Math.sin(c))),d=b.radiansToDegrees(c);return b.point([l,d],n.properties)}}));g(O);var k=g(w((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t,r){void 0===r&&(r={});for(var n=r.steps||64,i=r.properties?r.properties:!Array.isArray(e)&&"Feature"===e.type&&e.properties?e.properties:{},o=[],a=0;n>a;a++)o.push(O.default(e,t,-360*a/n,r).geometry.coordinates);return o.push(o[0]),b.polygon([o],i)}}))),C=g(w((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t,r){void 0===r&&(r={});var n=T.getCoord(e),i=T.getCoord(t),o=b.degreesToRadians(i[1]-n[1]),a=b.degreesToRadians(i[0]-n[0]),u=b.degreesToRadians(n[1]),s=b.degreesToRadians(i[1]),c=Math.pow(Math.sin(o/2),2)+Math.pow(Math.sin(a/2),2)*Math.cos(u)*Math.cos(s);return b.radiansToLength(2*Math.atan2(Math.sqrt(c),Math.sqrt(1-c)),r.units)}})));function z(e,t,r){var n=C(E(e),E(t),r);return k(e,n,{units:r.units,steps:r.steps,properties:u(u({},r),{},{active:!0,type:"circle",radius:n,startPoint:{lng:e[0],lat:e[1]},endPoint:{lng:t[0],lat:t[1]}})})}function x(e,t,r){var n=Math.min(e[0],t[0]),i=Math.min(e[1],t[1]),o=Math.max(e[0],t[0]),a=Math.max(e[1],t[1]);return{type:"Feature",properties:u({type:"rect",active:!0,startPoint:{lng:e[0],lat:e[1]},endPoint:{lng:t[0],lat:t[1]}},r),geometry:{type:"Polygon",coordinates:[[[n,i],[n,a],[o,a],[o,i],[n,i]]]}}}function F(e,t){var r=e.map((function(e){return[e.lng,e.lat]}));return 2>e.length?E(r[0],t):3>e.length?N(r,t):(r.push(r[0]),m([r],t))}function S(e,t){var r=e.map((function(e){return[e.lng,e.lat]}));return 2>e.length?E(r[0],t):N(r,t)}function _(e){var t=e.map((function(e,t){return E([e.lng,e.lat],{active:!0,id:""+t})}));return I(t)}function P(e,t){return e.forEach((function(e){var r,n=e.geometry,i=n.coordinates;switch(n.type){case j.POINT:r=Y(i,t);break;case j.LINE_STRING:case j.MULTI_POINT:r=U(i,t);break;case j.POLYGON:case j.MULTI_LINE_STRING:r=R(i,t);break;case j.MULTI_POLYGON:r=i.map((function(e){return R(e,t)}))}r&&(n.coordinates=r)})),e}function Y(e,t){return[e[0]+t.lng,e[1]+t.lat]}function U(e,t){return e.map((function(e){return Y(e,t)}))}function R(e,t){return e.map((function(e){return U(e,t)}))}function Q(e,r){var n,i,o;switch(null===(n=e.features[0])||void 0===n||null===(i=n.geometry)||void 0===i?void 0:i.type){case"Point":o=function(e,r){return[new t.PointLayer({zIndex:2,pickingBuffer:3}).source(e).shape("circle").color(r.color).size(r.size).style(r.style)]}(e,r.point);break;case"LineString":o=function(e,r){return[new t.LineLayer({pickingBuffer:3}).source(e).shape("line").color(r.color).size(r.size).style(r.style)]}(e,r.line);break;case"Polygon":o=function(e,r){var n=(new t.PolygonLayer).source(e).shape("fill").color(r.color).size(r.size).style({opacity:r.style.opacity}),i=(new t.PolygonLayer).source(e).shape("line").color(r.style.stroke).size(r.style.strokeWidth).style({opacity:r.style.strokeOpacity,lineType:r.style.lineType,dashArray:r.style.dashArray});return[n,i]}(e,r.polygon)}return o}var G=function(){function e(t){r(this,e),this.drawLayers=[],this.draw=t}return i(e,[{key:"update",value:function(e){this.drawLayers.length>0&&this.updateData(e),this.removeLayers();var t=this.draw.getStyle("normal");this.drawLayers=Q(e,t),this.addLayers()}},{key:"on",value:function(e,t){this.drawLayers[0].on(e,t)}},{key:"off",value:function(e,t){this.drawLayers[0].off(e,t)}},{key:"emit",value:function(e,t){this.drawLayers[0].emit(e,t)}},{key:"updateData",value:function(e){0===this.drawLayers.length&&this.update(e),this.drawLayers.forEach((function(t){return t.setData(e)}))}},{key:"destroy",value:function(){this.removeLayers()}},{key:"removeLayers",value:function(){var e=this;0!==this.drawLayers.length&&this.drawLayers.forEach((function(t){return e.draw.scene.removeLayer(t)}))}},{key:"addLayers",value:function(){var e=this;this.drawLayers.forEach((function(t){return e.draw.scene.addLayer(t)}))}},{key:"show",value:function(){this.drawLayers.forEach((function(e){return e.show()}))}},{key:"hide",value:function(){this.drawLayers.forEach((function(e){return e.hide()}))}}]),e}(),V=function(e){s(n,e);var t=h(n);function n(){var e;return r(this,n),(e=t.apply(this,arguments)).onMouseMove=function(t){e.draw.setCursor("move"),e.draw.selectMode.enable()},e.onUnMouseMove=function(t){e.draw.resetCursor(),e.draw.selectMode.disable()},e.onClick=function(t){e.draw.selectMode.disable(),e.draw.editMode.enable(),e.disableSelect(),e.draw.resetCursor(),e.enableEdit(),e.draw.setCurrentFeature(t.feature),e.draw.emit(D.MODE_CHANGE,L.DIRECT_SELECT)},e.onUnClick=function(t){e.draw.selectMode.disable(),e.draw.editMode.disable(),e.draw.source.setFeatureUnActive(e.draw.getCurrentFeature()),e.disableSelect(),e.disableEdit(),e.hide(),e.draw.emit(D.MODE_CHANGE,L.STATIC)},e}return i(n,[{key:"update",value:function(e){this.removeLayers();var t=this.draw.getStyle("active");this.drawLayers=Q(e,t),this.addLayers()}},{key:"enableSelect",value:function(){if(this.show(),!this.isEnableDrag){var e=this.drawLayers[0];e.on("mouseenter",this.onMouseMove),e.on("mouseout",this.onUnMouseMove),this.draw.editEnable&&e.on("click",this.onClick),e.on("unclick",this.onUnClick),this.isEnableDrag=!0}}},{key:"disableSelect",value:function(){if(this.isEnableDrag){var e=this.drawLayers[0];e.off("mouseenter",this.onMouseMove),e.off("mouseout",this.onUnMouseMove),e.off("click",this.onClick),e.off("unclick",this.onUnClick),this.isEnableDrag=!1}}},{key:"enableEdit",value:function(){this.isEnableEdit||(this.drawLayers[0].on("unclick",this.onUnClick),this.isEnableDrag=!0)}},{key:"disableEdit",value:function(){this.isEnableEdit&&(this.drawLayers[0].off("unclick",this.onUnClick),this.isEnableDrag=!1)}}]),n}(G),B=function(e){s(n,e);var t=h(n);function n(){var e;return r(this,n),(e=t.apply(this,arguments)).onClick=function(t){e.draw.source.setFeatureUnActive(e.draw.getCurrentFeature()),e.draw.setCurrentFeature(t.feature),e.draw.source.setFeatureActive(t.feature),e.updateData(e.draw.source.data),e.draw.emit(D.MODE_CHANGE,L.SIMPLE_SELECT)},e.onDeleteClick=function(t){e.draw.source.removeFeature(t.feature),e.updateData(e.draw.source.data)},e}return i(n,[{key:"update",value:function(e){if(0<this.drawLayers.length)this.updateData(e);else{this.removeLayers();var t=this.draw.getStyle("normal");this.drawLayers=Q(e,t),this.addFilter(),this.addLayers()}}},{key:"enableSelect",value:function(){this.isEnableDrag||this.draw.selectEnable&&(this.drawLayers[0].on("click",this.onClick),this.isEnableDrag=!0)}},{key:"disableSelect",value:function(){this.isEnableDrag&&(this.drawLayers[0].off("click",this.onClick),this.isEnableDrag=!1)}},{key:"enableDelete",value:function(){this.disableSelect(),this.drawLayers[0].on("click",this.onDeleteClick)}},{key:"disableDelete",value:function(){this.drawLayers[0].off("click",this.onDeleteClick)}},{key:"addFilter",value:function(){this.drawLayers.forEach((function(e){return e.filter("active",(function(e){return!e}))}))}}]),n}(G),H=function(e){s(n,e);var t=h(n);function n(){var e;return r(this,n),(e=t.apply(this,arguments)).onMouseEnter=function(t){e.draw.setCursor("move"),e.draw.setCurrentVertex(t.feature),e.draw.editMode.enable()},e.onMouseOut=function(t){e.draw.resetCursor(),e.draw.editMode.disable()},e.onClick=function(t){e.draw.setCurrentVertex(t.feature),e.draw.editMode.enable()},e}return i(n,[{key:"update",value:function(e){this.removeLayers();var t=this.draw.getStyle("active");this.drawLayers=Q(e,t),this.addLayers()}},{key:"enableSelect",value:function(){}},{key:"disableSelect",value:function(){}},{key:"enableEdit",value:function(){if(!this.isEnableEdit){var e=this.drawLayers[0];e.on("mouseenter",this.onMouseEnter),e.on("mouseout",this.onMouseOut),e.on("click",this.onClick),this.isEnableEdit=!0}}},{key:"disableEdit",value:function(){if(this.isEnableEdit){var e=this.drawLayers[0];e.off("mouseenter",this.onMouseEnter),e.off("mouseout",this.onMouseOut),e.off("click",this.onClick),this.isEnableEdit=!1}}}]),n}(G),Z=w((function(e){var t=Object.prototype.hasOwnProperty,r="~";function n(){}function i(e,t,r){this.fn=e,this.context=t,this.once=r||!1}function o(e,t,n,o,a){if("function"!=typeof n)throw new TypeError("The listener must be a function");var u=new i(n,o||e,a),s=r?r+t:t;return e._events[s]?e._events[s].fn?e._events[s]=[e._events[s],u]:e._events[s].push(u):(e._events[s]=u,e._eventsCount++),e}function a(e,t){0==--e._eventsCount?e._events=new n:delete e._events[t]}function u(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(r=!1)),u.prototype.eventNames=function(){var e,n,i=[];if(0===this._eventsCount)return i;for(n in e=this._events)t.call(e,n)&&i.push(r?n.slice(1):n);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(e)):i},u.prototype.listeners=function(e){var t=this._events[r?r+e:e];if(!t)return[];if(t.fn)return[t.fn];for(var n=0,i=t.length,o=Array(i);i>n;n++)o[n]=t[n].fn;return o},u.prototype.listenerCount=function(e){var t=this._events[r?r+e:e];return t?t.fn?1:t.length:0},u.prototype.emit=function(e,t,n,i,o,a){var u=r?r+e:e;if(!this._events[u])return!1;var s,c,l=this._events[u],d=arguments.length;if(l.fn){switch(l.once&&this.removeListener(e,l.fn,void 0,!0),d){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,t),!0;case 3:return l.fn.call(l.context,t,n),!0;case 4:return l.fn.call(l.context,t,n,i),!0;case 5:return l.fn.call(l.context,t,n,i,o),!0;case 6:return l.fn.call(l.context,t,n,i,o,a),!0}for(c=1,s=Array(d-1);d>c;c++)s[c-1]=arguments[c];l.fn.apply(l.context,s)}else{var f,h=l.length;for(c=0;h>c;c++)switch(l[c].once&&this.removeListener(e,l[c].fn,void 0,!0),d){case 1:l[c].fn.call(l[c].context);break;case 2:l[c].fn.call(l[c].context,t);break;case 3:l[c].fn.call(l[c].context,t,n);break;case 4:l[c].fn.call(l[c].context,t,n,i);break;default:if(!s)for(f=1,s=Array(d-1);d>f;f++)s[f-1]=arguments[f];l[c].fn.apply(l[c].context,s)}}return!0},u.prototype.on=function(e,t,r){return o(this,e,t,r,!1)},u.prototype.once=function(e,t,r){return o(this,e,t,r,!0)},u.prototype.removeListener=function(e,t,n,i){var o=r?r+e:e;if(!this._events[o])return this;if(!t)return a(this,o),this;var u=this._events[o];if(u.fn)u.fn!==t||i&&!u.once||n&&u.context!==n||a(this,o);else{for(var s=0,c=[],l=u.length;l>s;s++)(u[s].fn!==t||i&&!u[s].once||n&&u[s].context!==n)&&c.push(u[s]);c.length?this._events[o]=1===c.length?c[0]:c:a(this,o)}return this},u.prototype.removeAllListeners=function(e){var t;return e?this._events[t=r?r+e:e]&&a(this,t):(this._events=new n,this._eventsCount=0),this},u.prototype.off=u.prototype.removeListener,u.prototype.addListener=u.prototype.on,u.prefixed=r,u.EventEmitter=u,e.exports=u})).EventEmitter;var W=function(e,t){return e===t||e!=e&&t!=t};var q=function(e,t){for(var r=e.length;r--;)if(W(e[r][0],t))return r;return-1},J=Array.prototype.splice;var $=function(e){var t=this.__data__,r=q(t,e);return r>=0&&(r==t.length-1?t.pop():J.call(t,r,1),--this.size,!0)};var X=function(e){var t=this.__data__,r=q(t,e);return 0>r?void 0:t[r][1]};var K=function(e){return q(this.__data__,e)>-1};var ee=function(e,t){var r=this.__data__,n=q(r,e);return 0>n?(++this.size,r.push([e,t])):r[n][1]=t,this};function te(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}te.prototype.clear=function(){this.__data__=[],this.size=0},te.prototype.delete=$,te.prototype.get=X,te.prototype.has=K,te.prototype.set=ee;var re=te;var ne=function(){this.__data__=new re,this.size=0};var ie=function(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r};var oe=function(e){return this.__data__.get(e)};var ae=function(e){return this.__data__.has(e)},ue="object"==typeof M&&M&&M.Object===Object&&M,se="object"==typeof self&&self&&self.Object===Object&&self,ce=ue||se||Function("return this")(),le=ce.Symbol,de=Object.prototype,fe=de.hasOwnProperty,he=de.toString,ye=le?le.toStringTag:void 0;var ve=function(e){var t=fe.call(e,ye),r=e[ye];try{e[ye]=void 0;var n=!0}catch(e){}var i=he.call(e);return n&&(t?e[ye]=r:delete e[ye]),i},pe=Object.prototype.toString;var Me=function(e){return pe.call(e)},ge=le?le.toStringTag:void 0;var we=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":ge&&ge in Object(e)?ve(e):Me(e)};var be=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)};var De,Le=function(e){if(!be(e))return!1;var t=we(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},je=ce["__core-js_shared__"],Ee=(De=/[^.]+$/.exec(je&&je.keys&&je.keys.IE_PROTO||""))?"Symbol(src)_1."+De:"";var me=function(e){return!!Ee&&Ee in e},Ne=Function.prototype.toString;var Ie=function(e){if(null!=e){try{return Ne.call(e)}catch(e){}try{return e+""}catch(e){}}return""},Ae=/^\[object .+?Constructor\]$/,Te=RegExp("^"+Function.prototype.toString.call(Object.prototype.hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var Oe=function(e){return!(!be(e)||me(e))&&(Le(e)?Te:Ae).test(Ie(e))};var ke=function(e,t){return null==e?void 0:e[t]};var Ce=function(e,t){var r=ke(e,t);return Oe(r)?r:void 0},ze=Ce(ce,"Map"),xe=Ce(Object,"create");var Fe=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Se=Object.prototype.hasOwnProperty;var _e=function(e){var t=this.__data__;if(xe){var r=t[e];return"__lodash_hash_undefined__"===r?void 0:r}return Se.call(t,e)?t[e]:void 0},Pe=Object.prototype.hasOwnProperty;var Ye=function(e){var t=this.__data__;return xe?void 0!==t[e]:Pe.call(t,e)};var Ue=function(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=xe&&void 0===t?"__lodash_hash_undefined__":t,this};function Re(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}Re.prototype.clear=function(){this.__data__=xe?xe(null):{},this.size=0},Re.prototype.delete=Fe,Re.prototype.get=_e,Re.prototype.has=Ye,Re.prototype.set=Ue;var Qe=Re;var Ge=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e};var Ve=function(e,t){var r=e.__data__;return Ge(t)?r["string"==typeof t?"string":"hash"]:r.map};var Be=function(e){var t=Ve(this,e).delete(e);return this.size-=t?1:0,t};var He=function(e){return Ve(this,e).get(e)};var Ze=function(e){return Ve(this,e).has(e)};var We=function(e,t){var r=Ve(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this};function qe(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}qe.prototype.clear=function(){this.size=0,this.__data__={hash:new Qe,map:new(ze||re),string:new Qe}},qe.prototype.delete=Be,qe.prototype.get=He,qe.prototype.has=Ze,qe.prototype.set=We;var Je=qe;var $e=function(e,t){var r=this.__data__;if(r instanceof re){var n=r.__data__;if(!ze||199>n.length)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new Je(n)}return r.set(e,t),this.size=r.size,this};function Xe(e){var t=this.__data__=new re(e);this.size=t.size}Xe.prototype.clear=ne,Xe.prototype.delete=ie,Xe.prototype.get=oe,Xe.prototype.has=ae,Xe.prototype.set=$e;var Ke=Xe,et=function(){try{var e=Ce(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();var tt=function(e,t,r){"__proto__"==t&&et?et(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r};var rt=function(e,t,r){(void 0!==r&&!W(e[t],r)||void 0===r&&!(t in e))&&tt(e,t,r)};var nt=function(e){return function(t,r,n){for(var i=-1,o=Object(t),a=n(t),u=a.length;u--;){var s=a[e?u:++i];if(!1===r(o[s],s,o))break}return t}}(),it=w((function(e,t){var r=t&&!t.nodeType&&t,n=r&&e&&!e.nodeType&&e,i=n&&n.exports===r?ce.Buffer:void 0,o=i?i.allocUnsafe:void 0;e.exports=function(e,t){if(t)return e.slice();var r=e.length,n=o?o(r):new e.constructor(r);return e.copy(n),n}})),ot=ce.Uint8Array;var at=function(e){var t=new e.constructor(e.byteLength);return new ot(t).set(new ot(e)),t};var ut=function(e,t){var r=t?at(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)};var st=function(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r<n;)t[r]=e[r];return t},ct=Object.create,lt=function(){function e(){}return function(t){if(!be(t))return{};if(ct)return ct(t);e.prototype=t;var r=new e;return e.prototype=void 0,r}}();var dt=function(e,t){return function(r){return e(t(r))}},ft=dt(Object.getPrototypeOf,Object),ht=Object.prototype;var yt=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||ht)};var vt=function(e){return"function"!=typeof e.constructor||yt(e)?{}:lt(ft(e))};var pt=function(e){return null!=e&&"object"==typeof e};var Mt=function(e){return pt(e)&&"[object Arguments]"==we(e)},gt=Object.prototype,wt=gt.hasOwnProperty,bt=gt.propertyIsEnumerable,Dt=Mt(function(){return arguments}())?Mt:function(e){return pt(e)&&wt.call(e,"callee")&&!bt.call(e,"callee")},Lt=Array.isArray;var jt=function(e){return"number"==typeof e&&e>-1&&e%1==0&&9007199254740991>=e};var Et=function(e){return null!=e&&jt(e.length)&&!Le(e)};var mt=function(e){return pt(e)&&Et(e)};var Nt=function(){return!1},It=w((function(e,t){var r=t&&!t.nodeType&&t,n=r&&e&&!e.nodeType&&e,i=n&&n.exports===r?ce.Buffer:void 0;e.exports=(i?i.isBuffer:void 0)||Nt})),At=Function.prototype.toString,Tt=Object.prototype.hasOwnProperty,Ot=At.call(Object);var kt=function(e){if(!pt(e)||"[object Object]"!=we(e))return!1;var t=ft(e);if(null===t)return!0;var r=Tt.call(t,"constructor")&&t.constructor;return"function"==typeof r&&r instanceof r&&At.call(r)==Ot},Ct={};Ct["[object Float32Array]"]=Ct["[object Float64Array]"]=Ct["[object Int8Array]"]=Ct["[object Int16Array]"]=Ct["[object Int32Array]"]=Ct["[object Uint8Array]"]=Ct["[object Uint8ClampedArray]"]=Ct["[object Uint16Array]"]=Ct["[object Uint32Array]"]=!0,Ct["[object Arguments]"]=Ct["[object Array]"]=Ct["[object ArrayBuffer]"]=Ct["[object Boolean]"]=Ct["[object DataView]"]=Ct["[object Date]"]=Ct["[object Error]"]=Ct["[object Function]"]=Ct["[object Map]"]=Ct["[object Number]"]=Ct["[object Object]"]=Ct["[object RegExp]"]=Ct["[object Set]"]=Ct["[object String]"]=Ct["[object WeakMap]"]=!1;var zt=function(e){return pt(e)&&jt(e.length)&&!!Ct[we(e)]};var xt=function(e){return function(t){return e(t)}},Ft=w((function(e,t){var r=t&&!t.nodeType&&t,n=r&&e&&!e.nodeType&&e,i=n&&n.exports===r&&ue.process,o=function(){try{var e=n&&n.require&&n.require("util").types;return e||i&&i.binding&&i.binding("util")}catch(e){}}();e.exports=o})),St=Ft&&Ft.isTypedArray,_t=St?xt(St):zt;var Pt=function(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]},Yt=Object.prototype.hasOwnProperty;var Ut=function(e,t,r){var n=e[t];Yt.call(e,t)&&W(n,r)&&(void 0!==r||t in e)||tt(e,t,r)};var Rt=function(e,t,r,n){var i=!r;r||(r={});for(var o=-1,a=t.length;++o<a;){var u=t[o],s=n?n(r[u],e[u],u,r,e):void 0;void 0===s&&(s=e[u]),i?tt(r,u,s):Ut(r,u,s)}return r};var Qt=function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n},Gt=/^(?:0|[1-9]\d*)$/;var Vt=function(e,t){var r=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==r||"symbol"!=r&&Gt.test(e))&&e>-1&&e%1==0&&t>e},Bt=Object.prototype.hasOwnProperty;var Ht=function(e,t){var r=Lt(e),n=!r&&Dt(e),i=!r&&!n&&It(e),o=!r&&!n&&!i&&_t(e),a=r||n||i||o,u=a?Qt(e.length,String):[],s=u.length;for(var c in e)!t&&!Bt.call(e,c)||a&&("length"==c||i&&("offset"==c||"parent"==c)||o&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||Vt(c,s))||u.push(c);return u};var Zt=function(e){var t=[];if(null!=e)for(var r in Object(e))t.push(r);return t},Wt=Object.prototype.hasOwnProperty;var qt=function(e){if(!be(e))return Zt(e);var t=yt(e),r=[];for(var n in e)("constructor"!=n||!t&&Wt.call(e,n))&&r.push(n);return r};var Jt=function(e){return Et(e)?Ht(e,!0):qt(e)};var $t=function(e){return Rt(e,Jt(e))};var Xt=function(e,t,r,n,i,o,a){var u=Pt(e,r),s=Pt(t,r),c=a.get(s);if(c)rt(e,r,c);else{var l=o?o(u,s,r+"",e,t,a):void 0,d=void 0===l;if(d){var f=Lt(s),h=!f&&It(s),y=!f&&!h&&_t(s);l=s,f||h||y?Lt(u)?l=u:mt(u)?l=st(u):h?(d=!1,l=it(s,!0)):y?(d=!1,l=ut(s,!0)):l=[]:kt(s)||Dt(s)?(l=u,Dt(u)?l=$t(u):be(u)&&!Le(u)||(l=vt(s))):d=!1}d&&(a.set(s,l),i(l,s,n,o,a),a.delete(s)),rt(e,r,l)}};var Kt=function e(t,r,n,i,o){t!==r&&nt(r,(function(a,u){if(o||(o=new Ke),be(a))Xt(t,r,u,n,e,i,o);else{var s=i?i(Pt(t,u),a,u+"",t,r,o):void 0;void 0===s&&(s=a),rt(t,u,s)}}),Jt)};var er=function(e){return e};var tr=function(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)},rr=Math.max;var nr=function(e,t,r){return t=rr(void 0===t?e.length-1:t,0),function(){for(var n=arguments,i=-1,o=rr(n.length-t,0),a=Array(o);++i<o;)a[i]=n[t+i];i=-1;for(var u=Array(t+1);++i<t;)u[i]=n[i];return u[t]=r(a),tr(e,this,u)}};var ir=function(e){return function(){return e}},or=Date.now;var ar=function(e){var t=0,r=0;return function(){var n=or(),i=16-(n-r);if(r=n,i>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}(et?function(e,t){return et(e,"toString",{configurable:!0,enumerable:!1,value:ir(t),writable:!0})}:er);var ur=function(e,t){return ar(nr(e,t,er),e+"")};var sr=function(e,t,r){if(!be(r))return!1;var n=typeof t;return!!("number"==n?Et(r)&&Vt(t,r.length):"string"==n&&t in r)&&W(r[t],e)};var cr=function(e){return ur((function(t,r){var n=-1,i=r.length,o=i>1?r[i-1]:void 0,a=i>2?r[2]:void 0;for(o=e.length>3&&"function"==typeof o?(i--,o):void 0,a&&sr(r[0],r[1],a)&&(o=3>i?void 0:o,i=1),t=Object(t);++n<i;){var u=r[n];u&&e(t,u,n,o)}return t}))}((function(e,t,r){Kt(e,t,r)}));var lr=function(e,t){for(var r=-1,n=null==e?0:e.length;++r<n&&!1!==t(e[r],r,e););return e},dr=dt(Object.keys,Object),fr=Object.prototype.hasOwnProperty;var hr=function(e){if(!yt(e))return dr(e);var t=[];for(var r in Object(e))fr.call(e,r)&&"constructor"!=r&&t.push(r);return t};var yr=function(e){return Et(e)?Ht(e):hr(e)};var vr=function(e,t){return e&&Rt(t,yr(t),e)};var pr=function(e,t){return e&&Rt(t,Jt(t),e)};var Mr=function(e,t){for(var r=-1,n=null==e?0:e.length,i=0,o=[];++r<n;){var a=e[r];t(a,r,e)&&(o[i++]=a)}return o};var gr=function(){return[]},wr=Object.prototype.propertyIsEnumerable,br=Object.getOwnPropertySymbols,Dr=br?function(e){return null==e?[]:Mr(br(e=Object(e)),(function(t){return wr.call(e,t)}))}:gr;var Lr=function(e,t){return Rt(e,Dr(e),t)};var jr=function(e,t){for(var r=-1,n=t.length,i=e.length;++r<n;)e[i+r]=t[r];return e},Er=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)jr(t,Dr(e)),e=ft(e);return t}:gr;var mr=function(e,t){return Rt(e,Er(e),t)};var Nr=function(e,t,r){var n=t(e);return Lt(e)?n:jr(n,r(e))};var Ir=function(e){return Nr(e,yr,Dr)};var Ar=function(e){return Nr(e,Jt,Er)},Tr=Ce(ce,"DataView"),Or=Ce(ce,"Promise"),kr=Ce(ce,"Set"),Cr=Ce(ce,"WeakMap"),zr=Ie(Tr),xr=Ie(ze),Fr=Ie(Or),Sr=Ie(kr),_r=Ie(Cr),Pr=we;(Tr&&"[object DataView]"!=Pr(new Tr(new ArrayBuffer(1)))||ze&&"[object Map]"!=Pr(new ze)||Or&&"[object Promise]"!=Pr(Or.resolve())||kr&&"[object Set]"!=Pr(new kr)||Cr&&"[object WeakMap]"!=Pr(new Cr))&&(Pr=function(e){var t=we(e),r="[object Object]"==t?e.constructor:void 0,n=r?Ie(r):"";if(n)switch(n){case zr:return"[object DataView]";case xr:return"[object Map]";case Fr:return"[object Promise]";case Sr:return"[object Set]";case _r:return"[object WeakMap]"}return t});var Yr=Pr,Ur=Object.prototype.hasOwnProperty;var Rr=function(e){var t=e.length,r=new e.constructor(t);return t&&"string"==typeof e[0]&&Ur.call(e,"index")&&(r.index=e.index,r.input=e.input),r};var Qr=function(e,t){var r=t?at(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)},Gr=/\w*$/;var Vr=function(e){var t=new e.constructor(e.source,Gr.exec(e));return t.lastIndex=e.lastIndex,t},Br=le?le.prototype:void 0,Hr=Br?Br.valueOf:void 0;var Zr=function(e){return Hr?Object(Hr.call(e)):{}};var Wr=function(e,t,r){var n=e.constructor;switch(t){case"[object ArrayBuffer]":return at(e);case"[object Boolean]":case"[object Date]":return new n(+e);case"[object DataView]":return Qr(e,r);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return ut(e,r);case"[object Map]":return new n;case"[object Number]":case"[object String]":return new n(e);case"[object RegExp]":return Vr(e);case"[object Set]":return new n;case"[object Symbol]":return Zr(e)}};var qr=function(e){return pt(e)&&"[object Map]"==Yr(e)},Jr=Ft&&Ft.isMap,$r=Jr?xt(Jr):qr;var Xr=function(e){return pt(e)&&"[object Set]"==Yr(e)},Kr=Ft&&Ft.isSet,en=Kr?xt(Kr):Xr,tn={};tn["[object Arguments]"]=tn["[object Array]"]=tn["[object ArrayBuffer]"]=tn["[object DataView]"]=tn["[object Boolean]"]=tn["[object Date]"]=tn["[object Float32Array]"]=tn["[object Float64Array]"]=tn["[object Int8Array]"]=tn["[object Int16Array]"]=tn["[object Int32Array]"]=tn["[object Map]"]=tn["[object Number]"]=tn["[object Object]"]=tn["[object RegExp]"]=tn["[object Set]"]=tn["[object String]"]=tn["[object Symbol]"]=tn["[object Uint8Array]"]=tn["[object Uint8ClampedArray]"]=tn["[object Uint16Array]"]=tn["[object Uint32Array]"]=!0,tn["[object Error]"]=tn["[object Function]"]=tn["[object WeakMap]"]=!1;var rn=function e(t,r,n,i,o,a){var u,s=1&r,c=2&r,l=4&r;if(n&&(u=o?n(t,i,o,a):n(t)),void 0!==u)return u;if(!be(t))return t;var d=Lt(t);if(d){if(u=Rr(t),!s)return st(t,u)}else{var f=Yr(t),h="[object Function]"==f||"[object GeneratorFunction]"==f;if(It(t))return it(t,s);if("[object Object]"==f||"[object Arguments]"==f||h&&!o){if(u=c||h?{}:vt(t),!s)return c?mr(t,pr(u,t)):Lr(t,vr(u,t))}else{if(!tn[f])return o?t:{};u=Wr(t,f,s)}}a||(a=new Ke);var y=a.get(t);if(y)return y;a.set(t,u),en(t)?t.forEach((function(i){u.add(e(i,r,n,i,t,a))})):$r(t)&&t.forEach((function(i,o){u.set(o,e(i,r,n,o,t,a))}));var v=d?void 0:(l?c?Ar:Ir:c?Jt:yr)(t);return lr(v||t,(function(i,o){v&&(i=t[o=i]),Ut(u,o,e(i,r,n,o,t,a))})),u};var nn=function(e){return rn(e,5)},on=function(){function e(t){r(this,e),this.data=t||this.getDefaultData()}return i(e,[{key:"addFeature",value:function(e){this.data.features.push(e)}},{key:"getData",value:function(){return{type:"FeatureCollection",features:nn(this.data.features).map((function(e){var t,r;return e.properties={id:null==e||null===(t=e.properties)||void 0===t?void 0:t.id,type:null==e||null===(r=e.properties)||void 0===r?void 0:r.type},e}))}}},{key:"getFeature",value:function(e){return this.data.features.find((function(t){var r;return(null==t||null===(r=t.properties)||void 0===r?void 0:r.id)===e}))}},{key:"removeAllFeatures",value:function(){this.data=this.getDefaultData()}},{key:"removeFeature",value:function(e){var t=this.getFeatureIndex(e);void 0!==t&&this.data.features.splice(t,1)}},{key:"setFeatureActive",value:function(e){var t,r=this.getFeature(null==e||null===(t=e.properties)||void 0===t?void 0:t.id);r&&r.properties&&(r.properties.active=!0)}},{key:"setFeatureUnActive",value:function(e){var t,r=this.getFeature(null==e||null===(t=e.properties)||void 0===t?void 0:t.id);r&&r.properties&&(r.properties.active=!1)}},{key:"clearFeatureActive",value:function(){this.data.features.forEach((function(e){e&&e.properties&&(e.properties.active=!1)}))}},{key:"updateFeature",value:function(e){this.removeFeature(e),this.addFeature(e)}},{key:"destroy",value:function(){this.data=this.getDefaultData()}},{key:"getDefaultData",value:function(){return{type:"FeatureCollection",features:[]}}},{key:"getFeatureIndex",value:function(e){return this.data.features.findIndex((function(t){var r,n;return(null==t||null===(r=t.properties)||void 0===r?void 0:r.id)===(null==e||null===(n=e.properties)||void 0===n?void 0:n.id)}))}}]),e}(),an={active:{point:{type:"PointLayer",shape:"circle",color:"#fbb03b",size:5,style:{stroke:"#fff",strokeWidth:2}},line:{type:"LineLayer",shape:"line",color:"#fbb03b",size:1,style:{opacity:1,lineType:"dash",dashArray:[2,2]}},polygon:{shape:"fill",color:"#fbb03b",style:{opacity:.1,stroke:"#fbb03b",strokeWidth:1,strokeOpacity:1,lineType:"dash",dashArray:[2,2]}}},normal:{polygon:{type:"PolygonLayer",shape:"fill",color:"#3bb2d0",style:{opacity:.1,stroke:"#3bb2d0",strokeWidth:1,strokeOpacity:1,lineType:"solid",dashArray:[2,2]}},line:{type:"LineLayer",shape:"line",size:1,color:"#3bb2d0",style:{opacity:1}},point:{type:"PointLayer",shape:"circle",color:"#3bb2d0",size:3,style:{stroke:"#fff",strokeWidth:2}}},normal_point:{type:"PointLayer",shape:"circle",color:"#3bb2d0",size:3,style:{stroke:"#fff",strokeWidth:2}},mid_point:{point:{type:"PointLayer",shape:"circle",color:"#fbb03b",size:3,style:{}}}},un=0,sn=function(e){s(n,e);var t=h(n);function n(e){var i,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};r(this,n),(i=t.call(this)).isEnable=!1,i.options={style:an},i.drawStatus="Drawing";var a=o.data;return i.scene=e,i.source=new on(a),i.options=cr(i.options,i.getDefaultOptions(),o),i.title=i.getOption("title"),i}return i(n,[{key:"enable",value:function(){this.isEnable||(this.scene.setMapStatus({dragEnable:!1}),this.scene.on("dragstart",this.onDragStart),this.scene.on("dragging",this.onDragging),this.scene.on("dragend",this.onDragEnd),this.scene.on("click",this.onClick),this.setCursor(this.getOption("cursor")),this.isEnable=!0)}},{key:"disable",value:function(){this.isEnable&&(this.scene.off("dragstart",this.onDragStart),this.scene.off("dragging",this.onDragging),this.scene.off("dragend",this.onDragEnd),this.scene.off("click",this.onClick),this.resetCursor(),this.scene.setMapStatus({dragEnable:!0}),this.isEnable=!1)}},{key:"setCurrentFeature",value:function(e){this.currentFeature=e,this.source.setFeatureActive(e)}},{key:"setCurrentVertex",value:function(e){this.currentVertex=e}},{key:"deleteCurrentFeature",value:function(){throw Error("子类未实现该方法")}},{key:"getCurrentVertex",value:function(){return this.currentVertex}},{key:"getCurrentFeature",value:function(){return this.currentFeature}},{key:"getOption",value:function(e){return this.options[e]}},{key:"getStyle",value:function(e){return this.getOption("style")[e]}},{key:"getUniqId",value:function(){return un++}},{key:"setCursor",value:function(e){var t=this.scene.getMapCanvasContainer();t&&(t.style.cursor=e)}},{key:"resetCursor",value:function(){var e=this.scene.getMapCanvasContainer();e&&e.removeAttribute("style")}},{key:"destroy",value:function(){un=0,this.removeAllListeners(),this.disable()}},{key:"getDefaultOptions",value:function(){return{}}},{key:"onClick",value:function(e){return null}}]),n}(Z),cn=function(e){s(n,e);var t=h(n);function n(e){var i,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return r(this,n),(i=t.call(this,e,o)).onDragging=function(e){},i.onDragEnd=function(){throw Error("Method not implemented.")},i.onClick=function(){return null},i}return i(n,[{key:"enable",value:function(){this.emit(D.DELETE,"")}},{key:"disable",value:function(){return null}},{key:"getDefaultOptions",value:function(){return u(u({},y(c(n.prototype),"getDefaultOptions",this).call(this)),{},{title:"删除图形"})}},{key:"onDragStart",value:function(e){throw Error("Method not implemented.")}}]),n}(sn),ln=function(e){s(n,e);var t=h(n);function n(e){var i,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return r(this,n),(i=t.call(this,e,o)).onDragStart=function(e){},i.onDragging=function(e){i.endPoint=e.lngLat,i.emit(D.Edit,i.endPoint)},i.onDragEnd=function(){i.emit(D.UPDATE,i.currentFeature),i.resetCursor(),i.disable()},i.onClick=function(){return null},i}return i(n,[{key:"setEditFeature",value:function(e){this.currentFeature=e}},{key:"getDefaultOptions",value:function(){return{steps:64,units:"kilometres",cursor:"move"}}}]),n}(sn),dn=function(e){s(n,e);var t=h(n);function n(e){var i,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return r(this,n),(i=t.call(this,e,o)).onDragStart=function(e){i.scene.setMapStatus({dragEnable:!1}),i.dragStartPoint=e.lngLat},i.onDragging=function(e){i.emit(D.Move,{lng:e.lngLat.lng-i.dragStartPoint.lng,lat:e.lngLat.lat-i.dragStartPoint.lat}),i.dragStartPoint=e.lngLat},i.onDragEnd=function(){i.emit(D.UPDATE,i.currentFeature)},i.onClick=function(){return null},i}return i(n,[{key:"setSelectedFeature",value:function(e){this.currentFeature=e}},{key:"getDefaultOptions",value:function(){return{steps:64,units:"kilometers",cursor:"move"}}}]),n}(sn),fn=function(e){s(o,e);var n=h(o);function o(e){var t,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return r(this,o),(t=n.call(this,e,i)).onModeChange=function(e){var r,n,i,o;switch(e){case L.DIRECT_SELECT:if(!t.editEnable)return;t.editMode.enable(),t.editMode.setEditFeature(t.currentFeature),t.drawLayer.updateData(I([t.currentFeature])),t.drawVertexLayer.updateData(I(null===(r=t.currentFeature)||void 0===r||null===(n=r.properties)||void 0===n?void 0:n.pointFeatures)),t.drawVertexLayer.show(),t.drawVertexLayer.enableEdit(),t.showOtherLayer(),t.drawStatus="DrawEdit";break;case L.SIMPLE_SELECT:if(!t.selectEnable)return t.drawLayer.hide(),t.drawVertexLayer.hide(),t.hideOtherLayer(),void t.emit(D.MODE_CHANGE,L.STATIC);t.selectMode.setSelectedFeature(t.currentFeature),t.selectMode.enable(),t.drawLayer.updateData(I([t.currentFeature])),t.drawLayer.enableSelect(),t.drawVertexLayer.updateData(I(null===(i=t.currentFeature)||void 0===i||null===(o=i.properties)||void 0===o?void 0:o.pointFeatures)),t.drawVertexLayer.disableEdit(),t.drawVertexLayer.show(),t.drawLayer.show(),t.showOtherLayer(),t.drawStatus="DrawSelected";break;case L.STATIC:t.source.updateFeature(t.currentFeature),t.selectMode.disable(),t.editMode.disable(),t.source.clearFeatureActive(),t.drawVertexLayer.hide(),t.drawVertexLayer.disableEdit(),t.hideOtherLayer(),t.normalLayer.update(t.source.data),t.normalLayer.enableSelect(),t.drawStatus="DrawFinish"}},t.onDrawCreate=function(e){t.source.addFeature(e)},t.onDrawUpdate=function(e){t.source.updateFeature(t.currentFeature),t.emit(D.UPDATE,t.currentFeature)},t.onDrawMove=function(e){"DrawSelected"===t.drawStatus&&t.moveFeature(e)},t.onDrawEdit=function(e){t.editFeature(e)},t.onDrawDelete=function(){"DrawSelected"===t.drawStatus&&(t.clear(),t.source.removeFeature(t.currentFeature),t.normalLayer.update(t.source.data),t.drawLayer.disableSelect(),t.selectMode.disable(),t.currentFeature=null)},t.addKeyDownEvent=function(e){var r=e||window.event;r&&8===r.keyCode&&t.deleteMode.enable()},t.drawLayer=new V(d(t)),t.drawVertexLayer=new H(d(t)),t.normalLayer=new B(d(t)),t.selectEnable=t.getOption("selectEnable"),t.editEnable=t.getOption("editEnable"),t.selectMode=new dn(t.scene,{}),t.editMode=new ln(t.scene,{}),t.deleteMode=new cn(t.scene,{}),t.selectMode.on(D.UPDATE,t.onDrawUpdate),t.selectMode.on(D.Move,t.onDrawMove),t.editMode.on(D.MODE_CHANGE,t.onModeChange),t.editMode.on(D.UPDATE,t.onDrawUpdate),t.editMode.on(D.Edit,t.onDrawEdit),t.selectMode.on(D.MODE_CHANGE,t.onModeChange),t.deleteMode.on(D.DELETE,t.onDrawDelete),t.on(D.CREATE,t.onDrawCreate),t.on(D.MODE_CHANGE,t.onModeChange),document.addEventListener("keydown",t.addKeyDownEvent),t.options.data&&t.initData()&&(t.normalLayer.update(t.source.data),t.normalLayer.enableSelect()),t}return i(o,[{key:"setCurrentFeature",value:function(e){this.currentFeature=e,this.pointFeatures=e.properties.pointFeatures,this.source.setFeatureActive(e)}},{key:"deleteCurrentFeature",value:function(){this.deleteMode.enable()}},{key:"disableLayer",value:function(){this.drawLayer.disableSelect()}},{key:"enableLayer",value:function(){this.drawLayer.enableSelect()}},{key:"getData",value:function(){return this.source.getData()}},{key:"removeAllData",value:function(){this.source.removeAllFeatures(),this.currentFeature=null,this.drawLayer.hide(),this.drawVertexLayer.hide(),this.normalLayer.hide(),this.hideOtherLayer()}},{key:"clear",value:function(){this.drawLayer.disableSelect(),this.drawLayer.disableEdit(),this.drawLayer.hide(),this.drawVertexLayer.hide(),this.hideOtherLayer(),this.emit(D.MODE_CHANGE,L.STATIC)}},{key:"reset",value:function(){this.drawLayer.show(),this.drawVertexLayer.show(),this.showOtherLayer()}},{key:"addVertex",value:function(e){throw Error("子类未实现该方法")}},{key:"onRemove",value:function(){this.destroy(),this.selectMode.destroy(),this.editMode.destroy(),this.source.destroy(),this.drawLayer.destroy(),this.drawVertexLayer.destroy(),this.normalLayer.destroy(),document.removeEventListener("keydown",this.addKeyDownEvent)}},{key:"getDefaultOptions",value:function(){return{steps:64,units:"kilometers",cursor:"crosshair",editEnable:!0,selectEnable:!0}}},{key:"initData",value:function(){return!1}},{key:"addDrawPopup",value:function(e,r){var n=new t.Popup({anchor:"left",closeButton:!1}).setLnglat(e).setText("半径:".concat(r.toFixed(2),"千米"));this.scene.addPopup(n),this.popup=n}}]),o}(sn),hn=function(e){s(o,e);var n=h(o);function o(e){var t,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return r(this,o),(t=n.call(this,e,i)).onDragStart=function(e){"Drawing"!==t.drawStatus&&t.drawLayer.emit("unclick",null),t.startPoint=e.lngLat,t.setCursor("grabbing"),t.initCenterLayer(),t.centerLayer.setData([t.startPoint])},t.onDragging=function(e){t.endPoint=e.lngLat;var r=t.createFeature(),n=r.properties;t.drawLayer.update(I([r])),t.drawVertexLayer.update(I(n.pointFeatures))},t.onDragEnd=function(){var e=t.createFeature("".concat(t.getUniqId())),r=e.properties;t.drawLayer.update(I([e])),t.drawVertexLayer.update(I(r.pointFeatures)),t.emit(D.CREATE,t.currentFeature),t.emit(D.MODE_CHANGE,L.SIMPLE_SELECT),t.disable()},t.type="circle",t}return i(o,[{key:"drawFinish",value:function(){return null}},{key:"setCurrentFeature",value:function(e){this.currentFeature=e,this.pointFeatures=e.properties.pointFeatures,this.startPoint=e.properties.startPoint,this.endPoint=e.properties.endPoint,this.source.setFeatureActive(e)}},{key:"getDefaultOptions",value:function(){return u(u({},y(c(o.prototype),"getDefaultOptions",this).call(this)),{},{title:"绘制圆"})}},{key:"moveFeature",value:function(e){var t=P([this.currentFeature],e);this.drawLayer.updateData(I(t));var r=P(this.pointFeatures,e);this.drawVertexLayer.updateData(I(r));var n=Y([this.startPoint.lng,this.startPoint.lat],e);this.startPoint={lat:n[1],lng:n[0]};var i=Y([this.endPoint.lng,this.endPoint.lat],e),o={lat:i[1],lng:i[0]};t[0].properties=u(u({},t[0].properties),{},{startPoint:this.startPoint,endPoint:o,pointFeatures:r}),this.centerLayer.setData([this.startPoint]),this.setCurrentFeature(t[0]);var a=u({},t[0]);this.emit(D.CHANGE,a)}},{key:"createFeature",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"0",t=_([this.endPoint]),r=z([this.startPoint.lng,this.startPoint.lat],[this.endPoint.lng,this.endPoint.lat],{pointFeatures:t.features,units:this.getOption("units"),steps:this.getOption("steps"),id:e});return this.setCurrentFeature(r),r}},{key:"editFeature",value:function(e){this.endPoint=e;var t=this.createFeature(),r=t.properties;this.drawLayer.updateData(I([t])),this.drawVertexLayer.updateData(I(r.pointFeatures)),this.emit(D.CHANGE,I([t]).features[0])}},{key:"showOtherLayer",value:function(){var e,t;this.centerLayer.setData([null===(e=this.currentFeature)||void 0===e||null===(t=e.properties)||void 0===t?void 0:t.startPoint]),this.centerLayer.show()}},{key:"hideOtherLayer",value:function(){this.currentFeature&&this.centerLayer.hide()}},{key:"initCenterLayer",value:function(){var e=this.getStyle("active").point,r=(new t.PointLayer).source([this.startPoint],{parser:{type:"json",x:"lng",y:"lat"}}).shape("circle").color(e.color).size(e.size).style(e.style);this.scene.addLayer(r),this.centerLayer=r}}]),o}(fn);function yn(e){if(null==e)throw Error("degrees is required");return e%360*Math.PI/180}function vn(e){if(!e)throw Error("coord is required");if("Feature"===e.type&&null!==e.geometry&&"Point"===e.geometry.type)return e.geometry.coordinates;if("Point"===e.type)return e.coordinates;if(Array.isArray(e)&&e.length>=2&&void 0===e[0].length&&void 0===e[1].length)return e;throw Error("coord must be GeoJSON Point or an Array of numbers")}function pn(e,t,r){if(!(n=r=r||{})||n.constructor!==Object)throw Error("options is invalid");var n;if(!0===r.final)return function(e,t){var r=pn(t,e);return r=(r+180)%360}(e,t);var i=vn(e),o=vn(t),a=yn(i[0]),u=yn(o[0]),s=yn(i[1]),c=yn(o[1]);return function(e){if(null==e)throw Error("radians is required");return 180*(e%(2*Math.PI))/Math.PI}(Math.atan2(Math.sin(u-a)*Math.cos(c),Math.cos(s)*Math.sin(c)-Math.sin(s)*Math.cos(c)*Math.cos(u-a)))}var Mn={meters:6371008.8,metres:6371008.8,millimeters:6371008800,millimetres:6371008800,centimeters:637100880,centimetres:637100880,kilometers:6371.0088,kilometres:6371.0088,miles:3958.761333810546,nauticalmiles:6371008.8/1852,inches:6371008.8*39.37,yards:6371008.8/1.0936,feet:20902260.511392,radians:1,degrees:6371008.8/111325};function gn(e,t,r){if(!Ln(r=r||{}))throw Error("options is invalid");var n=r.bbox,i=r.id;if(void 0===e)throw Error("geometry is required");if(t&&t.constructor!==Object)throw Error("properties must be an Object");n&&function(e){if(!e)throw Error("bbox is required");if(!Array.isArray(e))throw Error("bbox must be an Array");if(4!==e.length&&6!==e.length)throw Error("bbox must be an Array of 4 or 6 numbers");e.forEach((function(e){if(!Dn(e))throw Error("bbox must only contain numbers")}))}(n),i&&function(e){if(!e)throw Error("id is required");if(-1===["string","number"].indexOf(typeof e))throw Error("id must be a number or a string")}(i);var o={type:"Feature"};return i&&(o.id=i),n&&(o.bbox=n),o.properties=t||{},o.geometry=e,o}function wn(e){if(null==e)throw Error("radians is required");return 180*(e%(2*Math.PI))/Math.PI}function bn(e){if(null==e)throw Error("degrees is required");return e%360*Math.PI/180}function Dn(e){return!isNaN(e)&&null!==e&&!Array.isArray(e)}function Ln(e){return!!e&&e.constructor===Object}function jn(e){if(!e)throw Error("coord is required");if("Feature"===e.type&&null!==e.geometry&&"Point"===e.geometry.type)return e.geometry.coordinates;if("Point"===e.type)return e.coordinates;if(Array.isArray(e)&&e.length>=2&&void 0===e[0].length&&void 0===e[1].length)return e;throw Error("coord must be GeoJSON Point or an Array of numbers")}function En(e,t,r,n){if(!Ln(n=n||{}))throw Error("options is invalid");var i=n.units,o=n.properties,a=jn(e),u=bn(a[0]),s=bn(a[1]),c=bn(r),l=function(e,t){if(null==e)throw Error("distance is required");if(t&&"string"!=typeof t)throw Error("units must be a string");var r=Mn[t||"kilometers"];if(!r)throw Error(t+" units is invalid");return e/r}(t,i),d=Math.asin(Math.sin(s)*Math.cos(l)+Math.cos(s)*Math.sin(l)*Math.cos(c));return function(e,t,r){if(!e)throw Error("coordinates is required");if(!Array.isArray(e))throw Error("coordinates must be an Array");if(2>e.length)throw Error("coordinates must be at least 2 numbers long");if(!Dn(e[0])||!Dn(e[1]))throw Error("coordinates must contain numbers");return gn({type:"Point",coordinates:e},t,r)}([wn(u+Math.atan2(Math.sin(c)*Math.sin(l)*Math.cos(s),Math.cos(l)-Math.sin(s)*Math.sin(d))),wn(d)],o)}function mn(e,t,r){if(!Ln(r=r||{}))throw Error("options is invalid");var n=r.units,i=jn(e),o=jn(t),a=bn(o[1]-i[1]),u=bn(o[0]-i[0]),s=bn(i[1]),c=bn(o[1]),l=Math.pow(Math.sin(a/2),2)+Math.pow(Math.sin(u/2),2)*Math.cos(s)*Math.cos(c);return function(e,t){if(null==e)throw Error("radians is required");if(t&&"string"!=typeof t)throw Error("units must be a string");var r=Mn[t||"kilometers"];if(!r)throw Error(t+" units is invalid");return e*r}(2*Math.atan2(Math.sqrt(l),Math.sqrt(1-l)),n)}var Nn=function(e){s(n,e);var t=h(n);function n(){var e;return r(this,n),(e=t.apply(this,arguments)).onMouseEnter=function(t){e.draw.setCursor("pointer")},e.onMouseOut=function(t){e.draw.resetCursor()},e.onClick=function(t){e.draw.addVertex(t.feature)},e}return i(n,[{key:"update",value:function(e){this.removeLayers();var t=this.calcMidPointData(e),r=this.draw.getStyle("mid_point");this.drawLayers=Q(t,r),this.addLayers(),this.enableEdit()}},{key:"updateData",value:function(e){var t=this.calcMidPointData(e);this.drawLayers.forEach((function(e){return e.setData(t)}))}},{key:"enableEdit",value:function(){var e=this.drawLayers[0];e.on("mouseenter",this.onMouseEnter),e.on("mouseout",this.onMouseOut),e.on("click",this.onClick)}},{key:"disableEdit",value:function(){var e=this.drawLayers[0];e.off("mouseenter",this.onMouseEnter),e.off("mouseout",this.onMouseOut),e.off("click",this.onClick)}},{key:"calcMidPointData",value:function(e){var t=this,r=[];return e.features.forEach((function(n,i){if("line"!==t.draw.type||i!==e.features.length-1){var o,a,u=En(o=n,mn(o,a=i!==e.features.length-1?e.features[i+1]:e.features[0])/2,pn(o,a));u.properties.id=i,r.push(u)}})),I(r)}}]),n}(G),In=function(e){s(n,e);var t=h(n);function n(e){var i,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return r(this,n),(i=t.call(this,e,o)).points=[],i.onDragStart=function(e){return null},i.onDragging=function(e){return null},i.onDragEnd=function(){return null},i.onClick=function(e){"Drawing"!==i.drawStatus&&i.drawLayer.emit("unclick",null);var t=e.lngLat||e.lnglat;i.endPoint=t,i.points.push(t);var r=i.createFeature(i.points),n=_([i.points[0],i.endPoint]);i.drawLayer.update(I([r])),i.drawVertexLayer.update(I(n.features)),i.onDraw()},i.onMouseMove=function(e){var t=e.lngLat||e.lnglat;if(0!==i.points.length){var r=i.points.slice();r.push(t);var n=i.createFeature(r);i.drawLayer.update(I([n]))}},i.onDblClick=function(e){2>i.points.length||(i.points.push(e.lngLat||e.lnglat),i.drawFinish())},i.onDraw=function(){i.drawVertexLayer.on("mousemove",(function(e){i.setCursor("pointer")})),i.drawVertexLayer.on("mouseout",(function(){i.setCursor("crosshair")})),i.drawVertexLayer.on("click",(function(){i.resetCursor(),i.drawFinish()}))},i.type="polygon",i.drawMidVertexLayer=new Nn(d(i)),i.on(D.MODE_CHANGE,i.addMidLayerEvent),i}return i(n,[{key:"enable",value:function(){y(c(n.prototype),"enable",this).call(this),this.scene.on("mousemove",this.onMouseMove),this.scene.on("dblclick",this.onDblClick)}},{key:"disable",value:function(){y(c(n.prototype),"disable",this).call(this),this.scene.off("mousemove",this.onMouseMove),this.scene.off("dblclick",this.onDblClick)}},{key:"drawFinish",value:function(){this.points=this.points.reverse();var e=this.createFeature(this.points),t=e.properties;this.drawLayer.update(I([e])),this.drawVertexLayer.update(I(t.pointFeatures)),this.emit(D.CREATE,this.currentFeature),this.emit(D.MODE_CHANGE,L.SIMPLE_SELECT),this.points=[],this.disable()}},{key:"addVertex",value:function(e){var t,r,n=e.properties.id,i=null==e||null===(t=e.geometry)||void 0===t?void 0:t.coordinates,o=this.currentFeature,a=[];if("Polygon"===(null==o||null===(r=o.geometry)||void 0===r?void 0:r.type)){var u,s=null==o||null===(u=o.geometry)||void 0===u?void 0:u.coordinates;s[0].splice(n+1,0,i);for(var c=0;s[0].length-1>c;c++)a.push({lng:s[0][c][0],lat:s[0][c][1]})}else{var l,d=null==o||null===(l=o.geometry)||void 0===l?void 0:l.coordinates;d.splice(n+1,0,i);var f,h=p(d);try{for(h.s();!(f=h.n()).done;){var y=f.value;a.push({lng:y[0],lat:y[1]})}}catch(e){h.e(e)}finally{h.f()}}var v=_(a);this.pointFeatures=v.features,this.drawLayer.updateData(I([o])),this.drawVertexLayer.updateData(v),this.drawMidVertexLayer.updateData(I(this.pointFeatures)),o.properties.pointFeatures=v.features,this.setCurrentFeature(o)}},{key:"getDefaultOptions",value:function(){return u(u({},y(c(n.prototype),"getDefaultOptions",this).call(this)),{},{title:"绘制多边形"})}},{key:"moveFeature",value:function(e){var t=P([this.currentFeature],e),r=P(this.pointFeatures,e);this.drawLayer.updateData(I(t)),this.drawVertexLayer.updateData(I(r)),t[0].properties=u(u({},t[0].properties),{},{pointFeatures:r}),this.setCurrentFeature(t[0])}},{key:"createFeature",value:function(e,t){var r=2>=arguments.length||void 0===arguments[2]||arguments[2],n=_(e);this.pointFeatures=n.features;var i=F(e,{id:t||this.getUniqId(),type:"polygon",active:r,pointFeatures:this.pointFeatures});return this.setCurrentFeature(i),i}},{key:"editFeature",value:function(e){var t=this.currentVertex;if(null!==t){var r,n=1*t.properties.id;t.geometry.coordinates=[e.lng,e.lat],this.pointFeatures[n].geometry.coordinates=[e.lng,e.lat],this.drawVertexLayer.updateData(I(this.pointFeatures)),this.drawMidVertexLayer.updateData(I(this.pointFeatures)),this.editPolygonVertex(n,e),this.drawLayer.updateData(I([this.currentFeature]));var i=this.currentFeature;i.properties=u(u({},null===(r=this.currentFeature)||void 0===r?void 0:r.properties),{},{pointFeatures:this.pointFeatures}),this.setCurrentFeature(i)}}},{key:"showOtherLayer",value:function(){return null}},{key:"hideOtherLayer",value:function(){return null}},{key:"addMidLayerEvent",value:function(e){switch(e){case L.DIRECT_SELECT:this.drawMidVertexLayer.update(I(this.pointFeatures)),this.drawMidVertexLayer.show();break;case L.STATIC:this.drawMidVertexLayer.hide()}}},{key:"initData",value:function(){var e=this,t=[];return this.source.data.features.forEach((function(r){if("Polygon"===r.geometry.type){var n,i=r.geometry.coordinates[0].map((function(e){return{lng:e[0],lat:e[1]}}));t.push(e.createFeature(i.slice(1),null==r||null===(n=r.properties)||void 0===n?void 0:n.id,!1))}})),this.source.data.features=t,!0}},{key:"editPolygonVertex",value:function(e,t){var r,n=this.currentFeature;if("Polygon"===(null==n||null===(r=n.geometry)||void 0===r?void 0:r.type)){var i,o=null==n||null===(i=n.geometry)||void 0===i?void 0:i.coordinates;o[0][e]=[t.lng,t.lat],0==-e&&(o[0][o[0].length-1]=[t.lng,t.lat])}else{var a;(null==n||null===(a=n.geometry)||void 0===a?void 0:a.coordinates)[e]=[t.lng,t.lat]}this.setCurrentFeature(n),this.drawLayer.updateData(I([this.currentFeature]))}}]),n}(fn),An=function(e){s(n,e);var t=h(n);function n(e){var i,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return r(this,n),(i=t.call(this,e,o)).type="line",i}return i(n,[{key:"getDefaultOptions",value:function(){return u(u({},y(c(n.prototype),"getDefaultOptions",this).call(this)),{},{title:"绘制线"})}},{key:"moveFeature",value:function(e){var t=P([this.currentFeature],e),r=P(this.pointFeatures,e);return this.drawLayer.updateData(I(t)),this.drawVertexLayer.updateData(I(r)),this.currentFeature=t[0],this.pointFeatures=r,this.currentFeature}},{key:"createFeature",value:function(e,t){var r=2>=arguments.length||void 0===arguments[2]||arguments[2],n=_(e);this.pointFeatures=n.features;var i=S(e,{id:t||this.getUniqId(),type:"line",active:r,pointFeatures:this.pointFeatures});return this.setCurrentFeature(i),i}},{key:"initData",value:function(){var e=this,t=[];return this.source.data.features.forEach((function(r){if("LineString"===r.geometry.type){var n,i=r.geometry.coordinates.map((function(e){return{lng:e[0],lat:e[1]}}));t.push(e.createFeature(i,null==r||null===(n=r.properties)||void 0===n?void 0:n.id,!1))}})),this.source.data.features=t,!0}}]),n}(In),Tn=function(e){s(n,e);var t=h(n);function n(e){var i,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return r(this,n),(i=t.call(this,e,o)).onDragStart=function(e){return null},i.onDragging=function(e){return null},i.onDragEnd=function(){return null},i.onClick=function(e){"Drawing"!==i.drawStatus&&i.drawLayer.emit("unclick",null);var t=i.createFeature(e.lngLat||e.lnglat);i.drawLayer.update(I([t])),i.drawVertexLayer.update(I([t])),i.drawFinish()},i.type="point",i}return i(n,[{key:"drawFinish",value:function(){this.emit(D.CREATE,this.currentFeature),this.emit(D.MODE_CHANGE,L.SIMPLE_SELECT),this.disable()}},{key:"getDefaultOptions",value:function(){return u(u({},y(c(n.prototype),"getDefaultOptions",this).call(this)),{},{title:"绘制点"})}},{key:"moveFeature",value:function(e){var t=P([this.currentFeature],e);return this.drawLayer.updateData(I(t)),this.drawVertexLayer.updateData(I(t)),this.currentFeature=t[0],this.pointFeatures=t,this.currentFeature.properties=u(u({},this.currentFeature.properties),{},{pointFeatures:t}),this.currentFeature}},{key:"createFeature",value:function(e,t){var r=2>=arguments.length||void 0===arguments[2]||arguments[2],n=E([e.lng,e.lat],{id:t||this.getUniqId(),type:"point",active:r,pointFeatures:[E([e.lng,e.lat])]});return this.setCurrentFeature(n),n}},{key:"initData",value:function(){var e=this,t=[];return this.source.data.features.forEach((function(r){var n;"Point"===r.geometry.type&&t.push(e.createFeature({lng:r.geometry.coordinates[0],lat:r.geometry.coordinates[1]},null==r||null===(n=r.properties)||void 0===n?void 0:n.id,!1))})),this.source.data.features=t,!0}},{key:"editFeature",value:function(e){this.createFeature(e)}},{key:"showOtherLayer",value:function(){return null}},{key:"hideOtherLayer",value:function(){return null}}]),n}(fn),On=function(e){s(n,e);var t=h(n);function n(e){var i,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return r(this,n),(i=t.call(this,e,o)).type="rect",i}return i(n,[{key:"drawFinish",value:function(){return null}},{key:"getDefaultOptions",value:function(){return u(u({},y(c(n.prototype),"getDefaultOptions",this).call(this)),{},{title:"绘制矩形"})}},{key:"createFeature",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"0",t=_([this.endPoint]),r=x([this.startPoint.lng,this.startPoint.lat],[this.endPoint.lng,this.endPoint.lat],{id:e,pointFeatures:t.features});return this.setCurrentFeature(r),r}}]),n}(hn);!function(e,t){void 0===t&&(t={});var r=t.insertAt;if(e&&"undefined"!=typeof document){var n=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style");i.type="text/css","top"===r&&n.firstChild?n.insertBefore(i,n.firstChild):n.appendChild(i),i.styleSheet?i.styleSheet.cssText=e:i.appendChild(document.createTextNode(e))}}('.l7-control-draw{border-radius:4px;background:#fff;box-shadow:0 0 0 1px rgba(0,0,0,.1);display:flex}.l7-control-draw button{background-repeat:no-repeat;background-position:50%;background-size:20px 20px;background-color:#fff;width:30px;height:30px;display:block;padding:0;outline:none;border:0;margin:1px;box-sizing:border-box;cursor:pointer}.l7-control-draw button:not(:disabled):hover{background-color:rgba(0,0,0,.05)}.l7-control-draw button:focus{box-shadow:0 0 2px 2px #0096ff}.l7-control-draw .draw-point{background-image:url("data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiIgdmlld0JveD0iMCAwIDExOTQgMTAyNCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB3aWR0aD0iMTQ5LjI1IiBoZWlnaHQ9IjEyOCI+PGRlZnM+PHN0eWxlLz48L2RlZnM+PHBhdGggZD0iTTYwOS41MzYgNzA3LjA3MmExOTUuMDcyIDE5NS4wNzIgMCAxMTAtMzkwLjE0NCAxOTUuMDcyIDE5NS4wNzIgMCAwMTAgMzkwLjE0NHpNMTA0OC40MDUgNDE0LjQ2NGExNDYuMjYxIDE0Ni4yNjEgMCAxMTAtMjkyLjUyMyAxNDYuMjYxIDE0Ni4yNjEgMCAwMTAgMjkyLjUyM3ptLTg3Ny43MzggNTg1LjEzYTE0Ni4yNjEgMTQ2LjI2MSAwIDExMC0yOTIuNTIyIDE0Ni4yNjEgMTQ2LjI2MSAwIDAxMCAyOTIuNTIzem0wLTY4Mi42NjZhMTQ2LjI2MSAxNDYuMjYxIDAgMTEwLTI5Mi41MjMgMTQ2LjI2MSAxNDYuMjYxIDAgMDEwIDI5Mi41MjN6IiBmaWxsPSIjMmMyYzJjIi8+PC9zdmc+")}.l7-control-draw .draw-line{background-image:url("data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiIgdmlld0JveD0iMCAwIDEwMjQgMTAyNCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB3aWR0aD0iMTI4IiBoZWlnaHQ9IjEyOCI+PGRlZnM+PHN0eWxlLz48L2RlZnM+PHBhdGggZD0iTTkwMC45MyAzMDAuMjk4Yy00MS4wNjcgMC03NC40NyAzMy40MjktNzQuNDcgNzQuNDkxIDAgMTAgMS45OTIgMTkuNTMzIDUuNTgxIDI4LjI1N2wtMjIwLjI2MiAyMDUuMThhNzMuOTkgNzMuOTkgMCAwMC00MS4yMzItMTIuNTA0IDc0LjE3IDc0LjE3IDAgMDAtMjIuNDUxIDMuNDUxbC03MC4xMTMtMTM5LjYzOGE3NC4xMzggNzQuMTM4IDAgMDA4LjE0Ni0zMy45MmMwLTQxLjA2Mi0zMy4zODMtNzQuNDktNzQuNDQ1LTc0LjQ5cy03NC40NDUgMzMuNDI4LTc0LjQ0NSA3NC40OWMwIDMuODI1LjI5MiA3LjYwNC44NTUgMTEuMzE2TDE2MC44NiA2MjcuMjJhNzMuODg3IDczLjg4NyAwIDAwLTM5Ljc5OC0xMS41OTdjLTQxLjA2MiAwLTc0LjQ3IDMzLjQyMy03NC40NyA3NC40OSAwIDQxLjA4MyAzMy40MDggNzQuNTE3IDc0LjQ3IDc0LjUxNyA0MS4wNDIgMCA3NC40Mi0zMy40MjggNzQuNDItNzQuNTE2YTc0LjIzIDc0LjIzIDAgMDAtMy4yOTMtMjEuODk5bDE3MS40MzMtMTg1LjcxMmE3NC40NTUgNzQuNDU1IDAgMDA3Ni4zMzQgMTIuMDc4bDY3LjM5IDEzNi4xOTJhNzQuMTY4IDc0LjE2OCAwIDAwLTExLjIzOCAzOS40NWMwIDQxLjA4MiAzMy4zODIgNzQuNTE2IDc0LjQ0NCA3NC41MTYgNDEuMDY4IDAgNzQuNDQ1LTMzLjQyOSA3NC40NDUtNzQuNTE3YTc0LjM0MiA3NC4zNDIgMCAwMC0yLjcyNC0xOS45MTZsMjI0LjY3MS0yMDkuMjY1YTczLjk2NCA3My45NjQgMCAwMDMzLjk5MiA4LjI0OGM0MS4wNDIgMCA3NC40MTktMzMuNDI4IDc0LjQxOS03NC40OS0uMDEtNDEuMDY4LTMzLjM4OC03NC41MDItNzQuNDI0LTc0LjUwMnpNMTIxLjA2OSA3MTMuMDQyYTIyLjkxNyAyMi45MTcgMCAwMTAtNDUuODMgMjIuOTMyIDIyLjkzMiAwIDAxMjIuODc2IDIyLjkwM2MtLjAwNSAxMi42NDYtMTAuMjg2IDIyLjkyNy0yMi44NzYgMjIuOTI3em0yNzYuMzEtMjY5LjUzN2EyMi44NiAyMi44NiAwIDAxLTguNTktMTcuODkgMjIuOTM4IDIyLjkzOCAwIDAxMjIuOTAxLTIyLjkwMSAyMi45MTIgMjIuOTEyIDAgMDEyMi44NzYgMjIuOTAxYzAgNi4wNDctMi4zMiAxMS43MjUtNi41MDcgMTYuMDFsLS4yLjE4NWMtOS4wNjggOS4wNTItMjUuMDQyIDYuMDc3LTMwLjQ4IDEuNjk1ek01NzAuNTUzIDY5My4xNGEyMi45MjIgMjIuOTIyIDAgMDEtMjIuODc2LTIyLjkyNyAyMi43MzMgMjIuNzMzIDAgMDE4LjI4LTE3LjYyM2MuMzM3LS4yNC42ODUtLjQ4MSAxLjAxMy0uNzQyLjItLjE1OS4zOS0uMzIzLjU4NC0uNDkyYTIyLjY0IDIyLjY0IDAgMDExMi45OTQtNC4wNDUgMjIuOTI3IDIyLjkyNyAwIDAxMjIuODgxIDIyLjkwMiAyMi45MzggMjIuOTM4IDAgMDEtMjIuODc2IDIyLjkyN3ptMzMwLjM3OS0yOTUuNDVjLTEyLjY1MiAwLTIyLjkwMi0xMC4yOC0yMi45MDItMjIuOXMxMC4yNS0yMi45MDMgMjIuOTAyLTIyLjkwM2EyMi45MjcgMjIuOTI3IDAgMDEyMi44NyAyMi45MDIgMjIuOTI3IDIyLjkyNyAwIDAxLTIyLjg3IDIyLjkwMnoiLz48L3N2Zz4=")}.l7-control-draw .draw-polygon{background-image:url("data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiIgdmlld0JveD0iMCAwIDEwMjQgMTAyNCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB3aWR0aD0iMTI4IiBoZWlnaHQ9IjEyOCI+PGRlZnM+PHN0eWxlLz48L2RlZnM+PHBhdGggZD0iTTQyMS4xNDkgOTkwLjQwNGwtMTQzLjMxOC0xMzcuMTUtNDMuNjc5LTQxLjc2NEwzMS44NDkgNjE3Ljg1M2wyMzQuMDc0LTQ4NS40ODggMTI1LjE0MSAxNy4wMjYgMTAzLjYxNCAxNC4wNDEtOC4wNTcgNTkuNDU2LTEwMy42My0xNC4wNDMtODEuOTYtMTEuMTUxLTk4LjEwMyAyMDMuNDMyLTk4LjEwNSAyMDMuNTE5IDE3MC44MDYgMTYzLjQ5IDQzLjY4MSA0MS43NjYgMzYuMTU3IDM0LjYxNiA3NS42OTggNzIuNCAzNi41MjktMTkuNjIxIDU1LjcxOC0yOS45NzEgNTEuNzA3LTI3LjczNiA1MS44MzQtMjcuOTY3IDE3LjExLTkuMTE0IDE3LjE4OC05LjMgMzQuNDc2LTE4LjQ4IDE3LjIzOS05LjMgMzQuNTQyLTE4LjUwNSAxNy4zMTUtOS4zODcgMTcuMjU2LTkuMjAxIDQ2Ljk4LTI1LjI5My00Ljk5NS0yNy4zNzUtOC44MzYtNDguOTY2LTE1LjM0MS04NC44OTEgNTkuMDQ0LTEwLjY3IDE1LjM0MiA4NC44OTggOC44MjcgNDguOTE4IDEyLjgzMSA3MC4zMjgtMzMuNzE3IDE4LjA0OS01MS44MjcgMjcuOTA0LTE3LjIzNiA5LjE5LTE3LjI3MiA5LjM2NS0zNC40OTMgMTguNDc4LTM0LjUzMSAxOC41NzYtMTcuMjEzIDkuMjItMTcuMjkyIDkuMzU2LTE3LjA5NyA5LjEwNi0xNy4yMTggOS4zMzV6IiBmaWxsPSIjM0UzQTM5Ii8+PHBhdGggZD0iTTc1Mi41MjQgNTUuNDM0aDYwdjM3MC4zMjNoLTYweiIgZmlsbD0iIzNFM0EzOSIvPjxwYXRoIGQ9Ik01OTcuMzg1IDIwNS42OTdoMzcwLjI3OXY2MEg1OTcuMzg1eiIgZmlsbD0iIzNFM0EzOSIvPjwvc3ZnPg==")}.l7-control-draw .draw-rect{background-image:url("data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiIgdmlld0JveD0iMCAwIDEwMjQgMTAyNCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB3aWR0aD0iMTI4IiBoZWlnaHQ9IjEyOCI+PGRlZnM+PHN0eWxlLz48L2RlZnM+PHBhdGggZD0iTTc2NS4yMzQgNjkuNDE3aDYwdjM3MC42MDVoLTYweiIgZmlsbD0iIzNFM0EzOSIvPjxwYXRoIGQ9Ik02MTQuMTkzIDIxOS44MDdoMzYyLjEyOHY2MEg2MTQuMTkzek04MjUuMjM0IDk3NS45MzZIODkuODE5VjIyNC43MDdoMzY3LjcwOHY2MEgxNDkuODE5djYzMS4yMjloNjE1LjQxNVY2MDAuMjk5aDYweiIgZmlsbD0iIzNFM0EzOSIvPjwvc3ZnPg==")}.l7-control-draw .draw-circle{background-image:url("data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiIgdmlld0JveD0iMCAwIDEwMjQgMTAyNCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB3aWR0aD0iMTI4IiBoZWlnaHQ9IjEyOCI+PGRlZnM+PHN0eWxlLz48L2RlZnM+PHBhdGggZD0iTTUxMiA4ODEuMDY3QTM2OS4wNjcgMzY5LjA2NyAwIDExODgxLjA2NyA1MTIgMzY5LjQ5MyAzNjkuNDkzIDAgMDE1MTIgODgxLjA2N3ptMC02ODIuNjY3QTMxMy42IDMxMy42IDAgMTA4MjUuNiA1MTIgMzE0LjAyNyAzMTQuMDI3IDAgMDA1MTIgMTk4LjR6Ii8+PC9zdmc+")}.l7-control-draw .draw-delete{background-image:url("data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiIgdmlld0JveD0iMCAwIDEwMjQgMTAyNCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB3aWR0aD0iMTI4IiBoZWlnaHQ9IjEyOCI+PGRlZnM+PHN0eWxlLz48L2RlZnM+PHBhdGggZD0iTTIxMy4zMzMgMjgyLjgzN2MwLTIwLjY5MyAxNi4xNzEtMzcuNDE4IDM2LjA5Ni0zNy40MThoMTgwLjQ4di0zNy4zNzZjMC0yMC42NTEgMTYuMjE0LTM3LjM3NiAzNi4xMzktMzcuMzc2aDcyLjE5MmMxOS45NjggMCAzNi4xMzkgMTYuNzI1IDM2LjEzOSAzNy4zNzZ2MzcuMzc2aDE4MC40OGMxOS45NjggMCAzNi4wOTYgMTYuNzI1IDM2LjA5NiAzNy40MTh2MzcuMzc2SDIxMy4zMzN2LTM3LjM3NnpNNzU0Ljg2IDM5NC45NjV2NDIwLjk5MmMwIDIwLjYwOC0xNi4xMjggMzcuMzc2LTM2LjA5NiAzNy4zNzZIMjg1LjUyNWMtMTkuOTI1IDAtMzYuMDk2LTE2Ljc2OC0zNi4wOTYtMzcuMzc2di00NTguNDFoNTA1LjQzdjM3LjM3NnpNMzkzLjg1NiA0NjkuNzZjMC0yMC42NS0xNi4xNy0zNy40MTktMzYuMDk2LTM3LjQxOS0xOS45NjggMC0zNi4xMzkgMTYuNzY4LTM2LjEzOSAzNy40MTl2MjcxLjQwM2MwIDIwLjY1IDE2LjIxNCAzNy40MTggMzYuMTM5IDM3LjQxOCAxOS45MjUgMCAzNi4wOTYtMTYuNzY4IDM2LjA5Ni0zNy40MThWNDY5Ljc2em0xNDQuMzg0IDBjMC0yMC42NS0xNi4xMjgtMzcuNDE5LTM2LjA5Ni0zNy40MTktMTkuOTI1IDAtMzYuMDk2IDE2Ljc2OC0zNi4wOTYgMzcuNDE5djI3MS40MDNjMCAyMC42NSAxNi4xNyAzNy40MTggMzYuMDk2IDM3LjQxOCAxOS45NjggMCAzNi4wOTYtMTYuNzY4IDM2LjA5Ni0zNy40MThWNDY5Ljc2em0xNDQuNDI3IDBjMC0yMC42NS0xNi4xNzEtMzcuNDE5LTM2LjA5Ni0zNy40MTktMTkuOTY4IDAtMzYuMDk2IDE2Ljc2OC0zNi4wOTYgMzcuNDE5djI3MS40MDNjMCAyMC42NSAxNi4xMjggMzcuNDE4IDM2LjA5NiAzNy40MTggMTkuOTI1IDAgMzYuMDk2LTE2Ljc2OCAzNi4wOTYtMzcuNDE4VjQ2OS43NnoiLz48L3N2Zz4=")}.horizontal{flex-direction:row}.horizontal button:focus:first-child{border-radius:4px 0 0 4px}.horizontal button:focus:last-child{border-radius:0 4px 4px 4px}.horizontal button+button{border-left:1px solid #eee}.vertical{flex-direction:column}.vertical button:focus:first-child{border-radius:4px 4px 0 0}.vertical button:focus:last-child{border-radius:0 0 4px 4px}.vertical button+button{border-top:1px solid #eee}');var kn={point:Tn,line:An,polygon:In,circle:hn,rect:On},Cn=function(e){s(o,e);var n=h(o);function o(e,t){var i;return r(this,o),(i=n.call(this,t)).draw={},i.onButtonClick=function(e,t){for(var r in i.draw)r===e?i.draw[r].enable():i.draw[r].disable()},i.onDeleteMode=function(e,t){if(t.stopPropagation(),i.currentDraw)return i.currentDraw.deleteMode.enable(),!1},i.onModeChange=function(e,t){t===L.SIMPLE_SELECT&&(i.currentDraw=i.draw[e])},i.scene=e,i}return i(o,[{key:"getDefault",value:function(){return{position:t.PositionType.TOPLEFT,controls:{point:!0,line:!0,polygon:!0,rect:!0,circle:!0,delete:!0},name:"draw"}}},{key:"onAdd",value:function(){var e=this.controlOption.controls,r=t.DOM.create("div","l7-control-draw "+this.controlOption.layout);return this.addControls(e,r),this.addControlEvent(),r}},{key:"onRemove",value:function(){for(var e in this.draw)this.draw[e]&&this.draw[e].destroy()}},{key:"getDraw",value:function(e){return this.controlOption.controls[e]?this.draw[e]:null}},{key:"getAllData",value:function(){var e={};for(var t in this.draw)this.draw[t]&&(e[t]=this.draw[t].getData());return e}},{key:"removeAllData",value:function(){for(var e in this.draw)this.draw[e]&&this.draw[e].removeAllData()}},{key:"addControls",value:function(e,t){var r=this.controlOption.style;for(var n in e)if(kn[n]&&!1!==e[n]){var i=A(e[n])?e[n]:{};r&&(i.style=r);var o=new kn[n](this.scene,i);o.on(D.MODE_CHANGE,this.onModeChange.bind(null,n)),this.draw[n]=o,this.createButton(o.title,"draw-"+n,t,"click",this.onButtonClick.bind(null,n))}else if("delete"===n&&!1!==e[n]){var a=new cn(this.scene);a.on(D.MODE_CHANGE,this.onModeChange.bind(null,n)),this.createButton(a.title,"draw-"+n,t,"mousedown",this.onDeleteMode.bind(null,n))}}},{key:"addControlEvent",value:function(){var e=this,t=function(t){e.draw[t]&&["draw.create","draw.update","draw.delete"].forEach((function(r){e.draw[t].on(r,(function(n){e.emit(r,{drawType:t,feature:n})}))}))};for(var r in this.draw)t(r)}},{key:"createButton",value:function(e,r,n,i,o){var a=t.DOM.create("button",r,n);return a.title=e,a.addEventListener(i,o,!1),a}}]),o}(t.Control);e.DrawCircle=hn,e.DrawControl=Cn,e.DrawDelete=cn,e.DrawFeature=fn,e.DrawLine=An,e.DrawMode=sn,e.DrawPoint=Tn,e.DrawPolygon=In,e.DrawRect=On,Object.defineProperty(e,"__esModule",{value:!0})}));
2//# sourceMappingURL=l7-draw.min.js.map