UNPKG

maptalks.multisuite

Version:

An Suite to Combine <-> Decompose, Peel <-> Fill MultiPolygon.

9 lines 20.7 kB
/*! * maptalks.multisuite v0.1.0 * LICENSE : MIT * (c) 2016-2021 maptalks.org */ /*! * requires maptalks@>=0.31.0 */ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(t.maptalks=t.maptalks||{})}(this,function(t){"use strict";var It="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var e,Dt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n=(function(t,e){var r="__lodash_hash_undefined__",g=1,_=2,f=9007199254740991,l="[object Arguments]",p="[object Array]",o="[object AsyncFunction]",y="[object Boolean]",d="[object Date]",m="[object Error]",i="[object Function]",n="[object GeneratorFunction]",v="[object Map]",b="[object Number]",s="[object Null]",k="[object Object]",a="[object Promise]",c="[object Proxy]",G="[object RegExp]",S="[object Set]",j="[object String]",w="[object Symbol]",h="[object Undefined]",u="[object WeakMap]",T="[object ArrayBuffer]",O="[object DataView]",C=/^\[object .+?Constructor\]$/,P=/^(?:0|[1-9]\d*)$/,E={};E["[object Float32Array]"]=E["[object Float64Array]"]=E["[object Int8Array]"]=E["[object Int16Array]"]=E["[object Int32Array]"]=E["[object Uint8Array]"]=E["[object Uint8ClampedArray]"]=E["[object Uint16Array]"]=E["[object Uint32Array]"]=!0,E[l]=E[p]=E[T]=E[y]=E[O]=E[d]=E[m]=E[i]=E[v]=E[b]=E[k]=E[G]=E[S]=E[j]=E[u]=!1;var L="object"==Dt(It)&&It&&It.Object===Object&&It,A="object"==("undefined"==typeof self?"undefined":Dt(self))&&self&&self.Object===Object&&self,W=L||A||Function("return this")(),z=e&&!e.nodeType&&e,M=z&&t&&!t.nodeType&&t,x=M&&M.exports===z,F=x&&L.process,A=function(){try{return F&&F.binding&&F.binding("util")}catch(t){}}(),e=A&&A.isTypedArray;function R(t){var o=-1,r=Array(t.size);return t.forEach(function(t,e){r[++o]=[e,t]}),r}function I(t){var e=-1,o=Array(t.size);return t.forEach(function(t){o[++e]=t}),o}var D,N,M=Array.prototype,z=Function.prototype,H=Object.prototype,L=W["__core-js_shared__"],U=z.toString,$=H.hasOwnProperty,B=(A=/[^.]+$/.exec(L&&L.keys&&L.keys.IE_PROTO||""))?"Symbol(src)_1."+A:"",V=H.toString,J=RegExp("^"+U.call($).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),z=x?W.Buffer:void 0,L=W.Symbol,X=W.Uint8Array,Y=H.propertyIsEnumerable,q=M.splice,Z=L?L.toStringTag:void 0,K=Object.getOwnPropertySymbols,A=z?z.isBuffer:void 0,Q=(D=Object.keys,N=Object,function(t){return D(N(t))}),x=jt(W,"DataView"),tt=jt(W,"Map"),M=jt(W,"Promise"),z=jt(W,"Set"),W=jt(W,"WeakMap"),et=jt(Object,"create"),ot=Ot(x),rt=Ot(tt),it=Ot(M),nt=Ot(z),st=Ot(W),L=L?L.prototype:void 0,at=L?L.valueOf:void 0;function ct(t){var e=-1,o=null==t?0:t.length;for(this.clear();++e<o;){var r=t[e];this.set(r[0],r[1])}}function ht(t){var e=-1,o=null==t?0:t.length;for(this.clear();++e<o;){var r=t[e];this.set(r[0],r[1])}}function ut(t){var e=-1,o=null==t?0:t.length;for(this.clear();++e<o;){var r=t[e];this.set(r[0],r[1])}}function lt(t){var e=-1,o=null==t?0:t.length;for(this.__data__=new ut;++e<o;)this.add(t[e])}function ft(t){t=this.__data__=new ht(t);this.size=t.size}function pt(t,e){var o,r,i,n=Et(t),s=!n&&Pt(t),a=!n&&!s&&Lt(t),c=!n&&!s&&!a&&Ft(t),h=n||s||a||c,u=h?function(t,e){for(var o=-1,r=Array(t);++o<t;)r[o]=e(o);return r}(t.length,String):[],l=u.length;for(o in t)!e&&!$.call(t,o)||h&&("length"==o||a&&("offset"==o||"parent"==o)||c&&("buffer"==o||"byteLength"==o||"byteOffset"==o)||(r=o,!!(i=null==(i=l)?f:i)&&("number"==typeof r||P.test(r))&&-1<r&&r%1==0&&r<i))||u.push(o);return u}function yt(t,e){for(var o=t.length;o--;)if(Ct(t[o][0],e))return o;return-1}function _t(t,e,o){e=e(t);return Et(t)?e:function(t,e){for(var o=-1,r=e.length,i=t.length;++o<r;)t[i+o]=e[o];return t}(e,o(t))}function dt(t){return null==t?void 0===t?h:s:Z&&Z in Object(t)?function(t){var e=$.call(t,Z),o=t[Z];try{var r=!(t[Z]=void 0)}catch(t){}var i=V.call(t);r&&(e?t[Z]=o:delete t[Z]);return i}(t):(t=t,V.call(t))}function mt(t){return Mt(t)&&dt(t)==l}function gt(t,e,o,r,i){return t===e||(null==t||null==e||!Mt(t)&&!Mt(e)?t!=t&&e!=e:function(t,e,o,r,i,n){var s=Et(t),a=Et(e),c=s?p:Tt(t),h=a?p:Tt(e),u=(c=c==l?k:c)==k,a=(h=h==l?k:h)==k,h=c==h;if(h&&Lt(t)){if(!Lt(e))return!1;u=!(s=!0)}if(h&&!u)return n=n||new ft,s||Ft(t)?kt(t,e,o,r,i,n):function(t,e,o,r,i,n,s){switch(o){case O:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case T:return t.byteLength==e.byteLength&&n(new X(t),new X(e))?!0:!1;case y:case d:case b:return Ct(+t,+e);case m:return t.name==e.name&&t.message==e.message;case G:case j:return t==e+"";case v:var a=R;case S:var c=r&g;if(a=a||I,t.size!=e.size&&!c)return!1;c=s.get(t);if(c)return c==e;r|=_,s.set(t,e);a=kt(a(t),a(e),r,i,n,s);return s.delete(t),a;case w:if(at)return at.call(t)==at.call(e)}return!1}(t,e,c,o,r,i,n);if(!(o&g)){u=u&&$.call(t,"__wrapped__"),a=a&&$.call(e,"__wrapped__");if(u||a){u=u?t.value():t,a=a?e.value():e;return n=n||new ft,i(u,a,o,r,n)}}return h&&(n=n||new ft,function(t,e,o,r,i,n){var s=o&g,a=Gt(t),c=a.length,h=Gt(e).length;if(c!=h&&!s)return!1;var u=c;for(;u--;){var l=a[u];if(!(s?l in e:$.call(e,l)))return!1}var f=n.get(t);if(f&&n.get(e))return f==e;var p=!0;n.set(t,e),n.set(e,t);var y=s;for(;++u<c;){l=a[u];var _,d=t[l],m=e[l];if(!(void 0===(_=r?s?r(m,d,l,e,t,n):r(d,m,l,t,e,n):_)?d===m||i(d,m,o,r,n):_)){p=!1;break}y=y||"constructor"==l}p&&!y&&(h=t.constructor,f=e.constructor,h!=f&&"constructor"in t&&"constructor"in e&&!("function"==typeof h&&h instanceof h&&"function"==typeof f&&f instanceof f)&&(p=!1));return n.delete(t),n.delete(e),p}(t,e,o,r,i,n))}(t,e,o,r,gt,i))}function vt(t){var e;return zt(t)&&(e=t,!(B&&B in e))&&(At(t)?J:C).test(Ot(t))}function bt(t){if(o="function"==typeof(o=(e=t)&&e.constructor)&&o.prototype||H,e!==o)return Q(t);var e,o,r,i=[];for(r in Object(t))$.call(t,r)&&"constructor"!=r&&i.push(r);return i}function kt(t,e,r,i,n,s){var o=r&g,a=t.length,c=e.length;if(a!=c&&!(o&&a<c))return!1;c=s.get(t);if(c&&s.get(e))return c==e;var h=-1,u=!0,l=r&_?new lt:void 0;for(s.set(t,e),s.set(e,t);++h<a;){var f,p=t[h],y=e[h];if(void 0!==(f=i?o?i(y,p,h,e,t,s):i(p,y,h,t,e,s):f)){if(f)continue;u=!1;break}if(l){if(!function(t,e){for(var o=-1,r=null==t?0:t.length;++o<r;)if(e(t[o],o,t))return 1}(e,function(t,e){return o=e,!l.has(o)&&(p===t||n(p,t,r,i,s))&&l.push(e);var o})){u=!1;break}}else if(p!==y&&!n(p,y,r,i,s)){u=!1;break}}return s.delete(t),s.delete(e),u}function Gt(t){return _t(t,Rt,wt)}function St(t,e){var o,r=t.__data__;return("string"==(t=void 0===(o=e)?"undefined":Dt(o))||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==o:null===o)?r["string"==typeof e?"string":"hash"]:r.map}function jt(t,e){e=e,e=null==(t=t)?void 0:t[e];return vt(e)?e:void 0}ct.prototype.clear=function(){this.__data__=et?et(null):{},this.size=0},ct.prototype.delete=function(t){return t=this.has(t)&&delete this.__data__[t],this.size-=t?1:0,t},ct.prototype.get=function(t){var e=this.__data__;if(et){var o=e[t];return o===r?void 0:o}return $.call(e,t)?e[t]:void 0},ct.prototype.has=function(t){var e=this.__data__;return et?void 0!==e[t]:$.call(e,t)},ct.prototype.set=function(t,e){var o=this.__data__;return this.size+=this.has(t)?0:1,o[t]=et&&void 0===e?r:e,this},ht.prototype.clear=function(){this.__data__=[],this.size=0},ht.prototype.delete=function(t){var e=this.__data__;return!((t=yt(e,t))<0)&&(t==e.length-1?e.pop():q.call(e,t,1),--this.size,!0)},ht.prototype.get=function(t){var e=this.__data__;return(t=yt(e,t))<0?void 0:e[t][1]},ht.prototype.has=function(t){return-1<yt(this.__data__,t)},ht.prototype.set=function(t,e){var o=this.__data__,r=yt(o,t);return r<0?(++this.size,o.push([t,e])):o[r][1]=e,this},ut.prototype.clear=function(){this.size=0,this.__data__={hash:new ct,map:new(tt||ht),string:new ct}},ut.prototype.delete=function(t){return t=St(this,t).delete(t),this.size-=t?1:0,t},ut.prototype.get=function(t){return St(this,t).get(t)},ut.prototype.has=function(t){return St(this,t).has(t)},ut.prototype.set=function(t,e){var o=St(this,t),r=o.size;return o.set(t,e),this.size+=o.size==r?0:1,this},lt.prototype.add=lt.prototype.push=function(t){return this.__data__.set(t,r),this},lt.prototype.has=function(t){return this.__data__.has(t)},ft.prototype.clear=function(){this.__data__=new ht,this.size=0},ft.prototype.delete=function(t){var e=this.__data__,t=e.delete(t);return this.size=e.size,t},ft.prototype.get=function(t){return this.__data__.get(t)},ft.prototype.has=function(t){return this.__data__.has(t)},ft.prototype.set=function(t,e){var o=this.__data__;if(o instanceof ht){var r=o.__data__;if(!tt||r.length<199)return r.push([t,e]),this.size=++o.size,this;o=this.__data__=new ut(r)}return o.set(t,e),this.size=o.size,this};var wt=K?function(e){return null==e?[]:(e=Object(e),function(t,e){for(var o=-1,r=null==t?0:t.length,i=0,n=[];++o<r;){var s=t[o];e(s,o,t)&&(n[i++]=s)}return n}(K(e),function(t){return Y.call(e,t)}))}:function(){return[]},Tt=dt;function Ot(t){if(null!=t){try{return U.call(t)}catch(t){}try{return t+""}catch(t){}}return""}function Ct(t,e){return t===e||t!=t&&e!=e}(x&&Tt(new x(new ArrayBuffer(1)))!=O||tt&&Tt(new tt)!=v||M&&Tt(M.resolve())!=a||z&&Tt(new z)!=S||W&&Tt(new W)!=u)&&(Tt=function(t){var e=dt(t),t=e==k?t.constructor:void 0,t=t?Ot(t):"";if(t)switch(t){case ot:return O;case rt:return v;case it:return a;case nt:return S;case st:return u}return e});var Pt=mt(function(){return arguments}())?mt:function(t){return Mt(t)&&$.call(t,"callee")&&!Y.call(t,"callee")},Et=Array.isArray;var Lt=A||function(){return!1};function At(t){if(zt(t)){t=dt(t);return t==i||t==n||t==o||t==c}}function Wt(t){return"number"==typeof t&&-1<t&&t%1==0&&t<=f}function zt(t){var e=void 0===t?"undefined":Dt(t);return null!=t&&("object"==e||"function"==e)}function Mt(t){return null!=t&&"object"==(void 0===t?"undefined":Dt(t))}var xt,Ft=e?(xt=e,function(t){return xt(t)}):function(t){return Mt(t)&&Wt(t.length)&&!!E[dt(t)]};function Rt(t){return(null!=(e=t)&&Wt(e.length)&&!At(e)?pt:bt)(t);var e}t.exports=function(t,e){return gt(t,e)}}(e={exports:{}},e.exports),e.exports);function o(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):function(t,e){for(var o=Object.getOwnPropertyNames(e),r=0;r<o.length;r++){var i=o[r],n=Object.getOwnPropertyDescriptor(e,i);n&&n.configurable&&void 0===t[i]&&Object.defineProperty(t,i,n)}}(t,e))}var r,i="multisuite@cXiaof",s={markerType:"path",markerPath:[{path:"M8 23l0 0 0 0 0 0 0 0 0 0c-4,-5 -8,-10 -8,-14 0,-5 4,-9 8,-9l0 0 0 0c4,0 8,4 8,9 0,4 -4,9 -8,14z M3,9 a5,5 0,1,0,0,-0.9Z",fill:"#DE3333"}],markerPathWidth:16,markerPathHeight:23,markerWidth:24,markerHeight:34},a=(o(c,r=maptalks.Class),c.prototype.combine=function(t,e){t instanceof maptalks.Geometry&&(this._initialTaskWithGeo(t,"combine"),(e=e instanceof maptalks.Geometry?[e]:e)instanceof Array&&0<e.length?(this._compositWithTargets(e),this.remove()):this._initialChooseGeos(t))},c.prototype.decompose=function(t,e){t instanceof maptalks.GeometryCollection&&(this._initialTaskWithGeo(t,"decompose"),(e=e instanceof maptalks.Geometry?[e]:e)instanceof Array&&0<e.length?(this._decomposeWithTargets(e),this.remove()):this._initialChooseGeos(t))},c.prototype.peel=function(t,e){t instanceof maptalks.Polygon&&(this._initialTaskWithGeo(t,"peel"),(e=e instanceof maptalks.Polygon?[e]:e)instanceof Array&&0<e.length&&(this._peelWithTargets(e),this.remove()))},c.prototype.fill=function(t,e,o){var r,i,n=this;t instanceof maptalks.MultiPolygon&&(this._initialTaskWithGeo(t,"fill"),o?(this._fillAll(),this.remove()):(e=e instanceof maptalks.Polygon?[e]:e)instanceof Array&&0<e.length?(this._fillWithTargets(e),this.remove()):(r=this.geometry.getCoordinates()[0],(i=this.geometry.getSymbol()).polygonOpacity=0,r.forEach(function(t,e){0<e&&new maptalks.Polygon([r[e]],{symbol:i}).addTo(n._tmpLayer)})))},c.prototype.submit=function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:function(){return!1};switch(this._task){case"combine":this._submitCombine();break;case"decompose":this._submitDecompose();break;case"peel":this._submitPeel();break;case"fill":this._submitFill()}t(this._result,this._deals,this._task),this.remove()},c.prototype.cancel=function(){this.remove()},c.prototype.remove=function(){this._tmpLayer&&this._tmpLayer.remove(),this._chooseLayer&&this._chooseLayer.remove(),this._chooseGeos=[],this._offMapEvents(),delete this._result,delete this._deals,delete this._task,delete this._tmpLayer,delete this._chooseLayer},c.prototype._initialTaskWithGeo=function(t,e){this.geometry&&this.remove(),this._task=e,this._savePrivateGeometry(t)},c.prototype._savePrivateGeometry=function(t){this.geometry=t,this.layer=t.getLayer(),this._addTo(t.getMap())},c.prototype._addTo=function(t){this._chooseLayer&&this.remove(),t._map_tool&&t._map_tool instanceof maptalks.DrawTool&&t._map_tool.disable(),this._map=t,this._tmpLayer=this._newVectorLayerToFront(this._layerTMP),this._chooseLayer=this._newVectorLayerToFront(this._layerName),this._registerMapEvents()},c.prototype._newVectorLayerToFront=function(t){return new maptalks.VectorLayer(t).addTo(this._map).bringToFront()},c.prototype._registerMapEvents=function(){map.on("mousemove",this._mousemoveEvents,this),map.on("click",this._clickEvents,this)},c.prototype._offMapEvents=function(){map.off("mousemove",this._mousemoveEvents,this),map.off("click",this._clickEvents,this)},c.prototype._mousemoveEvents=function(t){var o=this,r=[];switch(this._task){case"combine":r=this.layer.identify(t.coordinate);break;case"decompose":r=this._tmpLayer.identify(t.coordinate);break;case"peel":var i=this._getSafeCoords();this.layer.identify(t.coordinate).forEach(function(t){var e=o._getSafeCoords(t);n(e,i)||r.push(t)});break;case"fill":r=this._tmpLayer.identify(t.coordinate)}this._updateHitGeo(r)},c.prototype._getSafeCoords=function(){var t,e,o=0<arguments.length&&void 0!==arguments[0]?arguments[0]:this.geometry,r=o.getCoordinates();return o.options.numberOfShellPoints&&(e=(t=o.options).numberOfShellPoints,t.numberOfShellPoints=300,o.setOptions(t),r=[o.getShell()],t.numberOfShellPoints=e||60,o.setOptions(t)),r},c.prototype._updateHitGeo=function(t){var e;this._needRefreshSymbol&&((e=this._chooseLayer.getGeometryById("_hit"))&&(e.remove(),delete this.hitGeo),this._needRefreshSymbol=!1),t&&0<t.length&&(this._needRefreshSymbol=!0,this.hitGeo=t[0],this._checkIsSameType(this.hitGeo)?(t=this._getSymbolOrDefault(this.hitGeo,"Hit"),this._copyGeoUpdateSymbol(this.hitGeo,t).setId("_hit")):delete this.hitGeo)},c.prototype._checkIsSameType=function(t){var e=t.getType(),t=this.geometry.getType();return e.includes(t)||t.includes(e)},c.prototype._getSymbolOrDefault=function(t,e){var o=t.getSymbol(),r=this.options["color"+e];if(o){for(var i in o)(i.endsWith("Fill")||i.endsWith("Color"))&&(o[i]=r);o.lineWidth=4}else o=t.getType().endsWith("Point")?Object.assign(s,{markerFill:r}):{lineColor:r,lineWidth:4};return o},c.prototype._copyGeoUpdateSymbol=function(t,e){return t.copy().updateSymbol(e).addTo(this._chooseLayer)},c.prototype._clickEvents=function(t){switch(this._task){case"combine":this._clickCombine();break;case"decompose":this._clickDecompose(t);break;default:var e;this.hitGeo&&(e=this._getSafeCoords(this.hitGeo),this._setChooseGeosExceptHit(e),this._updateChooseGeos())}},c.prototype._clickCombine=function(){if(this.hitGeo){var t=this._getSafeCoords(this.hitGeo),e=this._getSafeCoords();if(n(t,e))return null;this._setChooseGeosExceptHit(t),this._updateChooseGeos()}},c.prototype._setChooseGeosExceptHit=function(r){var i=this,t=this._chooseGeos.reduce(function(t,e){var o=i._getSafeCoords(e);return n(r,o)?t:[].concat(t,[e])},[]);t.length===this._chooseGeos.length?this._chooseGeos.push(this.hitGeo):this._chooseGeos=t},c.prototype._updateChooseGeos=function(){var o=this;this._chooseLayer.clear(),this._chooseGeos.forEach(function(t){var e=o._getSymbolOrDefault(t,"Chosen");o._copyGeoUpdateSymbol(t,e)})},c.prototype._clickDecompose=function(t){var e=this._chooseLayer.identify(t.coordinate).reduce(function(t,e){return"_hit"!==e.getId()&&t.push(e),t},[]);0<e.length?(t=e[0],e=this._getSafeCoords(t),this._setChooseGeosExceptHit(e,!0),t.remove()):this.hitGeo&&this._chooseGeos.push(this.hitGeo),this._updateChooseGeos()},c.prototype._initialChooseGeos=function(t){var e=this;switch(this._task){case"combine":this._chooseGeos=[t];break;case"decompose":t.forEach(function(t){return t.copy().addTo(e._tmpLayer)}),this._chooseGeos=this._tmpLayer.getGeometries()}this._updateChooseGeos()},c.prototype._submitCombine=function(){this._compositWithTargets()},c.prototype._compositWithTargets=function(){var r=this,t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:this._chooseGeos;this._deals=t.map(function(t){return t.copy()});var i=this._getGeoStringifyCoords(t),t=this.layer.getGeometries().reduce(function(e,t){var o=r._getGeoStringifyCoords(t);return i.includes(o)&&(t.getType().startsWith("Multi")?t.forEach(function(t){return e.push(t.copy())}):e.push(t.copy()),t.remove()),e},[]);this._compositResultGeo(t)},c.prototype._getGeoStringifyCoords=function(t){var e=this;return t instanceof Array?t.map(function(t){return JSON.stringify(e._getSafeCoords(t))}):JSON.stringify(this._getSafeCoords(t))},c.prototype._compositResultGeo=function(t){var e=t.length;if(!e||0===e)return null;var o=void 0;if(1<e)switch(t[0].getType()){case"Point":o=new maptalks.MultiPoint(t);break;case"LineString":o=new maptalks.MultiLineString(t);break;default:o=new maptalks.MultiPolygon(t)}else o=t[0].copy();o.setSymbol(this.geometry.getSymbol()),o.setProperties(this.geometry.getProperties()),o.addTo(this.layer),this._result=o},c.prototype._submitDecompose=function(){this._decomposeWithTargets()},c.prototype._decomposeWithTargets=function(){var r=this,i=(0<arguments.length&&void 0!==arguments[0]?arguments[0]:this._chooseLayer.getGeometries()).reduce(function(t,e){return"_hit"!==e.getId()&&t.push(r._getGeoStringifyCoords(e)),t},[]),t=this._tmpLayer.getGeometries(),n=[];this._deals=t.reduce(function(t,e){var o=r._getGeoStringifyCoords(e);return i.includes(o)?n.push(e.copy()):(e=e.copy().addTo(r.layer),t.push(e)),t},[]),this.geometry.remove(),this._compositResultGeo(n)},c.prototype._peelWithTargets=function(){var o=this,t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:this._chooseGeos,e=this.geometry;0<t.length?(this._deals=[],t=t.reduce(function(e,t){return t instanceof maptalks.MultiPolygon?t.forEach(function(t){return e.push(o._getSafeCoords(t)[0])}):e.push(o._getSafeCoords(t)[0]),o._deals.push(t.copy()),t.remove(),e},[this._getSafeCoords(e)[0]]),this._result=new maptalks.MultiPolygon([t],{symbol:e.getSymbol(),properties:e.getProperties()}).addTo(this.layer)):this._result=e.copy().addTo(this.layer),e.remove()},c.prototype._submitPeel=function(){this._peelWithTargets()},c.prototype._submitFill=function(){this._fillWithTargets()},c.prototype._fillAll=function(){var t=this.geometry.getCoordinates(),e=this.geometry.getSymbol(),o=this.geometry.getProperties(),o=new maptalks.Polygon([t[0][0]],{symbol:e,properties:o}).addTo(this.layer);return this.geometry.remove(),o},c.prototype._fillWithTargets=function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:this._chooseGeos,o=this.geometry.getSymbol(),e=this.geometry.getProperties(),r=[];this._deals=t.map(function(t){var e=JSON.stringify(t.getCoordinates()[0]);return r.push(e),t.copy().setSymbol(o)});t=this.geometry.getCoordinates()[0].reduce(function(t,e){return r.includes(JSON.stringify(e))||t.push(e),t},[]);1===t.length?this._result=this._fillAll():(this._result=new maptalks.MultiPolygon([t],{symbol:o,properties:e}).addTo(this.layer),this.geometry.remove())},c);function c(t){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,c);t=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,r.call(this,t));return t._layerName=""+maptalks.INTERNAL_LAYER_PREFIX+i,t._layerTMP=""+maptalks.INTERNAL_LAYER_PREFIX+i+"_temp",t._chooseGeos=[],t}a.mergeOptions({colorHit:"#ffa400",colorChosen:"#00bcd4"}),t.MultiSuite=a,Object.defineProperty(t,"__esModule",{value:!0}),"undefined"!=typeof console&&console.log("maptalks.multisuite v0.1.0, requires maptalks@>=0.31.0.")});