ol-plot-tool
Version:
1 lines • 77.3 kB
JavaScript
"use strict";var te=Object.defineProperty;var ee=(o,s,t)=>s in o?te(o,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[s]=t;var l=(o,s,t)=>(ee(o,typeof s!="symbol"?s+"":s,t),t);const y=require("ol"),pt=require("ol/interaction/Draw"),se=require("ol/interaction/DoubleClickZoom"),_=require("ol/style"),yt=require("ol/Overlay"),Y=require("ol/layer"),st=require("ol/source"),wt=require("ol/interaction/DragPan"),ie=require("ol/events/Event"),x=require("ol/geom"),ne=require("ol/geom/Polygon"),V=require("ol/extent"),D=require("ol/color");const O=100,M=Math.PI/2,ot=1e-4,Ct="ol-plot-vector-layer",$="plot-helper-control-point-div",dt="plot-helper-hidden-div",ft={borderRadius:"2px",fontSize:"12px",outline:0,overflow:"hidden",boxSizing:"border-box",border:"1px solid #eeeeee",fontFamily:"Helvetica Neue,Helvetica,PingFang SC,Hiragino Sans GB,Microsoft YaHei,Noto Sans CJK SC,WenQuanYi Micro Hei,Arial,sans-serif",color:"#010500",fontWeight:400,padding:"3px",fontStretch:"normal",lineHeight:"normal",textAlign:"left",marginLeft:"auto",marginRight:"auto",width:"auto",height:"auto",background:"rgb(255, 255, 255)",fontStyle:"",fontVariant:""},v=(o,s)=>Math.sqrt((o[0]-s[0])**2+(o[1]-s[1])**2),rt=o=>{let s=0;return o&&Array.isArray(o)&&o.length>0&&o.forEach((t,e)=>{e<o.length-1&&(s+=v(t,o[e+1]))}),s},k=o=>rt(o)**.99,F=(o,s)=>[(o[0]+s[0])/2,(o[1]+s[1])/2],Mt=(o,s,t)=>{const e=[(o[0]+s[0])/2,(o[1]+s[1])/2],i=[e[0]-o[1]+s[1],e[1]+o[0]-s[0]],n=[(o[0]+t[0])/2,(o[1]+t[1])/2],r=[n[0]-o[1]+t[1],n[1]+o[0]-t[0]];return oe(e,i,n,r)},oe=(o,s,t,e)=>{if(o[1]===s[1]){const c=(e[0]-t[0])/(e[1]-t[1])*(o[1]-t[1])+t[0],u=o[1];return[c,u]}if(t[1]===e[1]){const c=(s[0]-o[0])/(s[1]-o[1])*(t[1]-o[1])+o[0],u=t[1];return[c,u]}const i=(s[0]-o[0])/(s[1]-o[1]),n=(e[0]-t[0])/(e[1]-t[1]),r=(i*o[1]-o[0]-n*t[1]+t[0])/(i-n);return[i*r-i*o[1]+o[0],r]},R=(o,s)=>{let t=0;const e=Math.asin(Math.abs(s[1]-o[1])/v(o,s));return s[1]>=o[1]&&s[0]>=o[0]?t=e+Math.PI:s[1]>=o[1]&&s[0]<o[0]?t=Math.PI*2-e:s[1]<o[1]&&s[0]<o[0]?t=e:s[1]<o[1]&&s[0]>=o[0]&&(t=Math.PI-e),t},J=(o,s,t)=>{const e=R(s,o)-R(s,t);return e<0?e+Math.PI*2:e},G=(o,s,t)=>(t[1]-o[1])*(s[0]-o[0])>(s[1]-o[1])*(t[0]-o[0]),at=(o,s,t,e,i)=>{o=Math.max(Math.min(o,1),0);const[n,r]=[1-o,o*o],a=r*o,h=n*n,c=h*n,u=c*s[0]+3*h*o*t[0]+3*n*r*e[0]+a*i[0],g=c*s[1]+3*h*o*t[1]+3*n*r*e[1]+a*i[1];return[u,g]},P=(o,s,t,e,i)=>{const n=R(o,s),r=i?n+t:n-t,a=e*Math.cos(r),h=e*Math.sin(r);return[s[0]+a,s[1]+h]},ht=(o,s,t,e)=>{let[i,n,r,a]=[0,0,[],e-t];a=a<0?a+Math.PI*2:a;for(let h=0;h<=100;h++){const c=t+a*h/100;i=o[0]+s*Math.cos(c),n=o[1]+s*Math.sin(c),r.push([i,n])}return r},j=(o,s,t,e)=>{const i=lt(s,t,e);let[n,r,a,h,c]=[[0,0],[0,0],0,0,0];const u=Math.sqrt(i[0]*i[0]+i[1]*i[1]),g=i[0]/u,p=i[1]/u,m=v(s,t),f=v(t,e);return u>ot?G(s,t,e)?(a=o*m,h=t[0]-a*p,c=t[1]+a*g,n=[h,c],a=o*f,h=t[0]+a*p,c=t[1]-a*g,r=[h,c]):(a=o*m,h=t[0]+a*p,c=t[1]-a*g,n=[h,c],a=o*f,h=t[0]-a*p,c=t[1]+a*g,r=[h,c]):(h=t[0]+o*(s[0]-t[0]),c=t[1]+o*(s[1]-t[1]),n=[h,c],h=t[0]+o*(e[0]-t[0]),c=t[1]+o*(e[1]-t[1]),r=[h,c]),[n,r]},lt=(o,s,t)=>{let e=o[0]-s[0],i=o[1]-s[1];const n=Math.sqrt(e*e+i*i);e/=n,i/=n;let r=t[0]-s[0],a=t[1]-s[1];const h=Math.sqrt(r*r+a*a);r/=h,a/=h;const c=e+r,u=i+a;return[c,u]},re=(o,s)=>{let[t,e,i,n,r]=[o[0],o[1],o[2],0,0];const h=j(0,t,e,i)[0],c=lt(t,e,i);if(Math.sqrt(c[0]*c[0]+c[1]*c[1])>ot){const g=F(t,e),p=t[0]-g[0],m=t[1]-g[1],w=2/v(t,e),A=-w*m,C=w*p,E=A*A-C*C,N=2*A*C,L=C*C-A*A,W=h[0]-g[0],S=h[1]-g[1];n=g[0]+E*W+N*S,r=g[1]+N*W+L*S}else n=t[0]+s*(e[0]-t[0]),r=t[1]+s*(e[1]-t[1]);return[n,r]},ae=(o,s)=>{const t=o.length,e=o[t-3],i=o[t-2],n=o[t-1],a=j(0,e,i,n)[1],h=lt(e,i,n),c=Math.sqrt(h[0]*h[0]+h[1]*h[1]);let[u,g]=[0,0];if(c>ot){const p=F(i,n),m=n[0]-p[0],f=n[1]-p[1],A=2/v(i,n),C=-A*f,E=A*m,N=C*C-E*E,L=2*C*E,W=E*E-C*C,S=a[0]-p[0],z=a[1]-p[1];u=p[0]+N*S+L*z,g=p[1]+L*S+W*z}else u=n[0]+s*(i[0]-n[0]),g=n[1]+s*(i[1]-n[1]);return[u,g]},he=(o,s)=>{const t=re(s,o);let[e,i,n,r]=[null,null,null,[t]];const a=[];for(let c=0;c<s.length-2;c++){[e,i,n]=[s[c],s[c+1],s[c+2]];const u=j(o,e,i,n);r=r.concat(u)}const h=ae(s,o);h&&r.push(h);for(let c=0;c<s.length-1;c++){e=s[c],i=s[c+1],a.push(e);for(let u=0;u<O;u++){const g=at(u/O,e,r[c*2],r[c*2+1],i);a.push(g)}a.push(i)}return a},X=function(o){if(o.length<=2)return o;const s=[],t=o.length-1;for(let e=0;e<=1;e+=.01){let[i,n]=[0,0];for(let r=0;r<=t;r++){const a=le(t,r),h=e**r,c=(1-e)**(t-r);i+=a*h*c*o[r][0],n+=a*h*c*o[r][1]}s.push([i,n])}return s.push(o[t]),s},tt=o=>{let s=1;switch(!0){case o<=1:s=1;break;case o===2:s=2;break;case o===3:s=6;break;case o===24:s=24;break;case o===5:s=120;break;default:for(let t=1;t<=o;t++)s*=t;break}return s},le=(o,s)=>tt(o)/(tt(s)*tt(o-s)),H=o=>{if(o.length<=2)return o;const[s,t]=[2,[]],e=o.length-s-1;t.push(o[0]);for(let i=0;i<=e;i++)for(let n=0;n<=1;n+=.05){let[r,a]=[0,0];for(let h=0;h<=s;h++){const c=ce(h,n);r+=c*o[i+h][0],a+=c*o[i+h][1]}t.push([r,a])}return t.push(o[o.length-1]),t},ce=(o,s)=>{let t=0;return o===0?t=(s-1)**2/2:o===1?t=(-2*s**2+2*s+1)/2:o===2&&(t=s**2/2),t};function it(o=!1){function s(t){return t?(t^Math.random()*16>>t/4).toString(16):([1e7]+-[1e3]+-4e3+-8e3+-1e11).replace(/[018]/g,s)}return o?s().replace(/-/g,""):s()}const Pt=o=>{const s=typeof o;return o!==null&&(s==="object"||s==="function")},At=(o,s)=>{for(const t in s)Pt(s[t])&&Pt(o[t])?At(o[t],s[t]):o[t]=s[t];return o};function ct(o,s){o.forEach(t=>{s[t]&&(s[t]=s[t].bind(s))})}const B=function(o,s){try{let t=null;if(o){const e=o.getLayers().getArray();t=vt(e,"layerName",s)}return t}catch(t){return console.log(t),null}},vt=function(o,s,t){let e=null;return o.length>0&&o.every(i=>{if(i instanceof Y.Group){const n=i.getLayers().getArray();return e=vt(n,s,t),!e}return i.get(s)===t?(e=i,!1):!0}),e},Et=function(o,s,t){try{if(o){let e=B(o,s);if(e instanceof Y.Vector||(e=null),e||t&&t.create&&(e=new Y.Vector({layerName:s,params:t,layerType:"vector",source:new st.Vector({wrapX:!1}),style:new _.Style({fill:new _.Fill({color:"rgba(67, 110, 238, 0.4)"}),stroke:new _.Stroke({color:"#4781d9",width:2}),image:new _.Circle({radius:7,fill:new _.Fill({color:"#ffcc33"})})})})),o&&e){t&&t.hasOwnProperty("selectable")&&e.set("selectable",t.selectable);const i=B(o,s);(!i||!(i instanceof Y.Vector))&&o.addLayer(e)}return e}}catch(e){console.error(e)}};var d=(o=>(o.TEXTAREA="TextArea",o.ARC="Arc",o.CURVE="Curve",o.GATHERING_PLACE="GatheringPlace",o.POLYLINE="Polyline",o.FREEHANDLINE="FreeHandLine",o.POINT="Point",o.PENNANT="Pennant",o.RECTANGLE="RectAngle",o.CIRCLE="Circle",o.ELLIPSE="Ellipse",o.LUNE="Lune",o.SECTOR="Sector",o.CLOSED_CURVE="ClosedCurve",o.POLYGON="Polygon",o.FREE_POLYGON="FreePolygon",o.ATTACK_ARROW="AttackArrow",o.DOUBLE_ARROW="DoubleArrow",o.STRAIGHT_ARROW="StraightArrow",o.FINE_ARROW="FineArrow",o.ASSAULT_DIRECTION="AssaultDirection",o.TAILED_SQUAD_COMBAT="TailedSquadCombat",o.TAILED_ATTACK_ARROW="TailedAttackArrow",o.SQUAD_COMBAT="SquadCombat",o.RECTFLAG="RectFlag",o.TRIANGLEFLAG="TriangleFlag",o.CURVEFLAG="CurveFlag",o.RECTINCLINED1="RectInclined1",o.RECTINCLINED2="RectInclined2",o))(d||{}),q=new Map;function ue(o){var s=q.get(o);s&&s.destroy()}function ge(o){var s=q.get(o);s&&s.update()}var U=null;typeof window>"u"?((U=function(o){return o}).destroy=function(o){return o},U.update=function(o){return o}):((U=function(o,s){return o&&Array.prototype.forEach.call(o.length?o:[o],function(t){return function(e){if(e&&e.nodeName&&e.nodeName==="TEXTAREA"&&!q.has(e)){var i,n=null,r=window.getComputedStyle(e),a=(i=e.value,function(){c({testForHeightReduction:i===""||!e.value.startsWith(i),restoreTextAlign:null}),i=e.value}),h=(function(g){e.removeEventListener("autosize:destroy",h),e.removeEventListener("autosize:update",u),e.removeEventListener("input",a),window.removeEventListener("resize",u),Object.keys(g).forEach(function(p){return e.style[p]=g[p]}),q.delete(e)}).bind(e,{height:e.style.height,resize:e.style.resize,textAlign:e.style.textAlign,overflowY:e.style.overflowY,overflowX:e.style.overflowX,wordWrap:e.style.wordWrap});e.addEventListener("autosize:destroy",h),e.addEventListener("autosize:update",u),e.addEventListener("input",a),window.addEventListener("resize",u),e.style.overflowX="hidden",e.style.wordWrap="break-word",q.set(e,{destroy:h,update:u}),u()}function c(g){var p,m,f=g.restoreTextAlign,w=f===void 0?null:f,A=g.testForHeightReduction,C=A===void 0||A,E=r.overflowY;if(e.scrollHeight!==0&&(r.resize==="vertical"?e.style.resize="none":r.resize==="both"&&(e.style.resize="horizontal"),C&&(p=function(L){for(var W=[];L&&L.parentNode&&L.parentNode instanceof Element;)L.parentNode.scrollTop&&W.push([L.parentNode,L.parentNode.scrollTop]),L=L.parentNode;return function(){return W.forEach(function(S){var z=S[0],Jt=S[1];z.style.scrollBehavior="auto",z.scrollTop=Jt,z.style.scrollBehavior=null})}}(e),e.style.height=""),m=r.boxSizing==="content-box"?e.scrollHeight-(parseFloat(r.paddingTop)+parseFloat(r.paddingBottom)):e.scrollHeight+parseFloat(r.borderTopWidth)+parseFloat(r.borderBottomWidth),r.maxHeight!=="none"&&m>parseFloat(r.maxHeight)?(r.overflowY==="hidden"&&(e.style.overflow="scroll"),m=parseFloat(r.maxHeight)):r.overflowY!=="hidden"&&(e.style.overflow="hidden"),e.style.height=m+"px",w&&(e.style.textAlign=w),p&&p(),n!==m&&(e.dispatchEvent(new Event("autosize:resized",{bubbles:!0})),n=m),E!==r.overflow&&!w)){var N=r.textAlign;r.overflow==="hidden"&&(e.style.textAlign=N==="start"?"end":"start"),c({restoreTextAlign:N,testForHeightReduction:!0})}}function u(){c({testForHeightReduction:!0,restoreTextAlign:null})}}(t)}),o}).destroy=function(o){return o&&Array.prototype.forEach.call(o.length?o:[o],ue),o},U.update=function(o){return o&&Array.prototype.forEach.call(o.length?o:[o],ge),o});var mt=U;const pe=/([\:\-\_]+(.))/g,de=/^moz([A-Z])/,fe=function(o,s,t,e){const i=document.createElement(o);return i.className=s||"",e&&(i.id=e),t&&t.appendChild(i),i},et=function(o){return typeof o=="string"?document.getElementById(o):o},Pe=function(o,s){const t=o.parentNode;t&&t.removeChild(o)},me=function(o,s,t){const e=document.createElement(o);return e.style.display="none",t&&(e.id=t),s&&s.appendChild(e),e},xt=function(o){return o.replace(pe,(s,t,e,i)=>i?e.toUpperCase():e).replace(de,"Moz$1")},T=function(){if(document)return function(o,s,t){o&&s&&t&&o.addEventListener(s,t,!1)}}(),I=function(){if(document)return function(o,s,t){o&&s&&o.removeEventListener(s,t,!1)}}();function ye(o,s){if(!o||!s)return!1;if(s.indexOf(" ")!==-1)throw new Error("className should not contain space.");return o.classList?o.classList.contains(s):` ${o.className} `.indexOf(` ${s} `)>-1}function we(o,s){var t;if(!o||!s)return null;s=xt(s),s==="float"&&(s="cssFloat");try{const e=(t=document.defaultView)==null?void 0:t.getComputedStyle(o,"");return o.style[s]||e?e==null?void 0:e[s]:null}catch{return o.style[s]}}function Q(o,s,t){if(!(!o||!s))if(typeof s=="object")for(const e in s)s.hasOwnProperty(e)&&Q(o,e,s[e]);else s=xt(s),s==="opacity"?o.style.filter=isNaN(t)?"":`alpha(opacity=${t*100})`:o.style[s]=t}class b extends ie{constructor(s,t={}){super(s),Object.keys(t).forEach(e=>{this[e]=t[e]})}}class Ce extends y.Overlay{constructor(s={},t){const[e,i,n,r,a,h,c,u,g,p]=[s.id,s.element,s.offset,s.stopEvent,s.positioning,s.insertFirst,s.autoPan,s.autoPanAnimation,s.autoPanMargin,s.className?s.className:"ol-plot-text-editor"];super({id:e,element:i,stopEvent:r,insertFirst:h,autoPan:c,autoPanAnimation:u,autoPanMargin:g,className:p}),this.parent=t,this.setOffset(n!==void 0?n:[0,0]),this.setPositioning(a!==void 0?a:"center-center"),this.mapDragPan=void 0,this.isClick_=!1,this.dragging_=!1,this.isFocus_=!1,this.options_=s,this._position=s.position&&s.position.length>0?s.position:[],this.handleTimer_=null,this.currentPixel_=[],this.freehand=!1,ct(["handleFocus_","handleBlur_","handleClick_","handleDragStart_","handleDragEnd_","handleDragDrag_","closeCurrentPlotText","handleResizeMouseDown_","handleResizeMouseMove_","handleResizeMouseUp_","resizeButtonMoveHandler_"],this),this.createTextContent(s)}createTextContent(s){const t=s.className||"ol-plot-text-editor",e=document.createElement("textarea");e.className=t,e.style.width=`${s.width}px`,e.style.height=`${s.height}px`,e.style.minHeight=`${s.minHeight}px`,e.setAttribute("id",s.id),e.setAttribute("autofocus",!0),mt(e),T(e,"focus",this.handleFocus_),T(e,"blur",this.handleBlur_),T(e,"click",this.handleClick_),T(e,"mousedown",this.handleDragStart_),T(window,"mouseup",this.handleDragEnd_),this.set("isPlotText",!0),this.setElement(e),this.createCloseButton(s),this.createResizeButton(s),this.setPosition(this._position),this.dispatchEvent(new b("textBoxDrawEnd",{overlay:this,element:e,uuid:s.id}))}getTextAreaFromContent_(){let s="";const t=Array.prototype.slice.call(this.element&&this.element.children,0);return t.length>0&&t.every(e=>e.nodeType===1&&e.nodeName.toLowerCase()==="textarea"?(s=e,!1):!0),s}createCloseButton(s){const t=document.createElement("span");t.className="ol-plot-text-editor-close",t.setAttribute("data-id",s.id),I(t,"click",this.closeCurrentPlotText),T(t,"click",this.closeCurrentPlotText),this.element.appendChild(t)}createResizeButton(s){const t=document.createElement("span");t.className="ol-plot-text-editor-resize",t.setAttribute("data-id",s.id),I(t,"mousedown",this.handleResizeMouseDown_),I(t,"mousemove",this.handleResizeMouseMove_),T(t,"mousedown",this.handleResizeMouseDown_),T(t,"mousemove",this.handleResizeMouseMove_),this.element.appendChild(t)}resizeButtonMoveHandler_(s){const t=s.pixel,e=this.getTextAreaFromContent_();if(t.length<1||this.currentPixel_.length<1||!e)return;const i=[t[0]-this.currentPixel_[0],t[1]-this.currentPixel_[1]],n=[e.offsetWidth,e.offsetHeight],r=n[0]+i[0]*2,a=n[1]+i[1]*2;Q(e,"width",`${r}px`),Q(e,"height",`${a}px`),this.currentPixel_=t,this.getMap().render()}handleResizeMouseMove_(s){s.stopImmediatePropagation()}handleResizeMouseDown_(s){this.getMap()&&(this.currentPixel_=[s.x,s.y],this.getMap().on("pointermove",this.resizeButtonMoveHandler_),T(this.getMap().getViewport(),"mouseup",this.handleResizeMouseUp_))}handleResizeMouseUp_(){this.getMap()&&(this.getMap().un("pointermove",this.resizeButtonMoveHandler_),I(this.getMap().getViewport(),"mouseup",this.handleResizeMouseUp_),this.currentPixel_=[])}closeCurrentPlotText(s){if(this.getMap()&&s&&ye(s.target,"ol-plot-text-editor-close")){const t=s.target.getAttribute("data-id");if(t){const e=this.getMap().getOverlayById(t);e&&this.getMap().removeOverlay(e)}}}handleFocus_(){this.isFocus_=!0,this.parent&&this.parent.dispatchEvent(new b("activeTextArea",{overlay:this}))}handleBlur_(){this.isFocus_=!1,this.parent&&this.parent.dispatchEvent(new b("deactivateTextArea",{overlay:this}))}handleDragStart_(){this.getMap()&&!this.dragging_&&this.isMoveModel()&&this.isFocus_&&(this.handleTimer_=window.setTimeout(()=>{window.clearTimeout(this.handleTimer_),this.handleTimer_=null,this.isClick_||(this.dragging_=!0,this.disableMapDragPan(),this.preCursor_=this.element.style.cursor,T(this.getMap().getViewport(),"mousemove",this.handleDragDrag_),T(this.element,"mouseup",this.handleDragEnd_))},300))}handleDragDrag_(s){this.dragging_&&(this.element.style.cursor="move",this._position=this.getMap().getCoordinateFromPixel([s.clientX,s.clientY]),this.setPosition(this._position))}handleDragEnd_(){this.isClick_=!1,window.clearTimeout(this.handleTimer_),this.handleTimer_=null,this.dragging_&&this.isFocus_&&(this.dragging_=!1,this.enableMapDragPan(),this.element.style.cursor=this.preCursor_,I(this.getMap().getViewport(),"mousemove",this.handleDragDrag_),I(this.element,"mouseup",this.handleDragEnd_))}handleClick_(s){s.target===this.element?this.isClick_=!0:this.isClick_=!1}isMoveModel(){if(!window)return!1;try{return window.getSelection()?window.getSelection().getRangeAt(0).collapsed:!1}catch(s){console.error("[ol-plot]: PlotTextBox check move error",s)}}setStyle(s={}){const t=this.getTextAreaFromContent_();if(t)for(const e in s)s[e]&&Q(t,e,s[e])}getStyle(){const s={},t=this.getTextAreaFromContent_();if(t)for(const e in ft)s[e]=we(t,e);return s}setValue(s){const t=this.getTextAreaFromContent_();t&&(t.value=s,s&&mt.update(t),this.getMap().render())}getValue(){const s=this.getTextAreaFromContent_();return s?s.value:""}getWidth(){const s=this.getTextAreaFromContent_();return s&&s.offsetWidth?s.offsetWidth:0}getHeight(){const s=this.getTextAreaFromContent_();return s&&s.offsetHeight?s.offsetHeight:0}enableMapDragPan(){const s=this.getMap();s&&this.mapDragPan&&(s.addInteraction(this.mapDragPan),delete this.mapDragPan)}disableMapDragPan(){const s=this.getMap();if(!s)return;s.getInteractions().getArray().every(e=>e instanceof wt||e.constructor.name.indexOf("DragPan")>-1?(this.mapDragPan=e,s.removeInteraction(e),!1):!0)}setMap(s){super.setMap(s),s&&s instanceof y.Map&&(this.setStyle(At(ft,this.options_.style)),this.setValue(this.options_.value))}finishDrawing(){}}const ut=Ce;class Me extends x.Point{constructor(t,e,i){super([]);l(this,"type");l(this,"fixPointCount");l(this,"map");l(this,"points");l(this,"freehand");l(this,"options");this.type=d.POINT,this.options=i||{},this.freehand=!1,this.set("params",this.options),this.fixPointCount=1,e&&e.length>0?this.setPoints(e):t&&t.length>0&&this.setCoordinates(t)}getPlotType(){return this.type}generate(){const t=this.points[0];this.setCoordinates(t)}setMap(t){if(t&&t instanceof y.Map)this.map=t;else throw new Error("传入的不是地图对象!")}getMap(){return this.map}isPlot(){return!0}setPoints(t){this.points=t||[],this.points.length>=1&&this.generate()}getPoints(){return this.points.slice(0)}getPointCount(){return this.points.length}updatePoint(t,e){e>=0&&e<this.points.length&&(this.points[e]=t,this.generate())}updateLastPoint(t){this.updatePoint(t,this.points.length-1)}finishDrawing(){}}const _t=Me;class Ae extends x.Point{constructor(t,e,i){super([]);l(this,"type");l(this,"fixPointCount");l(this,"map");l(this,"points");l(this,"freehand");l(this,"options");this.type=d.PENNANT,this.options=i||{},this.freehand=!1,this.fixPointCount=void 0,this.set("params",this.options),e&&e.length>0?this.setPoints(e):t&&t.length>0&&this.setCoordinates(t)}getPlotType(){return this.type}generate(){this.setCoordinates(this.points)}setMap(t){if(t&&t instanceof y.Map)this.map=t;else throw new Error("传入的不是地图对象!")}getMap(){return this.map}isPlot(){return!0}setPoints(t){this.points=t||[],this.points.length>=1&&this.generate()}getPoints(){return this.points.slice(0)}getPointCount(){return this.points.length}updatePoint(t,e){e>=0&&e<this.points.length&&(this.points[e]=t,this.generate())}updateLastPoint(t){this.updatePoint(t,this.points.length-1)}finishDrawing(){}}const Tt=Ae;class ve extends x.LineString{constructor(t,e,i){super([]);l(this,"type");l(this,"fixPointCount");l(this,"map");l(this,"points");l(this,"freehand");this.type=d.POLYLINE,this.freehand=!1,this.set("params",i),e&&e.length>0?this.setPoints(e):t&&t.length>0&&this.setCoordinates(t)}getPlotType(){return this.type}generate(){this.setCoordinates(this.points)}setMap(t){if(t&&t instanceof y.Map)this.map=t;else throw new Error("传入的不是地图对象!")}getMap(){return this.map}isPlot(){return!0}setPoints(t){this.points=t||[],this.points.length>=1&&this.generate()}getPoints(){return this.points.slice(0)}getPointCount(){return this.points.length}updatePoint(t,e){e>=0&&e<this.points.length&&(this.points[e]=t,this.generate())}updateLastPoint(t){this.updatePoint(t,this.points.length-1)}finishDrawing(){}}const Ft=ve;class Ee extends x.LineString{constructor(t,e,i){super([]);l(this,"type");l(this,"fixPointCount");l(this,"freehand");l(this,"map");l(this,"points");this.type=d.ARC,this.fixPointCount=3,this.set("params",i),e&&e.length>0?this.setPoints(e):t&&t.length>0&&this.setCoordinates(t)}getPlotType(){return this.type}generate(){const t=this.getPointCount();if(!(t<2))if(t===2)this.setCoordinates(this.points);else{let[e,i,n,r,a]=[this.points[0],this.points[1],this.points[2],0,0];const h=Mt(e,i,n),c=v(e,h),u=R(e,h),g=R(i,h);G(e,i,n)?(r=g,a=u):(r=u,a=g),this.setCoordinates(ht(h,c,r,a))}}setMap(t){if(t&&t instanceof y.Map)this.map=t;else throw new Error("传入的不是地图对象!")}getMap(){return this.map}isPlot(){return!0}setPoints(t){this.points=t||[],this.points.length>=1&&this.generate()}getPoints(){return this.points.slice(0)}getPointCount(){return this.points.length}updatePoint(t,e){e>=0&&e<this.points.length&&(this.points[e]=t,this.generate())}updateLastPoint(t){this.updatePoint(t,this.points.length-1)}finishDrawing(){}}const Lt=Ee;class xe extends x.Polygon{constructor(t,e,i){super([]);l(this,"type");l(this,"fixPointCount");l(this,"map");l(this,"points");l(this,"freehand");this.type=d.CIRCLE,this.fixPointCount=2,this.set("params",i),e&&e.length>0?this.setPoints(e):t&&t.length>0&&this.setCoordinates(t)}getPlotType(){return this.type}generate(){if(this.getPointCount()<2)return!1;const e=this.points[0],i=v(e,this.points[1]);this.setCoordinates([this.generatePoints(e,i)])}generatePoints(t,e){let[i,n,r]=[0,0,0];const a=[];for(let h=0;h<=100;h++)r=Math.PI*2*h/100,i=t[0]+e*Math.cos(r),n=t[1]+e*Math.sin(r),a.push([i,n]);return a}setMap(t){if(t&&t instanceof y.Map)this.map=t;else throw new Error("传入的不是地图对象!")}getMap(){return this.map}isPlot(){return!0}setPoints(t){this.points=t||[],this.points.length>=1&&this.generate()}getPoints(){return this.points.slice(0)}getPointCount(){return this.points.length}updatePoint(t,e){e>=0&&e<this.points.length&&(this.points[e]=t,this.generate())}updateLastPoint(t){this.updatePoint(t,this.points.length-1)}finishDrawing(){}}const It=xe;class _e extends x.LineString{constructor(t,e,i){super([]);l(this,"type");l(this,"fixPointCount");l(this,"map");l(this,"points");l(this,"freehand");l(this,"t");this.type=d.CURVE,this.t=.3,this.set("params",i),e&&e.length>0?this.setPoints(e):t&&t.length>0&&this.setCoordinates(t)}getPlotType(){return this.type}generate(){const t=this.getPointCount();if(t<2)return!1;if(t===2)this.setCoordinates(this.points);else{const e=he(this.t,this.points);this.setCoordinates(e)}}setMap(t){if(t&&t instanceof y.Map)this.map=t;else throw new Error("传入的不是地图对象!")}getMap(){return this.map}isPlot(){return!0}setPoints(t){this.points=t||[],this.points.length>=1&&this.generate()}getPoints(){return this.points.slice(0)}getPointCount(){return this.points.length}updatePoint(t,e){e>=0&&e<this.points.length&&(this.points[e]=t,this.generate())}updateLastPoint(t){this.updatePoint(t,this.points.length-1)}finishDrawing(){}}const kt=_e;class Te extends x.LineString{constructor(t,e,i){super([]);l(this,"type");l(this,"fixPointCount");l(this,"map");l(this,"points");l(this,"freehand");this.type=d.FREEHANDLINE,this.freehand=!0,this.set("params",i),e&&e.length>0?this.setPoints(e):t&&t.length>0&&this.setCoordinates(t)}getPlotType(){return this.type}generate(){this.setCoordinates(this.points)}setMap(t){if(t&&t instanceof y.Map)this.map=t;else throw new Error("传入的不是地图对象!")}getMap(){return this.map}isPlot(){return!0}setPoints(t){this.points=t||[],this.points.length>=1&&this.generate()}getPoints(){return this.points.slice(0)}getPointCount(){return this.points.length}updatePoint(t,e){e>=0&&e<this.points.length&&(this.points[e]=t,this.generate())}updateLastPoint(t){this.updatePoint(t,this.points.length-1)}finishDrawing(){}}const bt=Te;class Fe extends x.Polygon{constructor(t,e,i){super([]);l(this,"type");l(this,"fixPointCount");l(this,"map");l(this,"points");l(this,"freehand");l(this,"isFill");this.type=d.RECTANGLE,this.fixPointCount=2,this.set("params",i),this.isFill=i.isFill===!1?i.isFill:!0,e&&e.length>0?this.setPoints(e):t&&t.length>0&&this.setCoordinates(t)}getPlotType(){return this.type}generate(){if(this.points.length===2){let t;if(this.isFill){const e=V.boundingExtent(this.points);t=ne.fromExtent(e).getCoordinates()}else{const e=this.points[0],i=this.points[1];t=[e,[e[0],i[1]],i,[i[0],e[1]],e]}this.setCoordinates(t)}}setMap(t){if(t&&t instanceof y.Map)this.map=t;else throw new Error("传入的不是地图对象!")}getMap(){return this.map}isPlot(){return!0}setPoints(t){this.points=t||[],this.points.length>=1&&this.generate()}getPoints(){return this.points.slice(0)}getPointCount(){return this.points.length}updatePoint(t,e){e>=0&&e<this.points.length&&(this.points[e]=t,this.generate())}updateLastPoint(t){this.updatePoint(t,this.points.length-1)}finishDrawing(){}}const Rt=Fe;class Le extends x.Polygon{constructor(t,e,i){super([]);l(this,"type");l(this,"fixPointCount");l(this,"map");l(this,"points");l(this,"freehand");this.type=d.ELLIPSE,this.fixPointCount=2,this.set("params",i),e&&e.length>0?this.setPoints(e):t&&t.length>0&&this.setCoordinates(t)}getPlotType(){return this.type}generate(){if(this.getPointCount()<2)return!1;const[t,e]=[this.points[0],this.points[1]],i=F(t,e),n=Math.abs((t[0]-e[0])/2),r=Math.abs((t[1]-e[1])/2),a=this.generatePoints(i,n,r);this.setCoordinates([a])}generatePoints(t,e,i){let[n,r,a]=[0,0,0];const h=[];for(let c=0;c<=O;c++)a=Math.PI*2*c/O,n=t[0]+e*Math.cos(a),r=t[1]+i*Math.sin(a),h.push([n,r]);return h}setMap(t){if(t&&t instanceof y.Map)this.map=t;else throw new Error("传入的不是地图对象!")}getMap(){return this.map}isPlot(){return!0}setPoints(t){this.points=t||[],this.points.length>=1&&this.generate()}getPoints(){return this.points.slice(0)}getPointCount(){return this.points.length}updatePoint(t,e){e>=0&&e<this.points.length&&(this.points[e]=t,this.generate())}updateLastPoint(t){this.updatePoint(t,this.points.length-1)}finishDrawing(){}}const St=Le;class Ie extends x.Polygon{constructor(t,e,i){super([]);l(this,"type");l(this,"fixPointCount");l(this,"map");l(this,"points");l(this,"freehand");this.type=d.LUNE,this.fixPointCount=3,this.set("params",i),e&&e.length>0?this.setPoints(e):t&&t.length>0&&this.setCoordinates(t)}getPlotType(){return this.type}generate(){if(this.getPointCount()<2)return!1;let t=this.getPoints();if(this.getPointCount()===2){const p=F(t[0],t[1]),m=v(t[0],p),f=P(t[0],p,M,m);t.push(f)}let[e,i,n,r,a]=[t[0],t[1],t[2],0,0];const h=Mt(e,i,n),c=v(e,h),u=R(e,h),g=R(i,h);G(e,i,n)?(r=g,a=u):(r=u,a=g),t=ht(h,c,r,a),t.push(t[0]),this.setCoordinates([t])}setMap(t){if(t&&t instanceof y.Map)this.map=t;else throw new Error("传入的不是地图对象!")}getMap(){return this.map}isPlot(){return!0}setPoints(t){this.points=t||[],this.points.length>=1&&this.generate()}getPoints(){return this.points.slice(0)}getPointCount(){return this.points.length}updatePoint(t,e){e>=0&&e<this.points.length&&(this.points[e]=t,this.generate())}updateLastPoint(t){this.updatePoint(t,this.points.length-1)}finishDrawing(){}}const Dt=Ie;class ke extends x.Polygon{constructor(t,e,i){super([]);l(this,"type");l(this,"fixPointCount");l(this,"map");l(this,"points");l(this,"freehand");this.type=d.SECTOR,this.fixPointCount=3,this.set("params",i),e&&e.length>0?this.setPoints(e):t&&t.length>0&&this.setCoordinates(t)}getPlotType(){return this.type}generate(){const t=this.getPointCount();if(t<2)return!1;if(t===2)this.setCoordinates([this.points]);else{const e=this.getPoints(),[i,n,r]=[e[0],e[1],e[2]],a=v(n,i),h=R(n,i),c=R(r,i),u=ht(i,a,h,c);u.push(i,u[0]),this.setCoordinates([u])}}setMap(t){if(t&&t instanceof y.Map)this.map=t;else throw new Error("传入的不是地图对象!")}getMap(){return this.map}isPlot(){return!0}setPoints(t){this.points=t||[],this.points.length>=1&&this.generate()}getPoints(){return this.points.slice(0)}getPointCount(){return this.points.length}updatePoint(t,e){e>=0&&e<this.points.length&&(this.points[e]=t,this.generate())}updateLastPoint(t){this.updatePoint(t,this.points.length-1)}finishDrawing(){}}const Ot=ke;class be extends x.Polygon{constructor(t,e,i){super([]);l(this,"type");l(this,"fixPointCount");l(this,"map");l(this,"points");l(this,"freehand");l(this,"t");this.type=d.CLOSED_CURVE,this.t=.3,this.set("params",i),e&&e.length>0?this.setPoints(e):t&&t.length>0&&this.setCoordinates(t)}getPlotType(){return this.type}generate(){const t=this.getPointCount();if(t<2)return!1;if(t===2)this.setCoordinates([this.points]);else{const e=this.getPoints();e.push(e[0],e[1]);let i=[];const n=[];for(let a=0;a<e.length-2;a++){const h=j(this.t,e[a],e[a+1],e[a+2]);i=i.concat(h)}const r=i.length;i=[i[r-1]].concat(i.slice(0,r-1));for(let a=0;a<e.length-2;a++){const h=e[a],c=e[a+1];n.push(h);for(let u=0;u<=O;u++){const g=at(u/O,h,i[a*2],i[a*2+1],c);n.push(g)}n.push(c)}this.setCoordinates([n])}}setMap(t){if(t&&t instanceof y.Map)this.map=t;else throw new Error("传入的不是地图对象!")}getMap(){return this.map}isPlot(){return!0}setPoints(t){this.points=t||[],this.points.length>=1&&this.generate()}getPoints(){return this.points.slice(0)}getPointCount(){return this.points.length}updatePoint(t,e){e>=0&&e<this.points.length&&(this.points[e]=t,this.generate())}updateLastPoint(t){this.updatePoint(t,this.points.length-1)}finishDrawing(){}}const Ht=be;class Re extends x.Polygon{constructor(t,e,i){super([]);l(this,"type");l(this,"fixPointCount");l(this,"map");l(this,"points");l(this,"freehand");this.type=d.POLYGON,this.set("params",i),e&&e.length>0?this.setPoints(e):t&&t.length>0&&this.setCoordinates(t)}getPlotType(){return this.type}generate(){if(this.getPointCount()<2)return!1;this.setCoordinates([this.points])}setMap(t){if(t&&t instanceof y.Map)this.map=t;else throw new Error("传入的不是地图对象!")}getMap(){return this.map}isPlot(){return!0}setPoints(t){this.points=t||[],this.points.length>=1&&this.generate()}getPoints(){return this.points.slice(0)}getPointCount(){return this.points.length}updatePoint(t,e){e>=0&&e<this.points.length&&(this.points[e]=t,this.generate())}updateLastPoint(t){this.updatePoint(t,this.points.length-1)}finishDrawing(){}}const Nt=Re;class Se extends x.Polygon{constructor(t,e,i){super([]);l(this,"type");l(this,"fixPointCount");l(this,"map");l(this,"points");l(this,"freehand");this.type=d.FREE_POLYGON,this.freehand=!0,this.set("params",i),e&&e.length>0?this.setPoints(e):t&&t.length>0&&this.setCoordinates(t)}getPlotType(){return this.type}generate(){this.setCoordinates([this.points])}setMap(t){if(t&&t instanceof y.Map)this.map=t;else throw new Error("传入的不是地图对象!")}getMap(){return this.map}isPlot(){return!0}setPoints(t){this.points=t||[],this.points.length>=1&&this.generate()}getPoints(){return this.points.slice(0)}getPointCount(){return this.points.length}updatePoint(t,e){e>=0&&e<this.points.length&&(this.points[e]=t,this.generate())}updateLastPoint(t){this.updatePoint(t,this.points.length-1)}finishDrawing(){}}const Wt=Se;class De extends x.Polygon{constructor(t,e,i){super([]);l(this,"type");l(this,"fixPointCount");l(this,"map");l(this,"points");l(this,"freehand");l(this,"headWidthFactor");l(this,"headHeightFactor");l(this,"neckWidthFactor");l(this,"neckHeightFactor");l(this,"tailWidthFactor");l(this,"headTailFactor");l(this,"swallowTailFactor");l(this,"swallowTailPnt");this.type=d.ATTACK_ARROW,this.headHeightFactor=.18,this.headWidthFactor=.3,this.neckHeightFactor=.85,this.neckWidthFactor=.15,this.headTailFactor=.8,this.set("params",i),e&&e.length>0?this.setPoints(e):t&&t.length>0&&this.setCoordinates(t)}getPlotType(){return this.type}generate(){try{const t=this.getPointCount();if(t<2)return!1;if(t===2)this.setCoordinates([this.points]);else{const e=this.getPoints();let[i,n]=[e[0],e[1]];G(e[0],e[1],e[2])&&(i=e[1],n=e[0]);const a=[F(i,n)].concat(e.slice(2)),h=this.getArrowHeadPoints(a,i,n);if(h&&h.length>4){const[c,u]=[h[0],h[4]],g=v(i,n)/k(a),p=this.getArrowBodyPoints(a,c,u,g),m=p.length;let f=[i].concat(p.slice(0,m/2));f.push(c);let w=[n].concat(p.slice(m/2,m));w.push(u),f=H(f),w=H(w),this.setCoordinates([f.concat(h,w.reverse())])}}}catch(t){console.log(t)}}getArrowPoints(t,e,i,n){const r=F(t,e),a=v(r,i);let h=P(i,r,0,a*.3,!0),c=P(i,r,0,a*.5,!0);h=P(r,h,M,a/5,n),c=P(r,c,M,a/4,n);const u=[r,h,c,i],g=this.getArrowHeadPoints(u);if(g&&Array.isArray(g)&&g.length>0){const[p,m]=[g[0],g[4]],f=v(t,e)/k(u)/2,w=this.getArrowBodyPoints(u,p,m,f);if(w){const A=w.length;let C=w.slice(0,A/2),E=w.slice(A/2,A);return C.push(p),E.push(m),C=C.reverse(),C.push(e),E=E.reverse(),E.push(t),C.reverse().concat(g,E)}}else throw new Error("插值出错")}getArrowHeadPoints(t,e,i){try{let n=k(t),r=n*this.headHeightFactor;const a=t[t.length-1];n=v(a,t[t.length-2]);let h=0;e&&i&&(h=v(e,i)),r>h*this.headTailFactor&&(r=h*this.headTailFactor);const c=r*this.headWidthFactor,u=r*this.neckWidthFactor;r=r>n?n:r;const g=r*this.neckHeightFactor,p=P(t[t.length-2],a,0,r,!0),m=P(t[t.length-2],a,0,g,!0),f=P(a,p,M,c,!1),w=P(a,p,M,c,!0),A=P(a,m,M,u,!1),C=P(a,m,M,u,!0);return[A,f,a,w,C]}catch(n){console.log(n)}}getArrowBodyPoints(t,e,i,n){const r=rt(t),h=k(t)*n,c=v(e,i),u=(h-c)/2;let g=0;const p=[],m=[];for(let f=1;f<t.length-1;f++){const w=J(t[f-1],t[f],t[f+1])/2;g+=v(t[f-1],t[f]);const A=(h/2-g/r*u)/Math.sin(w),C=P(t[f-1],t[f],Math.PI-w,A,!0),E=P(t[f-1],t[f],w,A,!1);p.push(C),m.push(E)}return p.concat(m)}getTempPoint4(t,e,i){try{const n=F(t,e),r=v(n,i),a=J(t,n,i);let h,c=0,u=0,g;return a<M?(c=r*Math.sin(a),u=r*Math.cos(a),g=P(t,n,M,c,!1),h=P(n,g,M,u,!0)):a>=M&&a<Math.PI?(c=r*Math.sin(Math.PI-a),u=r*Math.cos(Math.PI-a),g=P(t,n,M,c,!1),h=P(n,g,M,u,!1)):a>=Math.PI&&a<Math.PI*1.5?(c=r*Math.sin(a-Math.PI),u=r*Math.cos(a-Math.PI),g=P(t,n,M,c,!0),h=P(n,g,M,u,!0)):(c=r*Math.sin(Math.PI*2-a),u=r*Math.cos(Math.PI*2-a),g=P(t,n,M,c,!0),h=P(n,g,M,u,!1)),h}catch(n){console.log(n)}}setMap(t){if(t&&t instanceof y.Map)this.map=t;else throw new Error("传入的不是地图对象!")}getMap(){return this.map}isPlot(){return!0}setPoints(t){this.points=t||[],this.points.length>=1&&this.generate()}getPoints(){return this.points.slice(0)}getPointCount(){return this.points.length}updatePoint(t,e){e>=0&&e<this.points.length&&(this.points[e]=t,this.generate())}updateLastPoint(t){this.updatePoint(t,this.points.length-1)}finishDrawing(){}}const Z=De;class Oe extends x.Polygon{constructor(t,e,i){super([]);l(this,"type");l(this,"fixPointCount");l(this,"map");l(this,"points");l(this,"freehand");l(this,"neckHeightFactor");l(this,"headHeightFactor");l(this,"headWidthFactor");l(this,"neckWidthFactor");l(this,"connPoint");l(this,"tempPoint4");this.type=d.DOUBLE_ARROW,this.headHeightFactor=.25,this.headWidthFactor=.3,this.neckHeightFactor=.85,this.neckWidthFactor=.15,this.connPoint=null,this.tempPoint4=null,this.fixPointCount=4,this.set("params",i),e&&e.length>0?this.setPoints(e):t&&t.length>0&&this.setCoordinates(t)}getPlotType(){return this.type}generate(){try{const t=this.getPointCount();if(t<2)return!1;if(t===2)return this.setCoordinates([this.points]),!1;if(t>2){const[e,i,n]=[this.points[0],this.points[1],this.points[2]];t===3?(this.tempPoint4=this.getTempPoint4(e,i,n),this.connPoint=F(e,i)):t===4?(this.tempPoint4=this.points[3],this.connPoint=F(e,i)):(this.tempPoint4=this.points[3],this.connPoint=this.points[4]);let r,a;G(e,i,n)?(r=this.getArrowPoints(e,this.connPoint,this.tempPoint4,!1),a=this.getArrowPoints(this.connPoint,i,n,!0)):(r=this.getArrowPoints(i,this.connPoint,n,!1),a=this.getArrowPoints(this.connPoint,e,this.tempPoint4,!0));const h=r.length,c=(h-5)/2,u=r.slice(0,c),g=r.slice(c,c+5);let p=r.slice(c+5,h),m=a.slice(0,c);const f=a.slice(c,c+5),w=a.slice(c+5,h);m=X(m);const A=X(w.concat(u.slice(1)));p=X(p);const C=m.concat(f,A,g,p);this.setCoordinates([C])}}catch(t){console.log(t)}}getArrowPoints(t,e,i,n){const r=F(t,e),a=v(r,i);let h=P(i,r,0,a*.3,!0),c=P(i,r,0,a*.5,!0);h=P(r,h,M,a/5,n),c=P(r,c,M,a/4,n);const u=[r,h,c,i],g=this.getArrowHeadPoints(u);if(g&&Array.isArray(g)&&g.length>0){const[p,m]=[g[0],g[4]],f=v(t,e)/k(u)/2,w=this.getArrowBodyPoints(u,p,m,f);if(w){const A=w.length;let C=w.slice(0,A/2),E=w.slice(A/2,A);return C.push(p),E.push(m),C=C.reverse(),C.push(e),E=E.reverse(),E.push(t),C.reverse().concat(g,E)}}else throw new Error("插值出错")}getArrowHeadPoints(t){try{const i=k(t)*this.headHeightFactor,n=t[t.length-1],r=i*this.headWidthFactor,a=i*this.neckWidthFactor,h=i*this.neckHeightFactor,c=P(t[t.length-2],n,0,i,!0),u=P(t[t.length-2],n,0,h,!0),g=P(n,c,M,r,!1),p=P(n,c,M,r,!0),m=P(n,u,M,a,!1),f=P(n,u,M,a,!0);return[m,g,n,p,f]}catch(e){console.log(e)}}getArrowBodyPoints(t,e,i,n){const r=rt(t),h=k(t)*n,c=v(e,i),u=(h-c)/2;let g=0;const p=[],m=[];for(let f=1;f<t.length-1;f++){const w=J(t[f-1],t[f],t[f+1])/2;g+=v(t[f-1],t[f]);const A=(h/2-g/r*u)/Math.sin(w),C=P(t[f-1],t[f],Math.PI-w,A,!0),E=P(t[f-1],t[f],w,A,!1);p.push(C),m.push(E)}return p.concat(m)}getTempPoint4(t,e,i){try{const n=F(t,e),r=v(n,i),a=J(t,n,i);let h,c=0,u=0,g;return a<M?(c=r*Math.sin(a),u=r*Math.cos(a),g=P(t,n,M,c,!1),h=P(n,g,M,u,!0)):a>=M&&a<Math.PI?(c=r*Math.sin(Math.PI-a),u=r*Math.cos(Math.PI-a),g=P(t,n,M,c,!1),h=P(n,g,M,u,!1)):a>=Math.PI&&a<Math.PI*1.5?(c=r*Math.sin(a-Math.PI),u=r*Math.cos(a-Math.PI),g=P(t,n,M,c,!0),h=P(n,g,M,u,!0)):(c=r*Math.sin(Math.PI*2-a),u=r*Math.cos(Math.PI*2-a),g=P(t,n,M,c,!0),h=P(n,g,M,u,!1)),h}catch(n){console.log(n)}}setMap(t){if(t&&t instanceof y.Map)this.map=t;else throw new Error("传入的不是地图对象!")}getMap(){return this.map}isPlot(){return!0}setPoints(t){this.points=t||[],this.points.length>=1&&this.generate()}getPoints(){return this.points.slice(0)}getPointCount(){return this.points.length}updatePoint(t,e){e>=0&&e<this.points.length&&(this.points[e]=t,this.generate())}updateLastPoint(t){this.updatePoint(t,this.points.length-1)}finishDrawing(){this.getPointCount()===3&&this.tempPoint4!==null&&this.points.push(this.tempPoint4),this.connPoint!==null&&this.points.push(this.connPoint)}}const Bt=Oe;class He extends x.LineString{constructor(t,e,i){super([]);l(this,"type");l(this,"fixPointCount");l(this,"map");l(this,"points");l(this,"freehand");l(this,"maxArrowLength");l(this,"arrowLengthScale");this.type=d.STRAIGHT_ARROW,this.fixPointCount=2,this.maxArrowLength=3e6,this.arrowLengthScale=5,this.set("params",i),e&&e.length>0?this.setPoints(e):t&&t.length>0&&this.setCoordinates(t)}getPlotType(){return this.type}generate(){try{if(this.getPointCount()<2)return!1;const e=this.getPoints(),[i,n]=[e[0],e[1]];let a=v(i,n)/this.arrowLengthScale;a=a>this.maxArrowLength?this.maxArrowLength:a;const h=P(i,n,Math.PI/6,a,!1),c=P(i,n,Math.PI/6,a,!0);this.setCoordinates([i,n,h,n,c])}catch(t){console.log(t)}}setMap(t){if(t&&t instanceof y.Map)this.map=t;else throw new Error("传入的不是地图对象!")}getMap(){return this.map}isPlot(){return!0}setPoints(t){this.points=t||[],this.points.length>=1&&this.generate()}getPoints(){return this.points.slice(0)}getPointCount(){return this.points.length}updatePoint(t,e){e>=0&&e<this.points.length&&(this.points[e]=t,this.generate())}updateLastPoint(t){this.updatePoint(t,this.points.length-1)}finishDrawing(){}}const zt=He;class Ne extends x.Polygon{constructor(t,e,i){super([]);l(this,"type");l(this,"fixPointCount");l(this,"map");l(this,"points");l(this,"freehand");l(this,"neckAngle");l(this,"headAngle");l(this,"headWidthFactor");l(this,"neckWidthFactor");l(this,"tailWidthFactor");this.type=d.FINE_ARROW,this.tailWidthFactor=.1,this.neckWidthFactor=.2,this.headWidthFactor=.25,this.headAngle=Math.PI/8.5,this.neckAngle=Math.PI/13,this.fixPointCount=2,this.set("params",i),e&&e.length>0?this.setPoints(e):t&&t.length>0&&this.setCoordinates(t)}getPlotType(){return this.type}generate(){try{if(this.getPointCount()<2)return!1;const e=this.getPoints(),[i,n]=[e[0],e[1]],r=k(e),a=r*this.tailWidthFactor,h=r*this.neckWidthFactor,c=r*this.headWidthFactor,u=P(n,i,M,a,!0),g=P(n,i,M,a,!1),p=P(i,n,this.headAngle,c,!1),m=P(i,n,this.headAngle,c,!0),f=P(i,n,this.neckAngle,h,!1),w=P(i,n,this.neckAngle,h,!0),A=[u,f,p,n,m,w,g];this.setCoordinates([A])}catch(t){console.log(t)}}setMap(t){if(t&&t instanceof y.Map)this.map=t;else throw new Error("传入的不是地图对象!")}getMap(){return this.map}isPlot(){return!0}setPoints(t){this.points=t||[],this.points.length>=1&&this.generate()}getPoints(){return this.points.slice(0)}getPointCount(){return this.points.length}updatePoint(t,e){e>=0&&e<this.points.length&&(this.points[e]=t,this.generate())}updateLastPoint(t){this.updatePoint(t,this.points.length-1)}finishDrawing(){}}const gt=Ne;class We extends gt{constructor(s,t,e){super(s,t,e),this.tailWidthFactor=.05,this.neckWidthFactor=.1,this.headWidthFactor=.15,this.type=d.ASSAULT_DIRECTION,this.headAngle=Math.PI/4,this.neckAngle=Math.PI*.17741,t&&t.length>0?this.setPoints(t):s&&s.length>0&&this.setCoordinates(s),this.set("params",e)}}const Gt=We;class Be extends Z{constructor(s,t,e){super(s,t,e),this.type=d.TAILED_ATTACK_ARROW,this.headHeightFactor=.18,this.headWidthFactor=.3,this.neckHeightFactor=.85,this.neckWidthFactor=.15,this.tailWidthFactor=.1,this.headTailFactor=.8,this.swallowTailFactor=1,this.swallowTailPnt=null,this.set("params",e),t&&t.length>0?this.setPoints(t):s&&s.length>0&&this.setCoordinates(s)}generate(){try{const s=this.getPointCount();if(s<2)return!1;if(s===2)return this.setCoordinates([this.points]),!1;const t=this.getPoints();let[e,i]=[t[0],t[1]];G(t[0],t[1],t[2])&&(e=t[1],i=t[0]);const r=[F(e,i)].concat(t.slice(2)),a=this.getArrowHeadPoints(r,e,i);if(a&&a.length>4){const[h,c]=[a[0],a[4]],u=v(e,i),g=k(r),p=g*this.tailWidthFactor*this.swallowTailFactor;this.swallowTailPnt=P(r[1],r[0],0,p,!0);const m=u/g,f=this.getArrowBodyPoints(r,h,c,m),w=f.length;let A=[e].concat(f.slice(0,w/2));A.push(h);let C=[i].concat(f.slice(w/2,w));C.push(c),A=H(A),C=H(C),this.setCoordinates([A.concat(a,C.reverse(),[this.swallowTailPnt,A[0]])])}}catch(s){console.log(s)}}}const $t=Be;class ze extends Z{constructor(s,t,e){super(s,t,e),this.type=d.SQUAD_COMBAT,this.headHeightFactor=.18,this.headWidthFactor=.3,this.neckHeightFactor=.85,this.neckWidthFactor=.15,this.tailWidthFactor=.1,this.set("params",e),t&&t.length>0?this.setPoints(t):s&&s.length>0&&this.setCoordinates(s)}generate(){try{if(this.getPointCount()<2)return!1;{const t=this.getPoints(),e=this.getTailPoints(t),i=this.getArrowHeadPoints(t,e[0],e[1]);if(i&&i.length>4){const n=i[0],r=i[4],a=this.getArrowBodyPoints(t,n,r,this.tailWidthFactor),h=a.length;let c=[e[0]].concat(a.slice(0,h/2));c.push(n);let u=[e[1]].concat(a.slice(h/2,h));u.push(r),c=H(c),u=H(u),this.setCoordinates([c.concat(i,u.reverse())])}}}catch(s){console.log(s)}}getTailPoints(s){const e=k(s)*this.tailWidthFactor,i=P(s[1],s[0],M,e,!1),n=P(s[1],s[0],M,e,!0);return[i,n]}}const Vt=ze;class Ge extends Z{constructor(s,t,e){super(s,t,e),this.type=d.TAILED_SQUAD_COMBAT,this.headHeightFactor=.18,this.headWidthFactor=.3,this.neckHeightFactor=.85,this.neckWidthFactor=.15,this.tailWidthFactor=.1,this.swallowTailFactor=1,this.swallowTailPnt=null,this.fixPointCount=2,this.set("params",e),t&&t.length>0?this.setPoints(t):s&&s.length>0&&this.setCoordinates(s)}generate(){try{if(this.getPointCount()<2)return!1;{const t=this.getPoints(),e=this.getTailPoints(t),i=this.getArrowHeadPoints(t,e[0],e[2]);if(i&&i.length>4){const n=i[0],r=i[4],a=this.getArrowBodyPoints(t,n,r,this.tailWidthFactor),h=a.length;let c=[e[0]].concat(a.slice(0,h/2));c.push(n);let u=[e[2]].concat(a.slice(h/2,h));u.push(r),c=H(c),u=H(u),this.setCoordinates([c.concat(i,u.reverse(),[e[1],c[0]])])}}}catch(s){console.log(s)}}getTailPoints(s){const e=k(s)*this.tailWidthFactor,i=P(s[1],s[0],M,e,!1),n=P(s[1],s[0],M,e,!0),r=e*this.swallowTailFactor,a=P(s[1],s[0],0,r,!0);return[i,a,n]}}const Ut=Ge;class $e extends x.Polygon{constructor(t,e,i){super([]);l(this,"type");l(this,"fixPointCount");l(this,"map");l(this,"points");l(this,"freehand");l(this,"t");this.type=d.GATHERING_PLACE,this.t=.4,this.fixPointCount=3,this.set("params",i),e&&e.length>0?this.setPoints(e):t&&t.length>0&&this.setCoordinates(t)}getPlotType(){return this.type}generate(){let t=this.getPoints();const e=this.getPointCount();if(t.length<2)return!1;if(e===2){const g=F(t[0],t[1]),p=v(t[0],g)/.9,m=P(t[0],g,M,p,!0);t=[t[0],m,t[1]]}const i=F(t[0],t[2]);t.push(i,t[0],t[1]);let n=[],r,a,h;const c=[];for(let g=0;g<t.length-2;g++){r=t[g],a=t[g+1],h=t[g+2];const p=j(this.t,r,a,h);n=n.concat(p)}const u=n.length;n=[n[u-1]].concat(n.slice(0,u-1));for(let g=0;g<t.length-2;g++){r=t[g],a=t[g+1],c.push(r);for(let p=0;p<=O;p++){const m=at(p/O,r,n[g*2],n[g*2+1],a);c.push(m)}c.push(a)}this.setCoordinates([c])}setMap(t){if(t&&t instanceof y.Map)this.map=t;else throw new Error("传入的不是地图对象!")}getMap(){return this.map}isPlot(){return!0}setPoints(t){this.points=t||[],this.points.length>=1&&this.generate()}getPoints(){return this.points.slice(0)}getPointCount(){return this.points.length}updatePoint(t,e){e>=0&&e<this.points.length&&(this.points[e]=t,this.generate())}updateLastPoint(t){this.updatePoint(t,this.points.length-1)}finishDrawing(){}}const Yt=$e;class Ve extends x.Polygon{constructor(t,e,i){super([]);l(this,"type");l(this,"fixPointCount");l(this,"map");l(this,"points");l(this,"freehand");this.type=d.RECTFLAG,this.fixPointCount=2,this.set("params",i),e&&e.length>0?this.setPoints(e):t&&t.length>0&&this.setCoordinates(t)}getPlotType(){return this.type}generate(){if(this.getPointCount()<2)return!1;this.setCoordinates([this.calculatePonits(this.points)])}calculatePonits(t){let e=[];if(t.length>1){const i=t[0],n=t[t.length-1],r=[n[0],i[1]],a=[n[0],(i[1]+n[1])/2],h=[i[0],(i[1]+n[1])/2],c=[i[0],n[1]];e=[i,r,a,h,c]}return e}setMap(t){if(t&&t instanceof y.Map)this.map=t;else throw new Error("传入的不是地图对象!")}getMap(){return this.map}isPlot(){return!0}setPoints(t){this.points=t||[],this.points.length>=1&&this.generate()}getPoints(){return this.points.slice(0)}getPointCount(){return this.points.length}updatePoint(t,e){e>=0&&e<this.points.length&&(this.points[e]=t,this.generate())}updateLastPoint(t){this.updatePoint(t,this.points.length-1)}finishDrawing(){}}const Xt=Ve;class Ue extends x.Polygon{constructor(t,e,i){super([]);l(this,"type");l(this,"fixPointCount");l(this,"map");l(this,"points");l(this,"freehand");this.type=d.TRIANGLEFLAG,this.fixPointCount=2,this.set("params",i),e&&e.length>0?this.setPoints(e):t&&t.length>0&&this.setCoordinates(t)}getPlotType(){return this.type}generate(){if(this.getPointCount()<2)return!1;this.setCoordinates([this.calculatePonits(this.points)])}calculatePonits(t){let e=[];if(t.length>1){const i=t[0],n=t[t.length-1],r=[n[0],(i[1]+n[1])/2],a=[i[0],(i[1]+n[1])/2],h=[i[0],n[1]];e=[i,r,a,h]}return e}setMap(t){if(t&&t instanceof y.Map)this.map=t;else throw new Error("传入的不是地图对象!")}getMap(){return this.map}isPlot(){return!0}setPoints(t){this.points=t||[],this.points.length>=1&&this.generate()}getPoints(){return this.points.slice(0)}getPointCount(){return this.points.length}updatePoint(t,e){e>=0&&e<this.points.length&&(this.points[e]=t,this.generate())}updateLastPoint(t){this.updatePoint(t,this.points.length-1)}finishDrawing(){}}const qt=Ue;class Ye extends x.Polygon{constructor(t,e,i){super([]);l(this,"type");l(this,"fixPointCount");l(this,"map");l(this,"points");l(this,"freehand");this.type=d.CURVEFLAG,this.fixPointCount=2,this.set("params",i),e&&e.length>0?this.setPoints(e):t&&t.length>0&&this.setCoordinates(t)}getPlotType(){return this.type}generate(){if(this.getPointCount()<2)return!1;this.setCoordinates([this.calculatePonits(this.points)])}calculatePonits(t){let e=[];if(t.length>1){const i=t[0],n=t[t.length-1],r=i,a=[(n[0]-i[0])/4+i[0],(n[1]-i[1])/8+i[1]],h=[(i[0]+n[0])/2,i[1]],c=[(n[0]-i[0])*3/4+i[0],-(n[1]-i[1])/8+i[1]],u=[n[0],i[1]],g=[n[0],(i[1]+n[1])/2],p=[(n[0]-i[0])*3/4+i[0],(n[1]-i[1])*3/8+i[1]],m=[(i[0]+n[0])/2,(i[1]+n[1])/2],f=[(n[0]-i[0])/4+i[0],(n[1]-i[1])*5/8+i[1]],w=[i[0],(i[1]+n[1])/2],A=[i[0],n[1]],C=X([r,a,h,c,u]),E=X([g,p,m,f,w]);e=C.concat(E),e.push(A)}return e}setMap(t){if(t&&t instanceof y.Map)this.map=t;else throw new Error("传入的不是地图对象!")}getMap(){return this.map}isPlot(){return!0}setPoints(t){this.points=t||[],this.points.length>=1&&this.generate()}getPoints(){return this.points.slice(0)}getPointCount(){return this.points.length}updatePoint(t,e){e>=0&&e<this.points.length&&(this.points[e]=t,this.generate())}updateLastPoint(t){this.updatePoint(t,this.points.length-1)}finishDrawing(){}}const jt=Ye;let Xe=class extends x.Polygon{constructor(t,e,i){super([]);l(this,"type");l(this,"fixPointCount");l(this,"map");l(this,"points");l(this,"freehand");this.type=d.RECTINCLINED1,this.fixPointCount=3,this.set("params",i),e&&e.length>0?this.setPoints(e):t&&t.length>0&&this.setCoordinates(t)}getPlotType(){return this.type}generate(){const t=this.getPointCount();if(t<2)return!1;if(t===2)this.setCoordinates([this.points]);else{const e=this.getPoints(),[i,n,r]=[e[0],e[1],e[2]],a=this.calculatePerpendicularDistance(i,n,r),h=this.calculatePositionRelativeToLine(i,n,r),c=this.calculatePerpendicularPoint(i,n,h*a),u=this.calculateFourthPoint(i,n,c),g=[];g.push(i,n,c,u,i),this.setCoordinates([g])}}calculatePerpendicularDistance(t,e,i){const n=e[0]-t[0],r=e[1]-t[1],a=i[0]-t[0],h=i[1]-t[1],c=Math.sqrt(n*n+r*r),g=(a*n+h*r)/c,p=Math.sqrt(a*a+h*h);return Math.sqrt(p*p-g*g)}calculatePositionRelativeToLine(t,e,i){const n={x:e[0]-t[0],y:e[1]-t[1]},r={x:i[0]-t[0],y:i[1]-t[1]},h=n.x*r.y-n.y*r.x>0?1:-1;return t[1]>e[1]?h:-h}calculateFourthPoint(t,e,i){const n=t[0]+i[0]-e[0],r=t[1]+i[1]-e[1];return[n,r]}calculatePerpendicularPoint(t,e,i){const n=(e[1]-t[1])/(e[0]-t[0]);let r,a;if(n!==0){const h=-1/n,c=e[1]-h*e[0];r=i*Math.sqrt(1/(1+h**2))+e[0],a=h*r+c}else r=e[0],a=e[1]-i;return[r,a]}setMap(t){if(t&&t instanceof y.Map)this.map=t;else throw new Error("传入的不是地图对象!")}getMap(){return this.map}isPlot(){return!0}setPoints(t){this.points=t||[],this.points.length>=1&&this.generate()}getPoints(){return this.points.slice(0)}getPointCount(){return this.points.length}updatePoint(t,e){e>=0&&e<this.points.length&&(this.points[e]=t,this.generate())}updateLastPoint(t){this.updatePoint(t,this.points.length-1)}finishDrawing(){}};const Zt=Xe;class qe extends x.Polygon{constructor(t,e,i){super([]);l(this,"type");l(this,"fixPointCount");l(this,"map");l(this,"points");l(this,"freehand");this.type=d.RECTINCLINED2,this.fixPointCount=3,this.set("params",i),e&&e.length>0?this.setPoints(e):t&&t.length>0&&this.setCoordinates(t)}getPlotType(){return this.type}generate(){const t=this.getPointCount();if(t<2)return!1;if(t===2)this.setCoordinates([this.points]);else{const e=this.getPoints(),[i,n,r]=[e[0],e[1],e[2]],a=this.calculateIntersectionPoint(i,n,r),h=this.calculateFourthPoint(i,a,r),c=[];c.push(i,a,r,h,i),this.setCoordinates([c])}}calculateFourthPoint(t,e,i){const n=t[0]+i[0]-e[0],r=t[1]+i[1]-e[1];return[n,r]}calculateIntersectionPoint(t,e,i){const n={x:e[0]-t[0],y:e[1]-t[1]},r={x:i[0]-t[0],y:i[1]-t[1]},a=(r.