diff --git a/_astro/DataSourceExample.Ci-K8pon.js b/_astro/DataSourceExample.DThNbKl6.js similarity index 99% rename from _astro/DataSourceExample.Ci-K8pon.js rename to _astro/DataSourceExample.DThNbKl6.js index 38a3038..b9dc822 100644 --- a/_astro/DataSourceExample.Ci-K8pon.js +++ b/_astro/DataSourceExample.DThNbKl6.js @@ -1,4 +1,4 @@ import{c as se,a as qe,R as ze,i as Ot,b as me,d as ye,r as $e,e as at,f as H,g as At,h as Pt,k as nt,l as st,m as vt,n as Gt,o as Bt,p as Zt,q as Qe,s as oe,t as ti,u as U,v as it,w as dt,x as Rt,y as Yt,z as be,A as ei,B as kt,C as ii,D as Xt,Z as ni,E as si,F as re,H as yt,I as Ce,J as oi,K as It,L as ri,M as li,N as Ie,O as Nt,P as jt,Q as ai,S as Wt,T as hi,U as ci,V as di,W as ui,X as Te,Y as Tt,_ as fi,$ as Ft,a0 as Ct,a1 as gi,a2 as _i,a3 as Re,a4 as ke,a5 as xi,a6 as bt,a7 as pi,a8 as Si,a9 as mi,aa as yi,ab as Ci,j as J,G as Ii}from"./GeoMap.Dd81DkbA.js";import{r as Ti}from"./index.C0Tw76Oi.js";const I={BEGIN_GEOMETRY:0,BEGIN_PATH:1,CIRCLE:2,CLOSE_PATH:3,CUSTOM:4,DRAW_CHARS:5,DRAW_IMAGE:6,END_GEOMETRY:7,FILL:8,MOVE_TO_LINE_TO:9,SET_FILL_STYLE:10,SET_STROKE_STYLE:11,STROKE:12},Mt=[I.FILL],ht=[I.STROKE],ut=[I.BEGIN_PATH],we=[I.CLOSE_PATH];class Me{drawCustom(t,e,i,n,o){}drawGeometry(t){}setStyle(t){}drawCircle(t,e,i){}drawFeature(t,e,i){}drawGeometryCollection(t,e,i){}drawLineString(t,e,i){}drawMultiLineString(t,e,i){}drawMultiPoint(t,e,i){}drawMultiPolygon(t,e,i){}drawPoint(t,e,i){}drawPolygon(t,e,i){}drawText(t,e,i){}setFillStrokeStyle(t,e){}setImageStyle(t,e){}setTextStyle(t,e){}}class wt extends Me{constructor(t,e,i,n){super(),this.tolerance=t,this.maxExtent=e,this.pixelRatio=n,this.maxLineWidth=0,this.resolution=i,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_=null,this.bufferedMaxExtent_=null,this.instructions=[],this.coordinates=[],this.tmpCoordinate_=[],this.hitDetectionInstructions=[],this.state={}}applyPixelRatio(t){const e=this.pixelRatio;return e==1?t:t.map(function(i){return i*e})}appendFlatPointCoordinates(t,e){const i=this.getBufferedMaxExtent(),n=this.tmpCoordinate_,o=this.coordinates;let s=o.length;for(let r=0,l=t.length;rl&&(this.instructions.push([I.CUSTOM,l,a,t,i,Ot,o]),this.hitDetectionInstructions.push([I.CUSTOM,l,a,t,n||i,Ot,o]));break;case"Point":h=t.getFlatCoordinates(),this.coordinates.push(h[0],h[1]),a=this.coordinates.length,this.instructions.push([I.CUSTOM,l,a,t,i,void 0,o]),this.hitDetectionInstructions.push([I.CUSTOM,l,a,t,n||i,void 0,o]);break}this.endGeometry(e)}beginGeometry(t,e,i){this.beginGeometryInstruction1_=[I.BEGIN_GEOMETRY,e,0,t,i],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[I.BEGIN_GEOMETRY,e,0,t,i],this.hitDetectionInstructions.push(this.beginGeometryInstruction2_)}finish(){return{instructions:this.instructions,hitDetectionInstructions:this.hitDetectionInstructions,coordinates:this.coordinates}}reverseHitDetectionInstructions(){const t=this.hitDetectionInstructions;t.reverse();let e;const i=t.length;let n,o,s=-1;for(e=0;ethis.maxLineWidth&&(this.maxLineWidth=i.lineWidth,this.bufferedMaxExtent_=null)}else i.strokeStyle=void 0,i.lineCap=void 0,i.lineDash=null,i.lineDashOffset=void 0,i.lineJoin=void 0,i.lineWidth=void 0,i.miterLimit=void 0}createFill(t){const e=t.fillStyle,i=[I.SET_FILL_STYLE,e];return typeof e!="string"&&i.push(t.fillPatternScale),i}applyStroke(t){this.instructions.push(this.createStroke(t))}createStroke(t){return[I.SET_STROKE_STYLE,t.strokeStyle,t.lineWidth*this.pixelRatio,t.lineCap,t.lineJoin,t.miterLimit,this.applyPixelRatio(t.lineDash),t.lineDashOffset*this.pixelRatio]}updateFillStyle(t,e){const i=t.fillStyle;(typeof i!="string"||t.currentFillStyle!=i)&&(i!==void 0&&this.instructions.push(e.call(this,t)),t.currentFillStyle=i)}updateStrokeStyle(t,e){const i=t.strokeStyle,n=t.lineCap,o=t.lineDash,s=t.lineDashOffset,r=t.lineJoin,l=t.lineWidth,h=t.miterLimit;(t.currentStrokeStyle!=i||t.currentLineCap!=n||o!=t.currentLineDash&&!Zt(t.currentLineDash,o)||t.currentLineDashOffset!=s||t.currentLineJoin!=r||t.currentLineWidth!=l||t.currentMiterLimit!=h)&&(i!==void 0&&e.call(this,t),t.currentStrokeStyle=i,t.currentLineCap=n,t.currentLineDash=o,t.currentLineDashOffset=s,t.currentLineJoin=r,t.currentLineWidth=l,t.currentMiterLimit=h)}endGeometry(t){this.beginGeometryInstruction1_[2]=this.instructions.length,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_[2]=this.hitDetectionInstructions.length,this.beginGeometryInstruction2_=null;const e=[I.END_GEOMETRY,t];this.instructions.push(e),this.hitDetectionInstructions.push(e)}getBufferedMaxExtent(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=Qe(this.maxExtent),this.maxLineWidth>0)){const t=this.resolution*(this.maxLineWidth+1)/2;oe(this.bufferedMaxExtent_,t,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_}}class Ri extends wt{constructor(t,e,i,n){super(t,e,i,n),this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.anchorX_=void 0,this.anchorY_=void 0,this.height_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.scale_=void 0,this.width_=void 0,this.declutterMode_=void 0,this.declutterImageWithText_=void 0}drawPoint(t,e,i){if(!this.image_||this.maxExtent&&!se(this.maxExtent,t.getFlatCoordinates()))return;this.beginGeometry(t,e,i);const n=t.getFlatCoordinates(),o=t.getStride(),s=this.coordinates.length,r=this.appendFlatPointCoordinates(n,o);this.instructions.push([I.DRAW_IMAGE,s,r,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_*this.imagePixelRatio_,this.originY_*this.imagePixelRatio_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_),this.declutterMode_,this.declutterImageWithText_]),this.hitDetectionInstructions.push([I.DRAW_IMAGE,s,r,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,1,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(e)}drawMultiPoint(t,e,i){if(!this.image_)return;this.beginGeometry(t,e,i);const n=t.getFlatCoordinates(),o=[];for(let l=0,h=n.length;l=f){const g=(f-r+d)/d,x=U(h,c,g),_=U(a,u,g);l.push(x,_),o.push(l),l=[x,_],r==f&&(s+=n),r=0}else if(r0&&o.push(l),o}function Li(f,t,e,i,n){let o=e,s=e,r=0,l=0,h=e,a,c,u,d,g,x,_,p,S,y;for(c=e;cf&&(l>r&&(r=l,o=h,s=c),l=0,h=c-n)),u=d,_=S,p=y),g=C,x=T}return l+=d,l>r?[h,c]:[o,s]}const Vt={left:0,center:.5,right:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1};class Ei extends wt{constructor(t,e,i,n){super(t,e,i,n),this.labels_=null,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=void 0,this.textRotation_=0,this.textFillState_=null,this.fillStates={},this.fillStates[H]={fillStyle:H},this.textStrokeState_=null,this.strokeStates={},this.textState_={},this.textStates={},this.textKey_="",this.fillKey_="",this.strokeKey_="",this.declutterMode_=void 0,this.declutterImageWithText_=void 0}finish(){const t=super.finish();return t.textStates=this.textStates,t.fillStates=this.fillStates,t.strokeStates=this.strokeStates,t}drawText(t,e,i){const n=this.textFillState_,o=this.textStrokeState_,s=this.textState_;if(this.text_===""||!s||!n&&!o)return;const r=this.coordinates;let l=r.length;const h=t.getType();let a=null,c=t.getStride();if(s.placement==="line"&&(h=="LineString"||h=="MultiLineString"||h=="Polygon"||h=="MultiPolygon")){if(!it(this.maxExtent,t.getExtent()))return;let u;if(a=t.getFlatCoordinates(),h=="LineString")u=[a.length];else if(h=="MultiLineString")u=t.getEnds();else if(h=="Polygon")u=t.getEnds().slice(0,1);else if(h=="MultiPolygon"){const _=t.getEndss();u=[];for(let p=0,S=_.length;p{const T=r[(S+C)*2]===a[C*c]&&r[(S+C)*2+1]===a[C*c+1];return T||--S,T})}this.saveTextStates_(),(s.backgroundFill||s.backgroundStroke)&&(this.setFillStrokeStyle(s.backgroundFill,s.backgroundStroke),s.backgroundFill&&this.updateFillStyle(this.state,this.createFill),s.backgroundStroke&&(this.updateStrokeStyle(this.state,this.applyStroke),this.hitDetectionInstructions.push(this.createStroke(this.state)))),this.beginGeometry(t,e,i);let g=s.padding;if(g!=dt&&(s.scale[0]<0||s.scale[1]<0)){let S=s.padding[0],y=s.padding[1],C=s.padding[2],T=s.padding[3];s.scale[0]<0&&(y=-y,T=-T),s.scale[1]<0&&(S=-S,C=-C),g=[S,y,C,T]}const x=this.pixelRatio;this.instructions.push([I.DRAW_IMAGE,l,d,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[1,1],NaN,this.declutterMode_,this.declutterImageWithText_,g==dt?dt:g.map(function(S){return S*x}),!!s.backgroundFill,!!s.backgroundStroke,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,u]);const _=1/x,p=this.state.fillStyle;s.backgroundFill&&(this.state.fillStyle=H,this.hitDetectionInstructions.push(this.createFill(this.state))),this.hitDetectionInstructions.push([I.DRAW_IMAGE,l,d,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[_,_],NaN,this.declutterMode_,this.declutterImageWithText_,g,!!s.backgroundFill,!!s.backgroundStroke,this.text_,this.textKey_,this.strokeKey_,this.fillKey_?H:this.fillKey_,this.textOffsetX_,this.textOffsetY_,u]),s.backgroundFill&&(this.state.fillStyle=p,this.hitDetectionInstructions.push(this.createFill(this.state))),this.endGeometry(e)}}saveTextStates_(){const t=this.textStrokeState_,e=this.textState_,i=this.textFillState_,n=this.strokeKey_;t&&(n in this.strokeStates||(this.strokeStates[n]={strokeStyle:t.strokeStyle,lineCap:t.lineCap,lineDashOffset:t.lineDashOffset,lineWidth:t.lineWidth,lineJoin:t.lineJoin,miterLimit:t.miterLimit,lineDash:t.lineDash}));const o=this.textKey_;o in this.textStates||(this.textStates[o]={font:e.font,textAlign:e.textAlign||Rt,justify:e.justify,textBaseline:e.textBaseline||Yt,scale:e.scale});const s=this.fillKey_;i&&(s in this.fillStates||(this.fillStates[s]={fillStyle:i.fillStyle}))}drawChars_(t,e){const i=this.textStrokeState_,n=this.textState_,o=this.strokeKey_,s=this.textKey_,r=this.fillKey_;this.saveTextStates_();const l=this.pixelRatio,h=Vt[n.textBaseline],a=this.textOffsetY_*l,c=this.text_,u=i?i.lineWidth*Math.abs(n.scale[0])/2:0;this.instructions.push([I.DRAW_CHARS,t,e,h,n.overflow,r,n.maxAngle,l,a,o,u*l,c,s,1,this.declutterMode_]),this.hitDetectionInstructions.push([I.DRAW_CHARS,t,e,h,n.overflow,r&&H,n.maxAngle,l,a,o,u*l,c,s,1/l,this.declutterMode_])}setTextStyle(t,e){let i,n,o;if(!t)this.text_="";else{const s=t.getFill();s?(n=this.textFillState_,n||(n={},this.textFillState_=n),n.fillStyle=at(s.getColor()||H)):(n=null,this.textFillState_=n);const r=t.getStroke();if(!r)o=null,this.textStrokeState_=o;else{o=this.textStrokeState_,o||(o={},this.textStrokeState_=o);const g=r.getLineDash(),x=r.getLineDashOffset(),_=r.getWidth(),p=r.getMiterLimit();o.lineCap=r.getLineCap()||Pt,o.lineDash=g?g.slice():nt,o.lineDashOffset=x===void 0?st:x,o.lineJoin=r.getLineJoin()||vt,o.lineWidth=_===void 0?Gt:_,o.miterLimit=p===void 0?Bt:p,o.strokeStyle=at(r.getColor()||At)}i=this.textState_;const l=t.getFont()||be;ei(l);const h=t.getScaleArray();i.overflow=t.getOverflow(),i.font=l,i.maxAngle=t.getMaxAngle(),i.placement=t.getPlacement(),i.textAlign=t.getTextAlign(),i.repeat=t.getRepeat(),i.justify=t.getJustify(),i.textBaseline=t.getTextBaseline()||Yt,i.backgroundFill=t.getBackgroundFill(),i.backgroundStroke=t.getBackgroundStroke(),i.padding=t.getPadding()||dt,i.scale=h===void 0?[1,1]:h;const a=t.getOffsetX(),c=t.getOffsetY(),u=t.getRotateWithView(),d=t.getRotation();this.text_=t.getText()||"",this.textOffsetX_=a===void 0?0:a,this.textOffsetY_=c===void 0?0:c,this.textRotateWithView_=u===void 0?!1:u,this.textRotation_=d===void 0?0:d,this.strokeKey_=o?(typeof o.strokeStyle=="string"?o.strokeStyle:kt(o.strokeStyle))+o.lineCap+o.lineDashOffset+"|"+o.lineWidth+o.lineJoin+o.miterLimit+"["+o.lineDash.join()+"]":"",this.textKey_=i.font+i.scale+(i.textAlign||"?")+(i.repeat||"?")+(i.justify||"?")+(i.textBaseline||"?"),this.fillKey_=n&&n.fillStyle?typeof n.fillStyle=="string"?n.fillStyle:"|"+kt(n.fillStyle):""}this.declutterMode_=t.getDeclutterMode(),this.declutterImageWithText_=e}}const Di={Circle:Le,Default:wt,Image:Ri,LineString:ki,Polygon:Le,Text:Ei};class Oi{constructor(t,e,i,n){this.tolerance_=t,this.maxExtent_=e,this.pixelRatio_=n,this.resolution_=i,this.buildersByZIndex_={}}finish(){const t={};for(const e in this.buildersByZIndex_){t[e]=t[e]||{};const i=this.buildersByZIndex_[e];for(const n in i){const o=i[n].finish();t[e][n]=o}}return t}getBuilder(t,e){const i=t!==void 0?t.toString():"0";let n=this.buildersByZIndex_[i];n===void 0&&(n={},this.buildersByZIndex_[i]=n);let o=n[e];if(o===void 0){const s=Di[e];o=new s(this.tolerance_,this.maxExtent_,this.resolution_,this.pixelRatio_),n[e]=o}return o}}function Fi(f,t,e,i,n,o,s,r,l,h,a,c){let u=f[t],d=f[t+1],g=0,x=0,_=0,p=0;function S(){g=u,x=d,t+=i,u=f[t],d=f[t+1],p+=_,_=Math.sqrt((u-g)*(u-g)+(d-x)*(d-x))}do S();while(tR[2]}else F=C>w;const D=Math.PI,W=[],O=L+i===t;t=L,_=0,p=E,u=f[t],d=f[t+1];let b;if(O){S(),b=Math.atan2(d-x,u-g),F&&(b+=b>0?-D:D);const R=(w+C)/2,v=(P+T)/2;return W[0]=[R,v,(k-o)/2,b,n],W}n=n.replace(/\n/g," ");for(let R=0,v=n.length;R0?-D:D),b!==void 0){let m=A-b;if(m+=m>D?-2*D:m<-D?2*D:0,Math.abs(m)>s)return null}b=A;const X=R;let M=0;for(;R0&&f.push(` `,""),f.push(t,""),f}class Mi{constructor(t,e,i,n,o){this.overlaps=i,this.pixelRatio=e,this.resolution=t,this.alignAndScaleFill_,this.instructions=n.instructions,this.coordinates=n.coordinates,this.coordinateCache_={},this.renderedTransform_=Xt(),this.hitDetectionInstructions=n.hitDetectionInstructions,this.pixelCoordinates_=null,this.viewRotation_=0,this.fillStates=n.fillStates||{},this.strokeStates=n.strokeStates||{},this.textStates=n.textStates||{},this.widths_={},this.labels_={},this.zIndexContext_=o?new ni:null}getZIndexContext(){return this.zIndexContext_}createLabel(t,e,i,n){const o=t+e+i+n;if(this.labels_[o])return this.labels_[o];const s=n?this.strokeStates[n]:null,r=i?this.fillStates[i]:null,l=this.textStates[e],h=this.pixelRatio,a=[l.scale[0]*h,l.scale[1]*h],c=l.justify?Vt[l.justify]:ie(Array.isArray(t)?t[0]:t,l.textAlign||Rt),u=n&&s.lineWidth?s.lineWidth:0,d=Array.isArray(t)?t:String(t).split(` `).reduce(bi,[]),{width:g,height:x,widths:_,heights:p,lineWidths:S}=si(l,d),y=g+u,C=[],T=(y+2)*a[0],L=(x+u)*a[1],E={width:T<0?Math.floor(T):Math.ceil(T),height:L<0?Math.floor(L):Math.ceil(L),contextInstructions:C};(a[0]!=1||a[1]!=1)&&C.push("scale",a),n&&(C.push("strokeStyle",s.strokeStyle),C.push("lineWidth",u),C.push("lineCap",s.lineCap),C.push("lineJoin",s.lineJoin),C.push("miterLimit",s.miterLimit),C.push("setLineDash",[s.lineDash]),C.push("lineDashOffset",s.lineDashOffset)),i&&C.push("fillStyle",r.fillStyle),C.push("textBaseline","middle"),C.push("textAlign","center");const k=.5-c;let w=c*y+k*u;const P=[],F=[];let D=0,W=0,O=0,b=0,R;for(let v=0,A=d.length;vt?t-h:o,C=s+a>e?e-a:s,T=g[3]+y*u[0]+g[1],L=g[0]+C*u[1]+g[2],E=p-g[3],k=S-g[0];(x||c!==0)&&(rt[0]=E,lt[0]=E,rt[1]=k,tt[1]=k,tt[0]=E+T,et[0]=tt[0],et[1]=k+L,lt[1]=et[1]);let w;return c!==0?(w=re(Xt(),i,n,1,1,c,-i,-n),yt(w,rt),yt(w,tt),yt(w,et),yt(w,lt),Ce(Math.min(rt[0],tt[0],et[0],lt[0]),Math.min(rt[1],tt[1],et[1],lt[1]),Math.max(rt[0],tt[0],et[0],lt[0]),Math.max(rt[1],tt[1],et[1],lt[1]),ft)):Ce(Math.min(E,E+T),Math.min(k,k+L),Math.max(E,E+T),Math.max(k,k+L),ft),d&&(p=Math.round(p),S=Math.round(S)),{drawImageX:p,drawImageY:S,drawImageW:y,drawImageH:C,originX:h,originY:a,declutterBox:{minX:ft[0],minY:ft[1],maxX:ft[2],maxY:ft[3],value:_},canvasTransform:w,scale:u}}replayImageOrLabel_(t,e,i,n,o,s,r){const l=!!(s||r),h=n.declutterBox,a=r?r[2]*n.scale[0]/2:0;return h.minX-a<=e[0]&&h.maxX+a>=0&&h.minY-a<=e[1]&&h.maxY+a>=0&&(l&&this.replayTextBackground_(t,rt,tt,et,lt,s,r),oi(t,n.canvasTransform,o,i,n.originX,n.originY,n.drawImageW,n.drawImageH,n.drawImageX,n.drawImageY,n.scale)),!0}fill_(t){const e=this.alignAndScaleFill_;if(e){const i=yt(this.renderedTransform_,[0,0]),n=512*this.pixelRatio;t.save(),t.translate(i[0]%n,i[1]%n),e!==1&&t.scale(e,e),t.rotate(this.viewRotation_)}t.fill(),e&&t.restore()}setStrokeStyle_(t,e){t.strokeStyle=e[1],t.lineWidth=e[2],t.lineCap=e[3],t.lineJoin=e[4],t.miterLimit=e[5],t.lineDashOffset=e[7],t.setLineDash(e[6])}drawLabelWithPointPlacement_(t,e,i,n){const o=this.textStates[e],s=this.createLabel(t,e,n,i),r=this.strokeStates[i],l=this.pixelRatio,h=ie(Array.isArray(t)?t[0]:t,o.textAlign||Rt),a=Vt[o.textBaseline||Yt],c=r&&r.lineWidth?r.lineWidth:0,u=s.width/l-2*o.scale[0],d=h*u+2*(.5-h)*c,g=a*s.height/l+2*(.5-a)*c;return{label:s,anchorX:d,anchorY:g}}execute_(t,e,i,n,o,s,r,l){const h=this.zIndexContext_;let a;this.pixelCoordinates_&&Zt(i,this.renderedTransform_)?a=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),a=It(this.coordinates,0,this.coordinates.length,2,i,this.pixelCoordinates_),ri(this.renderedTransform_,i));let c=0;const u=n.length;let d=0,g,x,_,p,S,y,C,T,L,E,k,w,P,F=0,D=0,W=null,O=null;const b=this.coordinateCache_,R=this.viewRotation_,v=Math.round(Math.atan2(-i[1],i[0])*1e12)/1e12,A={context:t,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:R},X=this.instructions!=n||this.overlaps?0:200;let M,B,N,ot;for(;cX&&(this.fill_(t),F=0),D>X&&(t.stroke(),D=0),!F&&!D&&(t.beginPath(),S=NaN,y=NaN),++c;break;case I.CIRCLE:d=m[1];const Jt=a[d],Kt=a[d+1],Ge=a[d+2],Be=a[d+3],le=Ge-Jt,ae=Be-Kt,he=Math.sqrt(le*le+ae*ae);t.moveTo(Jt+he,Kt),t.arc(Jt,Kt,he,0,2*Math.PI,!0),++c;break;case I.CLOSE_PATH:t.closePath(),++c;break;case I.CUSTOM:d=m[1],g=m[2];const Ye=m[3],Xe=m[4],ce=m[5];A.geometry=Ye,A.feature=M,c in b||(b[c]=[]);const _t=b[c];ce?ce(a,d,g,2,_t):(_t[0]=a[d],_t[1]=a[d+1],_t.length=2),h&&(h.zIndex=m[6]),Xe(_t,A),++c;break;case I.DRAW_IMAGE:d=m[1],g=m[2],L=m[3],x=m[4],_=m[5];let Ut=m[6];const Ne=m[7],je=m[8],Ve=m[9],de=m[10];let qt=m[11];const Ze=m[12];let Lt=m[13];p=m[14]||"declutter";const xt=m[15];if(!L&&m.length>=20){E=m[19],k=m[20],w=m[21],P=m[22];const j=this.drawLabelWithPointPlacement_(E,k,w,P);L=j.label,m[3]=L;const ct=m[23];x=(j.anchorX-ct)*this.pixelRatio,m[4]=x;const V=m[24];_=(j.anchorY-V)*this.pixelRatio,m[5]=_,Ut=L.height,m[6]=Ut,Lt=L.width,m[13]=Lt}let zt;m.length>25&&(zt=m[25]);let $t,Et,Dt;m.length>17?($t=m[16],Et=m[17],Dt=m[18]):($t=dt,Et=!1,Dt=!1),de&&v?qt+=R:!de&&!v&&(qt-=R);let He=0;for(;d!We.includes(f));class Ai{constructor(t,e,i,n,o,s,r){this.maxExtent_=t,this.overlaps_=n,this.pixelRatio_=i,this.resolution_=e,this.renderBuffer_=s,this.executorsByZIndex_={},this.hitDetectionContext_=null,this.hitDetectionTransform_=Xt(),this.renderedContext_=null,this.deferredZIndexContexts_={},this.createExecutors_(o,r)}clip(t,e){const i=this.getClipCoords(e);t.beginPath(),t.moveTo(i[0],i[1]),t.lineTo(i[2],i[3]),t.lineTo(i[4],i[5]),t.lineTo(i[6],i[7]),t.clip()}createExecutors_(t,e){for(const i in t){let n=this.executorsByZIndex_[i];n===void 0&&(n={},this.executorsByZIndex_[i]=n);const o=t[i];for(const s in o){const r=o[s];n[s]=new Mi(this.resolution_,this.pixelRatio_,this.overlaps_,r,e)}}}hasExecutors(t){for(const e in this.executorsByZIndex_){const i=this.executorsByZIndex_[e];for(let n=0,o=t.length;n0){if(!s||E==="none"||d!=="Image"&&d!=="Text"||s.includes(T)){const F=(u[w]-3)/4,D=n-F%r,W=n-(F/r|0),O=o(T,L,D*D+W*W);if(O)return O}a.clearRect(0,0,r,r);break}}const x=Object.keys(this.executorsByZIndex_).map(Number);x.sort(Wt);let _,p,S,y,C;for(_=x.length-1;_>=0;--_){const T=x[_].toString();for(S=this.executorsByZIndex_[T],p=gt.length-1;p>=0;--p)if(d=gt[p],y=S[d],y!==void 0&&(C=y.executeHitDetection(a,l,i,g,c),C))return C}}getClipCoords(t){const e=this.maxExtent_;if(!e)return null;const i=e[0],n=e[1],o=e[2],s=e[3],r=[i,n,i,s,o,s,o,n];return It(r,0,8,2,t,r),r}isEmpty(){return hi(this.executorsByZIndex_)}execute(t,e,i,n,o,s,r){const l=Object.keys(this.executorsByZIndex_).map(Number);l.sort(Wt),s=s||gt;const h=gt.length;let a,c,u,d,g;for(r&&l.reverse(),a=0,c=l.length;ap.execute(T,e,i,n,o,r)),C&&y.restore(),S){S.offset();const T=l[a]*h+u;this.deferredZIndexContexts_[T]||(this.deferredZIndexContexts_[T]=[]),this.deferredZIndexContexts_[T].push(S)}}}}this.renderedContext_=t}getDeferredZIndexContexts(){return this.deferredZIndexContexts_}getRenderedContext(){return this.renderedContext_}renderDeferred(){const t=this.deferredZIndexContexts_,e=Object.keys(t).map(Number).sort(Wt);for(let i=0,n=e.length;i{o.draw(this.renderedContext_),o.clear()}),t[e[i]].length=0}}const ne={};function Pi(f){if(ne[f]!==void 0)return ne[f];const t=f*2+1,e=f*f,i=new Array(e+1);for(let o=0;o<=f;++o)for(let s=0;s<=f;++s){const r=o*o+s*s;if(r>e)break;let l=i[r];l||(l=[],i[r]=l),l.push(((f+o)*t+(f+s))*4+3),o>0&&l.push(((f-o)*t+(f+s))*4+3),s>0&&(l.push(((f+o)*t+(f-s))*4+3),o>0&&l.push(((f-o)*t+(f-s))*4+3))}const n=[];for(let o=0,s=i.length;oc*this.pixelRatio_),lineDashOffset:(s||st)*this.pixelRatio_,lineJoin:r!==void 0?r:vt,lineWidth:(l!==void 0?l:Gt)*this.pixelRatio_,miterLimit:h!==void 0?h:Bt,strokeStyle:at(i||At)}}}setImageStyle(t){let e;if(!t||!(e=t.getSize())){this.image_=null;return}const i=t.getPixelRatio(this.pixelRatio_),n=t.getAnchor(),o=t.getOrigin();this.image_=t.getImage(this.pixelRatio_),this.imageAnchorX_=n[0]*i,this.imageAnchorY_=n[1]*i,this.imageHeight_=e[1]*i,this.imageOpacity_=t.getOpacity(),this.imageOriginX_=o[0],this.imageOriginY_=o[1],this.imageRotateWithView_=t.getRotateWithView(),this.imageRotation_=t.getRotation();const s=t.getScaleArray();this.imageScale_=[s[0]*this.pixelRatio_/i,s[1]*this.pixelRatio_/i],this.imageWidth_=e[0]*i}setTextStyle(t){if(!t)this.text_="";else{const e=t.getFill();if(!e)this.textFillState_=null;else{const d=e.getColor();this.textFillState_={fillStyle:at(d||H)}}const i=t.getStroke();if(!i)this.textStrokeState_=null;else{const d=i.getColor(),g=i.getLineCap(),x=i.getLineDash(),_=i.getLineDashOffset(),p=i.getLineJoin(),S=i.getWidth(),y=i.getMiterLimit();this.textStrokeState_={lineCap:g!==void 0?g:Pt,lineDash:x||nt,lineDashOffset:_||st,lineJoin:p!==void 0?p:vt,lineWidth:S!==void 0?S:Gt,miterLimit:y!==void 0?y:Bt,strokeStyle:at(d||At)}}const n=t.getFont(),o=t.getOffsetX(),s=t.getOffsetY(),r=t.getRotateWithView(),l=t.getRotation(),h=t.getScaleArray(),a=t.getText(),c=t.getTextAlign(),u=t.getTextBaseline();this.textState_={font:n!==void 0?n:be,textAlign:c!==void 0?c:Rt,textBaseline:u!==void 0?u:Yt},this.text_=a!==void 0?Array.isArray(a)?a.reduce((d,g,x)=>d+=x%2?" ":g,""):a:"",this.textOffsetX_=o!==void 0?this.pixelRatio_*o:0,this.textOffsetY_=s!==void 0?this.pixelRatio_*s:0,this.textRotateWithView_=r!==void 0?r:!1,this.textRotation_=l!==void 0?l:0,this.textScale_=[this.pixelRatio_*h[0],this.pixelRatio_*h[1]]}}}const q=.5;function Gi(f,t,e,i,n,o,s,r,l){const h=n,a=f[0]*q,c=f[1]*q,u=jt(a,c);u.imageSmoothingEnabled=!1;const d=u.canvas,g=new vi(u,q,n,null,s,r,null),x=e.length,_=Math.floor((256*256*256-1)/x),p={};for(let y=1;y<=x;++y){const C=e[y-1],T=C.getStyleFunction()||i;if(!T)continue;let L=T(C,o);if(!L)continue;Array.isArray(L)||(L=[L]);const k=(y*_).toString(16).padStart(7,"#00000");for(let w=0,P=L.length;w0;return c&&Promise.all(l).then(()=>n(null)),ji(f,t,e,i,o,s,r),c}function ji(f,t,e,i,n,o,s){const r=e.getGeometryFunction()(t);if(!r)return;const l=r.simplifyTransformed(i,n);if(e.getRenderer())ve(f,l,e,t,s);else{const a=Ae[l.getType()];a(f,l,e,t,s,o)}}function ve(f,t,e,i,n){if(t.getType()=="GeometryCollection"){const s=t.getGeometries();for(let r=0,l=s.length;r{if(this.frameState&&!this.hitDetectionImageData_&&!this.animatingOrInteracting_){const i=this.frameState.size.slice(),n=this.renderedCenter_,o=this.renderedResolution_,s=this.renderedRotation_,r=this.renderedProjection_,l=this.wrappedRenderedExtent_,h=this.getLayer(),a=[],c=i[0]*q,u=i[1]*q;a.push(this.getRenderTransform(n,o,s,q,c,u,0).slice());const d=h.getSource(),g=r.getExtent();if(d.getWrapX()&&r.canWrapX()&&!bt(g,l)){let x=l[0];const _=Ct(g);let p=0,S;for(;xg[2];)++p,S=_*p,a.push(this.getRenderTransform(n,o,s,q,c,u,S).slice()),x-=_}this.hitDetectionImageData_=Gi(i,a,this.renderedFeatures_,h.getStyleFunction(),l,o,s,Oe(o,this.renderedPixelRatio_))}e(Bi(t,this.renderedFeatures_,this.hitDetectionImageData_))})}forEachFeatureAtCoordinate(t,e,i,n,o){if(!this.replayGroup_)return;const s=e.viewState.resolution,r=e.viewState.rotation,l=this.getLayer(),h={},a=function(g,x,_){const p=kt(g),S=h[p];if(S){if(S!==!0&&_c=g.forEachFeatureAtCoordinate(t,s,r,i,a,d&&e.declutter[d]?e.declutter[d].all().map(x=>x.value):null)),c}handleFontsChanged(){const t=this.getLayer();t.getVisible()&&this.replayGroup_&&t.changed()}handleStyleImageChange_(t){this.renderIfReadyAndVisible()}prepareFrame(t){const e=this.getLayer(),i=e.getSource();if(!i)return!1;const n=t.viewHints[Ft.ANIMATING],o=t.viewHints[Ft.INTERACTING],s=e.getUpdateWhileAnimating(),r=e.getUpdateWhileInteracting();if(this.ready&&!s&&n||!r&&o)return this.animatingOrInteracting_=!0,!0;this.animatingOrInteracting_=!1;const l=t.extent,h=t.viewState,a=h.projection,c=h.resolution,u=t.pixelRatio,d=e.getRevision(),g=e.getRenderBuffer();let x=e.getRenderOrder();x===void 0&&(x=Xi);const _=h.center.slice(),p=oe(l,g*c),S=p.slice(),y=[p.slice()],C=a.getExtent();if(i.getWrapX()&&a.canWrapX()&&!bt(C,t.extent)){const O=Ct(C),b=Math.max(Ct(p)/2,O);p[0]=C[0]-b,p[2]=C[2]+b,pi(_,a);const R=Si(y[0],a);R[0]C[0]&&R[2]>C[2]&&y.push([R[0]-O,R[1],R[2]-O,R[3]])}if(this.ready&&this.renderedResolution_==c&&this.renderedRevision_==d&&this.renderedRenderOrder_==x&&this.renderedFrameDeclutter_===!!t.declutter&&bt(this.wrappedRenderedExtent_,p))return Zt(this.renderedExtent_,S)||(this.hitDetectionImageData_=null,this.renderedExtent_=S),this.renderedCenter_=_,this.replayGroupChanged=!1,!0;this.replayGroup_=null;const T=new Oi(Pe(c,u),p,c,u);let L;for(let O=0,b=y.length;O{let R;const v=O.getStyleFunction()||e.getStyleFunction();if(v&&(R=v(O,c)),R){const A=this.renderFeature(O,E,R,T,L,this.getLayer().getDeclutter(),b);k=k&&!A}},P=mi(p),F=i.getFeaturesInExtent(P);x&&F.sort(x);for(let O=0,b=F.length;OJ.jsxs(J.Fragment,{children:[J.jsx("section",{style:{width:"300px",height:"300px"},children:J.jsx(Ii,{className:"data-source-example-map",children:J.jsx(Qi,{fitViewToData:!0,url:"/react-geojson-mapsample.geojson"})})}),J.jsxs("section",{children:[J.jsx("h3",{children:"Update CSS Variables"}),J.jsx("div",{className:"data-source-example-options",children:tn.map((f,t)=>J.jsxs("div",{className:"data-source-example-option",children:[J.jsx("label",{children:f.title}),J.jsx("input",{defaultValue:f.defaultValue,title:f.title,type:f.type,onChange:e=>{document.querySelector(".data-source-example-map").style.setProperty(f.property,e.target.value+(f.type==="number"?"px":""))}})]},t))})]})]});export{sn as default}; +`){W+=D,D=0,w=c*y+k*u,++b;continue}const M=d[v+1]||l.font;M!==R&&(n&&P.push("font",M),i&&F.push("font",M),R=M),D=Math.max(D,p[O]);const B=[X,w+k*_[O]+c*(_[O]-S[b]),.5*(u+D)+W];w+=_[O],n&&P.push("strokeText",B),i&&F.push("fillText",B),++O}return Array.prototype.push.apply(C,P),Array.prototype.push.apply(C,F),this.labels_[o]=E,E}replayTextBackground_(t,e,i,n,o,s,r){t.beginPath(),t.moveTo.apply(t,e),t.lineTo.apply(t,i),t.lineTo.apply(t,n),t.lineTo.apply(t,o),t.lineTo.apply(t,e),s&&(this.alignAndScaleFill_=s[2],this.fill_(t)),r&&(this.setStrokeStyle_(t,r),t.stroke())}calculateImageOrLabelDimensions_(t,e,i,n,o,s,r,l,h,a,c,u,d,g,x,_){r*=u[0],l*=u[1];let p=i-r,S=n-l;const y=o+h>t?t-h:o,C=s+a>e?e-a:s,T=g[3]+y*u[0]+g[1],L=g[0]+C*u[1]+g[2],E=p-g[3],k=S-g[0];(x||c!==0)&&(rt[0]=E,lt[0]=E,rt[1]=k,tt[1]=k,tt[0]=E+T,et[0]=tt[0],et[1]=k+L,lt[1]=et[1]);let w;return c!==0?(w=re(Xt(),i,n,1,1,c,-i,-n),yt(w,rt),yt(w,tt),yt(w,et),yt(w,lt),Ce(Math.min(rt[0],tt[0],et[0],lt[0]),Math.min(rt[1],tt[1],et[1],lt[1]),Math.max(rt[0],tt[0],et[0],lt[0]),Math.max(rt[1],tt[1],et[1],lt[1]),ft)):Ce(Math.min(E,E+T),Math.min(k,k+L),Math.max(E,E+T),Math.max(k,k+L),ft),d&&(p=Math.round(p),S=Math.round(S)),{drawImageX:p,drawImageY:S,drawImageW:y,drawImageH:C,originX:h,originY:a,declutterBox:{minX:ft[0],minY:ft[1],maxX:ft[2],maxY:ft[3],value:_},canvasTransform:w,scale:u}}replayImageOrLabel_(t,e,i,n,o,s,r){const l=!!(s||r),h=n.declutterBox,a=r?r[2]*n.scale[0]/2:0;return h.minX-a<=e[0]&&h.maxX+a>=0&&h.minY-a<=e[1]&&h.maxY+a>=0&&(l&&this.replayTextBackground_(t,rt,tt,et,lt,s,r),oi(t,n.canvasTransform,o,i,n.originX,n.originY,n.drawImageW,n.drawImageH,n.drawImageX,n.drawImageY,n.scale)),!0}fill_(t){const e=this.alignAndScaleFill_;if(e){const i=yt(this.renderedTransform_,[0,0]),n=512*this.pixelRatio;t.save(),t.translate(i[0]%n,i[1]%n),e!==1&&t.scale(e,e),t.rotate(this.viewRotation_)}t.fill(),e&&t.restore()}setStrokeStyle_(t,e){t.strokeStyle=e[1],t.lineWidth=e[2],t.lineCap=e[3],t.lineJoin=e[4],t.miterLimit=e[5],t.lineDashOffset=e[7],t.setLineDash(e[6])}drawLabelWithPointPlacement_(t,e,i,n){const o=this.textStates[e],s=this.createLabel(t,e,n,i),r=this.strokeStates[i],l=this.pixelRatio,h=ie(Array.isArray(t)?t[0]:t,o.textAlign||Rt),a=Vt[o.textBaseline||Yt],c=r&&r.lineWidth?r.lineWidth:0,u=s.width/l-2*o.scale[0],d=h*u+2*(.5-h)*c,g=a*s.height/l+2*(.5-a)*c;return{label:s,anchorX:d,anchorY:g}}execute_(t,e,i,n,o,s,r,l){const h=this.zIndexContext_;let a;this.pixelCoordinates_&&Zt(i,this.renderedTransform_)?a=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),a=It(this.coordinates,0,this.coordinates.length,2,i,this.pixelCoordinates_),ri(this.renderedTransform_,i));let c=0;const u=n.length;let d=0,g,x,_,p,S,y,C,T,L,E,k,w,P,F=0,D=0,W=null,O=null;const b=this.coordinateCache_,R=this.viewRotation_,v=Math.round(Math.atan2(-i[1],i[0])*1e12)/1e12,A={context:t,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:R},X=this.instructions!=n||this.overlaps?0:200;let M,B,N,ot;for(;cX&&(this.fill_(t),F=0),D>X&&(t.stroke(),D=0),!F&&!D&&(t.beginPath(),S=NaN,y=NaN),++c;break;case I.CIRCLE:d=m[1];const Jt=a[d],Kt=a[d+1],Ge=a[d+2],Be=a[d+3],le=Ge-Jt,ae=Be-Kt,he=Math.sqrt(le*le+ae*ae);t.moveTo(Jt+he,Kt),t.arc(Jt,Kt,he,0,2*Math.PI,!0),++c;break;case I.CLOSE_PATH:t.closePath(),++c;break;case I.CUSTOM:d=m[1],g=m[2];const Ye=m[3],Xe=m[4],ce=m[5];A.geometry=Ye,A.feature=M,c in b||(b[c]=[]);const _t=b[c];ce?ce(a,d,g,2,_t):(_t[0]=a[d],_t[1]=a[d+1],_t.length=2),h&&(h.zIndex=m[6]),Xe(_t,A),++c;break;case I.DRAW_IMAGE:d=m[1],g=m[2],L=m[3],x=m[4],_=m[5];let Ut=m[6];const Ne=m[7],je=m[8],Ve=m[9],de=m[10];let qt=m[11];const Ze=m[12];let Lt=m[13];p=m[14]||"declutter";const xt=m[15];if(!L&&m.length>=20){E=m[19],k=m[20],w=m[21],P=m[22];const j=this.drawLabelWithPointPlacement_(E,k,w,P);L=j.label,m[3]=L;const ct=m[23];x=(j.anchorX-ct)*this.pixelRatio,m[4]=x;const V=m[24];_=(j.anchorY-V)*this.pixelRatio,m[5]=_,Ut=L.height,m[6]=Ut,Lt=L.width,m[13]=Lt}let zt;m.length>25&&(zt=m[25]);let $t,Et,Dt;m.length>17?($t=m[16],Et=m[17],Dt=m[18]):($t=dt,Et=!1,Dt=!1),de&&v?qt+=R:!de&&!v&&(qt-=R);let He=0;for(;d!We.includes(f));class Ai{constructor(t,e,i,n,o,s,r){this.maxExtent_=t,this.overlaps_=n,this.pixelRatio_=i,this.resolution_=e,this.renderBuffer_=s,this.executorsByZIndex_={},this.hitDetectionContext_=null,this.hitDetectionTransform_=Xt(),this.renderedContext_=null,this.deferredZIndexContexts_={},this.createExecutors_(o,r)}clip(t,e){const i=this.getClipCoords(e);t.beginPath(),t.moveTo(i[0],i[1]),t.lineTo(i[2],i[3]),t.lineTo(i[4],i[5]),t.lineTo(i[6],i[7]),t.clip()}createExecutors_(t,e){for(const i in t){let n=this.executorsByZIndex_[i];n===void 0&&(n={},this.executorsByZIndex_[i]=n);const o=t[i];for(const s in o){const r=o[s];n[s]=new Mi(this.resolution_,this.pixelRatio_,this.overlaps_,r,e)}}}hasExecutors(t){for(const e in this.executorsByZIndex_){const i=this.executorsByZIndex_[e];for(let n=0,o=t.length;n0){if(!s||E==="none"||d!=="Image"&&d!=="Text"||s.includes(T)){const F=(u[w]-3)/4,D=n-F%r,W=n-(F/r|0),O=o(T,L,D*D+W*W);if(O)return O}a.clearRect(0,0,r,r);break}}const x=Object.keys(this.executorsByZIndex_).map(Number);x.sort(Wt);let _,p,S,y,C;for(_=x.length-1;_>=0;--_){const T=x[_].toString();for(S=this.executorsByZIndex_[T],p=gt.length-1;p>=0;--p)if(d=gt[p],y=S[d],y!==void 0&&(C=y.executeHitDetection(a,l,i,g,c),C))return C}}getClipCoords(t){const e=this.maxExtent_;if(!e)return null;const i=e[0],n=e[1],o=e[2],s=e[3],r=[i,n,i,s,o,s,o,n];return It(r,0,8,2,t,r),r}isEmpty(){return hi(this.executorsByZIndex_)}execute(t,e,i,n,o,s,r){const l=Object.keys(this.executorsByZIndex_).map(Number);l.sort(Wt),s=s||gt;const h=gt.length;let a,c,u,d,g;for(r&&l.reverse(),a=0,c=l.length;ap.execute(T,e,i,n,o,r)),C&&y.restore(),S){S.offset();const T=l[a]*h+u;this.deferredZIndexContexts_[T]||(this.deferredZIndexContexts_[T]=[]),this.deferredZIndexContexts_[T].push(S)}}}}this.renderedContext_=t}getDeferredZIndexContexts(){return this.deferredZIndexContexts_}getRenderedContext(){return this.renderedContext_}renderDeferred(){const t=this.deferredZIndexContexts_,e=Object.keys(t).map(Number).sort(Wt);for(let i=0,n=e.length;i{o.draw(this.renderedContext_),o.clear()}),t[e[i]].length=0}}const ne={};function Pi(f){if(ne[f]!==void 0)return ne[f];const t=f*2+1,e=f*f,i=new Array(e+1);for(let o=0;o<=f;++o)for(let s=0;s<=f;++s){const r=o*o+s*s;if(r>e)break;let l=i[r];l||(l=[],i[r]=l),l.push(((f+o)*t+(f+s))*4+3),o>0&&l.push(((f-o)*t+(f+s))*4+3),s>0&&(l.push(((f+o)*t+(f-s))*4+3),o>0&&l.push(((f-o)*t+(f-s))*4+3))}const n=[];for(let o=0,s=i.length;oc*this.pixelRatio_),lineDashOffset:(s||st)*this.pixelRatio_,lineJoin:r!==void 0?r:vt,lineWidth:(l!==void 0?l:Gt)*this.pixelRatio_,miterLimit:h!==void 0?h:Bt,strokeStyle:at(i||At)}}}setImageStyle(t){let e;if(!t||!(e=t.getSize())){this.image_=null;return}const i=t.getPixelRatio(this.pixelRatio_),n=t.getAnchor(),o=t.getOrigin();this.image_=t.getImage(this.pixelRatio_),this.imageAnchorX_=n[0]*i,this.imageAnchorY_=n[1]*i,this.imageHeight_=e[1]*i,this.imageOpacity_=t.getOpacity(),this.imageOriginX_=o[0],this.imageOriginY_=o[1],this.imageRotateWithView_=t.getRotateWithView(),this.imageRotation_=t.getRotation();const s=t.getScaleArray();this.imageScale_=[s[0]*this.pixelRatio_/i,s[1]*this.pixelRatio_/i],this.imageWidth_=e[0]*i}setTextStyle(t){if(!t)this.text_="";else{const e=t.getFill();if(!e)this.textFillState_=null;else{const d=e.getColor();this.textFillState_={fillStyle:at(d||H)}}const i=t.getStroke();if(!i)this.textStrokeState_=null;else{const d=i.getColor(),g=i.getLineCap(),x=i.getLineDash(),_=i.getLineDashOffset(),p=i.getLineJoin(),S=i.getWidth(),y=i.getMiterLimit();this.textStrokeState_={lineCap:g!==void 0?g:Pt,lineDash:x||nt,lineDashOffset:_||st,lineJoin:p!==void 0?p:vt,lineWidth:S!==void 0?S:Gt,miterLimit:y!==void 0?y:Bt,strokeStyle:at(d||At)}}const n=t.getFont(),o=t.getOffsetX(),s=t.getOffsetY(),r=t.getRotateWithView(),l=t.getRotation(),h=t.getScaleArray(),a=t.getText(),c=t.getTextAlign(),u=t.getTextBaseline();this.textState_={font:n!==void 0?n:be,textAlign:c!==void 0?c:Rt,textBaseline:u!==void 0?u:Yt},this.text_=a!==void 0?Array.isArray(a)?a.reduce((d,g,x)=>d+=x%2?" ":g,""):a:"",this.textOffsetX_=o!==void 0?this.pixelRatio_*o:0,this.textOffsetY_=s!==void 0?this.pixelRatio_*s:0,this.textRotateWithView_=r!==void 0?r:!1,this.textRotation_=l!==void 0?l:0,this.textScale_=[this.pixelRatio_*h[0],this.pixelRatio_*h[1]]}}}const q=.5;function Gi(f,t,e,i,n,o,s,r,l){const h=n,a=f[0]*q,c=f[1]*q,u=jt(a,c);u.imageSmoothingEnabled=!1;const d=u.canvas,g=new vi(u,q,n,null,s,r,null),x=e.length,_=Math.floor((256*256*256-1)/x),p={};for(let y=1;y<=x;++y){const C=e[y-1],T=C.getStyleFunction()||i;if(!T)continue;let L=T(C,o);if(!L)continue;Array.isArray(L)||(L=[L]);const k=(y*_).toString(16).padStart(7,"#00000");for(let w=0,P=L.length;w0;return c&&Promise.all(l).then(()=>n(null)),ji(f,t,e,i,o,s,r),c}function ji(f,t,e,i,n,o,s){const r=e.getGeometryFunction()(t);if(!r)return;const l=r.simplifyTransformed(i,n);if(e.getRenderer())ve(f,l,e,t,s);else{const a=Ae[l.getType()];a(f,l,e,t,s,o)}}function ve(f,t,e,i,n){if(t.getType()=="GeometryCollection"){const s=t.getGeometries();for(let r=0,l=s.length;r{if(this.frameState&&!this.hitDetectionImageData_&&!this.animatingOrInteracting_){const i=this.frameState.size.slice(),n=this.renderedCenter_,o=this.renderedResolution_,s=this.renderedRotation_,r=this.renderedProjection_,l=this.wrappedRenderedExtent_,h=this.getLayer(),a=[],c=i[0]*q,u=i[1]*q;a.push(this.getRenderTransform(n,o,s,q,c,u,0).slice());const d=h.getSource(),g=r.getExtent();if(d.getWrapX()&&r.canWrapX()&&!bt(g,l)){let x=l[0];const _=Ct(g);let p=0,S;for(;xg[2];)++p,S=_*p,a.push(this.getRenderTransform(n,o,s,q,c,u,S).slice()),x-=_}this.hitDetectionImageData_=Gi(i,a,this.renderedFeatures_,h.getStyleFunction(),l,o,s,Oe(o,this.renderedPixelRatio_))}e(Bi(t,this.renderedFeatures_,this.hitDetectionImageData_))})}forEachFeatureAtCoordinate(t,e,i,n,o){if(!this.replayGroup_)return;const s=e.viewState.resolution,r=e.viewState.rotation,l=this.getLayer(),h={},a=function(g,x,_){const p=kt(g),S=h[p];if(S){if(S!==!0&&_c=g.forEachFeatureAtCoordinate(t,s,r,i,a,d&&e.declutter[d]?e.declutter[d].all().map(x=>x.value):null)),c}handleFontsChanged(){const t=this.getLayer();t.getVisible()&&this.replayGroup_&&t.changed()}handleStyleImageChange_(t){this.renderIfReadyAndVisible()}prepareFrame(t){const e=this.getLayer(),i=e.getSource();if(!i)return!1;const n=t.viewHints[Ft.ANIMATING],o=t.viewHints[Ft.INTERACTING],s=e.getUpdateWhileAnimating(),r=e.getUpdateWhileInteracting();if(this.ready&&!s&&n||!r&&o)return this.animatingOrInteracting_=!0,!0;this.animatingOrInteracting_=!1;const l=t.extent,h=t.viewState,a=h.projection,c=h.resolution,u=t.pixelRatio,d=e.getRevision(),g=e.getRenderBuffer();let x=e.getRenderOrder();x===void 0&&(x=Xi);const _=h.center.slice(),p=oe(l,g*c),S=p.slice(),y=[p.slice()],C=a.getExtent();if(i.getWrapX()&&a.canWrapX()&&!bt(C,t.extent)){const O=Ct(C),b=Math.max(Ct(p)/2,O);p[0]=C[0]-b,p[2]=C[2]+b,pi(_,a);const R=Si(y[0],a);R[0]C[0]&&R[2]>C[2]&&y.push([R[0]-O,R[1],R[2]-O,R[3]])}if(this.ready&&this.renderedResolution_==c&&this.renderedRevision_==d&&this.renderedRenderOrder_==x&&this.renderedFrameDeclutter_===!!t.declutter&&bt(this.wrappedRenderedExtent_,p))return Zt(this.renderedExtent_,S)||(this.hitDetectionImageData_=null,this.renderedExtent_=S),this.renderedCenter_=_,this.replayGroupChanged=!1,!0;this.replayGroup_=null;const T=new Oi(Pe(c,u),p,c,u);let L;for(let O=0,b=y.length;O{let R;const v=O.getStyleFunction()||e.getStyleFunction();if(v&&(R=v(O,c)),R){const A=this.renderFeature(O,E,R,T,L,this.getLayer().getDeclutter(),b);k=k&&!A}},P=mi(p),F=i.getFeaturesInExtent(P);x&&F.sort(x);for(let O=0,b=F.length;OJ.jsxs(J.Fragment,{children:[J.jsx("section",{style:{width:"300px",height:"300px"},children:J.jsx(Ii,{className:"data-source-example-map",children:J.jsx(Qi,{fitViewToData:!0,url:"/react-geojson-map/sample.geojson"})})}),J.jsxs("section",{children:[J.jsx("h3",{children:"Update CSS Variables"}),J.jsx("div",{className:"data-source-example-options",children:tn.map((f,t)=>J.jsxs("div",{className:"data-source-example-option",children:[J.jsx("label",{children:f.title}),J.jsx("input",{defaultValue:f.defaultValue,title:f.title,type:f.type,onChange:e=>{document.querySelector(".data-source-example-map").style.setProperty(f.property,e.target.value+(f.type==="number"?"px":""))}})]},t))})]})]});export{sn as default}; diff --git a/examples/test-data-source/index.html b/examples/test-data-source/index.html index 0e7f663..4e9e643 100644 --- a/examples/test-data-source/index.html +++ b/examples/test-data-source/index.html @@ -1,4 +1,4 @@ Data Source Example
\ No newline at end of file +
\ No newline at end of file