dolphin-leaflet
Version:
leaflet for dmap
3 lines • 27.9 kB
JavaScript
/*! version:1.1.5 */
webpackJsonp([1],{148:function(t,e,o){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var s=o(150),a=o(151),u=o(156),c=o(157),h=o(158),l=o(159),p=o(160),f=o(152),m=o(162),y=o(163),d=o(164),g=o(22),w=o(38),v=o(165),b=o(166),M=(o.n(b),o(167)),_=(o.n(M),T),O=_.isArray,P=L,k=P.Marker,D=P.Polyline,j=P.Polygon,E=P.Circle,x=P.CircleMarker,A=function(t){function e(){var o,i,s;n(this,e);for(var a=arguments.length,u=Array(a),c=0;c<a;c++)u[c]=arguments[c];return o=i=r(this,t.call.apply(t,[this].concat(u))),i.history=[],i.next=[],i.options={editable:!0,draggable:!0},s=o,r(i,s)}return i(e,t),e.prototype.addTo=function(e){return e.on("draw-end",this.onDrawEnd.bind(this)),t.prototype.addTo.call(this,e)},e.prototype.add=function(e,o,n){o.tooltip&&(o.tooltip.draggable=!0),t.prototype.add.call(this,e,o,n),e.editEnable(),e.makeDraggable(),e.dragging.enable()},e.prototype.change=function(t){var e=this;if(t){var o=e.dmap,n=e.history,r=e.next;switch(t.tool){case"clear":e.clear();break;case"pointer":e.reset();break;case"go":var i=r[r.length-1];i&&i.restore()&&r.pop(),!n.includes(i)&&n.push(i),e.reset();break;case"back":var s=n[n.length-1];s&&s.reback()&&n.pop(),!r.includes(s)&&r.push(s),e.reset();break;default:e.start(t)}o.do("tool-change",{target:e,options:t})}return e},e.prototype.start=function(t){var e=this,o=e.map,n=t.tool;if(e.cancel(),o.dragging.disable(),(n=e.get(n))&&(n=n.create(e,t)),n){var r=T.assign({},e.options,t);n.options.feature.draggable=r.draggable,n.options.reable=r.reable,n.options.editable=r.editable,n.start()}e.tool=n},e.prototype.get=function(t){switch(t){case"point":return s.a;case"distance":return u.a;case"polyline":return a.a;case"pen":return c.a;case"circle":return f.a;case"ellipse":return m.a;case"rect":return l.a;case"polygon":return p.a;case"penfill":return h.a;case"militaryArrow":return y.a;case"text":return d.a}},e.prototype.cancel=function(){this.tool&&this.tool.cancel(),this.tool=null},e.prototype.reset=function(){this.cancel(),this.map.dragging.enable()},e.prototype.onDrawEnd=function(t){this.next.length=0;var e=this.tool;if(e){!this.history.includes(e)&&this.history.push(e);var o=e,n=o.options,r=o.marker;n.searchable&&this.dmap.do("search-end",{target:this,event:t,value:this.search(t)}),n.editable&&T.defer(function(){r.editEnable()}),n.onDrawEnd&&n.onDrawEnd(t),n.multi?(e.cancel(),e=this.tool=e.clone(),e.start()):n.reable?(e.cancel(),this.tool=e,e.start()):this.reset()}else this.reset()},e.prototype.search=function(t){var e=t.marker,o=[];if(!e)throw"search error";var n=e._map;if(e instanceof E){var r=e._radius,i=e.getLatLng();n.eachLayer(function(t){if(t instanceof k||t instanceof g.a)n.latLngToLayerPoint(t.getLatLng()).distanceTo(n.latLngToLayerPoint(i))<r&&o.push(t);else if(t instanceof D){var e=t.getLatLngs();O(e[0])&&(e=e[0]);for(var s=0,a=e.length;s<a;s++)if(n.latLngToLayerPoint(e[s]).distanceTo(n.latLngToLayerPoint(i))<r){o.push(t);break}}else if(t instanceof j){var u=t.getLatLngs();O(u[0])&&(u=u[0]);for(var c=0,h=u.length;c<h;c++)if(n.latLngToLayerPoint(u[c]).distanceTo(n.latLngToLayerPoint(i))<r){o.push(t);break}}})}else if(e instanceof j){var s=e._rings;n.eachLayer(function(t){if(t instanceof k||t instanceof x)Object(v.a)(n.latLngToLayerPoint(t.getLatLng()),s[0])&&o.push(t);else if(t instanceof D){var e=t.getLatLngs();O(e[0])&&(e=e[0]);for(var r=0,i=e.length;r<i;r++)if(Object(v.a)(n.latLngToLayerPoint(e[r]),s[0])){o.push(t);break}}else if(t instanceof j){var a=t.getLatLngs();O(a[0])&&(a=a[0]);for(var u=0,c=a.length;u<c;u++)if(Object(v.a)(n.latLngToLayerPoint(a[u]),s[0])){o.push(t);break}}})}return o},e}(w.a);e.default=A},149:function(t,e,o){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var r=function(){function t(){n(this,t)}return t.prototype.setOptions=function(t){T.assign(this.options,t)},t.prototype.reback=function(){var t=this.marker,e=this.layer,o=this.history;if(t){if(!t._defaultShape)return t.removeFrom(e),!0;var n=t._defaultShape(),r=n.pop();if(!r)return t.removeFrom(e),!0;o.push(r),t.setLatLngs(n)}},t.prototype.restore=function(){var t=this.marker,e=this.layer,o=this.history;if(t){if(t.addTo(e),!(t._defaultShape&&o.length>0))return!0;var n=t._defaultShape(),r=o.pop();n.push(r),t.setLatLngs(n)}},t.prototype.onEnd=function(t){this.history=[],this.dmap.do("draw-end",{target:this,marker:this.marker})},t.prototype.clear=function(){var t=this.marker;t&&t.remove()},t.prototype.reset=function(){this.restart&&(this.clear(),this.restart=!1,this.marker=null)},t.prototype.cancel=function(){},t.create=function(t,e){var o=new this;return o.owner=t,o.dmap=t.dmap,o.map=t.map,o.layer=t.layer,o.setOptions(e),o},t.prototype.clone=function(){return this.constructor.create(this.owner,this.options)},t}();e.a=r},150:function(t,e,o){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var s=o(149),a=o(22),u=function(t){function e(){var o,i,s;n(this,e);for(var a=arguments.length,u=Array(a),c=0;c<a;c++)u[c]=arguments[c];return o=i=r(this,t.call.apply(t,[this].concat(u))),i.options={feature:{src:"circle",color:"#000",radius:5,fillColor:"#FFF",weight:1,fillOpacity:1}},s=o,r(i,s)}return i(e,t),e.prototype.start=function(){this.onMouseDown=this.onMouseDown.bind(this),this.map.on("mousedown",this.onMouseDown)},e.prototype.cancel=function(){this.map.off("mousedown",this.onMouseDown)},e.prototype.onMouseDown=function(t){var e=t.latlng,o=this.options,n=this.layer,r=this.marker;r?r.setLatLng(e):this.marker=new a.a(e,o.feature).addTo(n),this.onEnd()},e}(s.a);e.a=u},151:function(t,e,o){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var s=o(149),a=L,u=a.Polyline,c=function(t){function e(){var o,i,s;n(this,e);for(var a=arguments.length,u=Array(a),c=0;c<a;c++)u[c]=arguments[c];return o=i=r(this,t.call.apply(t,[this].concat(u))),i.options={feature:{color:"red",weight:2}},s=o,r(i,s)}return i(e,t),e.prototype.start=function(){this.onMouseDown=this.onMouseDown.bind(this),this.onMouseMove=this.onMouseMove.bind(this),this.map.on("mousedown",this.onMouseDown),this.restart=!0},e.prototype.cancel=function(){var t=this.map;t.off("mousedown",this.onMouseDown),t.off("mousemove",this.onMouseMove),this.mp=null},e.prototype.onMouseDown=function(t){this.reset();var e=this.marker,o=this.map,n=this.layer,r=this.options,i=t.latlng;e?this.mp=null:(e=this.marker=new u([i],r.feature).addTo(n),o.on("mousemove",this.onMouseMove),o.once("dblclick",this.onEnd.bind(this)))},e.prototype.onMouseMove=function(t){var e=this.marker,o=this.mp,n=t.latlng;o?(o.lat=n.lat,o.lng=n.lng,e.getBounds().extend(o),e.redraw()):(e.addLatLng(n),this.mp=n)},e}(s.a);e.a=c},152:function(t,e,o){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var s=o(149),a=o(161),u=function(t){function e(){var o,i,s;n(this,e);for(var a=arguments.length,u=Array(a),c=0;c<a;c++)u[c]=arguments[c];return o=i=r(this,t.call.apply(t,[this].concat(u))),i.options={feature:{color:"red",fillOpacity:.5,weight:1}},s=o,r(i,s)}return i(e,t),e.prototype.start=function(){this.onMouseMove=this.onMouseMove.bind(this),this.onMouseDown=this.onMouseDown.bind(this),this.map.once("mousedown",this.onMouseDown)},e.prototype.cancel=function(){var t=this.map;t.off("mousedown",this.onMouseDown),t.off("mousemove",this.onMouseMove)},e.prototype.onMouseDown=function(t){var e=this.options,o=this.map,n=this.layer,r=t.latlng;this.clear(),this.marker=new a.a(r,e.feature).addTo(n),o.on("mousemove",this.onMouseMove),o.once("mouseup",this.onEnd.bind(this))},e.prototype.onMouseMove=function(t){var e=this.marker,o=t.latlng,n=e.getLatLng(),r=o.distanceTo(n);e.setRadius(r),e.redraw()},e}(s.a);e.a=u},156:function(t,e,o){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var s=o(151),a=L,u=(a.Polyline,function(t){function e(){var o,i,s;n(this,e);for(var a=arguments.length,u=Array(a),c=0;c<a;c++)u[c]=arguments[c];return o=i=r(this,t.call.apply(t,[this].concat(u))),i.options={feature:{color:"red",weight:2,showMeasurements:!0,draggable:!1}},s=o,r(i,s)}return i(e,t),e.prototype.onMouseMove=function(e){t.prototype.onMouseMove.call(this,e),this.marker.updateMeasurements()},e}(s.a));e.a=u},157:function(t,e,o){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var s=o(149),a=L,u=a.Polyline,c=function(t){function e(){var o,i,s;n(this,e);for(var a=arguments.length,u=Array(a),c=0;c<a;c++)u[c]=arguments[c];return o=i=r(this,t.call.apply(t,[this].concat(u))),i.options={feature:{color:"red"}},s=o,r(i,s)}return i(e,t),e.prototype.start=function(){this.onMouseMove=this.onMouseMove.bind(this),this.onMouseDown=this.onMouseDown.bind(this),this.map.once("mousedown",this.onMouseDown),this.restart=!0},e.prototype.cancel=function(){this.map.off("mousedown",this.onMouseDown),this.map.off("mousemove",this.onMouseMove)},e.prototype.onMouseDown=function(t){this.reset();var e=this.marker,o=this.options,n=this.map,r=this.layer,i=t.latlng;e||(e=this.marker=new u([i],o.feature).addTo(r),n.once("mouseup",this.onEnd.bind(this)),n.on("mousemove",this.onMouseMove))},e.prototype.onMouseMove=function(t){this.marker.addLatLng(t.latlng)},e}(s.a);e.a=c},158:function(t,e,o){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var s=o(149),a=function(t){function e(){var o,i,s;n(this,e);for(var a=arguments.length,u=Array(a),c=0;c<a;c++)u[c]=arguments[c];return o=i=r(this,t.call.apply(t,[this].concat(u))),i.options={feature:{color:"red",fillOpacity:.5,weight:1}},s=o,r(i,s)}return i(e,t),e.prototype.start=function(){this.onMouseDown=this.onMouseDown.bind(this),this.onMouseMove=this.onMouseMove.bind(this),this.map.on("mousedown",this.onMouseDown),this.restart=!0},e.prototype.cancel=function(){var t=this.map;t.off("mousedown",this.onMouseDown),t.off("mousemove",this.onMouseMove)},e.prototype.onMouseDown=function(t){this.reset();var e=this.marker,o=this.options,n=this.map,r=this.layer,i=t.latlng;e||(e=this.marker=L.rectangle(L.latLngBounds(i,i),o.feature).addTo(r),n.on("mousemove",this.onMouseMove),n.once("mouseup",this.onEnd.bind(this)))},e.prototype.onMouseMove=function(t){this.marker.addLatLng(t.latlng)},e}(s.a);e.a=a},159:function(t,e,o){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var s=o(149),a=L,u=a.Rectangle,c=function(t){function e(){var o,i,s;n(this,e);for(var a=arguments.length,u=Array(a),c=0;c<a;c++)u[c]=arguments[c];return o=i=r(this,t.call.apply(t,[this].concat(u))),i.options={feature:{color:"red",fillOpacity:.5,weight:1}},s=o,r(i,s)}return i(e,t),e.prototype.start=function(){this.onMouseMove=this.onMouseMove.bind(this),this.onMouseDown=this.onMouseDown.bind(this),this.map.once("mousedown",this.onMouseDown)},e.prototype.cancel=function(){var t=this.map;t.off("mousedown",this.onMouseDown),t.off("mousemove",this.onMouseMove),this.sp=null},e.prototype.onMouseDown=function(t){var e=this.map,o=this.layer,n=this.options,r=t.latlng;this.clear(),this.marker=new u(L.latLngBounds(r,r),n.feature).addTo(o),this.sp=r,e.on("mousemove",this.onMouseMove),e.once("mouseup",this.onEnd.bind(this))},e.prototype.onMouseMove=function(t){var e=this.marker,o=t.latlng;e.setBounds(L.latLngBounds(this.sp,o)),e.redraw()},e}(s.a);e.a=c},160:function(t,e,o){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var s=o(149),a=L,u=a.Polygon,c=function(t){function e(){var o,i,s;n(this,e);for(var a=arguments.length,u=Array(a),c=0;c<a;c++)u[c]=arguments[c];return o=i=r(this,t.call.apply(t,[this].concat(u))),i.options={feature:{color:"red",fillOpacity:.5,weight:1}},s=o,r(i,s)}return i(e,t),e.prototype.start=function(){this.onMouseDown=this.onMouseDown.bind(this),this.onMouseMove=this.onMouseMove.bind(this),this.map.on("mousedown",this.onMouseDown),this.restart=!0},e.prototype.cancel=function(){var t=this.map;t.off("mousedown",this.onMouseDown),t.off("mousemove",this.onMouseMove),this.mp=null},e.prototype.onMouseDown=function(t){this.reset();var e=this.marker,o=this.map,n=this.layer,r=this.options,i=t.latlng;e||(e=this.marker=new u([i],r.feature).addTo(n),o.on("mousemove",this.onMouseMove),o.once("dblclick",this.onEnd.bind(this))),this.mp=null},e.prototype.onMouseMove=function(t){var e=this.marker,o=this.mp,n=t.latlng;o?(o.lat=n.lat,o.lng=n.lng,e.getBounds().extend(o),e.redraw()):(e.addLatLng(n),this.mp=n)},e}(s.a);e.a=c},161:function(t,e,o){"use strict";var n=L,r=n.Circle;e.a=r.extend({_updateBounds:function(){this._radius=this._radiusY,r.prototype._updateBounds.call(this)},toGeoJSON:function(){var t=this.getLatLng(),e=t.lat,o=t.lng;return this.options.radius=this._mRadius,{type:"Feature",properties:{},geometry:{coordinates:[o,e],type:"Circle"}}}})},162:function(t,e,o){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var s=o(152),a=o(39),u=function(t){function e(){return n(this,e),r(this,t.apply(this,arguments))}return i(e,t),e.prototype.onMouseDown=function(t){var e=this.options,o=this.map,n=this.layer,r=t.latlng;this.clear(),this.marker=new a.a(r,0,e.feature).addTo(n),o.on("mousemove",this.onMouseMove),o.once("mouseup",this.onEnd.bind(this))},e.prototype.onMouseMove=function(t){var e=this.marker,o=t.latlng,n=e.getLatLng(),r=o.clone(),i=o.clone();r.lat=n.lat,i.lng=n.lng;var s=r.distanceTo(n),a=i.distanceTo(n);e.setRadius(s),e.setRadiusY(a),e.redraw()},e}(s.a);e.a=u},163:function(t,e,o){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var s=o(149),a=o(40),u=L,c=(u.LatLng,function(t){function e(){var o,i,s;n(this,e);for(var a=arguments.length,u=Array(a),c=0;c<a;c++)u[c]=arguments[c];return o=i=r(this,t.call.apply(t,[this].concat(u))),i.options={feature:{fillColor:"red",weight:1,fillOpacity:.5,color:"#333"}},s=o,r(i,s)}return i(e,t),e.prototype.start=function(){this.onMouseDown=this.onMouseDown.bind(this),this.onMouseMove=this.onMouseMove.bind(this),this.map.on("mousedown",this.onMouseDown),this.restart=!0},e.prototype.cancel=function(){var t=this.map;t.off("mousedown",this.onMouseDown),t.off("mousemove",this.onMouseMove),this.mp=null},e.prototype.onMouseDown=function(t){this.reset();var e=this.marker,o=this.map,n=this.layer,r=this.options,i=r.feature,s=t.latlng;e?this.mp=null:(i.draggable=!1,e=this.marker=new a.a([s],i).addTo(n),o.on("mousemove",this.onMouseMove),o.once("dblclick",this.onEnd.bind(this))),this.lp=t.layerPoint},e.prototype.onMouseMove=function(t){var e=this.marker,o=this.mp,n=t.latlng;t.layerPoint,e.getLatLngs();if(o)o.lat=n.lat,o.lng=n.lng,e.redraw();else{this.lp;e.addLatLng(n),this.mp=n}},e}(s.a));e.a=c},164:function(t,e,o){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var s=o(150),a=function(t){function e(){var o,i,s;n(this,e);for(var a=arguments.length,u=Array(a),c=0;c<a;c++)u[c]=arguments[c];return o=i=r(this,t.call.apply(t,[this].concat(u))),i.options={feature:{}},s=o,r(i,s)}return i(e,t),e.prototype.onMouseDown=function(t){var e=t.latlng,o=this.options,n=this.layer;this.marker=L.text(e,o.text,o.feature).addTo(n),this.onEnd()},e}(s.a);e.a=a},165:function(t,e,o){"use strict";o.d(e,"a",function(){return n});var n=function(t,e){var o=0;if(e.length>0)for(var n=0;n<e.length;n++){var r=t,i=e[n],s=e[(n+1)%e.length];i.y==s.y||r.y<(i.y<=s.y?i.y:s.y)||r.y>=(i.y>=s.y?i.y:s.y)||(r.y-i.y)*(s.x-i.x)/(s.y-i.y)+i.x>r.x&&o++}return o%2==1}},166:function(t,e){!function(){L.Marker.Measurement=L.Layer.extend({options:{pane:"markerPane"},initialize:function(t,e,o,n,r){L.setOptions(this,r),this._latlng=t,this._measurement=e,this._title=o,this._rotation=n},addTo:function(t){return t.addLayer(this),this},onAdd:function(t){this._map=t;var e=this.getPane?this.getPane():t.getPanes().markerPane,o=this._element=L.DomUtil.create("div","leaflet-zoom-animated leaflet-measure-path-measurement",e),n=L.DomUtil.create("div","",o);n.title=this._title,n.innerHTML=this._measurement,t.on("zoomanim",this._animateZoom,this),this._setPosition()},onRemove:function(t){t.off("zoomanim",this._animateZoom,this),(this.getPane?this.getPane():t.getPanes().markerPane).removeChild(this._element),this._map=null},_setPosition:function(){L.DomUtil.setPosition(this._element,this._map.latLngToLayerPoint(this._latlng)),this._element.style.transform+=" rotate("+this._rotation+"rad)"},_animateZoom:function(t){var e=this._map._latLngToNewLayerPoint(this._latlng,t.zoom,t.center).round();L.DomUtil.setPosition(this._element,e),this._element.style.transform+=" rotate("+this._rotation+"rad)"}}),L.marker.measurement=function(t,e,o,n,r){return new L.Marker.Measurement(t,e,o,n,r)};var t=function(t){var e,o;return this._measurementOptions.imperial?(o=t/.3048,o>3e3?(t/=1609.344,e="mi"):(t=o,e="ft")):t>1e3?(t/=1e3,e="km"):e="m",t<100?t.toFixed(1)+" "+e:Math.round(t)+" "+e},e=function(t){var e;return this._measurementOptions.imperial?t>404.685642?(t/=4046.85642,e="ac"):(t/=.09290304,e="ft²"):t>1e6?(t/=1e6,e="km²"):e="m²",t<100?t.toFixed(1)+" "+e:Math.round(t)+" "+e},o=function(t){var e,o,n,r,i,s,a=function(t){return t*Math.PI/180},u=0,c=t.length;if(c>2){for(var h=0;h<c;h++)h===c-2?(r=c-2,i=c-1,s=0):h===c-1?(r=c-1,i=0,s=1):(r=h,i=h+1,s=h+2),e=t[r],o=t[i],n=t[s],u+=(a(n.lng)-a(e.lng))*Math.sin(a(o.lat));u=6378137*u*6378137/2}return Math.abs(u)},n=function(t){var e=t/6378137;return 2*Math.PI*6378137*6378137*(1-Math.cos(e))},r=function(t,e,o){return o?function(){return e.apply(this,arguments),t.apply(this,arguments)}:function(){return t.apply(this,arguments),e.apply(this,arguments)}};L.Polyline.include({showMeasurements:function(t){return!this._map||this._measurementLayer?this:(this._measurementOptions=L.extend({showOnHover:!1,minPixelDistance:30,showDistances:!0,showArea:!0,lang:{totalLength:"Total length",totalArea:"Total area",segmentLength:"Segment length"}},t||{}),this._measurementLayer=L.layerGroup().addTo(this._map),this.updateMeasurements(),this._map.on("zoomend",this.updateMeasurements,this),this)},hideMeasurements:function(){return this._map.off("zoomend",this.updateMeasurements,this),this._measurementLayer?(this._map.removeLayer(this._measurementLayer),this._measurementLayer=null,this):this},onAdd:r(L.Polyline.prototype.onAdd,function(){this.options.showMeasurements&&this.showMeasurements(this.options.measurementOptions)}),onRemove:r(L.Polyline.prototype.onRemove,function(){this.hideMeasurements()},!0),setLatLngs:r(L.Polyline.prototype.setLatLngs,function(){return this.updateMeasurements()}),spliceLatLngs:r(L.Polyline.prototype.spliceLatLngs,function(){return this.updateMeasurements()}),formatDistance:t,formatArea:e,updateMeasurements:function(){if(!this._measurementLayer)return this;var t,e,n,r,i,s,a=this.getLatLngs(),u=this instanceof L.Polygon,c=this._measurementOptions,h=0;if(a&&a.length&&L.Util.isArray(a[0])&&(a=a[0]),this._measurementLayer.clearLayers(),this._measurementOptions.showDistances&&a.length>1){t=this._measurementOptions.formatDistance||L.bind(this.formatDistance,this);for(var l=1,p=a.length;u&&l<=p||l<p;l++)e=a[l-1],n=a[l%p],s=e.distanceTo(n),h+=s,r=this._map.latLngToLayerPoint(e),i=this._map.latLngToLayerPoint(n),r.distanceTo(i)>=c.minPixelDistance&&L.marker.measurement(this._map.layerPointToLatLng([(r.x+i.x)/2,(r.y+i.y)/2]),t(s),c.lang.segmentLength,this._getRotation(e,n),c).addTo(this._measurementLayer);u||L.marker.measurement(n,t(h),c.lang.totalLength,0,c).addTo(this._measurementLayer)}if(u&&c.showArea&&a.length>2){t=c.formatArea||L.bind(this.formatArea,this);var f=o(a);L.marker.measurement(this.getBounds().getCenter(),t(f),c.lang.totalArea,0,c).addTo(this._measurementLayer)}return this},_getRotation:function(t,e){var o=this._map.project(t),n=this._map.project(e);return Math.atan((n.y-o.y)/(n.x-o.x))}}),L.Polyline.addInitHook(function(){this.options.showMeasurements&&this.showMeasurements()}),L.Circle.include({showMeasurements:function(t){return!this._map||this._measurementLayer?this:(this._measurementOptions=L.extend({showOnHover:!1,showArea:!0,lang:{totalArea:"Total area"}},t||{}),this._measurementLayer=L.layerGroup().addTo(this._map),this.updateMeasurements(),this._map.on("zoomend",this.updateMeasurements,this),this)},hideMeasurements:function(){return this._map.on("zoomend",this.updateMeasurements,this),this._measurementLayer?(this._map.removeLayer(this._measurementLayer),this._measurementLayer=null,this):this},onAdd:r(L.Circle.prototype.onAdd,function(){this.options.showMeasurements&&this.showMeasurements(this.options.measurementOptions)}),onRemove:r(L.Circle.prototype.onRemove,function(){this.hideMeasurements()},!0),setLatLng:r(L.Circle.prototype.setLatLng,function(){this.updateMeasurements()}),setRadius:r(L.Circle.prototype.setRadius,function(){this.updateMeasurements()}),formatArea:e,updateMeasurements:function(){if(this._measurementLayer){var t=this.getLatLng(),e=this._measurementOptions,o=e.formatArea||L.bind(this.formatArea,this);if(this._measurementLayer.clearLayers(),e.showArea){o=e.formatArea||L.bind(this.formatArea,this);var r=n(this.getRadius());L.marker.measurement(t,o(r),e.lang.totalArea,0,e).addTo(this._measurementLayer)}}}}),L.Circle.addInitHook(function(){this.options.showMeasurements&&this.showMeasurements()})}()},167:function(t,e,o){var n=o(168);"string"==typeof n&&(n=[[t.i,n,""]]),n.locals&&(t.exports=n.locals);var r=o(7).default;r("10279068",n,!0,{})},168:function(t,e,o){e=t.exports=o(6)(!1),e.push([t.i,".leaflet-measure-path-measurement{position:absolute;font-size:10px;color:#000;text-shadow:-1px 0 0 #fff,-1px -1px 0 #fff,0 -1px 0 #fff,1px -1px 0 #fff,1px 0 0 #fff,1px 1px 0 #fff,0 1px 0 #fff,-1px 1px 0 #fff;white-space:nowrap;transform-origin:0;pointer-events:none}.leaflet-measure-path-measurement>div{position:relative;margin-top:-25%;left:-50%}",""])}});
//# sourceMappingURL=drawtool.js.map