12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164 |
- !function(t) {
- var e = {};
- function n(r) {
- if (e[r]) return e[r].exports;
- var i = e[r] = {
- i:r,
- l:!1,
- exports:{}
- };
- return t[r].call(i.exports, i, i.exports, n), i.l = !0, i.exports;
- }
- n.m = t, n.c = e, n.d = function(t, e, r) {
- n.o(t, e) || Object.defineProperty(t, e, {
- configurable:!1,
- enumerable:!0,
- get:r
- });
- }, n.n = function(t) {
- var e = t && t.__esModule ? function() {
- return t["default"];
- } :function() {
- return t;
- };
- return n.d(e, "a", e), e;
- }, n.o = function(t, e) {
- return Object.prototype.hasOwnProperty.call(t, e);
- }, n.p = "", n(n.s = 19);
- }([ function(t, e, n) {
- "use strict";
- var r = n(10), i = L.Class.extend({
- includes:[ r.a ],
- options:{
- snappable:!0,
- snapDistance:20,
- cursorMarker:!0,
- finishOnDoubleClick:!1,
- finishOn:null,
- allowSelfIntersection:!0,
- templineStyle:{},
- hintlineStyle:{
- color:"#3388ff",
- dashArray:"5,5"
- },
- markerStyle:{
- draggable:!0
- }
- },
- initialize:function(t) {
- var e = this;
- this._map = t, this.shapes = [ "Marker", "Line", "Poly", "Rectangle", "Circle", "Cut" ],
- this.shapes.forEach(function(t) {
- e[t] = new L.PM.Draw[t](e._map);
- });
- },
- setPathOptions:function(t) {
- this.options.pathOptions = t;
- },
- getShapes:function() {
- return this.shapes;
- },
- enable:function(t, e) {
- if (!t) throw new Error("Error: Please pass a shape as a parameter. Possible shapes are: ".concat(this.getShapes().join(",")));
- this.disable(), this[t].enable(e);
- },
- disable:function() {
- var t = this;
- this.shapes.forEach(function(e) {
- t[e].disable();
- });
- },
- addControls:function() {
- var t = this;
- this.shapes.forEach(function(e) {
- t[e].addButton();
- });
- }
- });
- e.a = i;
- }, function(t, e, n) {
- "use strict";
- var r = n(10), i = n(35), a = L.Class.extend({
- includes:[ i.a, r.a ],
- options:{
- snappable:!0,
- snapDistance:20,
- allowSelfIntersection:!0,
- draggable:!0
- },
- isPolygon:function() {
- return this._layer instanceof L.Polygon;
- }
- });
- e.a = a;
- }, function(t, e, n) {
- "use strict";
- function r(t, e, n) {
- void 0 === n && (n = {});
- var r = {
- type:"Feature"
- };
- return (0 === n.id || n.id) && (r.id = n.id), n.bbox && (r.bbox = n.bbox), r.properties = e || {},
- r.geometry = t, r;
- }
- function i(t, e, n) {
- return void 0 === n && (n = {}), r({
- type:"Point",
- coordinates:t
- }, e, n);
- }
- function a(t, e, n) {
- void 0 === n && (n = {});
- for (var i = 0, a = t; i < a.length; i++) {
- var o = a[i];
- if (o.length < 4) throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");
- for (var s = 0; s < o[o.length - 1].length; s++) if (o[o.length - 1][s] !== o[0][s]) throw new Error("First and last Position are not equivalent.");
- }
- return r({
- type:"Polygon",
- coordinates:t
- }, e, n);
- }
- function o(t, e, n) {
- if (void 0 === n && (n = {}), t.length < 2) throw new Error("coordinates must be an array of two or more positions");
- return r({
- type:"LineString",
- coordinates:t
- }, e, n);
- }
- function s(t, e) {
- void 0 === e && (e = {});
- var n = {
- type:"FeatureCollection"
- };
- return e.id && (n.id = e.id), e.bbox && (n.bbox = e.bbox), n.features = t, n;
- }
- function l(t, e, n) {
- return void 0 === n && (n = {}), r({
- type:"MultiLineString",
- coordinates:t
- }, e, n);
- }
- function h(t, e, n) {
- return void 0 === n && (n = {}), r({
- type:"MultiPoint",
- coordinates:t
- }, e, n);
- }
- function u(t, e, n) {
- return void 0 === n && (n = {}), r({
- type:"MultiPolygon",
- coordinates:t
- }, e, n);
- }
- function c(t, n) {
- void 0 === n && (n = "kilometers");
- var r = e.factors[n];
- if (!r) throw new Error(n + " units is invalid");
- return t * r;
- }
- function p(t, n) {
- void 0 === n && (n = "kilometers");
- var r = e.factors[n];
- if (!r) throw new Error(n + " units is invalid");
- return t / r;
- }
- function f(t) {
- return 180 * (t % (2 * Math.PI)) / Math.PI;
- }
- function d(t) {
- return !isNaN(t) && null !== t && !Array.isArray(t) && !/^\s*$/.test(t);
- }
- Object.defineProperty(e, "__esModule", {
- value:!0
- }), e.earthRadius = 6371008.8, e.factors = {
- centimeters:100 * e.earthRadius,
- centimetres:100 * e.earthRadius,
- degrees:e.earthRadius / 111325,
- feet:3.28084 * e.earthRadius,
- inches:39.37 * e.earthRadius,
- kilometers:e.earthRadius / 1e3,
- kilometres:e.earthRadius / 1e3,
- meters:e.earthRadius,
- metres:e.earthRadius,
- miles:e.earthRadius / 1609.344,
- millimeters:1e3 * e.earthRadius,
- millimetres:1e3 * e.earthRadius,
- nauticalmiles:e.earthRadius / 1852,
- radians:1,
- yards:e.earthRadius / 1.0936
- }, e.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 / e.earthRadius,
- yards:1 / 1.0936
- }, e.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:3.86e-7,
- millimeters:1e6,
- millimetres:1e6,
- yards:1.195990046
- }, e.feature = r, e.geometry = function(t, e, n) {
- switch (void 0 === n && (n = {}), t) {
- case "Point":
- return i(e).geometry;
- case "LineString":
- return o(e).geometry;
- case "Polygon":
- return a(e).geometry;
- case "MultiPoint":
- return h(e).geometry;
- case "MultiLineString":
- return l(e).geometry;
- case "MultiPolygon":
- return u(e).geometry;
- default:
- throw new Error(t + " is invalid");
- }
- }, e.point = i, e.points = function(t, e, n) {
- return void 0 === n && (n = {}), s(t.map(function(t) {
- return i(t, e);
- }), n);
- }, e.polygon = a, e.polygons = function(t, e, n) {
- return void 0 === n && (n = {}), s(t.map(function(t) {
- return a(t, e);
- }), n);
- }, e.lineString = o, e.lineStrings = function(t, e, n) {
- return void 0 === n && (n = {}), s(t.map(function(t) {
- return o(t, e);
- }), n);
- }, e.featureCollection = s, e.multiLineString = l, e.multiPoint = h, e.multiPolygon = u,
- e.geometryCollection = function(t, e, n) {
- return void 0 === n && (n = {}), r({
- type:"GeometryCollection",
- geometries:t
- }, e, n);
- }, e.round = function(t, e) {
- if (void 0 === e && (e = 0), e && !(e >= 0)) throw new Error("precision must be a positive number");
- var n = Math.pow(10, e || 0);
- return Math.round(t * n) / n;
- }, e.radiansToLength = c, e.lengthToRadians = p, e.lengthToDegrees = function(t, e) {
- return f(p(t, e));
- }, e.bearingToAzimuth = function(t) {
- var e = t % 360;
- return e < 0 && (e += 360), e;
- }, e.radiansToDegrees = f, e.degreesToRadians = function(t) {
- return t % 360 * Math.PI / 180;
- }, e.convertLength = function(t, e, n) {
- if (void 0 === e && (e = "kilometers"), void 0 === n && (n = "kilometers"), !(t >= 0)) throw new Error("length must be a positive number");
- return c(p(t, e), n);
- }, e.convertArea = function(t, n, r) {
- if (void 0 === n && (n = "meters"), void 0 === r && (r = "kilometers"), !(t >= 0)) throw new Error("area must be a positive number");
- var i = e.areaFactors[n];
- if (!i) throw new Error("invalid original units");
- var a = e.areaFactors[r];
- if (!a) throw new Error("invalid final units");
- return t / i * a;
- }, e.isNumber = d, e.isObject = function(t) {
- return !!t && t.constructor === Object;
- }, e.validateBBox = function(t) {
- if (!t) throw new Error("bbox is required");
- if (!Array.isArray(t)) throw new Error("bbox must be an Array");
- if (4 !== t.length && 6 !== t.length) throw new Error("bbox must be an Array of 4 or 6 numbers");
- t.forEach(function(t) {
- if (!d(t)) throw new Error("bbox must only contain numbers");
- });
- }, e.validateId = function(t) {
- if (!t) throw new Error("id is required");
- if (-1 === [ "string", "number" ].indexOf(typeof t)) throw new Error("id must be a number or a string");
- }, e.radians2degrees = function() {
- throw new Error("method has been renamed to `radiansToDegrees`");
- }, e.degrees2radians = function() {
- throw new Error("method has been renamed to `degreesToRadians`");
- }, e.distanceToDegrees = function() {
- throw new Error("method has been renamed to `lengthToDegrees`");
- }, e.distanceToRadians = function() {
- throw new Error("method has been renamed to `lengthToRadians`");
- }, e.radiansToDistance = function() {
- throw new Error("method has been renamed to `radiansToLength`");
- }, e.bearingToAngle = function() {
- throw new Error("method has been renamed to `bearingToAzimuth`");
- }, e.convertDistance = function() {
- throw new Error("method has been renamed to `convertLength`");
- };
- }, function(t, e, n) {
- var r = n(17)(Object, "create");
- t.exports = r;
- }, function(t, e, n) {
- var r = n(68);
- t.exports = function(t, e) {
- for (var n = t.length; n--; ) if (r(t[n][0], e)) return n;
- return -1;
- };
- }, function(t, e, n) {
- var r = n(74);
- t.exports = function(t, e) {
- var n = t.__data__;
- return r(e) ? n["string" == typeof e ? "string" :"hash"] :n.map;
- };
- }, function(t, e) {
- var n = Array.isArray;
- t.exports = n;
- }, function(t, e, n) {
- var r = n(16), i = n(47), a = "[object Symbol]";
- t.exports = function(t) {
- return "symbol" == typeof t || i(t) && r(t) == a;
- };
- }, function(t, e, n) {
- var r = n(9).Symbol;
- t.exports = r;
- }, function(t, e, n) {
- var r = n(43), i = "object" == typeof self && self && self.Object === Object && self, a = r || i || Function("return this")();
- t.exports = a;
- }, function(t, e, n) {
- "use strict";
- var r = n(11), i = {
- _initSnappableMarkers:function() {
- this.options.snapDistance = this.options.snapDistance || 30, this._assignEvents(this._markers),
- this._layer.off("pm:dragstart", this._unsnap, this), this._layer.on("pm:dragstart", this._unsnap, this);
- },
- _assignEvents:function(t) {
- var e = this;
- t.forEach(function(t) {
- Array.isArray(t) ? e._assignEvents(t) :(t.off("drag", e._handleSnapping, e), t.on("drag", e._handleSnapping, e),
- t.off("dragend", e._cleanupSnapping, e), t.on("dragend", e._cleanupSnapping, e));
- });
- },
- _unsnap:function() {
- delete this._snapLatLng;
- },
- _cleanupSnapping:function() {
- delete this._snapList, this._map.off("pm:remove", this._handleSnapLayerRemoval, this),
- this.debugIndicatorLines && this.debugIndicatorLines.forEach(function(t) {
- t.remove();
- });
- },
- _handleSnapLayerRemoval:function(t) {
- var e = t.layer, n = this._snapList.findIndex(function(t) {
- return t._leaflet_id === e._leaflet_id;
- });
- this._snapList.splice(n, 1);
- },
- _handleSnapping:function(t) {
- var e = this;
- if (t.originalEvent.altKey) return !1;
- if (this._snapList === undefined && this._createSnapList(t), this._snapList.length <= 0) return !1;
- var n, r = t.target, i = this._calcClosestLayer(r.getLatLng(), this._snapList), a = i.layer instanceof L.Marker || i.layer instanceof L.CircleMarker;
- n = a ? i.latlng :this._checkPrioritiySnapping(i);
- var o = this.options.snapDistance, s = {
- marker:r,
- snapLatLng:n,
- segment:i.segment,
- layer:this._layer,
- layerInteractedWith:i.layer,
- distance:i.distance
- };
- if (s.marker.fire("pm:snapdrag", s), this._layer.fire("pm:snapdrag", s), i.distance < o) {
- r.setLatLng(n), r._snapped = !0;
- var l = this._snapLatLng || {}, h = n || {};
- l.lat === h.lat && l.lng === h.lng || (e._snapLatLng = n, r.fire("pm:snap", s),
- e._layer.fire("pm:snap", s));
- } else this._snapLatLng && (this._unsnap(s), r._snapped = !1, s.marker.fire("pm:unsnap", s),
- this._layer.fire("pm:unsnap", s));
- return !0;
- },
- _checkPrioritiySnapping:function(t) {
- var e, n = this._map, i = t.segment[0], a = t.segment[1], o = t.latlng, s = this._getDistance(n, i, o), l = this._getDistance(n, a, o), h = s < l ? i :a, u = s < l ? s :l;
- if (this.options.snapMiddle) {
- var c = r.a.calcMiddleLatLng(n, i, a), p = this._getDistance(n, c, o);
- p < s && p < l && (h = c, u = p);
- }
- return e = u < this.options.snapDistance ? h :o, Object.assign({}, e);
- },
- _createSnapList:function() {
- var t = this, e = [], n = [], r = this._map;
- r.off("pm:remove", this._handleSnapLayerRemoval, this), r.on("pm:remove", this._handleSnapLayerRemoval, this),
- r.eachLayer(function(t) {
- if (t instanceof L.Polyline || t instanceof L.Marker || t instanceof L.CircleMarker) {
- e.push(t);
- var r = L.polyline([], {
- color:"red",
- pmIgnore:!0
- });
- n.push(r);
- }
- }), e = (e = (e = e.filter(function(e) {
- return t._layer !== e;
- })).filter(function(t) {
- return t._latlng || t._latlngs && t._latlngs.length > 0;
- })).filter(function(t) {
- return !t._pmTempLayer;
- }), this._otherSnapLayers ? this._snapList = e.concat(this._otherSnapLayers) :this._snapList = e,
- this.debugIndicatorLines = n;
- },
- _calcClosestLayer:function(t, e) {
- var n = this, r = {};
- return e.forEach(function(e, i) {
- var a = n._calcLayerDistances(t, e);
- n.debugIndicatorLines[i].setLatLngs([ t, a.latlng ]), (r.distance === undefined || a.distance < r.distance) && ((r = a).layer = e);
- }), r;
- },
- _calcLayerDistances:function(t, e) {
- var n, r, i = this, a = this._map, o = e instanceof L.Marker || e instanceof L.CircleMarker, s = e instanceof L.Polygon, l = t, h = o ? e.getLatLng() :e.getLatLngs();
- if (o) return {
- latlng:Object.assign({}, h),
- distance:this._getDistance(a, h, l)
- };
- !function c(t) {
- t.forEach(function(e, o) {
- if (Array.isArray(e)) c(e); else {
- var h, u = e;
- h = s ? o + 1 === t.length ? 0 :o + 1 :o + 1 === t.length ? undefined :o + 1;
- var p = t[h];
- if (p) {
- var f = i._getDistanceToSegment(a, l, u, p);
- (r === undefined || f < r) && (r = f, n = [ u, p ]);
- }
- }
- });
- }(h);
- var u = this._getClosestPointOnSegment(a, t, n[0], n[1]);
- return {
- latlng:Object.assign({}, u),
- segment:n,
- distance:r
- };
- },
- _getClosestPointOnSegment:function(t, e, n, r) {
- var i = t.getMaxZoom();
- i === Infinity && (i = t.getZoom());
- var a = t.project(e, i), o = t.project(n, i), s = t.project(r, i), l = L.LineUtil.closestPointOnSegment(a, o, s);
- return t.unproject(l, i);
- },
- _getDistanceToSegment:function(t, e, n, r) {
- var i = t.latLngToLayerPoint(e), a = t.latLngToLayerPoint(n), o = t.latLngToLayerPoint(r);
- return L.LineUtil.pointToSegmentDistance(i, a, o);
- },
- _getDistance:function(t, e, n) {
- return t.latLngToLayerPoint(e).distanceTo(t.latLngToLayerPoint(n));
- }
- };
- e.a = i;
- }, function(t, e, n) {
- "use strict";
- e.a = {
- calcMiddleLatLng:function(t, e, n) {
- var r = t.project(e), i = t.project(n);
- return t.unproject(r._add(i)._divideBy(2));
- }
- };
- }, function(t, e, n) {
- "use strict";
- Object.defineProperty(e, "__esModule", {
- value:!0
- });
- var r = n(2);
- function i(t, e, n, r, i, a, o, s) {
- var l, h, u, c, p = {
- x:null,
- y:null,
- onLine1:!1,
- onLine2:!1
- };
- return 0 === (l = (s - a) * (n - t) - (o - i) * (r - e)) ? null !== p.x && null !== p.y && p :(c = (n - t) * (h = e - a) - (r - e) * (u = t - i),
- h = ((o - i) * h - (s - a) * u) / l, u = c / l, p.x = t + h * (n - t), p.y = e + h * (r - e),
- h >= 0 && h <= 1 && (p.onLine1 = !0), u >= 0 && u <= 1 && (p.onLine2 = !0), !(!p.onLine1 || !p.onLine2) && [ p.x, p.y ]);
- }
- e["default"] = function(t) {
- var e, n, a = {
- type:"FeatureCollection",
- features:[]
- };
- if ("LineString" === (n = "Feature" === t.type ? t.geometry :t).type) e = [ n.coordinates ]; else if ("MultiLineString" === n.type) e = n.coordinates; else if ("MultiPolygon" === n.type) e = [].concat.apply([], n.coordinates); else {
- if ("Polygon" !== n.type) throw new Error("Input must be a LineString, MultiLineString, Polygon, or MultiPolygon Feature or Geometry");
- e = n.coordinates;
- }
- return e.forEach(function(t) {
- e.forEach(function(e) {
- for (var n = 0; n < t.length - 1; n++) for (var o = n; o < e.length - 1; o++) {
- if (t === e) {
- if (1 === Math.abs(n - o)) continue;
- if (0 === n && o === t.length - 2 && t[n][0] === t[t.length - 1][0] && t[n][1] === t[t.length - 1][1]) continue;
- }
- var s = i(t[n][0], t[n][1], t[n + 1][0], t[n + 1][1], e[o][0], e[o][1], e[o + 1][0], e[o + 1][1]);
- s && a.features.push(r.point([ s[0], s[1] ]));
- }
- });
- }), a;
- };
- }, function(t, e, n) {
- "use strict";
- Object.defineProperty(e, "__esModule", {
- value:!0
- });
- var r = n(2);
- e.getCoord = function(t) {
- if (!t) throw new Error("coord is required");
- if (!Array.isArray(t)) {
- if ("Feature" === t.type && null !== t.geometry && "Point" === t.geometry.type) return t.geometry.coordinates;
- if ("Point" === t.type) return t.coordinates;
- }
- if (Array.isArray(t) && t.length >= 2 && !Array.isArray(t[0]) && !Array.isArray(t[1])) return t;
- throw new Error("coord must be GeoJSON Point or an Array of numbers");
- }, e.getCoords = function(t) {
- if (Array.isArray(t)) return t;
- if ("Feature" === t.type) {
- if (null !== t.geometry) return t.geometry.coordinates;
- } else if (t.coordinates) return t.coordinates;
- throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array");
- }, e.containsNumber = function i(t) {
- if (t.length > 1 && r.isNumber(t[0]) && r.isNumber(t[1])) return !0;
- if (Array.isArray(t[0]) && t[0].length) return i(t[0]);
- throw new Error("coordinates must only contain numbers");
- }, e.geojsonType = function(t, e, n) {
- if (!e || !n) throw new Error("type and name required");
- if (!t || t.type !== e) throw new Error("Invalid input to " + n + ": must be a " + e + ", given " + t.type);
- }, e.featureOf = function(t, e, n) {
- if (!t) throw new Error("No feature passed");
- if (!n) throw new Error(".featureOf() requires a name");
- if (!t || "Feature" !== t.type || !t.geometry) throw new Error("Invalid input to " + n + ", Feature with geometry required");
- if (!t.geometry || t.geometry.type !== e) throw new Error("Invalid input to " + n + ": must be a " + e + ", given " + t.geometry.type);
- }, e.collectionOf = function(t, e, n) {
- if (!t) throw new Error("No featureCollection passed");
- if (!n) throw new Error(".collectionOf() requires a name");
- if (!t || "FeatureCollection" !== t.type) throw new Error("Invalid input to " + n + ", FeatureCollection required");
- for (var r = 0, i = t.features; r < i.length; r++) {
- var a = i[r];
- if (!a || "Feature" !== a.type || !a.geometry) throw new Error("Invalid input to " + n + ", Feature with geometry required");
- if (!a.geometry || a.geometry.type !== e) throw new Error("Invalid input to " + n + ": must be a " + e + ", given " + a.geometry.type);
- }
- }, e.getGeom = function(t) {
- return "Feature" === t.type ? t.geometry :t;
- }, e.getType = function(t, e) {
- return "FeatureCollection" === t.type ? "FeatureCollection" :"GeometryCollection" === t.type ? "GeometryCollection" :"Feature" === t.type && null !== t.geometry ? t.geometry.type :t.type;
- };
- }, function(t, e, n) {
- !function(t, n) {
- n(e);
- }(0, function(t) {
- "use strict";
- function e(t, e) {
- return t > e ? 1 :t < e ? -1 :0;
- }
- var n = function(t, n) {
- void 0 === t && (t = e), void 0 === n && (n = !1), this._compare = t, this._root = null,
- this._size = 0, this._noDuplicates = !!n;
- }, r = {
- size:{
- configurable:!0
- }
- };
- n.prototype.rotateLeft = function(t) {
- var e = t.right;
- e && (t.right = e.left, e.left && (e.left.parent = t), e.parent = t.parent), t.parent ? t === t.parent.left ? t.parent.left = e :t.parent.right = e :this._root = e,
- e && (e.left = t), t.parent = e;
- }, n.prototype.rotateRight = function(t) {
- var e = t.left;
- e && (t.left = e.right, e.right && (e.right.parent = t), e.parent = t.parent), t.parent ? t === t.parent.left ? t.parent.left = e :t.parent.right = e :this._root = e,
- e && (e.right = t), t.parent = e;
- }, n.prototype._splay = function(t) {
- for (;t.parent; ) {
- var e = t.parent;
- e.parent ? e.left === t && e.parent.left === e ? (this.rotateRight(e.parent), this.rotateRight(e)) :e.right === t && e.parent.right === e ? (this.rotateLeft(e.parent),
- this.rotateLeft(e)) :e.left === t && e.parent.right === e ? (this.rotateRight(e),
- this.rotateLeft(e)) :(this.rotateLeft(e), this.rotateRight(e)) :e.left === t ? this.rotateRight(e) :this.rotateLeft(e);
- }
- }, n.prototype.splay = function(t) {
- for (var e, n, r, i, a; t.parent; ) (n = (e = t.parent).parent) && n.parent ? ((r = n.parent).left === n ? r.left = t :r.right = t,
- t.parent = r) :(t.parent = null, this._root = t), i = t.left, a = t.right, t === e.left ? (n && (n.left === e ? (e.right ? (n.left = e.right,
- n.left.parent = n) :n.left = null, e.right = n, n.parent = e) :(i ? (n.right = i,
- i.parent = n) :n.right = null, t.left = n, n.parent = t)), a ? (e.left = a, a.parent = e) :e.left = null,
- t.right = e, e.parent = t) :(n && (n.right === e ? (e.left ? (n.right = e.left,
- n.right.parent = n) :n.right = null, e.left = n, n.parent = e) :(a ? (n.left = a,
- a.parent = n) :n.left = null, t.right = n, n.parent = t)), i ? (e.right = i, i.parent = e) :e.right = null,
- t.left = e, e.parent = t);
- }, n.prototype.replace = function(t, e) {
- t.parent ? t === t.parent.left ? t.parent.left = e :t.parent.right = e :this._root = e,
- e && (e.parent = t.parent);
- }, n.prototype.minNode = function(t) {
- if (void 0 === t && (t = this._root), t) for (;t.left; ) t = t.left;
- return t;
- }, n.prototype.maxNode = function(t) {
- if (void 0 === t && (t = this._root), t) for (;t.right; ) t = t.right;
- return t;
- }, n.prototype.insert = function(t, e) {
- var n = this._root, r = null, i = this._compare;
- if (this._noDuplicates) for (;n; ) {
- if (r = n, 0 === i(n.key, t)) return;
- n = i(n.key, t) < 0 ? n.right :n.left;
- } else for (;n; ) r = n, n = i(n.key, t) < 0 ? n.right :n.left;
- return n = {
- key:t,
- data:e,
- left:null,
- right:null,
- parent:r
- }, r ? i(r.key, n.key) < 0 ? r.right = n :r.left = n :this._root = n, this.splay(n),
- this._size++, n;
- }, n.prototype.find = function(t) {
- for (var e = this._root, n = this._compare; e; ) {
- var r = n(e.key, t);
- if (r < 0) e = e.right; else {
- if (!(r > 0)) return e;
- e = e.left;
- }
- }
- return null;
- }, n.prototype.contains = function(t) {
- for (var e = this._root, n = this._compare; e; ) {
- var r = n(t, e.key);
- if (0 === r) return !0;
- e = r < 0 ? e.left :e.right;
- }
- return !1;
- }, n.prototype.remove = function(t) {
- var e = this.find(t);
- if (!e) return !1;
- if (this.splay(e), e.left) if (e.right) {
- var n = this.minNode(e.right);
- n.parent !== e && (this.replace(n, n.right), n.right = e.right, n.right.parent = n),
- this.replace(e, n), n.left = e.left, n.left.parent = n;
- } else this.replace(e, e.left); else this.replace(e, e.right);
- return this._size--, !0;
- }, n.prototype.removeNode = function(t) {
- if (!t) return !1;
- if (this.splay(t), t.left) if (t.right) {
- var e = this.minNode(t.right);
- e.parent !== t && (this.replace(e, e.right), e.right = t.right, e.right.parent = e),
- this.replace(t, e), e.left = t.left, e.left.parent = e;
- } else this.replace(t, t.left); else this.replace(t, t.right);
- return this._size--, !0;
- }, n.prototype.erase = function(t) {
- var e = this.find(t);
- if (e) {
- this.splay(e);
- var n = e.left, r = e.right, i = null;
- n && (n.parent = null, i = this.maxNode(n), this.splay(i), this._root = i), r && (n ? i.right = r :this._root = r,
- r.parent = i), this._size--;
- }
- }, n.prototype.pop = function() {
- var t = this._root, e = null;
- if (t) {
- for (;t.left; ) t = t.left;
- e = {
- key:t.key,
- data:t.data
- }, this.remove(t.key);
- }
- return e;
- }, n.prototype.next = function(t) {
- var e = t;
- if (e) if (e.right) for (e = e.right; e && e.left; ) e = e.left; else for (e = t.parent; e && e.right === t; ) t = e,
- e = e.parent;
- return e;
- }, n.prototype.prev = function(t) {
- var e = t;
- if (e) if (e.left) for (e = e.left; e && e.right; ) e = e.right; else for (e = t.parent; e && e.left === t; ) t = e,
- e = e.parent;
- return e;
- }, n.prototype.forEach = function(t) {
- for (var e = this._root, n = [], r = !1, i = 0; !r; ) e ? (n.push(e), e = e.left) :n.length > 0 ? (t(e = n.pop(), i++),
- e = e.right) :r = !0;
- return this;
- }, n.prototype.range = function(t, e, n, r) {
- for (var i = [], a = this._compare, o = this._root; 0 !== i.length || o; ) if (o) i.push(o),
- o = o.left; else {
- if (a((o = i.pop()).key, e) > 0) break;
- if (a(o.key, t) >= 0 && n.call(r, o)) return this;
- o = o.right;
- }
- return this;
- }, n.prototype.keys = function() {
- for (var t = this._root, e = [], n = [], r = !1; !r; ) t ? (e.push(t), t = t.left) :e.length > 0 ? (t = e.pop(),
- n.push(t.key), t = t.right) :r = !0;
- return n;
- }, n.prototype.values = function() {
- for (var t = this._root, e = [], n = [], r = !1; !r; ) t ? (e.push(t), t = t.left) :e.length > 0 ? (t = e.pop(),
- n.push(t.data), t = t.right) :r = !0;
- return n;
- }, n.prototype.at = function(t) {
- for (var e = this._root, n = [], r = !1, i = 0; !r; ) if (e) n.push(e), e = e.left; else if (n.length > 0) {
- if (e = n.pop(), i === t) return e;
- i++, e = e.right;
- } else r = !0;
- return null;
- }, n.prototype.load = function(t, e, n) {
- if (void 0 === t && (t = []), void 0 === e && (e = []), void 0 === n && (n = !1),
- 0 !== this._size) throw new Error("bulk-load: tree is not empty");
- var r = t.length;
- return n && function i(t, e, n, r, a) {
- if (n >= r) return;
- var o = t[n + r >> 1];
- var s = n - 1;
- var l = r + 1;
- for (;;) {
- do {
- s++;
- } while (a(t[s], o) < 0);
- do {
- l--;
- } while (a(t[l], o) > 0);
- if (s >= l) break;
- var h = t[s];
- t[s] = t[l], t[l] = h, h = e[s], e[s] = e[l], e[l] = h;
- }
- i(t, e, n, l, a);
- i(t, e, l + 1, r, a);
- }(t, e, 0, r - 1, this._compare), this._root = function a(t, e, n, r, i) {
- var o = i - r;
- if (o > 0) {
- var s = r + Math.floor(o / 2), l = e[s], h = n[s], u = {
- key:l,
- data:h,
- parent:t
- };
- return u.left = a(u, e, n, r, s), u.right = a(u, e, n, s + 1, i), u;
- }
- return null;
- }(null, t, e, 0, r), this._size = r, this;
- }, n.prototype.min = function() {
- var t = this.minNode(this._root);
- return t ? t.key :null;
- }, n.prototype.max = function() {
- var t = this.maxNode(this._root);
- return t ? t.key :null;
- }, n.prototype.isEmpty = function() {
- return null === this._root;
- }, r.size.get = function() {
- return this._size;
- }, n.createTree = function(t, e, r, i, a) {
- return new n(r, a).load(t, e, i);
- }, Object.defineProperties(n.prototype, r);
- var i = 0, a = 1, o = 2, s = 3, l = 0, h = 1, u = 2, c = 3;
- function p(t, e, n) {
- null === e ? (t.inOut = !1, t.otherInOut = !0) :(t.isSubject === e.isSubject ? (t.inOut = !e.inOut,
- t.otherInOut = e.otherInOut) :(t.inOut = !e.otherInOut, t.otherInOut = e.isVertical() ? !e.inOut :e.inOut),
- e && (t.prevInResult = !f(e, n) || e.isVertical() ? e.prevInResult :e)), t.inResult = f(t, n);
- }
- function f(t, e) {
- switch (t.type) {
- case i:
- switch (e) {
- case l:
- return !t.otherInOut;
- case h:
- return t.otherInOut;
- case u:
- return t.isSubject && t.otherInOut || !t.isSubject && !t.otherInOut;
- case c:
- return !0;
- }
- break;
- case o:
- return e === l || e === h;
- case s:
- return e === u;
- case a:
- return !1;
- }
- return !1;
- }
- var d = function(t, e, n, r, a) {
- this.left = e, this.point = t, this.otherEvent = n, this.isSubject = r, this.type = a || i,
- this.inOut = !1, this.otherInOut = !1, this.prevInResult = null, this.inResult = !1,
- this.resultInOut = !1, this.isExteriorRing = !0;
- };
- function g(t, e) {
- return t[0] === e[0] && t[1] === e[1];
- }
- function _(t, e, n) {
- return (t[0] - n[0]) * (e[1] - n[1]) - (e[0] - n[0]) * (t[1] - n[1]);
- }
- function m(t, e) {
- var n = t.point, r = e.point;
- return n[0] > r[0] ? 1 :n[0] < r[0] ? -1 :n[1] !== r[1] ? n[1] > r[1] ? 1 :-1 :function(t, e, n, r) {
- if (t.left !== e.left) return t.left ? 1 :-1;
- if (0 !== _(n, t.otherEvent.point, e.otherEvent.point)) return t.isBelow(e.otherEvent.point) ? -1 :1;
- return !t.isSubject && e.isSubject ? 1 :-1;
- }(t, e, n);
- }
- function y(t, e, n) {
- var r = new d(e, !1, t, t.isSubject), i = new d(e, !0, t.otherEvent, t.isSubject);
- return g(t.point, t.otherEvent.point) && console.warn("what is that, a collapsed segment?", t),
- r.contourId = i.contourId = t.contourId, m(i, t.otherEvent) > 0 && (t.otherEvent.left = !0,
- i.left = !1), t.otherEvent.otherEvent = i, t.otherEvent = r, n.push(i), n.push(r),
- n;
- }
- function v(t, e) {
- return t[0] * e[1] - t[1] * e[0];
- }
- function L(t, e) {
- return t[0] * e[0] + t[1] * e[1];
- }
- function b(t, e, n) {
- var r = function(t, e, n, r, i) {
- var a = [ e[0] - t[0], e[1] - t[1] ], o = [ r[0] - n[0], r[1] - n[1] ];
- function s(t, e, n) {
- return [ t[0] + e * n[0], t[1] + e * n[1] ];
- }
- var l = [ n[0] - t[0], n[1] - t[1] ], h = v(a, o), u = h * h, c = L(a, a);
- if (u > 0) {
- var p = v(l, o) / h;
- if (p < 0 || p > 1) return null;
- var f = v(l, a) / h;
- return f < 0 || f > 1 ? null :0 === p || 1 === p ? i ? null :[ s(t, p, a) ] :0 === f || 1 === f ? i ? null :[ s(n, f, o) ] :[ s(t, p, a) ];
- }
- if ((u = (h = v(l, a)) * h) > 0) return null;
- var d = L(a, l) / c, g = d + L(a, o) / c, _ = Math.min(d, g), m = Math.max(d, g);
- return _ <= 1 && m >= 0 ? 1 === _ ? i ? null :[ s(t, _ > 0 ? _ :0, a) ] :0 === m ? i ? null :[ s(t, m < 1 ? m :1, a) ] :i && 0 === _ && 1 === m ? null :[ s(t, _ > 0 ? _ :0, a), s(t, m < 1 ? m :1, a) ] :null;
- }(t.point, t.otherEvent.point, e.point, e.otherEvent.point), i = r ? r.length :0;
- if (0 === i) return 0;
- if (1 === i && (g(t.point, e.point) || g(t.otherEvent.point, e.otherEvent.point))) return 0;
- if (2 === i && t.isSubject === e.isSubject) return 0;
- if (1 === i) return g(t.point, r[0]) || g(t.otherEvent.point, r[0]) || y(t, r[0], n),
- g(e.point, r[0]) || g(e.otherEvent.point, r[0]) || y(e, r[0], n), 1;
- var l = [], h = !1, u = !1;
- return g(t.point, e.point) ? h = !0 :1 === m(t, e) ? l.push(e, t) :l.push(t, e),
- g(t.otherEvent.point, e.otherEvent.point) ? u = !0 :1 === m(t.otherEvent, e.otherEvent) ? l.push(e.otherEvent, t.otherEvent) :l.push(t.otherEvent, e.otherEvent),
- h && u || h ? (e.type = a, t.type = e.inOut === t.inOut ? o :s, h && !u && y(l[1].otherEvent, l[0].point, n),
- 2) :u ? (y(l[0], l[1].point, n), 3) :l[0] !== l[3].otherEvent ? (y(l[0], l[1].point, n),
- y(l[1], l[2].point, n), 3) :(y(l[0], l[1].point, n), y(l[3].otherEvent, l[2].point, n),
- 3);
- }
- function k(t, e) {
- if (t === e) return 0;
- if (0 !== _(t.point, t.otherEvent.point, e.point) || 0 !== _(t.point, t.otherEvent.point, e.otherEvent.point)) return g(t.point, e.point) ? t.isBelow(e.otherEvent.point) ? -1 :1 :t.point[0] === e.point[0] ? t.point[1] < e.point[1] ? -1 :1 :1 === m(t, e) ? e.isAbove(t.point) ? -1 :1 :t.isBelow(e.point) ? -1 :1;
- if (t.isSubject !== e.isSubject) return t.isSubject ? -1 :1;
- var n = t.point, r = e.point;
- return n[0] === r[0] && n[1] === r[1] ? (n = t.otherEvent.point, r = e.otherEvent.point,
- n[0] === r[0] && n[1] === r[1] ? 0 :t.contourId > e.contourId ? 1 :-1) :1 === m(t, e) ? 1 :-1;
- }
- function M(t, e, n, r) {
- var i = t + 1, a = e.length;
- if (i > a - 1) return t - 1;
- for (var o = e[t].point, s = e[i].point; i < a && s[0] === o[0] && s[1] === o[1]; ) {
- if (!n[i]) return i;
- s = e[++i].point;
- }
- for (i = t - 1; n[i] && i >= r; ) i--;
- return i;
- }
- function w(t, e) {
- var n, r, i, a = function(t) {
- var e, n, r, i, a = [];
- for (n = 0, r = t.length; n < r; n++) ((e = t[n]).left && e.inResult || !e.left && e.otherEvent.inResult) && a.push(e);
- for (var o = !1; !o; ) for (o = !0, n = 0, r = a.length; n < r; n++) n + 1 < r && 1 === m(a[n], a[n + 1]) && (i = a[n],
- a[n] = a[n + 1], a[n + 1] = i, o = !1);
- for (n = 0, r = a.length; n < r; n++) (e = a[n]).pos = n;
- for (n = 0, r = a.length; n < r; n++) (e = a[n]).left || (i = e.pos, e.pos = e.otherEvent.pos,
- e.otherEvent.pos = i);
- return a;
- }(t), o = {}, s = [];
- for (n = 0, r = a.length; n < r; n++) if (!o[n]) {
- var l = [ [] ];
- a[n].isExteriorRing ? e === u && !a[n].isSubject && s.length > 1 ? s[s.length - 1].push(l[0]) :s.push(l) :e !== u || a[n].isSubject || 0 !== s.length ? 0 === s.length ? s.push([ [ l ] ]) :s[s.length - 1].push(l[0]) :s.push(l);
- var h = s.length - 1, c = n, p = a[n].point;
- for (l[0].push(p); c >= n; ) i = a[c], o[c] = !0, i.left ? (i.resultInOut = !1,
- i.contourId = h) :(i.otherEvent.resultInOut = !0, i.otherEvent.contourId = h), o[c = i.pos] = !0,
- l[0].push(a[c].point), c = M(c, a, o, n);
- i = a[c = -1 === c ? n :c], o[c] = o[i.pos] = !0, i.otherEvent.resultInOut = !0,
- i.otherEvent.contourId = h;
- }
- return s;
- }
- d.prototype.isBelow = function(t) {
- var e = this.point, n = this.otherEvent.point;
- return this.left ? (e[0] - t[0]) * (n[1] - t[1]) - (n[0] - t[0]) * (e[1] - t[1]) > 0 :(n[0] - t[0]) * (e[1] - t[1]) - (e[0] - t[0]) * (n[1] - t[1]) > 0;
- }, d.prototype.isAbove = function(t) {
- return !this.isBelow(t);
- }, d.prototype.isVertical = function() {
- return this.point[0] === this.otherEvent.point[0];
- }, d.prototype.clone = function() {
- var t = new d(this.point, this.left, this.otherEvent, this.isSubject, this.type);
- return t.inResult = this.inResult, t.prevInResult = this.prevInResult, t.isExteriorRing = this.isExteriorRing,
- t.inOut = this.inOut, t.otherInOut = this.otherInOut, t;
- };
- var E = x, S = x;
- function x(t, e) {
- if (!(this instanceof x)) return new x(t, e);
- if (this.data = t || [], this.length = this.data.length, this.compare = e || C,
- this.length > 0) for (var n = (this.length >> 1) - 1; n >= 0; n--) this._down(n);
- }
- function C(t, e) {
- return t < e ? -1 :t > e ? 1 :0;
- }
- x.prototype = {
- push:function(t) {
- this.data.push(t), this.length++, this._up(this.length - 1);
- },
- pop:function() {
- if (0 === this.length) return undefined;
- var t = this.data[0];
- return this.length--, this.length > 0 && (this.data[0] = this.data[this.length],
- this._down(0)), this.data.pop(), t;
- },
- peek:function() {
- return this.data[0];
- },
- _up:function(t) {
- for (var e = this.data, n = this.compare, r = e[t]; t > 0; ) {
- var i = t - 1 >> 1, a = e[i];
- if (n(r, a) >= 0) break;
- e[t] = a, t = i;
- }
- e[t] = r;
- },
- _down:function(t) {
- for (var e = this.data, n = this.compare, r = this.length >> 1, i = e[t]; t < r; ) {
- var a = 1 + (t << 1), o = a + 1, s = e[a];
- if (o < this.length && n(e[o], s) < 0 && (a = o, s = e[o]), n(s, i) >= 0) break;
- e[t] = s, t = a;
- }
- e[t] = i;
- }
- }, E["default"] = S;
- var P = Math.max, O = Math.min, I = 0;
- function D(t, e, n, r, i, a) {
- var o, s, l, h, u, c;
- for (o = 0, s = t.length - 1; o < s; o++) if (l = t[o], h = t[o + 1], u = new d(l, !1, undefined, e),
- c = new d(h, !1, u, e), u.otherEvent = c, l[0] !== h[0] || l[1] !== h[1]) {
- u.contourId = c.contourId = n, a || (u.isExteriorRing = !1, c.isExteriorRing = !1),
- m(u, c) > 0 ? c.left = !0 :u.left = !0;
- var p = l[0], f = l[1];
- i[0] = O(i[0], p), i[1] = O(i[1], f), i[2] = P(i[2], p), i[3] = P(i[3], f), r.push(u),
- r.push(c);
- }
- }
- var T = [];
- function j(t, e, r) {
- "number" == typeof t[0][0][0] && (t = [ t ]), "number" == typeof e[0][0][0] && (e = [ e ]);
- var i = function(t, e, n) {
- var r = null;
- return t.length * e.length == 0 && (n === l ? r = T :n === u ? r = t :n !== h && n !== c || (r = 0 === t.length ? e :t)),
- r;
- }(t, e, r);
- if (i) return i === T ? null :i;
- var a = [ Infinity, Infinity, -Infinity, -Infinity ], o = [ Infinity, Infinity, -Infinity, -Infinity ], s = function(t, e, n, r, i) {
- var a, o, s, l, h, c, p = new E(null, m);
- for (s = 0, l = t.length; s < l; s++) for (h = 0, c = (a = t[s]).length; h < c; h++) (o = 0 === h) && I++,
- D(a[h], !0, I, p, n, o);
- for (s = 0, l = e.length; s < l; s++) for (h = 0, c = (a = e[s]).length; h < c; h++) o = 0 === h,
- i === u && (o = !1), o && I++, D(a[h], !1, I, p, r, o);
- return p;
- }(t, e, a, o, r);
- return (i = function(t, e, n, r, i) {
- var a = null;
- return (n[0] > r[2] || r[0] > n[2] || n[1] > r[3] || r[1] > n[3]) && (i === l ? a = T :i === u ? a = t :i !== h && i !== c || (a = t.concat(e))),
- a;
- }(t, e, a, o, r)) ? i === T ? null :i :w(function(t, e, r, i, a, o) {
- for (var s, h, c, f = new n(k), d = [], g = Math.min(i[2], a[2]); 0 !== t.length; ) {
- var _ = t.pop();
- if (d.push(_), o === l && _.point[0] > g || o === u && _.point[0] > i[2]) break;
- if (_.left) {
- h = s = f.insert(_), s = s !== (c = f.minNode()) ? f.prev(s) :null, h = f.next(h);
- var m = s ? s.key :null;
- if (p(_, m, o), h && 2 === b(_, h.key, t) && (p(_, m, o), p(_, h.key, o)), s && 2 === b(s.key, _, t)) {
- var y = s;
- p(m, (y = y !== c ? f.prev(y) :null) ? y.key :null, o), p(_, m, o);
- }
- } else _ = _.otherEvent, h = s = f.find(_), s && h && (s = s !== c ? f.prev(s) :null,
- h = f.next(h), f.remove(_), h && s && b(s.key, h.key, t));
- }
- return d;
- }(s, 0, 0, a, o, r), r);
- }
- var R = {
- UNION:h,
- DIFFERENCE:u,
- INTERSECTION:l,
- XOR:c
- };
- t.union = function(t, e) {
- return j(t, e, h);
- }, t.diff = function(t, e) {
- return j(t, e, u);
- }, t.xor = function(t, e) {
- return j(t, e, c);
- }, t.intersection = function(t, e) {
- return j(t, e, l);
- }, t.operations = R, Object.defineProperty(t, "__esModule", {
- value:!0
- });
- });
- }, function(t, e, n) {
- "use strict";
- Object.defineProperty(e, "__esModule", {
- value:!0
- });
- var r = n(2);
- function i(t, e, n) {
- if (null !== t) for (var r, a, o, s, l, h, u, c, p = 0, f = 0, d = t.type, g = "FeatureCollection" === d, _ = "Feature" === d, m = g ? t.features.length :1, y = 0; y < m; y++) {
- l = (c = !!(u = g ? t.features[y].geometry :_ ? t.geometry :t) && "GeometryCollection" === u.type) ? u.geometries.length :1;
- for (var v = 0; v < l; v++) {
- var L = 0, b = 0;
- if (null !== (s = c ? u.geometries[v] :u)) {
- h = s.coordinates;
- var k = s.type;
- switch (p = !n || "Polygon" !== k && "MultiPolygon" !== k ? 0 :1, k) {
- case null:
- break;
- case "Point":
- if (!1 === e(h, f, y, L, b)) return !1;
- f++, L++;
- break;
- case "LineString":
- case "MultiPoint":
- for (r = 0; r < h.length; r++) {
- if (!1 === e(h[r], f, y, L, b)) return !1;
- f++, "MultiPoint" === k && L++;
- }
- "LineString" === k && L++;
- break;
- case "Polygon":
- case "MultiLineString":
- for (r = 0; r < h.length; r++) {
- for (a = 0; a < h[r].length - p; a++) {
- if (!1 === e(h[r][a], f, y, L, b)) return !1;
- f++;
- }
- "MultiLineString" === k && L++, "Polygon" === k && b++;
- }
- "Polygon" === k && L++;
- break;
- case "MultiPolygon":
- for (r = 0; r < h.length; r++) {
- for (b = 0, a = 0; a < h[r].length; a++) {
- for (o = 0; o < h[r][a].length - p; o++) {
- if (!1 === e(h[r][a][o], f, y, L, b)) return !1;
- f++;
- }
- b++;
- }
- L++;
- }
- break;
- case "GeometryCollection":
- for (r = 0; r < s.geometries.length; r++) if (!1 === i(s.geometries[r], e, n)) return !1;
- break;
- default:
- throw new Error("Unknown Geometry Type");
- }
- }
- }
- }
- }
- function a(t, e) {
- var n;
- switch (t.type) {
- case "FeatureCollection":
- for (n = 0; n < t.features.length && !1 !== e(t.features[n].properties, n); n++) ;
- break;
- case "Feature":
- e(t.properties, 0);
- }
- }
- function o(t, e) {
- if ("Feature" === t.type) e(t, 0); else if ("FeatureCollection" === t.type) for (var n = 0; n < t.features.length && !1 !== e(t.features[n], n); n++) ;
- }
- function s(t, e) {
- var n, r, i, a, o, s, l, h, u, c, p = 0, f = "FeatureCollection" === t.type, d = "Feature" === t.type, g = f ? t.features.length :1;
- for (n = 0; n < g; n++) {
- for (s = f ? t.features[n].geometry :d ? t.geometry :t, h = f ? t.features[n].properties :d ? t.properties :{},
- u = f ? t.features[n].bbox :d ? t.bbox :undefined, c = f ? t.features[n].id :d ? t.id :undefined,
- o = (l = !!s && "GeometryCollection" === s.type) ? s.geometries.length :1, i = 0; i < o; i++) if (null !== (a = l ? s.geometries[i] :s)) switch (a.type) {
- case "Point":
- case "LineString":
- case "MultiPoint":
- case "Polygon":
- case "MultiLineString":
- case "MultiPolygon":
- if (!1 === e(a, p, h, u, c)) return !1;
- break;
- case "GeometryCollection":
- for (r = 0; r < a.geometries.length; r++) if (!1 === e(a.geometries[r], p, h, u, c)) return !1;
- break;
- default:
- throw new Error("Unknown Geometry Type");
- } else if (!1 === e(null, p, h, u, c)) return !1;
- p++;
- }
- }
- function l(t, e) {
- s(t, function(t, n, i, a, o) {
- var s, l = null === t ? null :t.type;
- switch (l) {
- case null:
- case "Point":
- case "LineString":
- case "Polygon":
- return !1 !== e(r.feature(t, i, {
- bbox:a,
- id:o
- }), n, 0) && void 0;
- }
- switch (l) {
- case "MultiPoint":
- s = "Point";
- break;
- case "MultiLineString":
- s = "LineString";
- break;
- case "MultiPolygon":
- s = "Polygon";
- }
- for (var h = 0; h < t.coordinates.length; h++) {
- var u = {
- type:s,
- coordinates:t.coordinates[h]
- };
- if (!1 === e(r.feature(u, i), n, h)) return !1;
- }
- });
- }
- function h(t, e) {
- l(t, function(t, n, a) {
- var o = 0;
- if (t.geometry) {
- var s = t.geometry.type;
- if ("Point" !== s && "MultiPoint" !== s) {
- var l, h = 0, u = 0, c = 0;
- return !1 !== i(t, function(i, s, p, f, d) {
- if (l === undefined || n > h || f > u || d > c) return l = i, h = n, u = f, c = d,
- void (o = 0);
- var g = r.lineString([ l, i ], t.properties);
- if (!1 === e(g, n, a, d, o)) return !1;
- o++, l = i;
- }) && void 0;
- }
- }
- });
- }
- function u(t, e) {
- if (!t) throw new Error("geojson is required");
- l(t, function(t, n, i) {
- if (null !== t.geometry) {
- var a = t.geometry.type, o = t.geometry.coordinates;
- switch (a) {
- case "LineString":
- if (!1 === e(t, n, i, 0, 0)) return !1;
- break;
- case "Polygon":
- for (var s = 0; s < o.length; s++) if (!1 === e(r.lineString(o[s], t.properties), n, i, s)) return !1;
- }
- }
- });
- }
- e.coordEach = i, e.coordReduce = function(t, e, n, r) {
- var a = n;
- return i(t, function(t, r, i, o, s) {
- a = 0 === r && n === undefined ? t :e(a, t, r, i, o, s);
- }, r), a;
- }, e.propEach = a, e.propReduce = function(t, e, n) {
- var r = n;
- return a(t, function(t, i) {
- r = 0 === i && n === undefined ? t :e(r, t, i);
- }), r;
- }, e.featureEach = o, e.featureReduce = function(t, e, n) {
- var r = n;
- return o(t, function(t, i) {
- r = 0 === i && n === undefined ? t :e(r, t, i);
- }), r;
- }, e.coordAll = function(t) {
- var e = [];
- return i(t, function(t) {
- e.push(t);
- }), e;
- }, e.geomEach = s, e.geomReduce = function(t, e, n) {
- var r = n;
- return s(t, function(t, i, a, o, s) {
- r = 0 === i && n === undefined ? t :e(r, t, i, a, o, s);
- }), r;
- }, e.flattenEach = l, e.flattenReduce = function(t, e, n) {
- var r = n;
- return l(t, function(t, i, a) {
- r = 0 === i && 0 === a && n === undefined ? t :e(r, t, i, a);
- }), r;
- }, e.segmentEach = h, e.segmentReduce = function(t, e, n) {
- var r = n, i = !1;
- return h(t, function(t, a, o, s, l) {
- r = !1 === i && n === undefined ? t :e(r, t, a, o, s, l), i = !0;
- }), r;
- }, e.lineEach = u, e.lineReduce = function(t, e, n) {
- var r = n;
- return u(t, function(t, i, a, o) {
- r = 0 === i && n === undefined ? t :e(r, t, i, a, o);
- }), r;
- }, e.findSegment = function(t, e) {
- if (e = e || {}, !r.isObject(e)) throw new Error("options is invalid");
- var n, i = e.featureIndex || 0, a = e.multiFeatureIndex || 0, o = e.geometryIndex || 0, s = e.segmentIndex || 0, l = e.properties;
- switch (t.type) {
- case "FeatureCollection":
- i < 0 && (i = t.features.length + i), l = l || t.features[i].properties, n = t.features[i].geometry;
- break;
- case "Feature":
- l = l || t.properties, n = t.geometry;
- break;
- case "Point":
- case "MultiPoint":
- return null;
- case "LineString":
- case "Polygon":
- case "MultiLineString":
- case "MultiPolygon":
- n = t;
- break;
- default:
- throw new Error("geojson is invalid");
- }
- if (null === n) return null;
- var h = n.coordinates;
- switch (n.type) {
- case "Point":
- case "MultiPoint":
- return null;
- case "LineString":
- return s < 0 && (s = h.length + s - 1), r.lineString([ h[s], h[s + 1] ], l, e);
- case "Polygon":
- return o < 0 && (o = h.length + o), s < 0 && (s = h[o].length + s - 1), r.lineString([ h[o][s], h[o][s + 1] ], l, e);
- case "MultiLineString":
- return a < 0 && (a = h.length + a), s < 0 && (s = h[a].length + s - 1), r.lineString([ h[a][s], h[a][s + 1] ], l, e);
- case "MultiPolygon":
- return a < 0 && (a = h.length + a), o < 0 && (o = h[a].length + o), s < 0 && (s = h[a][o].length - s - 1),
- r.lineString([ h[a][o][s], h[a][o][s + 1] ], l, e);
- }
- throw new Error("geojson is invalid");
- }, e.findPoint = function(t, e) {
- if (e = e || {}, !r.isObject(e)) throw new Error("options is invalid");
- var n, i = e.featureIndex || 0, a = e.multiFeatureIndex || 0, o = e.geometryIndex || 0, s = e.coordIndex || 0, l = e.properties;
- switch (t.type) {
- case "FeatureCollection":
- i < 0 && (i = t.features.length + i), l = l || t.features[i].properties, n = t.features[i].geometry;
- break;
- case "Feature":
- l = l || t.properties, n = t.geometry;
- break;
- case "Point":
- case "MultiPoint":
- return null;
- case "LineString":
- case "Polygon":
- case "MultiLineString":
- case "MultiPolygon":
- n = t;
- break;
- default:
- throw new Error("geojson is invalid");
- }
- if (null === n) return null;
- var h = n.coordinates;
- switch (n.type) {
- case "Point":
- return r.point(h, l, e);
- case "MultiPoint":
- return a < 0 && (a = h.length + a), r.point(h[a], l, e);
- case "LineString":
- return s < 0 && (s = h.length + s), r.point(h[s], l, e);
- case "Polygon":
- return o < 0 && (o = h.length + o), s < 0 && (s = h[o].length + s), r.point(h[o][s], l, e);
- case "MultiLineString":
- return a < 0 && (a = h.length + a), s < 0 && (s = h[a].length + s), r.point(h[a][s], l, e);
- case "MultiPolygon":
- return a < 0 && (a = h.length + a), o < 0 && (o = h[a].length + o), s < 0 && (s = h[a][o].length - s),
- r.point(h[a][o][s], l, e);
- }
- throw new Error("geojson is invalid");
- };
- }, function(t, e, n) {
- var r = n(8), i = n(45), a = n(46), o = "[object Null]", s = "[object Undefined]", l = r ? r.toStringTag :undefined;
- t.exports = function(t) {
- return null == t ? t === undefined ? s :o :l && l in Object(t) ? i(t) :a(t);
- };
- }, function(t, e, n) {
- var r = n(55), i = n(60);
- t.exports = function(t, e) {
- var n = i(t, e);
- return r(n) ? n :undefined;
- };
- }, function(t, e) {
- t.exports = function(t) {
- var e = typeof t;
- return null != t && ("object" == e || "function" == e);
- };
- }, function(t, e, n) {
- t.exports = n(20);
- }, function(t, e, n) {
- "use strict";
- Object.defineProperty(e, "__esModule", {
- value:!0
- });
- var r = n(21), i = (n.n(r), n(22)), a = (n.n(i), n(23)), o = n(24), s = n(0), l = (n(26),
- n(27), n(28), n(29), n(30), n(31), n(1)), h = (n(36), n(37), n(38), n(82), n(83),
- n(84), n(85)), u = (n.n(h), n(86));
- n.n(u);
- L.PM = L.PM || {
- Map:a.a,
- Toolbar:o.a,
- Draw:s.a,
- Edit:l.a,
- version:i.version,
- initialize:function() {
- this.addInitHooks();
- },
- addInitHooks:function() {
- L.Map.addInitHook(function() {
- this.options.pmIgnore || (this.pm = new L.PM.Map(this));
- }), L.LayerGroup.addInitHook(function() {
- this.pm = new L.PM.Edit.LayerGroup(this);
- }), L.Marker.addInitHook(function() {
- this.options.pmIgnore || (this.pm = new L.PM.Edit.Marker(this));
- }), L.Polyline.addInitHook(function() {
- this.options.pmIgnore || (this.pm = new L.PM.Edit.Line(this));
- }), L.Polygon.addInitHook(function() {
- this.options.pmIgnore || (this.pm = new L.PM.Edit.Poly(this));
- }), L.Rectangle.addInitHook(function() {
- this.options.pmIgnore || (this.pm = new L.PM.Edit.Rectangle(this));
- }), L.Circle.addInitHook(function() {
- this.options.pmIgnore || (this.pm = new L.PM.Edit.Circle(this));
- });
- }
- }, L.PM.initialize();
- }, function(t, e) {
- Array.prototype.findIndex = Array.prototype.findIndex || function(t) {
- if (null === this) throw new TypeError("Array.prototype.findIndex called on null or undefined");
- if ("function" != typeof t) throw new TypeError("callback must be a function");
- for (var e = Object(this), n = e.length >>> 0, r = arguments[1], i = 0; i < n; i++) if (t.call(r, e[i], i, e)) return i;
- return -1;
- }, Array.prototype.find = Array.prototype.find || function(t) {
- if (null === this) throw new TypeError("Array.prototype.find called on null or undefined");
- if ("function" != typeof t) throw new TypeError("callback must be a function");
- for (var e = Object(this), n = e.length >>> 0, r = arguments[1], i = 0; i < n; i++) {
- var a = e[i];
- if (t.call(r, a, i, e)) return a;
- }
- }, "function" != typeof Object.assign && (Object.assign = function(t) {
- "use strict";
- if (null == t) throw new TypeError("Cannot convert undefined or null to object");
- t = Object(t);
- for (var e = 1; e < arguments.length; e++) {
- var n = arguments[e];
- if (null != n) for (var r in n) Object.prototype.hasOwnProperty.call(n, r) && (t[r] = n[r]);
- }
- return t;
- }), [ Element.prototype, CharacterData.prototype, DocumentType.prototype ].forEach(function(t) {
- t.hasOwnProperty("remove") || Object.defineProperty(t, "remove", {
- configurable:!0,
- enumerable:!0,
- writable:!0,
- value:function() {
- this.parentNode.removeChild(this);
- }
- });
- });
- }, function(t, e) {
- t.exports = {
- name:"leaflet.pm",
- version:"1.1.0",
- description:"A Leaflet Plugin For Editing Geometry Layers in Leaflet 1.0",
- keywords:[ "leaflet", "polygon management", "geometry editing", "map data", "map overlay", "polygon", "geojson", "leaflet-draw", "data-field-geojson", "ui-leaflet-draw" ],
- files:[ "dist" ],
- main:"dist/leaflet.pm.min.js",
- dependencies:{
- "@turf/difference":"^6.0.2",
- "@turf/intersect":"^6.1.3",
- "@turf/kinks":"6.x",
- lodash:"^4.17.11"
- },
- devDependencies:{
- "@babel/core":"^7.1.2",
- "@babel/preset-env":"^7.1.0",
- "babel-loader":"^8.0.4",
- "css-loader":"^0.28.11",
- cypress:"^3.1.0",
- eslint:"^4.18.2",
- "eslint-config-airbnb-base":"^12.1.0",
- "eslint-plugin-cypress":"^2.0.1",
- "eslint-plugin-import":"^2.9.0",
- "extract-text-webpack-plugin":"^3.0.2",
- "file-loader":"^0.11.1",
- leaflet:"^1.3.4",
- "style-loader":"^0.19.0",
- "uglifyjs-webpack-plugin":"^1.3.0",
- "url-loader":"^0.6.2",
- webpack:"^3.12.0"
- },
- peerDependencies:{
- leaflet:"^1.2.0"
- },
- scripts:{
- start:"npm run dev",
- dev:"./node_modules/.bin/webpack --config=webpack.dev.js",
- test:"$(npm bin)/cypress run",
- cypress:"$(npm bin)/cypress open",
- build:"./node_modules/.bin/webpack --config=webpack.build.js",
- prepare:"npm run build"
- },
- repository:{
- type:"git",
- url:"git+https://github.com/codeofsumit/leaflet.pm.git"
- },
- author:{
- name:"Sumit Kumar",
- email:"sk@outlook.com",
- url:"http://twitter.com/TweetsOfSumit"
- },
- license:"MIT",
- bugs:{
- url:"https://github.com/codeofsumit/leaflet.pm/issues"
- },
- homepage:"https://leafletpm.now.sh"
- };
- }, function(t, e, n) {
- "use strict";
- var r = L.Class.extend({
- initialize:function(t) {
- var e = this;
- this.map = t, this.Draw = new L.PM.Draw(t), this.Toolbar = new L.PM.Toolbar(t),
- this.map.on("layerremove", function(t) {
- t.layer.pm && !t.layer._pmTempLayer && e.map.fire("pm:remove", t);
- }), this._globalRemovalMode = !1;
- },
- addControls:function(t) {
- this.Toolbar.addControls(t);
- },
- removeControls:function() {
- this.Toolbar.removeControls();
- },
- toggleControls:function() {
- this.Toolbar.toggleControls();
- },
- controlsVisible:function() {
- return this.Toolbar.isVisible;
- },
- enableDraw:function() {
- var t = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] :"Poly", e = arguments.length > 1 ? arguments[1] :undefined;
- this.Draw.enable(t, e);
- },
- disableDraw:function() {
- var t = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] :"Poly";
- this.Draw.disable(t);
- },
- setPathOptions:function(t) {
- this.Draw.setPathOptions(t);
- },
- removeLayer:function(t) {
- var e = t.target;
- e._layers || e.pm && e.pm.dragging() || t.target.remove();
- },
- toggleGlobalRemovalMode:function() {
- var t = this;
- this.globalRemovalEnabled() ? (this._globalRemovalMode = !1, this.map.eachLayer(function(e) {
- e.off("click", t.removeLayer);
- })) :(this._globalRemovalMode = !0, this.map.eachLayer(function(e) {
- !e.pm || e.pm.options && e.pm.options.preventMarkerRemoval || e.on("click", t.removeLayer);
- })), this.Toolbar.toggleButton("deleteLayer", this._globalRemovalMode);
- },
- globalRemovalEnabled:function() {
- return this._globalRemovalMode;
- },
- globalEditEnabled:function() {
- return this._globalEditMode;
- },
- enableGlobalEditMode:function(t) {
- var e = [];
- this.map.eachLayer(function(t) {
- (t instanceof L.Polyline || t instanceof L.Marker || t instanceof L.Circle) && e.push(t);
- }), e = (e = e.filter(function(t) {
- return !!t.pm;
- })).filter(function(t) {
- return !t._pmTempLayer;
- }), this._globalEditMode = !0, e.forEach(function(e) {
- e.pm.enable(t);
- }), this.Toolbar.toggleButton("editPolygon", this._globalEditMode), this._fireEditModeEvent(!0);
- },
- disableGlobalEditMode:function() {
- var t = [];
- this.map.eachLayer(function(e) {
- (e instanceof L.Polyline || e instanceof L.Marker || e instanceof L.Circle) && t.push(e);
- }), t = (t = t.filter(function(t) {
- return !!t.pm;
- })).filter(function(t) {
- return !t._pmTempLayer;
- }), this._globalEditMode = !1, t.forEach(function(t) {
- t.pm.disable();
- }), this.Toolbar.toggleButton("editPolygon", this._globalEditMode), this._fireEditModeEvent(!1);
- },
- _fireEditModeEvent:function(t) {
- this.map.fire("pm:globaleditmodetoggled", {
- enabled:t,
- map:this.map
- });
- },
- toggleGlobalEditMode:function(t) {
- this.globalEditEnabled() ? this.disableGlobalEditMode() :this.enableGlobalEditMode(t);
- }
- });
- e.a = r;
- }, function(t, e, n) {
- "use strict";
- var r = n(25);
- L.Control.PMButton = r.a;
- var i = L.Class.extend({
- options:{
- drawMarker:!0,
- drawPolygon:!0,
- drawPolyline:!0,
- drawCircle:!0,
- drawRectangle:!0,
- editMode:!0,
- cutPolygon:!0,
- dragPolygon:!1,
- removalMode:!0,
- position:"topleft"
- },
- initialize:function(t) {
- this.map = t, this.buttons = {}, this.isVisible = !1, this.container = L.DomUtil.create("div", "leaflet-pm-toolbar leaflet-bar leaflet-control"),
- this._defineButtons();
- },
- getButtons:function() {
- return this.buttons;
- },
- addControls:function() {
- var t = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] :this.options;
- "undefined" != typeof t.editPolygon && (t.editMode = t.editPolygon), "undefined" != typeof t.deleteLayer && (t.removalMode = t.deleteLayer),
- L.Util.setOptions(this, t), this._showHideButtons(), this.isVisible = !0;
- },
- removeControls:function() {
- var t = this.getButtons();
- for (var e in t) t[e].remove();
- this.isVisible = !1;
- },
- toggleControls:function() {
- var t = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] :this.options;
- this.isVisible ? this.removeControls() :this.addControls(t);
- },
- _addButton:function(t, e) {
- return this.buttons[t] = e, this.options[t] = this.options[t] || !1, this.buttons[t];
- },
- triggerClickOnToggledButtons:function(t) {
- for (var e in this.buttons) this.buttons[e] !== t && this.buttons[e].toggled() && this.buttons[e]._triggerClick();
- },
- toggleButton:function(t, e) {
- return "editPolygon" === t && (t = "editMode"), "deleteLayer" === t && (t = "removalMode"),
- this.triggerClickOnToggledButtons(this.buttons[t]), this.buttons[t].toggle(e);
- },
- _defineButtons:function() {
- var t = this, e = {
- className:" leaflet-pm-icon-delete",
- onClick:function() {},
- afterClick:function() {
- t.map.pm.toggleGlobalRemovalMode();
- },
- doToggle:!0,
- toggleStatus:!1,
- disableOtherButtons:!0,
- position:this.options.position,
- actions:[ "cancel" ]
- }, n = {
- className:"leaflet-pm-icon-polygon",
- jsClass:"Poly",
- onClick:function() {},
- afterClick:function() {
- t.map.pm.Draw.Poly.toggle();
- },
- doToggle:!0,
- toggleStatus:!1,
- disableOtherButtons:!0,
- position:this.options.position,
- actions:[ "finish", "removeLastVertex", "cancel" ]
- }, r = {
- className:"leaflet-pm-icon-cut",
- jsClass:"Cut",
- onClick:function() {},
- afterClick:function() {
- t.map.pm.Draw.Cut.toggle({
- snappable:!0,
- cursorMarker:!0,
- allowSelfIntersection:!1
- });
- },
- doToggle:!0,
- toggleStatus:!1,
- disableOtherButtons:!0,
- position:this.options.position,
- actions:[ "finish", "removeLastVertex", "cancel" ]
- }, i = {
- className:"leaflet-pm-icon-marker",
- jsClass:"Marker",
- onClick:function() {},
- afterClick:function() {
- t.map.pm.Draw.Marker.toggle();
- },
- doToggle:!0,
- toggleStatus:!1,
- disableOtherButtons:!0,
- position:this.options.position,
- actions:[ "cancel" ]
- }, a = {
- className:"leaflet-pm-icon-polyline",
- jsClass:"Line",
- onClick:function() {},
- afterClick:function() {
- t.map.pm.Draw.Line.toggle();
- },
- doToggle:!0,
- toggleStatus:!1,
- disableOtherButtons:!0,
- position:this.options.position,
- actions:[ "finish", "removeLastVertex", "cancel" ]
- }, o = {
- className:"leaflet-pm-icon-circle",
- jsClass:"Circle",
- onClick:function() {},
- afterClick:function() {
- t.map.pm.Draw.Circle.toggle();
- },
- doToggle:!0,
- toggleStatus:!1,
- disableOtherButtons:!0,
- position:this.options.position,
- actions:[ "cancel" ]
- }, s = {
- className:"leaflet-pm-icon-rectangle",
- jsClass:"Rectangle",
- onClick:function() {},
- afterClick:function() {
- t.map.pm.Draw.Rectangle.toggle();
- },
- doToggle:!0,
- toggleStatus:!1,
- disableOtherButtons:!0,
- position:this.options.position,
- actions:[ "cancel" ]
- }, l = {
- className:"leaflet-pm-icon-edit",
- onClick:function() {},
- afterClick:function() {
- t.map.pm.toggleGlobalEditMode();
- },
- doToggle:!0,
- toggleStatus:!1,
- disableOtherButtons:!0,
- position:this.options.position,
- actions:[ "cancel" ]
- }, h = {
- className:"leaflet-pm-icon-drag",
- onClick:function() {},
- afterClick:function() {},
- doToggle:!0,
- toggleStatus:!1,
- disableOtherButtons:!0,
- position:this.options.position
- };
- this._addButton("drawMarker", new L.Control.PMButton(i)), this._addButton("drawPolyline", new L.Control.PMButton(a)),
- this._addButton("drawRectangle", new L.Control.PMButton(s)), this._addButton("drawPolygon", new L.Control.PMButton(n)),
- this._addButton("drawCircle", new L.Control.PMButton(o)), this._addButton("cutPolygon", new L.Control.PMButton(r)),
- this._addButton("editMode", new L.Control.PMButton(l)), this._addButton("dragPolygon", new L.Control.PMButton(h)),
- this._addButton("removalMode", new L.Control.PMButton(e));
- },
- _showHideButtons:function() {
- this.removeControls();
- var t = this.getButtons();
- for (var e in t) this.options[e] && (t[e].setPosition(this.options.position), t[e].addTo(this.map));
- }
- });
- e.a = i;
- }, function(t, e, n) {
- "use strict";
- var r = L.Control.extend({
- options:{
- position:"topleft"
- },
- initialize:function(t) {
- this._button = L.Util.setOptions(this, t);
- },
- onAdd:function(t) {
- return this._map = t, this._container = this._map.pm.Toolbar.container, this.buttonsDomNode = this._makeButton(this._button),
- this._container.appendChild(this.buttonsDomNode), this._container;
- },
- onRemove:function() {
- return this.buttonsDomNode.remove(), this._container;
- },
- getText:function() {
- return this._button.text;
- },
- getIconUrl:function() {
- return this._button.iconUrl;
- },
- destroy:function() {
- this._button = {}, this._update();
- },
- toggle:function(t) {
- return this._button.toggleStatus = "boolean" == typeof t ? t :!this._button.toggleStatus,
- this._applyStyleClasses(), this._button.toggleStatus;
- },
- toggled:function() {
- return this._button.toggleStatus;
- },
- onCreate:function() {
- this.toggle(!1);
- },
- _triggerClick:function(t) {
- this._button.onClick(t), this._clicked(t), this._button.afterClick(t);
- },
- _makeButton:function(t) {
- var e = this, n = L.DomUtil.create("div", "button-container", this._container), r = L.DomUtil.create("a", "leaflet-buttons-control-button", n), i = L.DomUtil.create("div", "leaflet-pm-actions-container", n), a = {
- cancel:{
- text:"Cancel",
- onClick:function() {
- this._triggerClick();
- }
- },
- removeLastVertex:{
- text:"Remove Last Vertex",
- onClick:function() {
- this._map.pm.Draw[t.jsClass]._removeLastVertex();
- }
- },
- finish:{
- text:"Finish",
- onClick:function() {
- this._map.pm.Draw[t.jsClass]._finishShape();
- }
- }
- };
- t.actions.forEach(function(t) {
- var n = a[t], r = L.DomUtil.create("a", "leaflet-pm-action action-".concat(t), i);
- r.innerHTML = n.text, L.DomEvent.addListener(r, "click", n.onClick, e), L.DomEvent.disableClickPropagation(r);
- }), t.toggleStatus && L.DomUtil.addClass(r, "active");
- var o = L.DomUtil.create("div", "control-icon", r);
- return t.iconUrl && o.setAttribute("src", t.iconUrl), t.className && L.DomUtil.addClass(o, t.className),
- L.DomEvent.addListener(r, "click", function() {
- e._button.disableOtherButtons && e._map.pm.Toolbar.triggerClickOnToggledButtons(e);
- }), L.DomEvent.addListener(r, "click", this._triggerClick, this), L.DomEvent.disableClickPropagation(r),
- n;
- },
- _applyStyleClasses:function() {
- this._container && (this._button.toggleStatus ? L.DomUtil.addClass(this.buttonsDomNode, "active") :L.DomUtil.removeClass(this.buttonsDomNode, "active"));
- },
- _clicked:function() {
- this._button.doToggle && this.toggle();
- }
- });
- e.a = r;
- }, function(t, e, n) {
- "use strict";
- var r = n(0);
- r.a.Marker = r.a.extend({
- initialize:function(t) {
- this._map = t, this._shape = "Marker", this.toolbarButtonName = "drawMarker";
- },
- enable:function(t) {
- L.Util.setOptions(this, t), this._enabled = !0, this._map.on("click", this._createMarker, this),
- this._map.pm.Toolbar.toggleButton(this.toolbarButtonName, !0), this._hintMarker = L.marker([ 0, 0 ], this.options.markerStyle),
- this._hintMarker._pmTempLayer = !0, this._hintMarker.addTo(this._map), this._layer = this._hintMarker,
- this._map.on("mousemove", this._syncHintMarker, this), this._map.fire("pm:drawstart", {
- shape:this._shape,
- workingLayer:this._layer
- }), this._map.eachLayer(function(t) {
- t instanceof L.Marker && t.pm && t.pm.enable();
- });
- },
- disable:function() {
- this._enabled && (this._map.off("click", this._createMarker, this), this._hintMarker.remove(),
- this._map.off("mousemove", this._syncHintMarker, this), this._map.eachLayer(function(t) {
- t instanceof L.Marker && t.pm && !t._pmTempLayer && t.pm.disable();
- }), this._map.fire("pm:drawend", {
- shape:this._shape
- }), this._map.pm.Toolbar.toggleButton(this.toolbarButtonName, !1), this._enabled = !1);
- },
- enabled:function() {
- return this._enabled;
- },
- toggle:function(t) {
- this.enabled() ? this.disable() :this.enable(t);
- },
- _createMarker:function(t) {
- if (t.latlng) {
- this._hintMarker._snapped || this._hintMarker.setLatLng(t.latlng);
- var e = this._hintMarker.getLatLng(), n = new L.Marker(e, this.options.markerStyle);
- n.addTo(this._map), n.pm.enable(), this._map.fire("pm:create", {
- shape:this._shape,
- marker:n,
- layer:n
- }), this._cleanupSnapping();
- }
- },
- _syncHintMarker:function(t) {
- if (this._hintMarker.setLatLng(t.latlng), this.options.snappable) {
- var e = t;
- e.target = this._hintMarker, this._handleSnapping(e);
- }
- }
- });
- }, function(t, e, n) {
- "use strict";
- var r = n(12), i = n.n(r), a = n(0);
- a.a.Line = a.a.extend({
- initialize:function(t) {
- this._map = t, this._shape = "Line", this.toolbarButtonName = "drawPolyline", this._doesSelfIntersect = !1;
- },
- enable:function(t) {
- L.Util.setOptions(this, t), this.options.finishOnDoubleClick && !this.options.finishOn && (this.options.finishOn = "dblclick"),
- this._enabled = !0, this._layerGroup = new L.LayerGroup(), this._layerGroup._pmTempLayer = !0,
- this._layerGroup.addTo(this._map), this._layer = L.polyline([], this.options.templineStyle),
- this._layer._pmTempLayer = !0, this._layerGroup.addLayer(this._layer), this._hintline = L.polyline([], this.options.hintlineStyle),
- this._hintline._pmTempLayer = !0, this._layerGroup.addLayer(this._hintline), this._hintMarker = L.marker(this._map.getCenter(), {
- icon:L.divIcon({
- className:"marker-icon cursor-marker"
- })
- }), this._hintMarker._pmTempLayer = !0, this._layerGroup.addLayer(this._hintMarker),
- this.options.cursorMarker && L.DomUtil.addClass(this._hintMarker._icon, "visible"),
- this._map._container.style.cursor = "crosshair", this._map.on("click", this._createVertex, this),
- this.options.finishOn && this._map.on(this.options.finishOn, this._finishShape, this),
- "dblclick" === this.options.finishOn && (this.tempMapDoubleClickZoomState = this._map.doubleClickZoom._enabled,
- this.tempMapDoubleClickZoomState && this._map.doubleClickZoom.disable()), this._map.on("mousemove", this._syncHintMarker, this),
- this._hintMarker.on("move", this._syncHintLine, this), this._map.fire("pm:drawstart", {
- shape:this._shape,
- workingLayer:this._layer
- }), this._map.pm.Toolbar.toggleButton(this.toolbarButtonName, !0), this._otherSnapLayers = [];
- },
- disable:function() {
- this._enabled && (this._enabled = !1, this._map._container.style.cursor = "", this._map.off("click", this._createVertex, this),
- this._map.off("mousemove", this._syncHintMarker, this), this.options.finishOn && this._map.off(this.options.finishOn, this._finishShape, this),
- this.tempMapDoubleClickZoomState && this._map.doubleClickZoom.enable(), this._map.removeLayer(this._layerGroup),
- this._map.fire("pm:drawend", {
- shape:this._shape
- }), this._map.pm.Toolbar.toggleButton(this.toolbarButtonName, !1), this.options.snappable && this._cleanupSnapping());
- },
- enabled:function() {
- return this._enabled;
- },
- toggle:function(t) {
- this.enabled() ? this.disable() :this.enable(t);
- },
- hasSelfIntersection:function() {
- return i()(this._layer.toGeoJSON(15)).features.length > 0;
- },
- _syncHintLine:function() {
- var t = this._layer.getLatLngs();
- if (t.length > 0) {
- var e = t[t.length - 1];
- this._hintline.setLatLngs([ e, this._hintMarker.getLatLng() ]);
- }
- },
- _syncHintMarker:function(t) {
- if (this._hintMarker.setLatLng(t.latlng), this.options.snappable) {
- var e = t;
- e.target = this._hintMarker, this._handleSnapping(e);
- }
- this.options.allowSelfIntersection || this._handleSelfIntersection();
- },
- _handleSelfIntersection:function() {
- var t = L.polyline(this._layer.getLatLngs());
- t.addLatLng(this._hintMarker.getLatLng());
- var e = i()(t.toGeoJSON(15));
- this._doesSelfIntersect = e.features.length > 0, this._doesSelfIntersect ? this._hintline.setStyle({
- color:"red"
- }) :this._hintline.setStyle(this.options.hintlineStyle);
- },
- _removeLastVertex:function() {
- var t = this._layer.getLatLngs(), e = t.pop();
- t.length < 1 && this.disable();
- var n = this._layerGroup.getLayers().filter(function(t) {
- return t instanceof L.Marker;
- }).filter(function(t) {
- return !L.DomUtil.hasClass(t._icon, "cursor-marker");
- }).find(function(t) {
- return t.getLatLng() === e;
- });
- this._layerGroup.removeLayer(n), this._layer.setLatLngs(t), this._syncHintLine();
- },
- _createVertex:function(t) {
- if (this.options.allowSelfIntersection || !this._doesSelfIntersect) {
- this._hintMarker._snapped || this._hintMarker.setLatLng(t.latlng);
- var e = this._hintMarker.getLatLng();
- if (e.equals(this._layer.getLatLngs()[0])) this._finishShape(t); else {
- var n = 0 === this._layer.getLatLngs().length;
- this._layer.addLatLng(e);
- var r = this._createMarker(e, n);
- this._hintline.setLatLngs([ e, e ]), this._layer.fire("pm:vertexadded", {
- shape:this._shape,
- workingLayer:this._layer,
- marker:r,
- latlng:e
- });
- }
- }
- },
- _finishShape:function() {
- if (this.options.allowSelfIntersection || !this._doesSelfIntersect) {
- var t = this._layer.getLatLngs();
- if (!(t.length <= 1)) {
- var e = L.polyline(t, this.options.pathOptions).addTo(this._map);
- this.disable(), this._map.fire("pm:create", {
- shape:this._shape,
- layer:e
- }), this.options.snappable && this._cleanupSnapping();
- }
- }
- },
- _createMarker:function(t) {
- var e = new L.Marker(t, {
- draggable:!1,
- icon:L.divIcon({
- className:"marker-icon"
- })
- });
- return e._pmTempLayer = !0, this._layerGroup.addLayer(e), e.on("click", this._finishShape, this),
- e;
- }
- });
- }, function(t, e, n) {
- "use strict";
- var r = n(0);
- r.a.Poly = r.a.Line.extend({
- initialize:function(t) {
- this._map = t, this._shape = "Poly", this.toolbarButtonName = "drawPolygon";
- },
- _finishShape:function(t) {
- if (this.options.allowSelfIntersection || !this._doesSelfIntersect) {
- var e = this._layer.getLatLngs();
- if (!(e.length <= 1)) {
- t && "dblclick" === t.type && e.splice(e.length - 1, 1);
- var n = L.polygon(e, this.options.pathOptions).addTo(this._map);
- this.disable(), this._map.fire("pm:create", {
- shape:this._shape,
- layer:n
- }), this._cleanupSnapping(), this._otherSnapLayers.splice(this._tempSnapLayerIndex, 1),
- delete this._tempSnapLayerIndex;
- }
- }
- },
- _createMarker:function(t, e) {
- var n = new L.Marker(t, {
- draggable:!1,
- icon:L.divIcon({
- className:"marker-icon"
- })
- });
- return n._pmTempLayer = !0, this._layerGroup.addLayer(n), e && (n.on("click", this._finishShape, this),
- this._tempSnapLayerIndex = this._otherSnapLayers.push(n) - 1, this.options.snappable && this._cleanupSnapping()),
- n;
- }
- });
- }, function(t, e, n) {
- "use strict";
- var r = n(0);
- r.a.Rectangle = r.a.extend({
- initialize:function(t) {
- this._map = t, this._shape = "Rectangle", this.toolbarButtonName = "drawRectangle";
- },
- enable:function(t) {
- if (L.Util.setOptions(this, t), this._enabled = !0, this._layerGroup = new L.LayerGroup(),
- this._layerGroup._pmTempLayer = !0, this._layerGroup.addTo(this._map), this._layer = L.rectangle([ [ 0, 0 ], [ 0, 0 ] ], this.options.pathOptions),
- this._layer._pmTempLayer = !0, this._startMarker = L.marker([ 0, 0 ], {
- icon:L.divIcon({
- className:"marker-icon rect-start-marker"
- }),
- draggable:!0,
- zIndexOffset:100,
- opacity:this.options.cursorMarker ? 1 :0
- }), this._startMarker._pmTempLayer = !0, this._layerGroup.addLayer(this._startMarker),
- this._hintMarker = L.marker([ 0, 0 ], {
- icon:L.divIcon({
- className:"marker-icon cursor-marker"
- })
- }), this._hintMarker._pmTempLayer = !0, this._layerGroup.addLayer(this._hintMarker),
- this.options.cursorMarker) {
- L.DomUtil.addClass(this._hintMarker._icon, "visible"), this._styleMarkers = [];
- for (var e = 0; e < 2; e += 1) {
- var n = L.marker([ 0, 0 ], {
- icon:L.divIcon({
- className:"marker-icon rect-style-marker"
- }),
- draggable:!0,
- zIndexOffset:100
- });
- n._pmTempLayer = !0, this._layerGroup.addLayer(n), this._styleMarkers.push(n);
- }
- }
- this._map._container.style.cursor = "crosshair", this._map.on("click", this._placeStartingMarkers, this),
- this._map.on("mousemove", this._syncHintMarker, this), this._map.fire("pm:drawstart", {
- shape:this._shape,
- workingLayer:this._layer
- }), this._map.pm.Toolbar.toggleButton(this.toolbarButtonName, !0), this._otherSnapLayers = [];
- },
- disable:function() {
- this._enabled && (this._enabled = !1, this._map._container.style.cursor = "", this._map.off("click", this._finishShape, this),
- this._map.off("click", this._placeStartingMarkers, this), this._map.off("mousemove", this._syncHintMarker, this),
- this._map.removeLayer(this._layerGroup), this._map.fire("pm:drawend", {
- shape:this._shape
- }), this._map.pm.Toolbar.toggleButton(this.toolbarButtonName, !1), this.options.snappable && this._cleanupSnapping());
- },
- enabled:function() {
- return this._enabled;
- },
- toggle:function(t) {
- this.enabled() ? this.disable() :this.enable(t);
- },
- _placeStartingMarkers:function(t) {
- this._hintMarker._snapped || this._hintMarker.setLatLng(t.latlng);
- var e = this._hintMarker.getLatLng();
- L.DomUtil.addClass(this._startMarker._icon, "visible"), this._startMarker.setLatLng(e),
- this.options.cursorMarker && this._styleMarkers && this._styleMarkers.forEach(function(t) {
- L.DomUtil.addClass(t._icon, "visible"), t.setLatLng(e);
- }), this._map.off("click", this._placeStartingMarkers, this), this._map.on("click", this._finishShape, this),
- this._setRectangleOrigin();
- },
- _setRectangleOrigin:function() {
- var t = this._startMarker.getLatLng();
- t && (this._layerGroup.addLayer(this._layer), this._layer.setLatLngs([ t, t ]),
- this._hintMarker.on("move", this._syncRectangleSize, this));
- },
- _syncHintMarker:function(t) {
- if (this._hintMarker.setLatLng(t.latlng), this.options.snappable) {
- var e = t;
- e.target = this._hintMarker, this._handleSnapping(e);
- }
- },
- _syncRectangleSize:function() {
- var t = this, e = this._startMarker.getLatLng(), n = this._hintMarker.getLatLng();
- if (this._layer.setBounds([ e, n ]), this.options.cursorMarker && this._styleMarkers) {
- var r = [];
- this._findCorners().forEach(function(e) {
- e.equals(t._startMarker.getLatLng()) || e.equals(t._hintMarker.getLatLng()) || r.push(e);
- }), r.forEach(function(e, n) {
- t._styleMarkers[n].setLatLng(e);
- });
- }
- },
- _finishShape:function(t) {
- var e = this._startMarker.getLatLng(), n = t.latlng, r = L.rectangle([ e, n ], this.options.pathOptions).addTo(this._map);
- this.disable(), this._map.fire("pm:create", {
- shape:this._shape,
- layer:r
- });
- },
- _findCorners:function() {
- var t = this._layer.getBounds();
- return [ t.getNorthWest(), t.getNorthEast(), t.getSouthEast(), t.getSouthWest() ];
- }
- });
- }, function(t, e, n) {
- "use strict";
- var r = n(0);
- r.a.Circle = r.a.extend({
- initialize:function(t) {
- this._map = t, this._shape = "Circle", this.toolbarButtonName = "drawCircle";
- },
- enable:function(t) {
- L.Util.setOptions(this, t), this.options.radius = 0, this._enabled = !0, this._layerGroup = new L.LayerGroup(),
- this._layerGroup._pmTempLayer = !0, this._layerGroup.addTo(this._map), this._layer = L.circle([ 0, 0 ], this.options.templineStyle),
- this._layer._pmTempLayer = !0, this._layerGroup.addLayer(this._layer), this._centerMarker = L.marker([ 0, 0 ], {
- icon:L.divIcon({
- className:"marker-icon"
- }),
- draggable:!1,
- zIndexOffset:100
- }), this._centerMarker._pmTempLayer = !0, this._layerGroup.addLayer(this._centerMarker),
- this._hintMarker = L.marker([ 0, 0 ], {
- icon:L.divIcon({
- className:"marker-icon cursor-marker"
- })
- }), this._hintMarker._pmTempLayer = !0, this._layerGroup.addLayer(this._hintMarker),
- this.options.cursorMarker && L.DomUtil.addClass(this._hintMarker._icon, "visible"),
- this._hintline = L.polyline([], this.options.hintlineStyle), this._hintline._pmTempLayer = !0,
- this._layerGroup.addLayer(this._hintline), this._map._container.style.cursor = "crosshair",
- this._map.on("click", this._placeCenterMarker, this), this._map.on("mousemove", this._syncHintMarker, this),
- this._map.fire("pm:drawstart", {
- shape:this._shape,
- workingLayer:this._layer
- }), this._map.pm.Toolbar.toggleButton(this.toolbarButtonName, !0), this._otherSnapLayers = [];
- },
- disable:function() {
- this._enabled && (this._enabled = !1, this._map._container.style.cursor = "", this._map.off("click", this._finishShape, this),
- this._map.off("click", this._placeCenterMarker, this), this._map.off("mousemove", this._syncHintMarker, this),
- this._map.removeLayer(this._layerGroup), this._map.fire("pm:drawend", {
- shape:this._shape
- }), this._map.pm.Toolbar.toggleButton(this.toolbarButtonName, !1), this.options.snappable && this._cleanupSnapping());
- },
- enabled:function() {
- return this._enabled;
- },
- toggle:function(t) {
- this.enabled() ? this.disable() :this.enable(t);
- },
- _syncHintLine:function() {
- var t = this._centerMarker.getLatLng();
- this._hintline.setLatLngs([ t, this._hintMarker.getLatLng() ]);
- },
- _syncCircleRadius:function() {
- var t = this._centerMarker.getLatLng(), e = this._hintMarker.getLatLng(), n = t.distanceTo(e);
- this._layer.setRadius(n);
- },
- _syncHintMarker:function(t) {
- if (this._hintMarker.setLatLng(t.latlng), this.options.snappable) {
- var e = t;
- e.target = this._hintMarker, this._handleSnapping(e);
- }
- },
- _placeCenterMarker:function(t) {
- this._hintMarker._snapped || this._hintMarker.setLatLng(t.latlng);
- var e = this._hintMarker.getLatLng();
- this._centerMarker.setLatLng(e), this._map.off("click", this._placeCenterMarker, this),
- this._map.on("click", this._finishShape, this), this._placeCircleCenter();
- },
- _placeCircleCenter:function() {
- var t = this._centerMarker.getLatLng();
- t && (this._layer.setLatLng(t), this._hintMarker.on("move", this._syncHintLine, this),
- this._hintMarker.on("move", this._syncCircleRadius, this), this._layer.fire("pm:centerplaced", {
- shape:this._shape,
- workingLayer:this._layer,
- latlng:t
- }));
- },
- _finishShape:function(t) {
- var e = this._centerMarker.getLatLng(), n = t.latlng, r = e.distanceTo(n), i = Object.assign({}, this.options.pathOptions, {
- radius:r
- }), a = L.circle(e, i).addTo(this._map);
- this.disable(), this._map.fire("pm:create", {
- shape:this._shape,
- layer:a
- });
- },
- _createMarker:function(t) {
- var e = new L.Marker(t, {
- draggable:!1,
- icon:L.divIcon({
- className:"marker-icon"
- })
- });
- return e._pmTempLayer = !0, this._layerGroup.addLayer(e), e;
- }
- });
- }, function(t, e, n) {
- "use strict";
- var r = n(32), i = n.n(r), a = n(33), o = n(0);
- o.a.Cut = o.a.Poly.extend({
- initialize:function(t) {
- this._map = t, this._shape = "Cut", this.toolbarButtonName = "cutPolygon";
- },
- _cut:function(t) {
- var e = this, n = this._map._layers;
- Object.keys(n).map(function(t) {
- return n[t];
- }).filter(function(t) {
- return t.pm;
- }).filter(function(t) {
- return t instanceof L.Polygon;
- }).filter(function(e) {
- return e !== t;
- }).filter(function(e) {
- try {
- return !!i()(t.toGeoJSON(15), e.toGeoJSON(15));
- } catch (n) {
- return console.error("You cant cut polygons with self-intersections"), !1;
- }
- }).forEach(function(n) {
- var r = Object(a.a)(n.toGeoJSON(15), t.toGeoJSON(15)), i = L.geoJSON(r, n.options).addTo(e._map);
- i.addTo(e._map), i.pm.enable(e.options), i.pm.disable(), n.fire("pm:cut", {
- shape:e._shape,
- layer:i,
- originalLayer:n
- }), e._map.fire("pm:cut", {
- shape:e._shape,
- layer:i,
- originalLayer:n
- }), n._pmTempLayer = !0, t._pmTempLayer = !0, n.remove(), t.remove();
- });
- },
- _finishShape:function() {
- var t = this._layer.getLatLngs(), e = L.polygon(t, this.options.pathOptions);
- this._cut(e), this.disable(), this._cleanupSnapping(), this._otherSnapLayers.splice(this._tempSnapLayerIndex, 1),
- delete this._tempSnapLayerIndex;
- }
- });
- }, function(t, e, n) {
- "use strict";
- var r = this && this.__importStar || function(t) {
- if (t && t.__esModule) return t;
- var e = {};
- if (null != t) for (var n in t) Object.hasOwnProperty.call(t, n) && (e[n] = t[n]);
- return e["default"] = t, e;
- };
- Object.defineProperty(e, "__esModule", {
- value:!0
- });
- var i = n(2), a = n(13), o = r(n(14));
- e["default"] = function s(t, e, n) {
- void 0 === n && (n = {});
- var r = a.getGeom(t), l = a.getGeom(e);
- if ("Polygon" === r.type && "Polygon" === l.type) {
- var h = o.intersection(r.coordinates, l.coordinates);
- if (null === h || 0 === h.length) return null;
- if (1 === h.length) {
- var u = h[0][0][0], c = h[0][0][h[0][0].length - 1];
- return u[0] === c[0] && u[1] === c[1] ? i.polygon(h[0], n.properties) :null;
- }
- return i.multiPolygon(h, n.properties);
- }
- if ("MultiPolygon" === r.type) {
- for (var p = [], f = 0, d = r.coordinates; f < d.length; f++) {
- var g = d[f], _ = s(a.getGeom(i.polygon(g)), l);
- if (_) {
- var m = a.getGeom(_);
- if ("Polygon" === m.type) p.push(m.coordinates); else {
- if ("MultiPolygon" !== m.type) throw new Error("intersection is invalid");
- p = p.concat(m.coordinates);
- }
- }
- }
- return 0 === p.length ? null :1 === p.length ? i.polygon(p[0], n.properties) :i.multiPolygon(p, n.properties);
- }
- if ("MultiPolygon" === l.type) return s(l, r);
- throw new Error("poly1 and poly2 must be either polygons or multiPolygons");
- };
- }, function(t, e, n) {
- "use strict";
- var r = n(14), i = (n.n(r), n(34)), a = n.n(i), o = n(2), s = (n.n(o), n(13)), l = (n.n(s),
- n(15));
- n.n(l);
- function h(t) {
- switch (t.type) {
- case "Polygon":
- return a()(t) > 1 ? t :null;
- case "MultiPolygon":
- var e = [];
- if (Object(l.flattenEach)(t, function(t) {
- a()(t) > 1 && e.push(t.geometry.coordinates);
- }), e.length) return {
- type:"MultiPolygon",
- coordinates:e
- };
- }
- }
- e.a = function(t, e) {
- var n = Object(s.getGeom)(t), i = Object(s.getGeom)(e), a = t.properties || {};
- if (n = h(n), i = h(i), !n) return null;
- if (!i) return Object(o.feature)(n, a);
- var l = r.diff(n.coordinates, i.coordinates);
- return 0 === l.length ? null :1 === l.length ? Object(o.polygon)(l[0], a) :Object(o.multiPolygon)(l, a);
- };
- }, function(t, e, n) {
- "use strict";
- Object.defineProperty(e, "__esModule", {
- value:!0
- });
- var r = n(15), i = 6378137;
- function a(t) {
- var e = 0;
- if (t && t.length > 0) {
- e += Math.abs(o(t[0]));
- for (var n = 1; n < t.length; n++) e -= Math.abs(o(t[n]));
- }
- return e;
- }
- function o(t) {
- var e, n, r, a, o, l, h = 0, u = t.length;
- if (u > 2) {
- for (l = 0; l < u; l++) l === u - 2 ? (r = u - 2, a = u - 1, o = 0) :l === u - 1 ? (r = u - 1,
- a = 0, o = 1) :(r = l, a = l + 1, o = l + 2), e = t[r], n = t[a], h += (s(t[o][0]) - s(e[0])) * Math.sin(s(n[1]));
- h = h * i * i / 2;
- }
- return h;
- }
- function s(t) {
- return t * Math.PI / 180;
- }
- e["default"] = function(t) {
- return r.geomReduce(t, function(t, e) {
- return t + function(t) {
- var e, n = 0;
- switch (t.type) {
- case "Polygon":
- return a(t.coordinates);
- case "MultiPolygon":
- for (e = 0; e < t.coordinates.length; e++) n += a(t.coordinates[e]);
- return n;
- case "Point":
- case "MultiPoint":
- case "LineString":
- case "MultiLineString":
- return 0;
- }
- return 0;
- }(e);
- }, 0);
- };
- }, function(t, e, n) {
- "use strict";
- var r = {
- _initDraggableLayer:function() {
- this._tempDragCoord = null;
- var t = this._layer._path ? this._layer._path :this._layer._renderer._container;
- L.DomUtil.addClass(t, "leaflet-pm-draggable"), this._originalMapDragState = this._layer._map.dragging._enabled,
- this._safeToCacheDragState = !0, this._layer.on("mousedown", this._dragMixinOnMouseDown, this);
- },
- _dragMixinOnMouseUp:function() {
- var t = this, e = this._layer._path ? this._layer._path :this._layer._renderer._container;
- return this._originalMapDragState && this._layer._map.dragging.enable(), this._safeToCacheDragState = !0,
- this._layer._map.off("mousemove", this._dragMixinOnMouseMove, this), this._layer.off("mouseup", this._dragMixinOnMouseUp, this),
- !!this._dragging && (this._initMarkers(), window.setTimeout(function() {
- t._dragging = !1, L.DomUtil.removeClass(e, "leaflet-pm-dragging"), t._layer.fire("pm:dragend"),
- t._fireEdit();
- }, 10), !0);
- },
- _dragMixinOnMouseMove:function(t) {
- var e = this._layer._path ? this._layer._path :this._layer._renderer._container;
- this._dragging || (this._dragging = !0, L.DomUtil.addClass(e, "leaflet-pm-dragging"),
- this._layer.bringToFront(), this._originalMapDragState && this._layer._map.dragging.disable(),
- this._markerGroup.clearLayers(), this._layer.fire("pm:dragstart")), this._onLayerDrag(t);
- },
- _dragMixinOnMouseDown:function(t) {
- t.originalEvent.button > 0 || (this._safeToCacheDragState && (this._originalMapDragState = this._layer._map.dragging._enabled,
- this._safeToCacheDragState = !1), this._tempDragCoord = t.latlng, this._layer.on("mouseup", this._dragMixinOnMouseUp, this),
- this._layer._map.on("mousemove", this._dragMixinOnMouseMove, this));
- },
- dragging:function() {
- return this._dragging;
- },
- _onLayerDrag:function(t) {
- var e = t.latlng, n = e.lat - this._tempDragCoord.lat, r = e.lng - this._tempDragCoord.lng, i = function a(t) {
- return t.map(function(t) {
- return Array.isArray(t) ? a(t) :{
- lat:t.lat + n,
- lng:t.lng + r
- };
- });
- }(this._layer._latlngs);
- this._layer.setLatLngs(i).redraw(), this._tempDragCoord = e, this._layer.fire("pm:drag");
- }
- };
- e.a = r;
- }, function(t, e, n) {
- "use strict";
- n(1).a.LayerGroup = L.Class.extend({
- initialize:function(t) {
- var e = this;
- this._layerGroup = t, this._layers = this.findLayers(), this._layers.forEach(function(t) {
- return e._initLayer(t);
- }), this._layerGroup.on("layeradd", function(t) {
- t.target._pmTempLayer || (e._layers = e.findLayers(), t.layer.pm && e._initLayer(t.layer),
- t.target.pm.enabled() && e.enable(e.getOptions()));
- });
- },
- findLayers:function() {
- var t = this._layerGroup.getLayers();
- return t = (t = (t = t.filter(function(t) {
- return !(t instanceof L.LayerGroup);
- })).filter(function(t) {
- return !!t.pm;
- })).filter(function(t) {
- return !t._pmTempLayer;
- });
- },
- _initLayer:function(t) {
- var e = this;
- [ "pm:edit", "pm:update", "pm:remove", "pm:dragstart", "pm:drag", "pm:dragend", "pm:snap", "pm:unsnap", "pm:cut", "pm:intersect", "pm:raiseMarkers", "pm:markerdragend", "pm:markerdragstart", "pm:vertexadded", "pm:vertexremoved", "pm:centerplaced" ].forEach(function(n) {
- t.on(n, e._fireEvent, e);
- }), t.pm._layerGroup = this._layerGroup;
- },
- _fireEvent:function(t) {
- this._layerGroup.fireEvent(t.type, t);
- },
- toggleEdit:function(t) {
- this._options = t, this._layers.forEach(function(e) {
- e.pm.toggleEdit(t);
- });
- },
- enable:function(t) {
- this._options = t, this._layers.forEach(function(e) {
- e.pm.enable(t);
- });
- },
- disable:function() {
- this._layers.forEach(function(t) {
- t.pm.disable();
- });
- },
- enabled:function() {
- var t = this._layers.find(function(t) {
- return t.pm.enabled();
- });
- return !!t;
- },
- dragging:function() {
- var t = this._layers.find(function(t) {
- return t.pm.dragging();
- });
- return !!t;
- },
- getOptions:function() {
- return this._options;
- }
- });
- }, function(t, e, n) {
- "use strict";
- var r = n(1);
- r.a.Marker = r.a.extend({
- initialize:function(t) {
- this._layer = t, this._enabled = !1, this._layer.on("dragend", this._onDragEnd, this);
- },
- toggleEdit:function(t) {
- this.enabled() ? this.disable() :this.enable(t);
- },
- enable:function() {
- var t = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] :{
- draggable:!0,
- snappable:!0
- };
- L.Util.setOptions(this, t), this._map = this._layer._map, this.enabled() || (this._enabled = !0,
- this.options.preventMarkerRemoval || this._layer.on("contextmenu", this._removeMarker, this),
- this.options.draggable && this._layer.dragging.enable(), this.options.snappable && this._initSnappableMarkers());
- },
- enabled:function() {
- return this._enabled;
- },
- disable:function() {
- this._enabled = !1, this._layer.dragging && this._layer.dragging.disable(), this._layer.off("contextmenu", this._removeMarker, this),
- this._layerEdited && this._layer.fire("pm:update", {}), this._layerEdited = !1;
- },
- _removeMarker:function(t) {
- var e = t.target;
- e.remove(), e.fire("pm:remove");
- },
- _onDragEnd:function(t) {
- t.target.fire("pm:edit"), this._layerEdited = !0;
- },
- _initSnappableMarkers:function() {
- var t = this._layer;
- this.options.snapDistance = this.options.snapDistance || 30, t.off("drag", this._handleSnapping, this),
- t.on("drag", this._handleSnapping, this), t.off("dragend", this._cleanupSnapping, this),
- t.on("dragend", this._cleanupSnapping, this), t.off("pm:dragstart", this._unsnap, this),
- t.on("pm:dragstart", this._unsnap, this);
- }
- });
- }, function(t, e, n) {
- "use strict";
- var r = n(12), i = n.n(r), a = n(39), o = n.n(a), s = n(1), l = n(11);
- s.a.Line = s.a.extend({
- initialize:function(t) {
- this._layer = t, this._enabled = !1;
- },
- toggleEdit:function(t) {
- this.enabled() ? this.disable() :this.enable(t);
- },
- enable:function(t) {
- L.Util.setOptions(this, t), this._map = this._layer._map, this._map && (this.enabled() || this.disable(),
- this._enabled = !0, this._initMarkers(), this._layer.on("remove", this._onLayerRemove, this),
- this.options.allowSelfIntersection || this._layer.on("pm:vertexremoved", this._handleSelfIntersectionOnVertexRemoval, this),
- this.options.draggable && this._initDraggableLayer(), this.options.allowSelfIntersection || this._handleLayerStyle());
- },
- _onLayerRemove:function(t) {
- this.disable(t.target);
- },
- enabled:function() {
- return this._enabled;
- },
- disable:function() {
- var t = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] :this._layer;
- if (!this.enabled()) return !1;
- if (t.pm._dragging) return !1;
- t.pm._enabled = !1, t.pm._markerGroup.clearLayers(), t.off("mousedown"), t.off("mouseup"),
- this._layer.off("remove", this._onLayerRemove), this.options.allowSelfIntersection || this._layer.off("pm:vertexremoved", this._handleSelfIntersectionOnVertexRemoval);
- var e = t._path ? t._path :this._layer._renderer._container;
- return L.DomUtil.removeClass(e, "leaflet-pm-draggable"), this.hasSelfIntersection() && L.DomUtil.removeClass(e, "leaflet-pm-invalid"),
- this._layerEdited && this._layer.fire("pm:update", {}), this._layerEdited = !1,
- !0;
- },
- hasSelfIntersection:function() {
- return i()(this._layer.toGeoJSON(15)).features.length > 0;
- },
- _handleSelfIntersectionOnVertexRemoval:function() {
- this._handleLayerStyle(!0), this.hasSelfIntersection() && (this._layer.setLatLngs(this._coordsBeforeEdit),
- this._coordsBeforeEdit = null, this._initMarkers());
- },
- _handleLayerStyle:function(t) {
- var e = this._layer._path ? this._layer._path :this._layer._renderer._container;
- if (this.hasSelfIntersection()) {
- if (L.DomUtil.hasClass(e, "leaflet-pm-invalid")) return;
- t ? (L.DomUtil.addClass(e, "leaflet-pm-invalid"), window.setTimeout(function() {
- L.DomUtil.removeClass(e, "leaflet-pm-invalid");
- }, 200)) :L.DomUtil.addClass(e, "leaflet-pm-invalid"), this._layer.fire("pm:intersect", {
- intersection:i()(this._layer.toGeoJSON(15))
- });
- } else L.DomUtil.removeClass(e, "leaflet-pm-invalid");
- },
- _initMarkers:function() {
- var t = this, e = this._map, n = this._layer.getLatLngs();
- this._markerGroup && this._markerGroup.clearLayers(), this._markerGroup = new L.LayerGroup(),
- this._markerGroup._pmTempLayer = !0, e.addLayer(this._markerGroup);
- this._markers = function r(e) {
- if (Array.isArray(e[0])) return e.map(r, t);
- var n = e.map(t._createMarker, t);
- return e.map(function(r, i) {
- var a = t.isPolygon() ? (i + 1) % e.length :i + 1;
- return t._createMiddleMarker(n[i], n[a]);
- }), n;
- }(n), this.options.snappable && this._initSnappableMarkers();
- },
- _createMarker:function(t) {
- var e = new L.Marker(t, {
- draggable:!this.options.preventVertexEdit,
- icon:L.divIcon({
- className:"marker-icon"
- })
- });
- return e._pmTempLayer = !0, e.on("dragstart", this._onMarkerDragStart, this), e.on("move", this._onMarkerDrag, this),
- e.on("dragend", this._onMarkerDragEnd, this), this.options.preventMarkerRemoval || e.on("contextmenu", this._removeMarker, this),
- this._markerGroup.addLayer(e), e;
- },
- _createMiddleMarker:function(t, e) {
- var n = this;
- if (!t || !e) return !1;
- var r = l.a.calcMiddleLatLng(this._map, t.getLatLng(), e.getLatLng()), i = this._createMarker(r), a = L.divIcon({
- className:"marker-icon marker-icon-middle"
- });
- return i.setIcon(a), t._middleMarkerNext = i, e._middleMarkerPrev = i, i.on("click", function() {
- var r = L.divIcon({
- className:"marker-icon"
- });
- i.setIcon(r), n._addMarker(i, t, e);
- }), i.on("movestart", function() {
- i.on("moveend", function() {
- var t = L.divIcon({
- className:"marker-icon"
- });
- i.setIcon(t), i.off("moveend");
- }), n._addMarker(i, t, e);
- }), i;
- },
- _addMarker:function(t, e, n) {
- t.off("movestart"), t.off("click");
- var r = t.getLatLng(), i = this._layer._latlngs, a = this.findDeepMarkerIndex(this._markers, e), s = a.indexPath, l = a.index, h = a.parentPath, u = s.length > 1 ? o()(i, h) :i, c = s.length > 1 ? o()(this._markers, h) :this._markers;
- u.splice(l + 1, 0, r), c.splice(l + 1, 0, t), this._layer.setLatLngs(i), this._createMiddleMarker(e, t),
- this._createMiddleMarker(t, n), this._fireEdit(), this._layer.fire("pm:vertexadded", {
- layer:this._layer,
- marker:t,
- indexPath:this.findDeepMarkerIndex(this._markers, t).indexPath,
- latlng:r
- }), this.options.snappable && this._initSnappableMarkers();
- },
- _removeMarker:function(t) {
- if (!this.options.allowSelfIntersection) {
- var e = this._layer.getLatLngs();
- this._coordsBeforeEdit = JSON.parse(JSON.stringify(e));
- }
- var n = t.target, r = this._layer.getLatLngs(), i = this.findDeepMarkerIndex(this._markers, n), a = i.indexPath, s = i.index, l = i.parentPath;
- if (a) {
- var h, u, c = a.length > 1 ? o()(r, l) :r, p = a.length > 1 ? o()(this._markers, l) :this._markers;
- if (c.splice(s, 1), this._layer.setLatLngs(r), c.length <= 1 && (c.splice(0, c.length),
- this._layer.setLatLngs(r), this.disable(), this.enable(this.options)), this.isEmptyDeep(r) && this._layer.remove(),
- n._middleMarkerPrev && this._markerGroup.removeLayer(n._middleMarkerPrev), n._middleMarkerNext && this._markerGroup.removeLayer(n._middleMarkerNext),
- this._markerGroup.removeLayer(n), this.isPolygon() ? (h = (s + 1) % p.length, u = (s + (p.length - 1)) % p.length) :(u = s - 1 < 0 ? undefined :s - 1,
- h = s + 1 >= p.length ? undefined :s + 1), h !== u) {
- var f = p[u], d = p[h];
- this._createMiddleMarker(f, d);
- }
- p.splice(s, 1), this._fireEdit(), this._layer.fire("pm:vertexremoved", {
- layer:this._layer,
- marker:n,
- indexPath:a
- });
- }
- },
- isEmptyDeep:function(t) {
- return !function e(t) {
- return t.filter(function(t) {
- return ![ null, "", undefined ].includes(t);
- }).reduce(function(t, n) {
- return t.concat(Array.isArray(n) ? e(n) :n);
- }, []);
- }(t).length;
- },
- findDeepMarkerIndex:function(t, e) {
- var n;
- t.some(function i(t) {
- return function(r, a) {
- var o = t.concat(a);
- return r._leaflet_id === e._leaflet_id ? (n = o, !0) :Array.isArray(r) && r.some(i(o));
- };
- }([]));
- var r = {};
- return n && (r = {
- indexPath:n,
- index:n[n.length - 1],
- parentPath:n.slice(0, n.length - 1)
- }), r;
- },
- updatePolygonCoordsFromMarkerDrag:function(t) {
- var e = this._layer.getLatLngs(), n = t.getLatLng(), r = this.findDeepMarkerIndex(this._markers, t), i = r.indexPath, a = r.index, s = r.parentPath;
- (i.length > 1 ? o()(e, s) :e).splice(a, 1, n), this._layer.setLatLngs(e).redraw();
- },
- _onMarkerDrag:function(t) {
- var e = t.target, n = this.findDeepMarkerIndex(this._markers, e), r = n.indexPath, i = n.index, a = n.parentPath;
- if (r) {
- this.updatePolygonCoordsFromMarkerDrag(e);
- var s = r.length > 1 ? o()(this._markers, a) :this._markers, h = (i + 1) % s.length, u = (i + (s.length - 1)) % s.length, c = e.getLatLng(), p = s[u].getLatLng(), f = s[h].getLatLng();
- if (e._middleMarkerNext) {
- var d = l.a.calcMiddleLatLng(this._map, c, f);
- e._middleMarkerNext.setLatLng(d);
- }
- if (e._middleMarkerPrev) {
- var g = l.a.calcMiddleLatLng(this._map, c, p);
- e._middleMarkerPrev.setLatLng(g);
- }
- this.options.allowSelfIntersection || this._handleLayerStyle();
- }
- },
- _onMarkerDragEnd:function(t) {
- var e = t.target, n = this.findDeepMarkerIndex(this._markers, e).indexPath;
- if (!this.options.allowSelfIntersection && this.hasSelfIntersection()) return this._layer.setLatLngs(this._coordsBeforeEdit),
- this._coordsBeforeEdit = null, this._initMarkers(), void this._handleLayerStyle();
- this._layer.fire("pm:markerdragend", {
- markerEvent:t,
- indexPath:n
- }), this._fireEdit();
- },
- _onMarkerDragStart:function(t) {
- var e = t.target, n = this.findDeepMarkerIndex(this._markers, e).indexPath;
- this._layer.fire("pm:markerdragstart", {
- markerEvent:t,
- indexPath:n
- }), this.options.allowSelfIntersection || (this._coordsBeforeEdit = this._layer.getLatLngs());
- },
- _fireEdit:function() {
- this._layerEdited = !0, this._layer.fire("pm:edit");
- }
- });
- }, function(t, e, n) {
- var r = n(40);
- t.exports = function(t, e, n) {
- var i = null == t ? undefined :r(t, e);
- return i === undefined ? n :i;
- };
- }, function(t, e, n) {
- var r = n(41), i = n(81);
- t.exports = function(t, e) {
- for (var n = 0, a = (e = r(e, t)).length; null != t && n < a; ) t = t[i(e[n++])];
- return n && n == a ? t :undefined;
- };
- }, function(t, e, n) {
- var r = n(6), i = n(42), a = n(48), o = n(78);
- t.exports = function(t, e) {
- return r(t) ? t :i(t, e) ? [ t ] :a(o(t));
- };
- }, function(t, e, n) {
- var r = n(6), i = n(7), a = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, o = /^\w*$/;
- t.exports = function(t, e) {
- if (r(t)) return !1;
- var n = typeof t;
- return !("number" != n && "symbol" != n && "boolean" != n && null != t && !i(t)) || o.test(t) || !a.test(t) || null != e && t in Object(e);
- };
- }, function(t, e, n) {
- (function(e) {
- var n = "object" == typeof e && e && e.Object === Object && e;
- t.exports = n;
- }).call(e, n(44));
- }, function(t, e) {
- var n;
- n = function() {
- return this;
- }();
- try {
- n = n || Function("return this")() || (0, eval)("this");
- } catch (r) {
- "object" == typeof window && (n = window);
- }
- t.exports = n;
- }, function(t, e, n) {
- var r = n(8), i = Object.prototype, a = i.hasOwnProperty, o = i.toString, s = r ? r.toStringTag :undefined;
- t.exports = function(t) {
- var e = a.call(t, s), n = t[s];
- try {
- t[s] = undefined;
- var r = !0;
- } catch (l) {}
- var i = o.call(t);
- return r && (e ? t[s] = n :delete t[s]), i;
- };
- }, function(t, e) {
- var n = Object.prototype.toString;
- t.exports = function(t) {
- return n.call(t);
- };
- }, function(t, e) {
- t.exports = function(t) {
- return null != t && "object" == typeof t;
- };
- }, function(t, e, n) {
- var r = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g, i = /\\(\\)?/g, a = n(49)(function(t) {
- var e = [];
- return 46 === t.charCodeAt(0) && e.push(""), t.replace(r, function(t, n, r, a) {
- e.push(r ? a.replace(i, "$1") :n || t);
- }), e;
- });
- t.exports = a;
- }, function(t, e, n) {
- var r = n(50), i = 500;
- t.exports = function(t) {
- var e = r(t, function(t) {
- return n.size === i && n.clear(), t;
- }), n = e.cache;
- return e;
- };
- }, function(t, e, n) {
- var r = n(51), i = "Expected a function";
- function a(t, e) {
- if ("function" != typeof t || null != e && "function" != typeof e) throw new TypeError(i);
- var n = function() {
- var r = arguments, i = e ? e.apply(this, r) :r[0], a = n.cache;
- if (a.has(i)) return a.get(i);
- var o = t.apply(this, r);
- return n.cache = a.set(i, o) || a, o;
- };
- return n.cache = new (a.Cache || r)(), n;
- }
- a.Cache = r, t.exports = a;
- }, function(t, e, n) {
- var r = n(52), i = n(73), a = n(75), o = n(76), s = n(77);
- function l(t) {
- var e = -1, n = null == t ? 0 :t.length;
- for (this.clear(); ++e < n; ) {
- var r = t[e];
- this.set(r[0], r[1]);
- }
- }
- l.prototype.clear = r, l.prototype["delete"] = i, l.prototype.get = a, l.prototype.has = o,
- l.prototype.set = s, t.exports = l;
- }, function(t, e, n) {
- var r = n(53), i = n(65), a = n(72);
- t.exports = function() {
- this.size = 0, this.__data__ = {
- hash:new r(),
- map:new (a || i)(),
- string:new r()
- };
- };
- }, function(t, e, n) {
- var r = n(54), i = n(61), a = n(62), o = n(63), s = n(64);
- function l(t) {
- var e = -1, n = null == t ? 0 :t.length;
- for (this.clear(); ++e < n; ) {
- var r = t[e];
- this.set(r[0], r[1]);
- }
- }
- l.prototype.clear = r, l.prototype["delete"] = i, l.prototype.get = a, l.prototype.has = o,
- l.prototype.set = s, t.exports = l;
- }, function(t, e, n) {
- var r = n(3);
- t.exports = function() {
- this.__data__ = r ? r(null) :{}, this.size = 0;
- };
- }, function(t, e, n) {
- var r = n(56), i = n(57), a = n(18), o = n(59), s = /^\[object .+?Constructor\]$/, l = Function.prototype, h = Object.prototype, u = l.toString, c = h.hasOwnProperty, p = RegExp("^" + u.call(c).replace(/[\\^$.*+?()[\]{}|]/g, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$");
- t.exports = function(t) {
- return !(!a(t) || i(t)) && (r(t) ? p :s).test(o(t));
- };
- }, function(t, e, n) {
- var r = n(16), i = n(18), a = "[object AsyncFunction]", o = "[object Function]", s = "[object GeneratorFunction]", l = "[object Proxy]";
- t.exports = function(t) {
- if (!i(t)) return !1;
- var e = r(t);
- return e == o || e == s || e == a || e == l;
- };
- }, function(t, e, n) {
- var r = n(58), i = function() {
- var t = /[^.]+$/.exec(r && r.keys && r.keys.IE_PROTO || "");
- return t ? "Symbol(src)_1." + t :"";
- }();
- t.exports = function(t) {
- return !!i && i in t;
- };
- }, function(t, e, n) {
- var r = n(9)["__core-js_shared__"];
- t.exports = r;
- }, function(t, e) {
- var n = Function.prototype.toString;
- t.exports = function(t) {
- if (null != t) {
- try {
- return n.call(t);
- } catch (e) {}
- try {
- return t + "";
- } catch (e) {}
- }
- return "";
- };
- }, function(t, e) {
- t.exports = function(t, e) {
- return null == t ? undefined :t[e];
- };
- }, function(t, e) {
- t.exports = function(t) {
- var e = this.has(t) && delete this.__data__[t];
- return this.size -= e ? 1 :0, e;
- };
- }, function(t, e, n) {
- var r = n(3), i = "__lodash_hash_undefined__", a = Object.prototype.hasOwnProperty;
- t.exports = function(t) {
- var e = this.__data__;
- if (r) {
- var n = e[t];
- return n === i ? undefined :n;
- }
- return a.call(e, t) ? e[t] :undefined;
- };
- }, function(t, e, n) {
- var r = n(3), i = Object.prototype.hasOwnProperty;
- t.exports = function(t) {
- var e = this.__data__;
- return r ? e[t] !== undefined :i.call(e, t);
- };
- }, function(t, e, n) {
- var r = n(3), i = "__lodash_hash_undefined__";
- t.exports = function(t, e) {
- var n = this.__data__;
- return this.size += this.has(t) ? 0 :1, n[t] = r && e === undefined ? i :e, this;
- };
- }, function(t, e, n) {
- var r = n(66), i = n(67), a = n(69), o = n(70), s = n(71);
- function l(t) {
- var e = -1, n = null == t ? 0 :t.length;
- for (this.clear(); ++e < n; ) {
- var r = t[e];
- this.set(r[0], r[1]);
- }
- }
- l.prototype.clear = r, l.prototype["delete"] = i, l.prototype.get = a, l.prototype.has = o,
- l.prototype.set = s, t.exports = l;
- }, function(t, e) {
- t.exports = function() {
- this.__data__ = [], this.size = 0;
- };
- }, function(t, e, n) {
- var r = n(4), i = Array.prototype.splice;
- t.exports = function(t) {
- var e = this.__data__, n = r(e, t);
- return !(n < 0 || (n == e.length - 1 ? e.pop() :i.call(e, n, 1), --this.size, 0));
- };
- }, function(t, e) {
- t.exports = function(t, e) {
- return t === e || t != t && e != e;
- };
- }, function(t, e, n) {
- var r = n(4);
- t.exports = function(t) {
- var e = this.__data__, n = r(e, t);
- return n < 0 ? undefined :e[n][1];
- };
- }, function(t, e, n) {
- var r = n(4);
- t.exports = function(t) {
- return r(this.__data__, t) > -1;
- };
- }, function(t, e, n) {
- var r = n(4);
- t.exports = function(t, e) {
- var n = this.__data__, i = r(n, t);
- return i < 0 ? (++this.size, n.push([ t, e ])) :n[i][1] = e, this;
- };
- }, function(t, e, n) {
- var r = n(17)(n(9), "Map");
- t.exports = r;
- }, function(t, e, n) {
- var r = n(5);
- t.exports = function(t) {
- var e = r(this, t)["delete"](t);
- return this.size -= e ? 1 :0, e;
- };
- }, function(t, e) {
- t.exports = function(t) {
- var e = typeof t;
- return "string" == e || "number" == e || "symbol" == e || "boolean" == e ? "__proto__" !== t :null === t;
- };
- }, function(t, e, n) {
- var r = n(5);
- t.exports = function(t) {
- return r(this, t).get(t);
- };
- }, function(t, e, n) {
- var r = n(5);
- t.exports = function(t) {
- return r(this, t).has(t);
- };
- }, function(t, e, n) {
- var r = n(5);
- t.exports = function(t, e) {
- var n = r(this, t), i = n.size;
- return n.set(t, e), this.size += n.size == i ? 0 :1, this;
- };
- }, function(t, e, n) {
- var r = n(79);
- t.exports = function(t) {
- return null == t ? "" :r(t);
- };
- }, function(t, e, n) {
- var r = n(8), i = n(80), a = n(6), o = n(7), s = 1 / 0, l = r ? r.prototype :undefined, h = l ? l.toString :undefined;
- t.exports = function u(t) {
- if ("string" == typeof t) return t;
- if (a(t)) return i(t, u) + "";
- if (o(t)) return h ? h.call(t) :"";
- var e = t + "";
- return "0" == e && 1 / t == -s ? "-0" :e;
- };
- }, function(t, e) {
- t.exports = function(t, e) {
- for (var n = -1, r = null == t ? 0 :t.length, i = Array(r); ++n < r; ) i[n] = e(t[n], n, t);
- return i;
- };
- }, function(t, e, n) {
- var r = n(7), i = 1 / 0;
- t.exports = function(t) {
- if ("string" == typeof t || r(t)) return t;
- var e = t + "";
- return "0" == e && 1 / t == -i ? "-0" :e;
- };
- }, function(t, e, n) {
- "use strict";
- var r = n(1);
- r.a.Poly = r.a.Line.extend({});
- }, function(t, e, n) {
- "use strict";
- var r = n(1);
- r.a.Rectangle = r.a.Poly.extend({
- _initMarkers:function() {
- var t = this._map, e = this._findCorners();
- this._markerGroup && this._markerGroup.clearLayers(), this._markerGroup = new L.LayerGroup(),
- this._markerGroup._pmTempLayer = !0, t.addLayer(this._markerGroup), this._markers = [],
- this._markers[0] = e.map(this._createMarker, this), this._cornerMarkers = this._markers[0],
- this.options.snappable && this._initSnappableMarkers();
- },
- _createMarker:function(t, e) {
- var n = new L.Marker(t, {
- draggable:!this.options.preventVertexEdit,
- icon:L.divIcon({
- className:"marker-icon"
- })
- });
- return n._origLatLng = t, n._index = e, n._pmTempLayer = !0, n.on("dragstart", this._onMarkerDragStart, this),
- n.on("drag", this._onMarkerDrag, this), n.on("dragend", this._onMarkerDragEnd, this),
- n.on("pm:snap", this._adjustRectangleForMarkerSnap, this), this.options.preventMarkerRemoval || n.on("contextmenu", this._removeMarker, this),
- this._markerGroup.addLayer(n), n;
- },
- _removeMarker:function() {
- return null;
- },
- _onMarkerDragStart:function(t) {
- var e = t.target, n = this._findCorners();
- e._oppositeCornerLatLng = n[(e._index + 2) % 4], e._snapped = !1, this._layer.fire("pm:markerdragstart", {
- markerEvent:t
- });
- },
- _onMarkerDrag:function(t) {
- var e = t.target;
- e._index !== undefined && (e._snapped || this._adjustRectangleForMarkerMove(e));
- },
- _onMarkerDragEnd:function(t) {
- var e = this._findCorners();
- this._adjustAllMarkers(e), this._cornerMarkers.forEach(function(t) {
- delete t._oppositeCornerLatLng;
- }), this._layer.setLatLngs(e), this._layer.redraw(), this._layer.fire("pm:markerdragend", {
- markerEvent:t
- }), this._fireEdit();
- },
- _adjustRectangleForMarkerMove:function(t) {
- L.extend(t._origLatLng, t._latlng);
- var e = t.getLatLng();
- this._layer.setBounds(L.latLngBounds(e, t._oppositeCornerLatLng)), this._adjustAdjacentMarkers(t),
- this._layer.redraw();
- },
- _adjustRectangleForMarkerSnap:function(t) {
- if (this.options.snappable) {
- var e = t.target;
- this._adjustRectangleForMarkerMove(e);
- }
- },
- _adjustAllMarkers:function(t) {
- t.length && 4 == t.length ? this._cornerMarkers.forEach(function(e, n) {
- e.setLatLng(t[n]);
- }) :console.error("_adjustAllMarkers() requires an array of EXACTLY 4 LatLng coordinates");
- },
- _adjustAdjacentMarkers:function(t) {
- if (t && t.getLatLng && t._oppositeCornerLatLng) {
- var e = t.getLatLng(), n = t._oppositeCornerLatLng, r = [];
- this._findCorners().forEach(function(t) {
- t.equals(e) || t.equals(n) || r.push(t);
- });
- var i = 0;
- 2 == r.length && this._cornerMarkers.forEach(function(t) {
- var a = t.getLatLng();
- a.equals(e) || a.equals(n) || (t.setLatLng(r[i]), i += 1);
- });
- } else console.error("_adjustAdjacentMarkers() requires a valid Marker object");
- },
- _findCorners:function() {
- var t = this._layer.getBounds();
- return [ t.getNorthWest(), t.getNorthEast(), t.getSouthEast(), t.getSouthWest() ];
- }
- });
- }, function(t, e, n) {
- "use strict";
- var r = n(1);
- r.a.Circle = r.a.extend({
- initialize:function(t) {
- this._layer = t, this._enabled = !1;
- },
- toggleEdit:function(t) {
- this.enabled() ? this.disable() :this.enable(t);
- },
- enabled:function() {
- return this._enabled;
- },
- enable:function(t) {
- var e = this;
- L.Util.setOptions(this, t), this._map = this._layer._map, this.enabled() || this.disable(),
- this._enabled = !0, this._initMarkers(), this._layer.on("remove", function(t) {
- e.disable(t.target);
- });
- },
- disable:function() {
- var t = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] :this._layer;
- if (!this.enabled()) return !1;
- if (t.pm._dragging) return !1;
- t.pm._enabled = !1, t.pm._helperLayers.clearLayers(), t.off("mousedown"), t.off("mouseup");
- var e = t._path ? t._path :this._layer._renderer._container;
- return L.DomUtil.removeClass(e, "leaflet-pm-draggable"), this._layerEdited && this._layer.fire("pm:update", {}),
- this._layerEdited = !1, !0;
- },
- _initMarkers:function() {
- var t = this._map;
- this._helperLayers && this._helperLayers.clearLayers(), this._helperLayers = new L.LayerGroup().addTo(t);
- var e = this._layer.getLatLng(), n = this._layer._radius, r = this._getLatLngOnCircle(e, n);
- this._centerMarker = this._createCenterMarker(e), this._outerMarker = this._createOuterMarker(r),
- this._markers = [ this._centerMarker, this._outerMarker ], this._createHintLine(this._centerMarker, this._outerMarker),
- this.options.snappable && this._initSnappableMarkers();
- },
- _getLatLngOnCircle:function(t, e) {
- var n = this._map.project(t), r = L.point(n.x + e, n.y);
- return this._map.unproject(r);
- },
- _resizeCircle:function() {
- this._syncHintLine(), this._syncCircleRadius();
- },
- _moveCircle:function(t) {
- var e = t.latlng;
- this._layer.setLatLng(e);
- var n = this._layer._radius, r = this._getLatLngOnCircle(e, n);
- this._outerMarker.setLatLng(r), this._syncHintLine(), this._layer.fire("pm:centerplaced", {
- layer:this._layer,
- latlng:e
- });
- },
- _onMarkerDragStart:function(t) {
- this._layer.fire("pm:markerdragstart", {
- markerEvent:t
- });
- },
- _onMarkerDragEnd:function(t) {
- this._fireEdit(), this._layer.fire("pm:markerdragend", {
- markerEvent:t
- });
- },
- _syncCircleRadius:function() {
- var t = this._centerMarker.getLatLng(), e = this._outerMarker.getLatLng(), n = t.distanceTo(e);
- this._layer.setRadius(n);
- },
- _syncHintLine:function() {
- var t = this._centerMarker.getLatLng(), e = this._outerMarker.getLatLng();
- this._hintline.setLatLngs([ t, e ]);
- },
- _createHintLine:function(t, e) {
- var n = t.getLatLng(), r = e.getLatLng();
- this._hintline = L.polyline([ n, r ], this.options.hintlineStyle), this._hintline._pmTempLayer = !0,
- this._helperLayers.addLayer(this._hintline);
- },
- _createCenterMarker:function(t) {
- var e = this._createMarker(t);
- return e.on("move", this._moveCircle, this), e;
- },
- _createOuterMarker:function(t) {
- var e = this._createMarker(t);
- return this.options.preventVertexEdit && e.dragging.disable(), e.on("move", this._resizeCircle, this),
- e;
- },
- _createMarker:function(t) {
- var e = new L.Marker(t, {
- draggable:!0,
- icon:L.divIcon({
- className:"marker-icon"
- })
- });
- return e._origLatLng = t, e._pmTempLayer = !0, e.on("dragstart", this._onMarkerDragStart, this),
- e.on("dragend", this._onMarkerDragEnd, this), this._helperLayers.addLayer(e), e;
- },
- _fireEdit:function() {
- this._layer.fire("pm:edit"), this._layerEdited = !0;
- }
- });
- }, function(t, e) {}, function(t, e) {} ]);
|