ol-cesium
Version:
OpenLayers Cesium integration library
1 lines • 63.5 kB
JavaScript
var olcs_unused_var;(()=>{"use strict";var e={n:t=>{var i=t&&t.__esModule?()=>t.default:()=>t;return e.d(i,{a:i}),i},d:(t,i)=>{for(var n in i)e.o(i,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:i[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{AbstractSynchronizer:()=>Ne,ContribLazyLoader:()=>Ct,ContribManager:()=>pt,FeatureConverter:()=>Je,MaskDrawer:()=>mt,OLCSCamera:()=>Ie,OLImageryProvider:()=>O,RasterSynchronizer:()=>je,VectorLayerCounterpart:()=>Qe,VectorSynchronizer:()=>et,applyHeightOffsetToGeometry:()=>te,attributionsFunctionToCredits:()=>be,autoDrawMask:()=>dt,bottomFovRay:()=>ce,calcDistanceForResolution:()=>Pe,calcResolutionForDistance:()=>Ee,computeAngleToZenith:()=>ue,computeBoundingBoxAtTarget:()=>ee,computePixelSizeAtCoordinate:()=>J,computeRectangle:()=>ht,computeSignedTiltAngleOnGlobe:()=>le,convertColorToCesium:()=>fe,convertUrlToCesium:()=>ve,createMatrixAtCoordinates:()=>ie,default:()=>yt,extentToRectangle:()=>me,isCesiumProjection:()=>Te,limitCameraToBoundingSphere:()=>Re,normalizeView:()=>Le,ol4326CoordinateArrayToCsCartesians:()=>ye,ol4326CoordinateToCesiumCartesian:()=>pe,olGeometryCloneTo4326:()=>_e,pickBottomPoint:()=>oe,pickCenterPoint:()=>ae,pickOnTerrainOrEllipsoid:()=>re,resetToNorthZenith:()=>we,rotateAroundAxis:()=>ne,rotateAroundBottomCenter:()=>Se,setHeadingUsingBottomCenter:()=>se,signedAngleBetween:()=>he,sourceToImageryProvider:()=>de,takeScreenshot:()=>gt,tileLayerToImageryLayer:()=>ge,updateCesiumLayerProperties:()=>Ce});var i={};e.r(i),e.d(i,{applyHeightOffsetToGeometry:()=>te,attributionsFunctionToCredits:()=>be,bottomFovRay:()=>ce,calcDistanceForResolution:()=>Pe,calcResolutionForDistance:()=>Ee,computeAngleToZenith:()=>ue,computeBoundingBoxAtTarget:()=>ee,computePixelSizeAtCoordinate:()=>J,computeSignedTiltAngleOnGlobe:()=>le,convertColorToCesium:()=>fe,convertUrlToCesium:()=>ve,createMatrixAtCoordinates:()=>ie,extentToRectangle:()=>me,isCesiumProjection:()=>Te,limitCameraToBoundingSphere:()=>Re,normalizeView:()=>Le,ol4326CoordinateArrayToCsCartesians:()=>ye,ol4326CoordinateToCesiumCartesian:()=>pe,olGeometryCloneTo4326:()=>_e,pickBottomPoint:()=>oe,pickCenterPoint:()=>ae,pickOnTerrainOrEllipsoid:()=>re,resetToNorthZenith:()=>we,rotateAroundAxis:()=>ne,rotateAroundBottomCenter:()=>Se,setHeadingUsingBottomCenter:()=>se,signedAngleBetween:()=>he,sourceToImageryProvider:()=>de,tileLayerToImageryLayer:()=>ge,updateCesiumLayerProperties:()=>Ce});const n=ol.geom.Point;var s=e.n(n);let r,o;function a(){if(void 0===r){const e=document.createElement("canvas");e.setAttribute("style","image-rendering: -moz-crisp-edges; image-rendering: crisp-edges; image-rendering: pixelated;");const t=e.style.imageRendering;r=!!t,r&&(o=t)}return r}function l(e){return e.get("olcs.projection")||e.getProjection()}let c=0;function h(e){return e.olcs_uid||(e.olcs_uid=++c)}function u(e){const t=e,i=t.readyPromise;return i||(void 0!==t.ready?t.ready?Promise.resolve(e):new Promise(((i,n)=>{const s=setInterval((()=>{t.ready&&(clearInterval(s),i(e))}),20)})):Promise.reject("Not a readyable object"))}const m=ol.easing,d=ol.layer.Tile;var g=e.n(d);const C=ol.layer.Image;var p=e.n(C);const y=ol.proj,_=ol.source.ImageStatic;var f=e.n(_);const v=ol.source.ImageWMS;var w=e.n(v);const S=ol.source.TileImage;var L=e.n(S);const T=ol.source.TileWMS;var b=e.n(T);const P=ol.source.VectorTile;var E=e.n(P);const R=ol.source.Image,A=ol.source;function x(){const e=document.createElement("canvas");return e.width=1,e.height=1,e}const F=function(){const e=new A.Tile({projection:"EPSG:3857",wrapX:!0}).getTileCoordForTileUrlFunction([6,-31,22]);return e&&33===e[1]&&22===e[2]}();class O{get ready(){return this.ready_}get rectangle(){return this.rectangle_}get tilingScheme(){return this.tilingScheme_}get _ready(){return this.ready_}get tileWidth(){const e=this.source_.getTileGrid();if(e){const t=e.getTileSize(0);return Array.isArray(t)?t[0]:t}return 256}get tileHeight(){const e=this.source_.getTileGrid();if(e){const t=e.getTileSize(0);return Array.isArray(t)?t[1]:t}return 256}get maximumLevel(){const e=this.source_.getTileGrid();return e?e.getMaxZoom():18}get minimumLevel(){return 0}get tileDiscardPolicy(){}get hasAlphaChannel(){return!0}pickFeatures(e,t,i,n,s){}constructor(e,t,i){this.emptyCanvas_=x(),this.emptyCanvasPromise_=Promise.resolve(this.emptyCanvas_),this.errorEvent=new Cesium.Event,this.source_=t,this.projection_=null,this.ready_=!1,this.fallbackProj_=i||null,this.tilingScheme_=new Cesium.WebMercatorTilingScheme,this.rectangle_=null,this.map_=e,this.shouldRequestNextLevel=!1;const n=this.source_.get("olcs.proxy");n&&("function"==typeof n?this.proxy={getURL:n}:"string"==typeof n&&(this.proxy=new Cesium.DefaultProxy(n))),this.source_.on("change",(e=>{this.handleSourceChanged_()})),this.handleSourceChanged_()}handleSourceChanged_(){if(!this.ready_&&"ready"==this.source_.getState()){this.projection_=l(this.source_)||this.fallbackProj_;const e={numberOfLevelZeroTilesX:1,numberOfLevelZeroTilesY:1};if(null!==this.source_.tileGrid&&this.source_.tileGrid.forEachTileCoord(this.projection_.getExtent(),0,(t=>{let[i,n,s]=t;e.numberOfLevelZeroTilesX=n+1,e.numberOfLevelZeroTilesY=s+1})),"EPSG:4326"===this.projection_.getCode())this.shouldRequestNextLevel=1===e.numberOfLevelZeroTilesX&&1===e.numberOfLevelZeroTilesY,this.tilingScheme_=new Cesium.GeographicTilingScheme(e);else{if("EPSG:3857"!==this.projection_.getCode())return;this.shouldRequestNextLevel=!1,this.tilingScheme_=new Cesium.WebMercatorTilingScheme(e)}this.rectangle_=this.tilingScheme_.rectangle,this.ready_=!0}}getTileCredits(e,t,i){const n=this.source_.getAttributions();if(!n)return[];const s=this.map_.getView().calculateExtent(this.map_.getSize()),r=this.map_.getView().getCenter();return be(n,this.shouldRequestNextLevel?i+1:i,r,s)}requestImage(e,t,i,n){const s=this.source_.getTileUrlFunction();if(s&&this.projection_){const n=this.shouldRequestNextLevel?i+1:i;let r=t;F||(r=-t-1);let o=s.call(this.source_,[n,e,r],1,this.projection_);return this.proxy&&(o=this.proxy.getURL(o)),o?Cesium.ImageryProvider.loadImage(this,o):this.emptyCanvasPromise_}return this.emptyCanvasPromise_}}const G=ol.format.MVT;var M=e.n(G);const I=ol.style.Style;var k=e.n(I);const V=ol.style.Stroke;var N=e.n(V);const D=ol.render,B=ol.util,j=ol.structs.LRUCache;var U=e.n(j);const z=ol.tilegrid,H=ol.tileurlfunction,W=ol.render.Feature;var K=e.n(W);const q=new(M())({featureClass:K()}),Z=[new(k())({stroke:new(N())({color:"blue",width:2})})];class Y{get minimumLevel(){return this.minimumLevel_}get ready(){return this.ready_}get rectangle(){return this.rectangle_}get tilingScheme(){return this.tilingScheme_}getTileCredits(e,t,i){return[]}get _ready(){return this.ready_}get tileDiscardPolicy(){}get hasAlphaChannel(){return!0}pickFeatures(e,t,i,n,s){}constructor(e){this.emptyCanvas_=x(),this.emptyCanvasPromise_=Promise.resolve(this.emptyCanvas_),this.tilingScheme_=new Cesium.WebMercatorTilingScheme,this.ready_=!0,this.tileWidth=256,this.tileHeight=256,this.maximumLevel=20,this.minimumLevel_=0,this.projection_=(0,y.get)("EPSG:3857"),this.errorEvent=new Cesium.Event,this.urls=e.urls,this.rectangle_=e.rectangle||this.tilingScheme.rectangle,this.credit=e.credit,this.styleFunction_=e.styleFunction||(()=>Z),this.tileRectangle_=new Cesium.Rectangle;const t=void 0!==e.cacheSize?e.cacheSize:50;this.tileCache=new(U())(t),this.featureCache=e.featureCache||new(U())(t),this.minimumLevel_=e.minimumLevel||0;const i=(0,z.getForProjection)(this.projection_);this.tileFunction_=(0,H.createFromTemplates)(this.urls,i)}getTileFeatures(e,t,i){const n=this.getCacheKey_(e,t,i);let s;if(this.featureCache.containsKey(n)&&(s=this.featureCache.get(n)),!s){const r=this.getUrl_(e,t,i);if(s=fetch(r).then((e=>e.ok?e:Promise.reject(e))).then((e=>e.arrayBuffer())).then((e=>this.readFeaturesFromBuffer(e))),this.featureCache.set(n,s),this.featureCache.getCount()>2*this.featureCache.highWaterMark)for(;this.featureCache.canExpireCache();)this.featureCache.pop()}return s}readFeaturesFromBuffer(e){let t;B.VERSION<="6.4.4"&&(t={extent:[0,0,4096,4096],dataProjection:this.projection_,featureProjection:this.projection_});const i=q.readFeatures(e,t),n=this.tileWidth/4096;return i.forEach((e=>{const t=e.getFlatCoordinates();let i=!1;for(let e=0;e<t.length;++e)t[e]*=n,i&&(t[e]=this.tileWidth-t[e]),B.VERSION<="6.4.4"&&(i=!i)})),i}getUrl_(e,t,i){return this.tileFunction_([e,t,i],1,this.projection_)}getCacheKey_(e,t,i){return`${e}_${t}_${i}`}requestImage(e,t,i,n){if(i<this.minimumLevel_)return this.emptyCanvasPromise_;try{const n=this.getCacheKey_(i,e,t);let s;if(this.tileCache.containsKey(n)&&(s=this.tileCache.get(n)),!s&&(s=this.getTileFeatures(i,e,t).then((n=>{this.tilingScheme.tileXYToNativeRectangle(e,t,i,this.tileRectangle_);const s=(this.tileRectangle_.east-this.tileRectangle_.west)/this.tileWidth;return this.rasterizeFeatures(n,this.styleFunction_,s)})),this.tileCache.set(n,s),this.tileCache.getCount()>2*this.tileCache.highWaterMark))for(;this.tileCache.canExpireCache();)this.tileCache.pop();return s}catch(e){this.errorEvent.raiseEvent("could not render pbf to tile",e)}}rasterizeFeatures(e,t,i){const n=document.createElement("canvas"),s=(0,D.toContext)(n.getContext("2d"),{size:[this.tileWidth,this.tileHeight]});return e.forEach((e=>{const n=t(e,i);n&&(Array.isArray(n)?n.forEach((t=>{s.setStyle(t),s.drawGeometry(e)})):(s.setStyle(n),s.drawGeometry(e)))})),n}}const X=ol.layer.VectorTile;var Q=e.n(X);const $=ol.extent;function J(e,t){const i=e.camera,n=e.canvas,s=i.frustum,r=Cesium.Cartesian3.magnitude(Cesium.Cartesian3.subtract(i.position,t,new Cesium.Cartesian3));return s.getPixelDimensions(n.clientWidth,n.clientHeight,r,e.pixelRatio,new Cesium.Cartesian2)}function ee(e,t,i){const n=J(e,t),s=Cesium.Transforms.eastNorthUpToFixedFrame(t),r=Cesium.Matrix4.multiplyByPoint(s,new Cesium.Cartesian3(-n.x*i,-n.y*i,0),new Cesium.Cartesian3),o=Cesium.Matrix4.multiplyByPoint(s,new Cesium.Cartesian3(n.x*i,n.y*i,0),new Cesium.Cartesian3);return Cesium.Ellipsoid.WGS84.cartesianArrayToCartographicArray([r,o])}function te(e,t){e.applyTransform(((e,i,n)=>{if(void 0!==n&&n>=3)for(let e=0;e<i.length;e+=n)i[e+2]=i[e+2]+t;return i}))}function ie(e,t,i,n){void 0===t&&(t=0),void 0===i&&(i=Cesium.Cartesian3.ZERO),void 0===n&&(n=new Cesium.Cartesian3(1,1,1));const s=pe(e),r=Cesium.Transforms.eastNorthUpToFixedFrame(s),o=Cesium.Quaternion.fromAxisAngle(Cesium.Cartesian3.UNIT_Z,-t),a=Cesium.Matrix4.fromTranslationQuaternionRotationScale(i,o,n);return Cesium.Matrix4.multiply(r,a,new Cesium.Matrix4)}function ne(e,t,i,n,s){const r=Cesium.Math.clamp,o=Cesium.defaultValue,a=s,l=o(null==a?void 0:a.duration,500),c=o(null==a?void 0:a.easing,m.linear),h=null==a?void 0:a.callback;let u=0;const d=new Cesium.Matrix4,g=Date.now(),C=function(){const s=Date.now(),o=c(r((s-g)/l,0,1));e.transform.clone(d);const a=(o-u)*t;u=o,e.lookAtTransform(n),e.rotate(i,a),e.lookAtTransform(d),o<1?window.requestAnimationFrame(C):h&&h()};window.requestAnimationFrame(C)}function se(e,t,i,n){const s=e.camera,r=ue(e,i),o=s.right,a=Cesium.Quaternion.fromAxisAngle(o,r),l=Cesium.Matrix3.fromQuaternion(a),c=new Cesium.Cartesian3;Cesium.Cartesian3.subtract(s.position,i,c);const h=new Cesium.Cartesian3;Cesium.Matrix3.multiplyByVector(l,c,h),Cesium.Cartesian3.add(h,i,h);ne(s,t,h,Cesium.Matrix4.fromTranslation(h),n)}function re(e,t){const i=e.camera.getPickRay(t);return e.globe.pick(i,e)||e.camera.pickEllipsoid(t)}function oe(e){const t=e.canvas;return re(e,new Cesium.Cartesian2(t.clientWidth/2,t.clientHeight))}function ae(e){const t=e.canvas;return re(e,new Cesium.Cartesian2(t.clientWidth/2,t.clientHeight/2))}function le(e){const t=e.camera,i=new Cesium.Ray(t.position,t.direction);let n=e.globe.pick(i,e);if(!n){const e=Cesium.Ellipsoid.WGS84,t=Cesium.IntersectionTests.rayEllipsoid(i,e);t&&(n=Cesium.Ray.getPoint(i,t.start))}if(!n)return;const s=new Cesium.Cartesian3;Cesium.Ellipsoid.WGS84.geocentricSurfaceNormal(n,s);const r=he(t.direction,s,t.right)-Math.PI;return Cesium.Math.convertLongitudeRange(r)}function ce(e){const t=e.camera,i=t.frustum.fovy/2,n=t.direction,s=Cesium.Quaternion.fromAxisAngle(t.right,i),r=Cesium.Matrix3.fromQuaternion(s),o=new Cesium.Cartesian3;return Cesium.Matrix3.multiplyByVector(r,n,o),new Cesium.Ray(t.position,o)}function he(e,t,i){const n=new Cesium.Cartesian3,s=new Cesium.Cartesian3,r=new Cesium.Cartesian3;Cesium.Cartesian3.normalize(e,n),Cesium.Cartesian3.normalize(t,s),Cesium.Cartesian3.cross(n,s,r);const o=Cesium.Cartesian3.dot(n,s),a=Cesium.Cartesian3.magnitude(r),l=Cesium.Cartesian3.dot(i,r),c=Math.atan2(a,o);return l>=0?c:-c}function ue(e,t){const i=e.camera,n=i.frustum.fovy/2,s=ce(e),r=Cesium.Cartesian3.clone(s.direction);Cesium.Cartesian3.negate(r,r);const o=new Cesium.Cartesian3;Cesium.Ellipsoid.WGS84.geocentricSurfaceNormal(t,o);const a=new Cesium.Cartesian3;Cesium.Cartesian3.negate(i.right,a);return he(o,r,a)+n}function me(e,t){if(e&&t){const i=(0,y.transformExtent)(e,t,"EPSG:4326");return Cesium.Rectangle.fromDegrees(i[0],i[1],i[2],i[3])}return null}function de(e,t,i,n){const s=t.get("olcs_skip");if(s)return null;let r=null;if(t instanceof w()&&t.getUrl()&&t.getImageLoadFunction()===R.defaultImageLoadFunction){const e={"olcs.proxy":t.get("olcs.proxy"),"olcs.extent":t.get("olcs.extent"),"olcs.projection":t.get("olcs.projection"),"olcs.imagesource":t};(t=new(b())({url:t.getUrl(),attributions:t.getAttributions(),projection:t.getProjection(),params:t.getParams()})).setProperties(e)}if(t instanceof L()){let n=l(t);if(n||(n=i),!Te(n))return null;r=new O(e,t,i)}else{if(!(t instanceof f())){if(t instanceof E()&&n instanceof Q()){let e=l(t);if(e||(e=i),!1===s){const i=e.getCode().split(":")[1],s=t.urls.map((e=>e.replace(i,"3857"))),o=n.getExtent(),a=me(o,e),l=t.get("olcs_minimumLevel"),c=t.getAttributions(),h=n.getStyleFunction();let u;if(o&&c){u=be(c,0,(0,$.getCenter)(o),o)[0]}return r=new Y({credit:u,rectangle:a,minimumLevel:l,styleFunction:h,urls:s}),r}return null}return null}{let e=l(t);if(e||(e=i),!Te(e))return null;{const e=Cesium.Rectangle.fromDegrees(t.getImageExtent()[0],t.getImageExtent()[1],t.getImageExtent()[2],t.getImageExtent()[3],new Cesium.Rectangle);r=new Cesium.SingleTileImageryProvider({url:t.getUrl(),rectangle:e})}}}return r}function ge(e,t,i){if(!(t instanceof g()||t instanceof p()||t instanceof Q()))return null;const n=t.getSource();if(!n)return null;let s=n.get("olcs_provider");if(s||(s=de(e,n,i,t)),!s)return null;const r={},o=t.get("olcs.extent")||t.getExtent();o&&(r.rectangle=me(o,i));return new Cesium.ImageryLayer(s,r)}function Ce(e,t){let i=1,n=!0;[e.layer].concat(e.parents).forEach((e=>{const t=e.getOpacity();void 0!==t&&(i*=t);const s=e.getVisible();void 0!==s&&(n=n&&s)})),t.alpha=i,t.show=n}function pe(e){const t=e;return t.length>2?Cesium.Cartesian3.fromDegrees(t[0],t[1],t[2]):Cesium.Cartesian3.fromDegrees(t[0],t[1])}function ye(e){const t=pe,i=[];for(let n=0;n<e.length;++n)i.push(t(e[n]));return i}function _e(e,t){const i=(0,y.get)("EPSG:4326"),n=(0,y.get)(t);if(n.getCode()!==i.getCode()){const t=e.getProperties();(e=e.clone()).transform(n,i),e.setProperties(t)}return e}function fe(e){if(e=e||"black",Array.isArray(e))return new Cesium.Color(Cesium.Color.byteToFloat(e[0]),Cesium.Color.byteToFloat(e[1]),Cesium.Color.byteToFloat(e[2]),e[3]);if("string"==typeof e)return Cesium.Color.fromCssColorString(e);if(e instanceof CanvasPattern||e instanceof CanvasGradient){const t=document.createElement("canvas"),i=t.getContext("2d");return t.width=t.height=256,i.fillStyle=e,i.fillRect(0,0,t.width,t.height),new Cesium.ImageMaterialProperty({image:t})}}function ve(e){let t="";const i=/\{(\d|[a-z])-(\d|[a-z])\}/,n=i.exec(e);if(n){e=e.replace(i,"{s}");const s=n[1].charCodeAt(0),r=n[2].charCodeAt(0);let o;for(o=s;o<=r;++o)t+=String.fromCharCode(o)}return{url:e,subdomains:t}}function we(e,t){return new Promise(((i,n)=>{const s=t.camera,r=oe(t);if(!r)return void n("Could not get bottom pivot");const o=e.getView().getRotation();if(void 0===o)return void n("The view is not initialized");const a=ue(t,r);se(t,o,r);const l=Cesium.Matrix4.fromTranslation(r);ne(s,-a,s.right,l,{callback:()=>{Le(e.getView()),i(void 0)}})}))}function Se(e,t){return new Promise(((i,n)=>{const s=e.camera,r=oe(e);if(!r)return void n("could not get bottom pivot");const o={callback:()=>i(void 0)},a=Cesium.Matrix4.fromTranslation(r),l=s.right;ne(s,-t,l,a,o)}))}function Le(e,t){void 0===t&&(t=0);const i=e.getResolution();e.setRotation(t),e.constrainResolution?e.setResolution(e.constrainResolution(i)):e.setResolution(e.getConstrainedResolution(i))}function Te(e){const t="EPSG:3857"===e.getCode(),i="EPSG:4326"===e.getCode();return t||i}function be(e,t,i,n){if(!e)return[];let s=e({viewState:{zoom:t,center:i,projection:void 0,resolution:void 0,rotation:void 0},extent:n});return Array.isArray(s)||(s=[s]),s.map((e=>new Cesium.Credit(e,!0)))}function Pe(e,t,i,n){const s=i.canvas,r=i.camera.frustum.fovy,o=n.getMetersPerUnit();return e*s.clientHeight*o*Math.cos(Math.abs(t))/2/Math.tan(r/2)}function Ee(e,t,i,n){const s=i.canvas,r=i.camera.frustum.fovy,o=n.getMetersPerUnit();return 2*e*Math.tan(r/2)/o/Math.cos(Math.abs(t))/s.clientHeight}function Re(e,t,i){let n=!1;return function(){if(!n){const s=e.position,r=Cesium.Cartographic.fromCartesian(s);if(Cesium.Cartesian3.distance(t.center,s)>t.radius*i(r.height)){if(!0===e.flying)return;{n=!0;const i=()=>n=!1;e.flyToBoundingSphere(t,{complete:i,cancel:i})}}}}}class Ae{constructor(e){this.repaintEventNames_=["mousemove","mousedown","mouseup","touchstart","touchend","touchmove","pointerdown","pointerup","pointermove","wheel"],this.ol3d=e,this.scene_=e.getCesiumScene(),this.canvas_=this.scene_.canvas,this._boundNotifyRepaintRequired=this.notifyRepaintRequired.bind(this),this.enable()}enable(){this.scene_.requestRenderMode=!0,this.scene_.maximumRenderTimeChange=1e3;for(const e of this.repaintEventNames_)this.canvas_.addEventListener(e,this._boundNotifyRepaintRequired,!1);window.addEventListener("resize",this._boundNotifyRepaintRequired,!1),this.ol3d.getOlMap().getLayerGroup().on("change",this._boundNotifyRepaintRequired)}disable(){for(const e of this.repaintEventNames_)this.canvas_.removeEventListener(e,this._boundNotifyRepaintRequired,!1);window.removeEventListener("resize",this._boundNotifyRepaintRequired,!1),this.ol3d.getOlMap().getLayerGroup().un("change",this._boundNotifyRepaintRequired),this.scene_.requestRenderMode=!1}restartRenderLoop(){this.notifyRepaintRequired()}notifyRepaintRequired(){this.scene_.requestRender()}}const xe=ol.Observable;var Fe=e.n(xe);function Oe(e){return 180*e/Math.PI}function Ge(e){return e*Math.PI/180}function Me(e,t,i){const n=i||e.length;if(t)for(let i=0;i<n;++i)t[i]=e[i];return e}class Ie{constructor(e,t){this.viewListenKey_=null,this.toLonLat_=Me,this.fromLonLat_=Me,this.tilt_=0,this.distance_=0,this.lastCameraViewMatrix_=null,this.viewUpdateInProgress_=!1,this.scene_=e,this.cam_=e.camera,this.map_=t,this.map_.on("change:view",(e=>{this.setView_(this.map_.getView())})),this.setView_(this.map_.getView())}destroy(){(0,xe.unByKey)(this.viewListenKey_),this.viewListenKey_=null}setView_(e){if(this.view_&&((0,xe.unByKey)(this.viewListenKey_),this.viewListenKey_=null),this.view_=e,e){const t=(0,y.getTransform)(e.getProjection(),"EPSG:4326"),i=(0,y.getTransform)("EPSG:4326",e.getProjection());this.toLonLat_=t,this.fromLonLat_=i,this.viewListenKey_=e.on("propertychange",(e=>this.handleViewChangedEvent_())),this.readFromView()}else this.toLonLat_=Me,this.fromLonLat_=Me}handleViewChangedEvent_(){this.viewUpdateInProgress_||this.readFromView()}setHeading(e){this.view_&&this.view_.setRotation(e)}getHeading(){if(!this.view_)return;return this.view_.getRotation()||0}setTilt(e){this.tilt_=e,this.updateCamera_()}getTilt(){return this.tilt_}setDistance(e){this.distance_=e,this.updateCamera_(),this.updateView()}getDistance(){return this.distance_}setCenter(e){this.view_&&this.view_.setCenter(e)}getCenter(){if(this.view_)return this.view_.getCenter()}setPosition(e){if(!this.toLonLat_)return;const t=this.toLonLat_(e),i=new Cesium.Cartographic(Ge(t[0]),Ge(t[1]),this.getAltitude());this.cam_.setView({destination:Cesium.Ellipsoid.WGS84.cartographicToCartesian(i)}),this.updateView()}getPosition(){if(!this.fromLonLat_)return;const e=Cesium.Ellipsoid.WGS84.cartesianToCartographic(this.cam_.position);return this.fromLonLat_([Oe(e.longitude),Oe(e.latitude)])}setAltitude(e){const t=Cesium.Ellipsoid.WGS84.cartesianToCartographic(this.cam_.position);t.height=e,this.cam_.position=Cesium.Ellipsoid.WGS84.cartographicToCartesian(t),this.updateView()}getAltitude(){return Cesium.Ellipsoid.WGS84.cartesianToCartographic(this.cam_.position).height}updateCamera_(){if(!this.view_||!this.toLonLat_)return;const e=this.view_.getCenter();if(!e)return;const t=this.toLonLat_(e),i=new Cesium.Cartographic(Ge(t[0]),Ge(t[1]));if(this.scene_.globe){const e=this.scene_.globe.getHeight(i);i.height=e||0}const n=Cesium.Ellipsoid.WGS84.cartographicToCartesian(i),s={pitch:this.tilt_-Cesium.Math.PI_OVER_TWO,heading:-this.view_.getRotation(),roll:void 0};this.cam_.setView({destination:n,orientation:s}),this.cam_.moveBackward(this.distance_),this.checkCameraChange(!0)}readFromView(){if(!this.view_||!this.toLonLat_)return;const e=this.view_.getCenter();if(null==e)return;const t=this.toLonLat_(e),i=this.view_.getResolution();this.distance_=this.calcDistanceForResolution(i||0,Ge(t[1])),this.updateCamera_()}updateView(){if(!this.view_||!this.fromLonLat_)return;this.viewUpdateInProgress_=!0;const e=Cesium.Ellipsoid.WGS84,t=this.scene_,i=ae(t);let n=i;if(!n){const e=t.globe,i=this.cam_.positionCartographic.clone(),s=e.getHeight(i);i.height=s||0,n=Cesium.Ellipsoid.WGS84.cartographicToCartesian(i)}this.distance_=Cesium.Cartesian3.distance(n,this.cam_.position);const s=e.cartesianToCartographic(n);if(this.view_.setCenter(this.fromLonLat_([Oe(s.longitude),Oe(s.latitude)])),this.view_.setResolution(this.calcResolutionForDistance(this.distance_,s?s.latitude:0)),i){const t=this.cam_.position,n=new Cesium.Cartesian3;e.geocentricSurfaceNormal(i,n);const s=new Cesium.Cartesian3;Cesium.Cartesian3.subtract(t,i,s),Cesium.Cartesian3.normalize(s,s);const r=this.cam_.up,o=this.cam_.right,a=new Cesium.Cartesian3(-i.y,i.x,0),l=Cesium.Cartesian3.angleBetween(o,a),c=Cesium.Cartesian3.cross(i,r,new Cesium.Cartesian3).z;this.view_.setRotation(c<0?l:-l);const h=Math.acos(Cesium.Cartesian3.dot(n,s));this.tilt_=isNaN(h)?0:h}else this.view_.setRotation(this.cam_.heading),this.tilt_=-this.cam_.pitch+Math.PI/2;this.viewUpdateInProgress_=!1}checkCameraChange(e){const t=this.lastCameraViewMatrix_,i=this.cam_.viewMatrix;t&&Cesium.Matrix4.equalsEpsilon(t,i,1e-7)||(this.lastCameraViewMatrix_=i.clone(),!0!==e&&this.updateView())}calcDistanceForResolution(e,t){return Pe(e,t,this.scene_,this.view_.getProjection())}calcResolutionForDistance(e,t){return Ee(e,t,this.scene_,this.view_.getProjection())}}const ke=ol.layer.Group;var Ve=e.n(ke);class Ne{constructor(e,t){this.layerMap={},this.olLayerListenKeys={},this.olGroupListenKeys_={},this.map=e,this.view=e.getView(),this.scene=t,this.olLayers=e.getLayerGroup().getLayers(),this.mapLayerGroup=e.getLayerGroup()}synchronize(){this.destroyAll(),this.addLayers_(this.mapLayerGroup)}orderLayers(){}addLayers_(e){const t=[{layer:e,parents:[]}];for(;t.length>0;){const e=t.splice(0,1)[0],i=e.layer,n=h(i).toString();this.olLayerListenKeys[n]=[];let s=null;if(i instanceof Ve())this.listenForGroupChanges_(i),i!==this.mapLayerGroup&&(s=this.createSingleLayerCounterparts(e)),s||i.getLayers().forEach((n=>{if(n){const s={layer:n,parents:i===this.mapLayerGroup?[]:[e.layer].concat(e.parents)};t.push(s)}}));else if(s=this.createSingleLayerCounterparts(e),!s){const t=n,i=e,s=()=>{const e=this.createSingleLayerCounterparts(i);e&&(i.layer.un("change",s),this.addCesiumObjects_(e,t,i.layer),this.orderLayers())};this.olLayerListenKeys[n].push(i.layer.on("change",s))}s&&this.addCesiumObjects_(s,n,i)}this.orderLayers()}addCesiumObjects_(e,t,i){this.layerMap[t]=e,this.olLayerListenKeys[t].push(i.on("change:zIndex",(()=>this.orderLayers()))),e.forEach((e=>{this.addCesiumObject(e)}))}removeAndDestroySingleLayer_(e){const t=h(e).toString(),i=this.layerMap[t];return i&&(i.forEach((e=>{this.removeSingleCesiumObject(e,!1),this.destroyCesiumObject(e)})),this.olLayerListenKeys[t].forEach(xe.unByKey),delete this.olLayerListenKeys[t]),delete this.layerMap[t],!!i}unlistenSingleGroup_(e){if(e===this.mapLayerGroup)return;const t=h(e).toString();this.olGroupListenKeys_[t].forEach((e=>{(0,xe.unByKey)(e)})),delete this.olGroupListenKeys_[t],delete this.layerMap[t]}removeLayer_(e){if(e){const t=[e];for(;t.length>0;){const e=t.splice(0,1)[0],i=this.removeAndDestroySingleLayer_(e);e instanceof Ve()&&(this.unlistenSingleGroup_(e),i||e.getLayers().forEach((e=>{t.push(e)})))}}}listenForGroupChanges_(e){const t=h(e).toString(),i=[];this.olGroupListenKeys_[t]=i;let n=[];const s=function(){const t=e.getLayers();t&&(n=[t.on("add",(e=>{this.addLayers_(e.element)})),t.on("remove",(e=>{this.removeLayer_(e.element)}))],i.push(...n))}.bind(this);s(),i.push(e.on("change:layers",(e=>{n.forEach((e=>{const t=i.indexOf(e);t>=0&&i.splice(t,1),(0,xe.unByKey)(e)})),s()})))}destroyAll(){let e;for(e in this.removeAllCesiumObjects(!0),this.olGroupListenKeys_){this.olGroupListenKeys_[e].forEach(xe.unByKey)}for(e in this.olLayerListenKeys)this.olLayerListenKeys[e].forEach(xe.unByKey);this.olGroupListenKeys_={},this.olLayerListenKeys={},this.layerMap={}}}const De=ol.layer.BaseVector;var Be=e.n(De);class je extends Ne{constructor(e,t){super(e,t),this.cesiumLayers_=t.imageryLayers,this.ourLayers_=new Cesium.ImageryLayerCollection}addCesiumObject(e){this.cesiumLayers_.add(e),this.ourLayers_.add(e)}destroyCesiumObject(e){e.destroy()}removeSingleCesiumObject(e,t){this.cesiumLayers_.remove(e,t),this.ourLayers_.remove(e,!1)}removeAllCesiumObjects(e){for(let t=0;t<this.ourLayers_.length;++t)this.cesiumLayers_.remove(this.ourLayers_.get(t),e);this.ourLayers_.removeAll(!1)}convertLayerToCesiumImageries(e,t){const i=ge(this.map,e,t);return i?[i]:null}createSingleLayerCounterparts(e){const t=e.layer,i=h(t).toString(),n=this.view.getProjection(),s=this.convertLayerToCesiumImageries(t,n);if(s){const n=[];if([e.layer].concat(e.parents).forEach((t=>{n.push(t.on(["change:opacity","change:visible"],(()=>{for(let t=0;t<s.length;++t)Ce(e,s[t])})))})),t instanceof Be()){let e=t.getStyleFunction();n.push(t.on("change",(()=>{const i=t.getStyleFunction();if(e!==i){e=i;for(let e=0;e<s.length;++e){const t=s[e];t._imageryCache&&(t._imageryCache={});const r=t.imageryProvider;var n;if(r)null==(n=r.tileCache)||n.clear(),r.styleFunction_=i}this.scene.requestRender()}})))}for(let t=0;t<s.length;++t)Ce(e,s[t]);n.push(t.on("change:extent",(e=>{for(let e=0;e<s.length;++e)this.cesiumLayers_.remove(s[e],!0),this.ourLayers_.remove(s[e],!1);delete this.layerMap[h(t)],this.synchronize()}))),n.push(t.on("change",(e=>{for(let e=0;e<s.length;++e){const t=this.cesiumLayers_.indexOf(s[e]);t>=0&&(this.cesiumLayers_.remove(s[e],!1),this.cesiumLayers_.add(s[e],t))}}))),this.olLayerListenKeys[i].push(...n)}return Array.isArray(s)?s:null}orderLayers(){const e=[],t={},i=[this.mapLayerGroup];for(;i.length>0;){const n=i.splice(0,1)[0];if(e.push(n),t[h(n)]=n.getZIndex()||0,n instanceof Ve()){const e=n.getLayers();e&&i.unshift(...e.getArray())}}e.sort(((e,i)=>t[h(e)]-t[h(i)])),e.forEach((e=>{const t=h(e).toString(),i=this.layerMap[t];i&&i.forEach((e=>{this.raiseToTop(e)}))}))}raiseToTop(e){this.cesiumLayers_.raiseToTop(e)}}ol.source.Vector;ol.layer.Layer;const Ue=ol.source.Cluster;var ze=e.n(Ue);const He=ol.layer.Vector;var We=e.n(He);const Ke=ol.style.Icon;var qe=e.n(Ke);const Ze=ol.geom.Polygon,Ye=ol.geom.SimpleGeometry;var Xe=e.n(Ye);class Qe{constructor(e,t){this.olListenKeys=[];const i=new Cesium.BillboardCollection({scene:t}),n=new Cesium.PrimitiveCollection;this.rootCollection_=new Cesium.PrimitiveCollection,this.context={projection:e,billboards:i,featureToCesiumMap:{},primitives:n},this.rootCollection_.add(i),this.rootCollection_.add(n)}destroy(){this.olListenKeys.forEach(xe.unByKey),this.olListenKeys.length=0}getRootPrimitive(){return this.rootCollection_}}const $e=ol.geom;class Je{constructor(e){this.boundOnRemoveOrClearFeatureListener_=this.onRemoveOrClearFeature_.bind(this),this.defaultBillboardEyeOffset_=new Cesium.Cartesian3(0,0,10),this.scene=e,this.scene=e}onRemoveOrClearFeature_(e){const t=e.target,i=t.olcs_cancellers;if(i){const n=e.feature;if(n){const e=h(n),t=i[e];t&&(t(),delete i[e])}else{for(const e in i)i.hasOwnProperty(e)&&i[e]();t.olcs_cancellers={}}}}setReferenceForPicking(e,t,i){i.olLayer=e,i.olFeature=t}createColoredPrimitive(e,t,i,n,s,r){const o={flat:!0,renderState:{depthTest:{enabled:!0}}};void 0!==r&&(o.renderState.lineWidth=r);const a=function(e,t){const i=new Cesium.GeometryInstance({geometry:e});return!t||t instanceof Cesium.ImageMaterialProperty||(i.attributes={color:Cesium.ColorGeometryInstanceAttribute.fromColor(t)}),i}(n,s);let l;if(this.getHeightReference(e,t,i)===Cesium.HeightReference.CLAMP_TO_GROUND){if(!("createShadowVolume"in a.geometry.constructor))return null;l=new Cesium.GroundPrimitive({geometryInstances:a})}else l=new Cesium.Primitive({geometryInstances:a});if(s instanceof Cesium.ImageMaterialProperty){const e=s.image.getValue().toDataURL();l.appearance=new Cesium.MaterialAppearance({flat:!0,renderState:{depthTest:{enabled:!0}},material:new Cesium.Material({fabric:{type:"Image",uniforms:{image:e}}})})}else l.appearance=new Cesium.MaterialAppearance({...o,material:new Cesium.Material({translucent:1!==s.alpha,fabric:{type:"Color",uniforms:{color:s}}})}),l instanceof Cesium.Primitive&&(t.get("olcs_shadows")||e.get("olcs_shadows"))&&(l.shadows=1);return this.setReferenceForPicking(e,t,l),l}extractColorFromOlStyle(e,t){const i=e.getFill()?e.getFill().getColor():null,n=e.getStroke()?e.getStroke().getColor():null;let s="black";return n&&t?s=n:i&&(s=i),fe(s)}extractLineWidthFromOlStyle(e){const t=e.getStroke()?e.getStroke().getWidth():void 0;return void 0!==t?t:1}wrapFillAndOutlineGeometries(e,t,i,n,s,r){const o=this.extractColorFromOlStyle(r,!1),a=this.extractColorFromOlStyle(r,!0),l=new Cesium.PrimitiveCollection;if(r.getFill()){const s=this.createColoredPrimitive(e,t,i,n,o);l.add(s)}if(r.getStroke()&&s){const n=this.extractLineWidthFromOlStyle(r),o=this.createColoredPrimitive(e,t,i,s,a,n);o&&l.add(o)}return l}addTextStyle(e,t,i,n,s){let r;if(s instanceof Cesium.PrimitiveCollection?r=s:(r=new Cesium.PrimitiveCollection,r.add(s)),!n.getText())return r;const o=n.getText(),a=this.olGeometry4326TextPartToCesium(e,t,i,o);return a&&r.add(a),r}csAddBillboard(e,t,i,n,s,r){t.eyeOffset||(t.eyeOffset=this.defaultBillboardEyeOffset_);const o=e.add(t);return this.setReferenceForPicking(i,n,o),o}olCircleGeometryToCesium(e,t,i,n,s){const r=(i=_e(i,n)).getCenter(),o=3==r.length?r[2]:0,a=r.slice();a[0]+=i.getRadius();const l=pe(r),c=pe(a),h=Cesium.Cartesian3.distance(l,c),m=new Cesium.CircleGeometry({center:l,radius:h,height:o});let d,g;if(this.getHeightReference(e,t,i)===Cesium.HeightReference.CLAMP_TO_GROUND){const n=this.extractLineWidthFromOlStyle(s);if(n){const r=ye((0,Ze.circular)(i.getCenter(),h).getLinearRing(0).getCoordinates()),o=d=new Cesium.GroundPolylinePrimitive({geometryInstances:new Cesium.GeometryInstance({geometry:new Cesium.GroundPolylineGeometry({positions:r,width:n})}),appearance:new Cesium.PolylineMaterialAppearance({material:this.olStyleToCesium(t,s,!0)}),classificationType:Cesium.ClassificationType.TERRAIN});u(d).then((()=>{this.setReferenceForPicking(e,t,o._primitive)}))}}else g=new Cesium.CircleOutlineGeometry({center:l,radius:h,extrudedHeight:o,height:o});const C=this.wrapFillAndOutlineGeometries(e,t,i,m,g,s);return d&&C.add(d),this.addTextStyle(e,t,i,s,C)}olLineStringGeometryToCesium(e,t,i,n,s){const r=ye((i=_e(i,n)).getCoordinates()),o=this.extractLineWidthFromOlStyle(s);let a;const l=this.getHeightReference(e,t,i),c=new Cesium.PolylineMaterialAppearance({material:this.olStyleToCesium(t,s,!0)});if(l===Cesium.HeightReference.CLAMP_TO_GROUND){const i=new Cesium.GroundPolylineGeometry({positions:r,width:o}),n=a=new Cesium.GroundPolylinePrimitive({appearance:c,geometryInstances:new Cesium.GeometryInstance({geometry:i})});u(a).then((()=>{this.setReferenceForPicking(e,t,n._primitive)}))}else{const e=new Cesium.PolylineGeometry({positions:r,width:o,vertexFormat:c.vertexFormat});a=new Cesium.Primitive({appearance:c,geometryInstances:new Cesium.GeometryInstance({geometry:e})})}return this.setReferenceForPicking(e,t,a),this.addTextStyle(e,t,i,s,a)}olPolygonGeometryToCesium(e,t,i,n,s){i=_e(i,n);const r=this.getHeightReference(e,t,i);let o,a,l;if(5==i.getCoordinates()[0].length&&"rectangle"===t.get("olcs.polygon_kind")){const e=i.getCoordinates()[0],n=(0,$.boundingExtent)(e),s=Cesium.Rectangle.fromDegrees(n[0],n[1],n[2],n[3]);let r=0;if(3==e[0].length)for(let t=0;t<e.length;t++)r=Math.max(r,e[t][2]);const l=t.get("olcs_extruded_height");o=new Cesium.RectangleGeometry({ellipsoid:Cesium.Ellipsoid.WGS84,rectangle:s,height:r,extrudedHeight:l}),a=new Cesium.RectangleOutlineGeometry({ellipsoid:Cesium.Ellipsoid.WGS84,rectangle:s,height:r,extrudedHeight:l})}else{const n=i.getLinearRings(),c={positions:[],holes:[]},h=c;for(let e=0;e<n.length;++e){const t=ye(n[e].getCoordinates());0===e?c.positions=t:c.holes.push({positions:t,holes:[]})}const m=t.get("olcs_extruded_height");if(o=new Cesium.PolygonGeometry({polygonHierarchy:h,perPositionHeight:!0,extrudedHeight:m}),r===Cesium.HeightReference.CLAMP_TO_GROUND){const i=this.extractLineWidthFromOlStyle(s);if(i>0){const n=[c.positions];if(c.holes)for(let e=0;e<c.holes.length;++e)n.push(c.holes[e].positions);const r=new Cesium.PolylineMaterialAppearance({material:this.olStyleToCesium(t,s,!0)}),o=[];for(const e of n){const t=new Cesium.GroundPolylineGeometry({positions:e,width:i});o.push(new Cesium.GeometryInstance({geometry:t}))}l=new Cesium.GroundPolylinePrimitive({appearance:r,geometryInstances:o}),u(l).then((()=>{this.setReferenceForPicking(e,t,l._primitive)}))}}else a=new Cesium.PolygonOutlineGeometry({polygonHierarchy:c,perPositionHeight:!0,extrudedHeight:m})}const c=this.wrapFillAndOutlineGeometries(e,t,i,o,a,s);return l&&c.add(l),this.addTextStyle(e,t,i,s,c)}getHeightReference(e,t,i){let n=i.get("altitudeMode");void 0===n&&(n=t.get("altitudeMode")),void 0===n&&(n=e.get("altitudeMode"));let s=Cesium.HeightReference.NONE;return"clampToGround"===n?s=Cesium.HeightReference.CLAMP_TO_GROUND:"relativeToGround"===n&&(s=Cesium.HeightReference.RELATIVE_TO_GROUND),s}createBillboardFromImage(e,t,i,n,s,r,o,a){r instanceof qe()&&r.load();const l=r.getImage(1),c=function(){if(!l)return;if(!(l instanceof HTMLCanvasElement||l instanceof Image||l instanceof HTMLImageElement))return;const n=pe(i.getCoordinates());let c;const h=r.getOpacity();void 0!==h&&(c=new Cesium.Color(1,1,1,h));const u=r.getScale(),m=this.getHeightReference(e,t,i),d={image:l,color:c,scale:u,heightReference:m,position:n};if(Object.assign(d,t.get("cesiumOptions")),r instanceof qe()){const e=r.getAnchor();if(e){const t=Array.isArray(u)?u[0]:u,i=Array.isArray(u)?u[1]:u;d.pixelOffset=new Cesium.Cartesian2((l.width/2-e[0])*t,(l.height/2-e[1])*i)}}const g=this.csAddBillboard(o,d,e,t,i,s);a&&a(g)}.bind(this);if(l instanceof Image&&!function(e){return""!=e.src&&0!=e.naturalHeight&&0!=e.naturalWidth&&e.complete}(l)){let i=!1;const n=e.getSource(),s=function(){i=!0};n.on(["removefeature","clear"],this.boundOnRemoveOrClearFeatureListener_);let r=n.olcs_cancellers;r||(r=n.olcs_cancellers={});const a=h(t);r[a]&&r[a](),r[a]=s;const u=function(){l.removeEventListener("load",u),o.isDestroyed()||i||c()};l.addEventListener("load",u)}else c()}olPointGeometryToCesium(e,t,i,n,s,r,o){i=_e(i,n);let a=null;const l=s.getImage();if(l){const c=i.get("olcs_model")||t.get("olcs_model");if(c){a=new Cesium.PrimitiveCollection;const e=c(),t=Object.assign({},{scene:this.scene},e.cesiumOptions);if("fromGltf"in Cesium.Model){const e=Cesium.Model.fromGltf(t);a.add(e)}else Cesium.Model.fromGltfAsync(t).then((e=>{a.add(e)}));e.debugModelMatrix&&a.add(new Cesium.DebugModelMatrixPrimitive({modelMatrix:e.debugModelMatrix}))}else this.createBillboardFromImage(e,t,i,n,s,l,r,o)}return s.getText()?this.addTextStyle(e,t,i,s,a||new Cesium.Primitive):a}olMultiGeometryToCesium(e,t,i,n,s,r,o){switch(i.getType()){case"MultiPoint":{const a=i.getPoints();if(s.getText()){const i=new Cesium.PrimitiveCollection;return a.forEach((a=>{const l=this.olPointGeometryToCesium(e,t,a,n,s,r,o);l&&i.add(l)})),i}return a.forEach((i=>{this.olPointGeometryToCesium(e,t,i,n,s,r,o)})),null}case"MultiLineString":{const r=i.getLineStrings(),o=new Cesium.PrimitiveCollection;return r.forEach((i=>{const r=this.olLineStringGeometryToCesium(e,t,i,n,s);o.add(r)})),o}case"MultiPolygon":{const r=i.getPolygons(),o=new Cesium.PrimitiveCollection;return r.forEach((i=>{const r=this.olPolygonGeometryToCesium(e,t,i,n,s);o.add(r)})),o}}}olGeometry4326TextPartToCesium(e,t,i,n){const s=n.getText();if(!s)return null;const r=new Cesium.LabelCollection({scene:this.scene}),o=(0,$.getCenter)(i.getExtent());if(i instanceof Xe()){const e=i.getFirstCoordinate();o[2]=3==e.length?e[2]:0}const a={};a.position=pe(o),a.text=s,a.heightReference=this.getHeightReference(e,t,i);const l=n.getOffsetX(),c=n.getOffsetY();if(0!=l||0!=c){const e=new Cesium.Cartesian2(l,c);a.pixelOffset=e}let h,u;switch(a.font=n.getFont()||"10px sans-serif",n.getFill()&&(a.fillColor=this.extractColorFromOlStyle(n,!1),h=Cesium.LabelStyle.FILL),n.getStroke()&&(a.outlineWidth=this.extractLineWidthFromOlStyle(n),a.outlineColor=this.extractColorFromOlStyle(n,!0),h=Cesium.LabelStyle.OUTLINE),n.getFill()&&n.getStroke()&&(h=Cesium.LabelStyle.FILL_AND_OUTLINE),a.style=h,n.getTextAlign()){case"left":u=Cesium.HorizontalOrigin.LEFT;break;case"right":u=Cesium.HorizontalOrigin.RIGHT;break;default:u=Cesium.HorizontalOrigin.CENTER}if(a.horizontalOrigin=u,n.getTextBaseline()){let e;switch(n.getTextBaseline()){case"top":case"alphabetic":e=Cesium.VerticalOrigin.TOP;break;case"middle":e=Cesium.VerticalOrigin.CENTER;break;case"bottom":case"hanging":e=Cesium.VerticalOrigin.BOTTOM}a.verticalOrigin=e}const m=r.add(a);return this.setReferenceForPicking(e,t,m),r}olStyleToCesium(e,t,i){const n=t.getFill(),s=t.getStroke();if(i&&!s||!i&&!n)return null;const r=fe(i?s.getColor():n.getColor());return i&&s.getLineDash()?Cesium.Material.fromType("Stripe",{horizontal:!1,repeat:500,evenColor:r,oddColor:new Cesium.Color(0,0,0,0)}):Cesium.Material.fromType("Color",{color:r})}computePlainStyle(e,t,i,n){const s=t.getStyleFunction();let r=null;return s&&(r=s(t,n)),!r&&i&&(r=i(t,n)),r?Array.isArray(r)?r:[r]:null}getGeometryFromFeature(e,t,i){if(i)return i;const n=e.get("olcs.3d_geometry");if(n&&n instanceof $e.Geometry)return n;if(t){const i=t.getGeometryFunction()(e);if(i instanceof $e.Geometry)return i}return e.getGeometry()}olFeatureToCesium(e,t,i,n,s){const r=this.getGeometryFromFeature(t,i,s);if(!r)return null;const o=n.projection,a=function(e){const i=n.featureToCesiumMap[h(t)];i instanceof Array?i.push(e):n.featureToCesiumMap[h(t)]=[e]};switch(r.getType()){case"GeometryCollection":const s=new Cesium.PrimitiveCollection;return r.getGeometriesArray().forEach((r=>{if(r){const o=this.olFeatureToCesium(e,t,i,n,r);o&&s.add(o)}})),s;case"Point":const l=n.billboards,c=this.olPointGeometryToCesium(e,t,r,o,i,l,a);return c||null;case"Circle":return this.olCircleGeometryToCesium(e,t,r,o,i);case"LineString":return this.olLineStringGeometryToCesium(e,t,r,o,i);case"Polygon":return this.olPolygonGeometryToCesium(e,t,r,o,i);case"MultiPoint":case"MultiLineString":case"MultiPolygon":return this.olMultiGeometryToCesium(e,t,r,o,i,n.billboards,a)||null;case"LinearRing":throw new Error("LinearRing should only be part of polygon.");default:throw new Error(`Ol geom type not handled : ${r.getType()}`)}}olVectorLayerToCesium(e,t,i){const n=t.getProjection(),s=t.getResolution();if(void 0===s||!n)throw new Error("View not ready");let r=e.getSource();r instanceof ze()&&(r=r.getSource());const o=r.getFeatures(),a=new Qe(n,this.scene),l=a.context;for(let t=0;t<o.length;++t){const n=o[t];if(!n)continue;const r=e.getStyleFunction(),c=this.computePlainStyle(e,n,r,s);if(!c||!c.length)continue;let u=null;for(let t=0;t<c.length;t++){const i=this.olFeatureToCesium(e,n,c[t],l);if(i)if(u){if(i){let e,t=0;for(;e=i.get(t);)u.add(e),t++}}else u=i}u&&(i[h(n)]=u,a.getRootPrimitive().add(u))}return a}convert(e,t,i,n){const s=t.getProjection(),r=t.getResolution();if(null==r||!s)return null;const o=e.getStyleFunction(),a=this.computePlainStyle(e,i,o,r);if(!a||!a.length)return null;n.projection=s;let l=null;for(let t=0;t<a.length;t++){const s=this.olFeatureToCesium(e,i,a[t],n);if(l){if(s){let e,t=0;for(;e=s.get(t);)l.add(e),t++}}else l=s}return l}}class et extends Ne{constructor(e,t,i){super(e,t),this.converter=i||new Je(t),this.csAllPrimitives_=new Cesium.PrimitiveCollection,t.primitives.add(this.csAllPrimitives_),this.csAllPrimitives_.destroyPrimitives=!1}addCesiumObject(e){e.getRootPrimitive().counterpart=e,this.csAllPrimitives_.add(e.getRootPrimitive())}destroyCesiumObject(e){e.getRootPrimitive().destroy()}removeSingleCesiumObject(e,t){e.destroy(),this.csAllPrimitives_.destroyPrimitives=t,this.csAllPrimitives_.remove(e.getRootPrimitive()),this.csAllPrimitives_.destroyPrimitives=!1}removeAllCesiumObjects(e){if(this.csAllPrimitives_.destroyPrimitives=e,e)for(let e=0;e<this.csAllPrimitives_.length;++e)this.csAllPrimitives_.get(e).counterpart.destroy();this.csAllPrimitives_.removeAll(),this.csAllPrimitives_.destroyPrimitives=!1}updateLayerVisibility(e,t){let i=!0;[e.layer].concat(e.parents).forEach((e=>{const t=e.getVisible();i=void 0!==t&&(i&&t)})),t.show=i}createSingleLayerCounterparts(e){const t=e.layer;if(!(t instanceof We())||t instanceof Q())return null;let i=t.getSource();if(i instanceof ze()&&(i=i.getSource()),!i)return null;const n=this.view,s={},r=this.converter.olVectorLayerToCesium(t,n,s),o=r.getRootPrimitive(),a=r.olListenKeys;[e.layer].concat(e.parents).forEach((t=>{a.push(t.on("change:visible",(()=>{this.updateLayerVisibility(e,o)})))})),this.updateLayerVisibility(e,o);const l=e=>{const i=r.context,a=this.converter.convert(t,n,e,i);a&&(s[h(e)]=a,o.add(a))},c=e=>{const t=h(e),i=r.context,n=i.featureToCesiumMap[t];n&&(delete i.featureToCesiumMap[t],n.forEach((e=>{e instanceof Cesium.Billboard&&i.billboards.remove(e)})));const a=s[t];delete s[t],a&&o.remove(a)};return a.push(i.on("addfeature",(e=>{l(e.feature)}))),a.push(i.on("removefeature",(e=>{c(e.feature)}))),a.push(i.on("changefeature",(e=>{const t=e.feature;c(t),l(t)}))),r?[r]:null}}const tt=ol.Overlay;var it=e.n(tt);function nt(e,t){const i=e.cloneNode();if("CANVAS"===e.nodeName){i.getContext("2d").drawImage(e,0,0)}t&&t.appendChild(i),e.nodeType!==Node.TEXT_NODE&&i.addEventListener("click",(t=>{e.dispatchEvent(new MouseEvent("click",t)),t.stopPropagation()}));const n=e.childNodes;for(let e=0;e<n.length;e++)n[e]&&nt(n[e],i);return i}class st extends(it()){constructor(e){const t=e.parent;super(t.getOptions()),this.scenePostRenderListenerRemover_=null,this.attributeObserver_=[],this.scene_=e.scene,this.synchronizer_=e.synchronizer,this.parent_=t,this.positionWGS84_=void 0,this.observer_=new MutationObserver(this.handleElementChanged.bind(this)),this.attributeObserver_=[],this.listenerKeys_=[];const i=e=>this.setPropertyFromEvent_(e);this.listenerKeys_.push(this.parent_.on("change:element",i)),this.listenerKeys_.push(this.parent_.on("change:offset",i)),this.listenerKeys_.push(this.parent_.on("change:position",i)),this.listenerKeys_.push(this.parent_.on("change:positioning",i)),this.setProperties(this.parent_.getProperties()),this.handleMapChanged(),this.handleElementChanged()}observeTarget_(e){if(this.observer_){this.observer_.disconnect(),this.observer_.observe(e,{attributes:!1,childList:!0,characterData:!0,subtree:!0}),this.attributeObserver_.forEach((e=>{e.disconnect()})),this.attributeObserver_.length=0;for(let t=0;t<e.childNodes.length;t++){const i=e.childNodes[t];if(1===i.nodeType){const e=new MutationObserver(this.handleElementChanged.bind(this));e.observe(i,{attributes:!0,subtree:!0}),this.attributeObserver_.push(e)}}}}setPropertyFromEvent_(e){e.target&&e.key&&this.set(e.key,e.target.get(e.key))}getScene(){return this.scene_}handleMapChanged(){var e;this.scenePostRenderListenerRemover_&&(this.scenePostRenderListenerRemover_(),(e=this.element)&&e.parentNode&&e.parentNode.removeChild(e)),this.scenePostRenderListenerRemover_=null;const t=this.getScene();if(t){this.scenePostRenderListenerRemover_=t.postRender.addEventListener(this.updatePixelPosition.bind(this)),this.updatePixelPosition();const e=this.stopEvent?this.synchronizer_.getOverlayContainerStopEvent():this.synchronizer_.getOverlayContainer();this.insertFirst?e.insertBefore(this.element,e.childNodes[0]||null):e.appendChild(this.element)}}handlePositionChanged(){const e=this.getPosition();if(e){const t=this.parent_.getMap().getView().getProjection();this.positionWGS84_=(0,y.transform)(e,t,"EPSG:4326")}else this.positionWGS84_=void 0;this.updatePixelPosition()}handleElementChanged(){!function(e){for(;e.lastChild;)e.removeChild(e.lastChild)}(this.element);const e=this.getElement();if(e&&e.parentNode&&e.parentNode.childNodes)for(const t of Array.from(e.parentNode.childNodes)){const e=nt(t,null);this.element.appendChild(e)}e.parentNode&&this.observeTarget_(e.parentNode)}updatePixelPosition(){const e=this.positionWGS84_;if(!this.scene_||!e)return void this.setVisible(!1);let t=0;if(2===e.length){const i=this.scene_.globe.getHeight(Cesium.Cartographic.fromDegrees(e[0],e[1]));i&&this.scene_.globe.tilesLoaded&&(e[2]=i),i&&(t=i)}else t=e[2];const i=Cesium.Cartesian3.fromDegrees(e[0],e[1],t),n=this.scene_.camera,s=new Cesium.BoundingSphere(new Cesium.Cartesian3,6356752);if(!new Cesium.Occluder(s,n.position).isPointVisible(i))return void this.setVisible(!1);if(1!==n.frustum.computeCullingVolume(n.position,n.direction,n.up).computeVisibility(new Cesium.BoundingSphere(i)))return void this.setVisible(!1);this.setVisible(!0);const r=this.scene_.cartesianToCanvasCoordinates(i),o=[r.x,r.y],a=[this.scene_.canvas.width,this.scene_.canvas.height];this.updateRenderedPosition(o,a)}destroy(){this.scenePostRenderListenerRemover_&&this.scenePostRenderListenerRemover_(),this.observer_&&this.observer_.disconnect(),(0,xe.unByKey)(this.listenerKeys_),this.listenerKeys_.splice(0),"removeNode"in this.element?this.element.removeNode(!0):this.element.remove(),this.element=null}}class rt{constructor(e,t){this.overlayMap_=new Map,this.overlayEvents=["click","dblclick","mousedown","touchstart","pointerdown","mousewheel","wheel"],this.map=e,this.scene=t,this.map=e,this.overlayCollection_=this.map.getOverlays(),this.scene=t,this.overlayContainerStopEvent_=document.createElement("div"),this.overlayContainerStopEvent_.className="ol-overlaycontainer-stopevent",this.overlayEvents.forEach((e=>{this.overlayContainerStopEvent_.addEventListener(e,(e=>e.stopPropagation()))})),this.scene.canvas.parentElement.appendChild(this.overlayContainerStopEvent_),this.overlayContainer_=document.createElement("div"),this.overlayContainer_.className="ol-overlaycontainer",this.scene.canvas.parentElement.appendChild(this.overlayContainer_)}getOverlayContainerStopEvent(){return this.overlayContainerStopEvent_}getOverlayContainer(){return this.overlayContainer_}synchronize(){this.destroyAll(),this.overlayCollection_.forEach((e=>{this.addOverlay(e)})),this.overlayCollection_.on("add",(e=>this.addOverlay(e.element))),this.overlayCollection_.on("remove",(e=>this.removeOverlay(e.element)))}addOverlay(e){if(!e)return;const t=new st({scene:this.scene,synchronizer:this,parent:e});this.overlayMap_.set(h(e),t)}removeOverlay(e){const t=h(e),i=this.overlayMap_.get(t);i&&(i.destroy(),this.overlayMap_.delete(t))}destroyAll(){this.overlayMap_.forEach((e=>{e.destroy()})),this.overlayMap_.clear()}}const ot=0,at=1,lt=2;class ct{constructor(e){this.autoRenderLoop_=null,this.resolutionScale_=1,this.canvasClientWidth_=0,this.canvasClientHeight_=0,this.resolutionScaleChanged_=!0,this.enabled_=!1,this.pausedInteractions_=[],this.hiddenRootGroup_=null,this.lastFrameTime_=0,this.targetFrameRate_=Number.POSITIVE_INFINITY,this.blockCesiumRendering_=!1,this.warmingUp_=!1,this.trackedFeature_=null,this.trackedEntity_=null,this.entityView_=null,this.needTrackedEntityUpdate_=!1,this.boundingSphereScratch_=new Cesium.BoundingSphere,this.map_=e.map,this.time_=e.time||function(){return Cesium.JulianDate.now()},this.to4326Transform_=(0,y.getTransform)(this.map_.getView().getProjection(),"EPSG:4326");const t="position:absolute;top:0;left:0;width:100%;height:100%;touch-action:none;";this.container_=document.createElement("DIV");const i=document.createAttribute("style");i.value=`${t}visibility:hidden;`,this.container_.setAttributeNode(i);let n=e.target||this.map_.getViewport();if("string"==typeof n&&(n=document.getElementById(n)),n.appendChild(this.container_),this.isOverMap_=!e.target,this.isOverMap_&&e.stopOpenLayersEventsPropagation){const e=["click","dblclick","mousedown","touchstart","pointerdown","mousewheel","wheel"];for(let t=0,i=e.length;t<i;++t)this.container_.addEventListener(e[t],(e=>e.stopPropagation()))}this.canvas_=document.createElement("canvas");const s=document.createAttribute("style");s.value=t,this.canvas_.setAttributeNode(s),a()&&(this.canvas_.style.imageRendering=(a(),o||"")),this.canvas_.oncontextmenu=function(){return!1},this.canvas_.onselectstart=function(){return!1},this.container_.appendChild(this.canvas_);const r=void 0!==e.sceneOptions?{...e.sceneOptions,canvas:this.canvas_,scene3DOnly:!0}:{canvas:this.canvas_,scene3DOnly:!0};this.scene_=new Cesium.Scene(r);const