@poor-knight/cesium-utils 0.3.4 → 0.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cesium-utils.cjs
CHANGED
|
@@ -74,4 +74,4 @@
|
|
|
74
74
|
<path id="svg_4" data-name="svg 4" class="cls-1" d="${p}"/>
|
|
75
75
|
</g>
|
|
76
76
|
<image id="img_1" width="${i}" height="${146/124*i}" transform="translate(${-i/2+u.x} ${u.y})" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHwAAACSCAMAAACwjl5+AAAAq1BMVEUAAAD////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////Nr6iZAAAAOXRSTlMABRshFgkSZg5qJmFdWlEqOXBFPYVJQYB1VXtNLpc1mzKguZCKtJONxc69yaukwa/SqN/k1trs6fBhRQqRAAAVcElEQVR42rSX3ZKaQBCFgxoIICh/ggjiIMPPMAOy6yZ5/yfLaTBVSa5istu1Vepe+M3p7jkHPz1Vmqav99umYLxsh7bvO6oeb8ZR1XUS7TaftU8fVdqX9cWpGBt5WeJvKbwbOJvyujEPlv5RcLBXZyesc1lyMSk5qWmS0zQxNQrGVF2Fpv9hdOg+2HFzZZwPQjFWFAxV4FUNJd5VcWr4u4+hgx0YcVgVchRtOSmW50wpVoA+lS0vWB6mifkxdE2H7jSOazaVfYtJo91yHKVSUmLq/Yihp2Zi09a9N1rb7Hxi07oN/dAOgnMwB4F9E3jtW1Y1oWea2yhbve/Oa583WWR4SRLnGHAPVkd3bblpA70XvcjDKjVs24ku70rX9NU5OgIeV9ect0L03a3rbve3l5e3+6273Vp0opVVmnrG1jkFl9UX7R3HfY5c2zCTOLxKNHzobzdCv3779voK/ls3tOi+ihPPcI5uFGRrXdPeZ8t16+y7zpbgVcHFWLb9fUZ/RX0D/e2txew5zxPTcNzIP+xBR+vfgb2x9oeTe3Rs04sLXuKmDWg5sb+jFnqH9Zej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vZIa/+2GbrLkNdy7Ez89SIL8C9+7yRk0137n7DEXrsPE2a4XD+FjcLXchdE3sv75lug50pZnaf2rPbBfIvwA2jcoh9iZ//PGjxKPu4HHe3yc7cWfPU9+9hlRfZpSZyIH4gkGGezDecu9kGsSt+eGeoScy4R+Ry93v+oWfNozrDEIaiHXRD7DXkDONmzdY7oGbuAxPH/wEwphW49aD/MlAP40uv1I7bCf2a+KP+wF2p1f3pdBHHJfycnf43/AJwK37vPZnSygAAAABJRU5ErkJggg=="/>
|
|
77
|
-
</svg>`;return{url:URL.createObjectURL(new Blob([b],{type:"image/svg+xml"})),viewBox:h,scale:v}},s=>`${s.color},${s.isMoving},${s.designBeam??0},${s.designLength??0},${s.aisFromBow??0},${s.aisFromCenter??0}`),shipTypeColorMap=new Map([[-1,"#00FF00"],[70,"#95B3D7"],[37,"#00FF00"],[50,"#366092"],[51,"#366092"],[52,"#366092"],[53,"#366092"],[54,"#366092"],[55,"#366092"],[56,"#366092"],[57,"#366092"],[58,"#366092"],[59,"#366092"],[80,"red"],[81,"red"],[82,"red"],[83,"red"],[84,"red"],[85,"red"],[86,"red"],[87,"red"],[88,"red"],[89,"red"]]);function createAlphaSampled(s){const i=new Cesium__namespace.SampledProperty(Cesium__namespace.Color),r=(s==null?void 0:s.startTime)??Cesium__namespace.JulianDate.now(),u=Cesium__namespace.JulianDate.addMinutes(r,1,new Cesium__namespace.JulianDate),m=Cesium__namespace.JulianDate.addMinutes(r,5,new Cesium__namespace.JulianDate),o=Cesium__namespace.JulianDate.fromIso8601("2100-01-01T00:00:00Z"),l=(s==null?void 0:s.color)??Cesium__namespace.Color.WHITE;return i.addSample(r,l.withAlpha(1)),i.addSample(u,l.withAlpha(1)),i.addSample(m,l.withAlpha(.2)),i.addSample(o,l.withAlpha(.1)),i}function getHideAfterFiveMinutesProperty(s){const i=s??Cesium__namespace.JulianDate.now(),r=Cesium__namespace.JulianDate.addMinutes(i,5,new Cesium__namespace.JulianDate);return new Cesium__namespace.CallbackProperty(u=>u?Cesium__namespace.JulianDate.lessThan(u,r):!0,!1)}class ShipLayer{constructor(i,r){z(this,"db");z(this,"isMounted",!1);z(this,"_viewer",null);z(this,"entityMap",new Map);z(this,"IS_MOVING_THRESHOLD",1);z(this,"shadowEntityMap",new WeakMap);this.key=i,this.zIndex=r,this.db=new Cesium__namespace.CustomDataSource(i)}show(i){this.isMounted||(i.dataSources.add(this.db),this._viewer=i,this.isMounted=!0),this.db.show=!0}hide(){this.isMounted&&(this.db.show=!1)}render(i){i.features.forEach(r=>{this.renderFeature(r)})}renderFeature(i){var c,d;const r=String(i.id),u=new Cesium__namespace.SampledPositionProperty;u.backwardExtrapolationType=Cesium__namespace.ExtrapolationType.HOLD,u.forwardExtrapolationType=Cesium__namespace.ExtrapolationType.HOLD;const m=Cesium__namespace.Cartesian3.fromDegrees(i.geometry.coordinates[0],i.geometry.coordinates[1]);u.addSample(((c=this._viewer)==null?void 0:c.clock.currentTime)??Cesium__namespace.JulianDate.now(),m);const o=((d=i.properties)==null?void 0:d.courseOverGroundTrue)??0,l=new Cesium__namespace.Entity({id:r,position:u,orientation:new Cesium__namespace.ConstantProperty(Cesium__namespace.Transforms.headingPitchRollQuaternion(m,new Cesium__namespace.HeadingPitchRoll(o,0,0))),properties:i.properties??{}});this.entityMap.set(r,l),this.db.entities.add(l),this.renderEntity(l)}update(i){var u,m,o,l,c,d,a,p;const r=this.db.entities.getById(String(i.id));if(r){const y=this.shadowEntityMap.get(r),g=((u=i.properties)==null?void 0:u.shipTypeId)??-1,h=shipTypeColorMap.get(g)??shipTypeColorMap.get(-1),[v,b]=i.geometry.coordinates,w=((m=this._viewer)==null?void 0:m.clock.currentTime)??Cesium__namespace.JulianDate.now(),T=(o=r.position)==null?void 0:o.getValue(w),_=Cesium__namespace.JulianDate.addSeconds(w,3,new Cesium__namespace.JulianDate),x=Cesium__namespace.Cartesian3.fromDegrees(v,b),O=new Cesium__namespace.SampledPositionProperty;if(O.backwardExtrapolationType=Cesium__namespace.ExtrapolationType.HOLD,O.forwardExtrapolationType=Cesium__namespace.ExtrapolationType.HOLD,O instanceof Cesium__namespace.SampledPositionProperty&&(O.addSample(Cesium__namespace.JulianDate.addSeconds(w,1,new Cesium__namespace.JulianDate),T??x),O.addSample(_,x)),r.position=O,y&&(y.position=O),r.properties)for(const[R,E]of Object.entries(i.properties??{})){if(R=="speedOverGround"){const C=r.properties.getValue().speedOverGround??0,N=Number(C)>this.IS_MOVING_THRESHOLD,A=Number(E)>this.IS_MOVING_THRESHOLD;if(N!==A&&(r.billboard&&(r.billboard.image=new Cesium__namespace.ConstantProperty(createShipIconUrl(h,A))),y!=null&&y.plane)){const D=((l=i.properties)==null?void 0:l.designBeam)??8,P=((c=i.properties)==null?void 0:c.designLength)??20,M=createShipIconV2({color:h,isMoving:A,...i.properties,designBeam:D,designLength:P}),q=(d=y.plane)==null?void 0:d.material;q&&(q.image=new Cesium__namespace.ConstantProperty(M.url),y.plane.dimensions=new Cesium__namespace.ConstantProperty(new Cesium__namespace.Cartesian2(D*M.scale.x,P*M.scale.y))),y.plane.dimensions=new Cesium__namespace.CallbackProperty(()=>new Cesium__namespace.Cartesian2(D*M.scale.x,P*M.scale.y),!0)}}if(R=="courseOverGroundTrue"){const C=((a=i.properties)==null?void 0:a.courseOverGroundTrue)??0;r.billboard.rotation=new Cesium__namespace.ConstantProperty(typeof E=="number"?-1*E:0);const N=new Cesium__namespace.ConstantProperty(Cesium__namespace.Transforms.headingPitchRollQuaternion(x,new Cesium__namespace.HeadingPitchRoll(C,0,0)));y&&(y.orientation=N)}if(R=="updateTime"){const C=Cesium__namespace.JulianDate.fromDate(new Date(E));r.billboard.color=createAlphaSampled({startTime:C});const N=(p=y==null?void 0:y.plane)==null?void 0:p.material;N&&(N.color=createAlphaSampled({startTime:C}));const A=getHideAfterFiveMinutesProperty(C);r.label.show=A,r.point.show=A}r.properties[R]=E}}else this.renderFeature(i)}renderEntity(i){var a,p,y,g,h,v,b;const r=(a=i.properties)==null?void 0:a.getValue(),u=(r==null?void 0:r.shipTypeId)??-1,m=shipTypeColorMap.get(u)??shipTypeColorMap.get(-1),o=Number((r==null?void 0:r.speedOverGround)??0),l=r!=null&&r.updateTime?new Date(r.updateTime):new Date,c=Cesium__namespace.JulianDate.fromDate(l),d=createShipIconUrl(m,o>this.IS_MOVING_THRESHOLD);i.point=new Cesium__namespace.PointGraphics({pixelSize:4,color:Cesium__namespace.Color.fromCssColorString("#8AF22C"),disableDepthTestDistance:3e6,distanceDisplayCondition:new Cesium__namespace.DistanceDisplayCondition(15e3),show:getHideAfterFiveMinutesProperty(c)}),i.billboard=new Cesium__namespace.BillboardGraphics({image:d,width:14,height:70,disableDepthTestDistance:3e6,distanceDisplayCondition:new Cesium__namespace.DistanceDisplayCondition(4e3,15e3),pixelOffset:new Cesium__namespace.Cartesian2(0,0),alignedAxis:Cesium__namespace.Cartesian3.UNIT_Z,color:createAlphaSampled({startTime:c}),rotation:new Cesium__namespace.ConstantProperty((y=(p=i.properties)==null?void 0:p.getValue())!=null&&y.courseOverGroundTrue?-1*i.properties.getValue().courseOverGroundTrue:0)}),i.label=new Cesium__namespace.LabelGraphics({font:'12px normal "微软雅黑"',backgroundColor:Cesium__namespace.Color.fromCssColorString("#E9F4FC"),fillColor:Cesium__namespace.Color.BLACK,outlineColor:Cesium__namespace.Color.BLACK,outlineWidth:2,showBackground:!0,style:Cesium__namespace.LabelStyle.FILL,pixelOffset:new Cesium__namespace.Cartesian2(0,-20),scale:1,scaleByDistance:new Cesium__namespace.NearFarScalar(3e3,1,1e4,.55),text:((h=(g=i.properties)==null?void 0:g.getValue())==null?void 0:h.name)??((v=i.properties)!=null&&v.getValue().mmsi?"mmsi:"+((b=i.properties)==null?void 0:b.getValue().mmsi):"未知"),horizontalOrigin:Cesium__namespace.HorizontalOrigin.CENTER,distanceDisplayCondition:new Cesium__namespace.DistanceDisplayCondition(0,15e3),disableDepthTestDistance:5e3,show:getHideAfterFiveMinutesProperty(c)}),this.createShipPlane(i)}createShipPlane(i){var g;const r=new Cesium__namespace.Entity({id:i.id+"_shadow",position:i.position,orientation:i.orientation});this.shadowEntityMap.set(i,r),this.db.entities.add(r);const u=(g=i.properties)==null?void 0:g.getValue(),m=u!=null&&u.updateTime?new Date(u.updateTime):new Date,o=Cesium__namespace.JulianDate.fromDate(m),l=Number((u==null?void 0:u.speedOverGround)??0),c=(u==null?void 0:u.designLength)??20,d=(u==null?void 0:u.designBeam)??8,a=(u==null?void 0:u.shipTypeId)??-1,p=shipTypeColorMap.get(a)??shipTypeColorMap.get(-1),y=createShipIconV2({color:p,isMoving:l>this.IS_MOVING_THRESHOLD,...u,designBeam:(u==null?void 0:u.designBeam)??8,designLength:(u==null?void 0:u.designLength)??20});r.plane=new Cesium__namespace.PlaneGraphics({plane:new Cesium__namespace.Plane(Cesium__namespace.Cartesian3.UNIT_Z,0),dimensions:new Cesium__namespace.Cartesian2(d*y.scale.x,c*y.scale.y),show:new Cesium__namespace.CallbackProperty(()=>{var w;if(!this._viewer)return!0;const h=this._viewer.clock.currentTime,v=(w=i.position)==null?void 0:w.getValue(h);return v?Cesium__namespace.Cartesian3.distance(this._viewer.camera.positionWC,v)<=4e3:!1},!1),material:new Cesium__namespace.ImageMaterialProperty({image:y.url,transparent:!0,repeat:new Cesium__namespace.Cartesian2(1,1),color:createAlphaSampled({startTime:o})})})}}Cesium.Color.fromCssColorString("#FC4C02");Cesium.Color.WHITE;new Cesium.Color;new Array(4);var e$2=[],t$2=[];function n$2(s,i){if(s&&typeof document<"u"){var r,u=i.prepend===!0?"prepend":"append",m=i.singleTag===!0,o=typeof i.container=="string"?document.querySelector(i.container):document.getElementsByTagName("head")[0];if(m){var l=e$2.indexOf(o);l===-1&&(l=e$2.push(o)-1,t$2[l]={}),r=t$2[l]&&t$2[l][u]?t$2[l][u]:t$2[l][u]=c()}else r=c();s.charCodeAt(0)===65279&&(s=s.substring(1)),r.styleSheet?r.styleSheet.cssText+=s:r.appendChild(document.createTextNode(s))}function c(){var d=document.createElement("style");if(d.setAttribute("type","text/css"),i.attributes)for(var a=Object.keys(i.attributes),p=0;p<a.length;p++)d.setAttribute(a[p],i.attributes[a[p]]);var y=u==="prepend"?"afterbegin":"beforeend";return o.insertAdjacentElement(y,d),d}}var css$2='.cesium-tool-tip{background:rgba(0,0,0,.6);border-radius:4px;color:#fff;left:0;line-height:30px;min-height:30px;min-width:100px;padding:0 10px;pointer-events:none;position:absolute;top:0;visibility:hidden;z-index:-1}.cesium-tool-tip:before{border-bottom:10px solid transparent;border-right:10px solid rgba(0,0,0,.6);border-top:10px solid transparent;content:"";display:block;left:-10px;pointer-events:none;position:absolute;top:calc(50% - 10px)}';n$2(css$2,{});Cesium.Color.YELLOW,Cesium.Color.YELLOW,Cesium.Color.DARKTURQUOISE.withAlpha(.5),Cesium.Color.BLUE,Cesium.Color.WHITE,Cesium.Color.YELLOW.withAlpha(.5),Cesium.Color.YELLOW.withAlpha(.5);Cesium.Color.WHITE,new Cesium.Color(.165,.165,.165,.8),new Cesium.Cartesian2(4,4),Cesium.LabelStyle.FILL_AND_OUTLINE,new Cesium.Cartesian2(4,0),new Cesium.NearFarScalar(1,.85,8e6,.75),Cesium.HeightReference.CLAMP_TO_GROUND;class Popup{constructor(i,r){z(this,"_position");z(this,"_screenPosition",new Cesium.Cartesian2);z(this,"_element");z(this,"_viewer");z(this,"_options");z(this,"_destroyed",!1);z(this,"_offset");z(this,"setPosition",()=>{if(this._position&&this._viewer&&this._position){if(this._viewer.scene.mode===Cesium.SceneMode.SCENE3D){const u=this._viewer.scene.camera.position,m=new Cesium.BoundingSphere(new Cesium.Cartesian3(0,0,0),635e4);if(!new Cesium.Occluder(m,u).isPointVisible(this._position)){this.switchElementShow(!1);return}}const i=Cesium.SceneTransforms.worldToWindowCoordinates(this._viewer.scene,this._position),{_element:r}=this;if(r&&i){if(this._screenPosition&&this._screenPosition.x===i.x&&this._screenPosition.y===i.y)return;this.switchElementShow(!0);const u=i.x-r.clientWidth/2+this._offset[0],m=i.y-r.clientHeight+this._offset[1];r.style.left=`${u}px`,r.style.top=`${m}px`,this._screenPosition=i}}});this._viewer=i,this._options=r;const{position:u,element:m,offset:o}=r;if(!m)throw Error("no element!");this._position=u?Cesium.Cartesian3.fromDegrees(u[0],u[1],u[2]):null,this._element=m,this._offset=[(o==null?void 0:o[0])??0,(o==null?void 0:o[1])??0],this.addMapListener()}set position(i){if(!i){this.switchElementShow(!1),this._position=null,this._options.position=null;return}this._position=Cesium.Cartesian3.fromDegrees(i[0],i[1],i[2]),this._options.position=i,this.setPosition()}get position(){return this._options.position}get destroyed(){return this._destroyed}switchElementShow(i){this._element&&(this._element.style.display=i?"block":"none")}addMapListener(){var i;(i=this._viewer)==null||i.scene.postRender.addEventListener(this.setPosition)}destroy(){this._viewer.isDestroyed()||this._viewer.scene.postRender.removeEventListener(this.setPosition),this.setPosition=void 0,this._destroyed=!0}}var e$1=[],t$1=[];function n$1(s,i){if(s&&typeof document<"u"){var r,u=i.prepend===!0?"prepend":"append",m=i.singleTag===!0,o=typeof i.container=="string"?document.querySelector(i.container):document.getElementsByTagName("head")[0];if(m){var l=e$1.indexOf(o);l===-1&&(l=e$1.push(o)-1,t$1[l]={}),r=t$1[l]&&t$1[l][u]?t$1[l][u]:t$1[l][u]=c()}else r=c();s.charCodeAt(0)===65279&&(s=s.substring(1)),r.styleSheet?r.styleSheet.cssText+=s:r.appendChild(document.createTextNode(s))}function c(){var d=document.createElement("style");if(d.setAttribute("type","text/css"),i.attributes)for(var a=Object.keys(i.attributes),p=0;p<a.length;p++)d.setAttribute(a[p],i.attributes[a[p]]);var y=u==="prepend"?"afterbegin":"beforeend";return o.insertAdjacentElement(y,d),d}}var css$1=".cesium-compass{cursor:pointer;height:60px;pointer-events:auto;position:absolute;right:15px;top:100px;user-select:none;width:60px}.cesium-compass .out-ring{fill:rgba(23,49,71,.702);background-repeat:no-repeat;background-size:contain;border-radius:50%;height:60px;left:0;position:absolute;top:0;transition:all .3s ease;width:60px}.cesium-compass .out-ring svg{height:60px;width:60px}.cesium-compass:hover .rotation_marker svg{height:70.2px;width:70.2px}.cesium-compass .gyro{align-items:center;background:#fff;border-radius:50%;box-sizing:border-box;display:flex;height:30px;justify-content:center;margin:0 auto;padding:4px;position:relative;text-align:center;top:50%;transform:translateY(-50%);transition:all .3s ease;width:30px}.cesium-compass .gyro svg{height:20px;width:20px}.rotation_marker{background-repeat:no-repeat;background-size:contain;border-radius:50%;position:relative}.rotation_marker svg{height:60px;left:50%;position:absolute;top:50%;transform:translate(-50%,-50%);transition:all .3s ease;width:60px}.cesium-compass .gyro-active,.cesium-compass .gyro:hover{fill:#68adfe}";n$1(css$1,{});var e=[],t=[];function n(s,i){if(s&&typeof document<"u"){var r,u=i.prepend===!0?"prepend":"append",m=i.singleTag===!0,o=typeof i.container=="string"?document.querySelector(i.container):document.getElementsByTagName("head")[0];if(m){var l=e.indexOf(o);l===-1&&(l=e.push(o)-1,t[l]={}),r=t[l]&&t[l][u]?t[l][u]:t[l][u]=c()}else r=c();s.charCodeAt(0)===65279&&(s=s.substring(1)),r.styleSheet?r.styleSheet.cssText+=s:r.appendChild(document.createTextNode(s))}function c(){var d=document.createElement("style");if(d.setAttribute("type","text/css"),i.attributes)for(var a=Object.keys(i.attributes),p=0;p<a.length;p++)d.setAttribute(a[p],i.attributes[a[p]]);var y=u==="prepend"?"afterbegin":"beforeend";return o.insertAdjacentElement(y,d),d}}var css=".cesium-zoom-controller{border-radius:100px;box-sizing:border-box;display:flex;flex-direction:column;line-height:1.2rem;pointer-events:auto;position:absolute;right:30px;text-align:center;top:187px;user-select:none}.cesium-zoom-controller .refresh,.cesium-zoom-controller .zoom-in,.cesium-zoom-controller .zoom-out{border-radius:14%;margin-bottom:5px}.cesium-zoom-controller .cesium-button{background:#2a2e39;border:none;margin-right:0;transition:all .3s cubic-bezier(.645,.045,.355,1);transition-delay:0s;transition-duration:.2s;transition-property:all;transition-timing-function:cubic-bezier(.645,.045,.355,1)}.cesium-zoom-controller .cesium-button:hover{background:#48b;box-shadow:none}.cesium-zoom-controller .cesium-button:active{fill:#edffff;background:#adf;color:#edffff}.cesium-zoom-controller .cesium-toolbar-button{align-items:center;display:flex;height:30px;justify-content:center;width:30px}";n(css,{});var heatmap$1={exports:{}},heatmap=heatmap$1.exports,hasRequiredHeatmap;function requireHeatmap(){return hasRequiredHeatmap||(hasRequiredHeatmap=1,function(s){(function(i,r,u){s.exports?s.exports=u():r[i]=u()})("h337",heatmap,function(){var i={defaultRadius:40,defaultRenderer:"canvas2d",defaultGradient:{.25:"rgb(0,0,255)",.55:"rgb(0,255,0)",.85:"yellow",1:"rgb(255,0,0)"},defaultMaxOpacity:1,defaultMinOpacity:0,defaultBlur:.85,defaultXField:"x",defaultYField:"y",defaultValueField:"value",plugins:{}},r=function(){var a=function(g){this._coordinator={},this._data=[],this._radi=[],this._min=10,this._max=1,this._xField=g.xField||g.defaultXField,this._yField=g.yField||g.defaultYField,this._valueField=g.valueField||g.defaultValueField,g.radius&&(this._cfgRadius=g.radius)},p=i.defaultRadius;return a.prototype={_organiseData:function(y,g){var h=y[this._xField],v=y[this._yField],b=this._radi,w=this._data,T=this._max,_=this._min,x=y[this._valueField]||1,O=y.radius||this._cfgRadius||p;w[h]||(w[h]=[],b[h]=[]),w[h][v]?w[h][v]+=x:(w[h][v]=x,b[h][v]=O);var R=w[h][v];return R>T?(g?this.setDataMax(R):this._max=R,!1):R<_?(g?this.setDataMin(R):this._min=R,!1):{x:h,y:v,value:x,radius:O,min:_,max:T}},_unOrganizeData:function(){var y=[],g=this._data,h=this._radi;for(var v in g)for(var b in g[v])y.push({x:v,y:b,radius:h[v][b],value:g[v][b]});return{min:this._min,max:this._max,data:y}},_onExtremaChange:function(){this._coordinator.emit("extremachange",{min:this._min,max:this._max})},addData:function(){if(arguments[0].length>0)for(var y=arguments[0],g=y.length;g--;)this.addData.call(this,y[g]);else{var h=this._organiseData(arguments[0],!0);h&&(this._data.length===0&&(this._min=this._max=h.value),this._coordinator.emit("renderpartial",{min:this._min,max:this._max,data:[h]}))}return this},setData:function(y){var g=y.data,h=g.length;this._data=[],this._radi=[];for(var v=0;v<h;v++)this._organiseData(g[v],!1);return this._max=y.max,this._min=y.min||0,this._onExtremaChange(),this._coordinator.emit("renderall",this._getInternalData()),this},removeData:function(){},setDataMax:function(y){return this._max=y,this._onExtremaChange(),this._coordinator.emit("renderall",this._getInternalData()),this},setDataMin:function(y){return this._min=y,this._onExtremaChange(),this._coordinator.emit("renderall",this._getInternalData()),this},setCoordinator:function(y){this._coordinator=y},_getInternalData:function(){return{max:this._max,min:this._min,data:this._data,radi:this._radi}},getData:function(){return this._unOrganizeData()}},a}(),u=function(){var a=function(h){var v=h.gradient||h.defaultGradient,b=document.createElement("canvas"),w=b.getContext("2d",{willReadFrequently:!0});b.width=256,b.height=1;var T=w.createLinearGradient(0,0,256,1);for(var _ in v)T.addColorStop(_,v[_]);return w.fillStyle=T,w.fillRect(0,0,256,1),w.getImageData(0,0,256,1).data},p=function(h,v){var b=document.createElement("canvas"),w=b.getContext("2d",{willReadFrequently:!0}),T=h,_=h;if(b.width=b.height=h*2,v==1)w.beginPath(),w.arc(T,_,h,0,2*Math.PI,!1),w.fillStyle="rgba(0,0,0,1)",w.fill();else{var x=w.createRadialGradient(T,_,h*v,T,_,h);x.addColorStop(0,"rgba(0,0,0,1)"),x.addColorStop(1,"rgba(0,0,0,0)"),w.fillStyle=x,w.fillRect(0,0,2*h,2*h)}return b},y=function(_){for(var v=[],b=_.min,w=_.max,T=_.radi,_=_.data,x=Object.keys(_),O=x.length;O--;)for(var R=x[O],E=Object.keys(_[R]),C=E.length;C--;){var N=E[C],A=_[R][N],D=T[R][N];v.push({x:R,y:N,value:A,radius:D})}return{min:b,max:w,data:v}};function g(h){var v=h.container,b=this.shadowCanvas=document.createElement("canvas"),w=this.canvas=h.canvas||document.createElement("canvas");this._renderBoundaries=[1e4,1e4,0,0];var T=getComputedStyle(h.container)||{};w.className="heatmap-canvas",this._width=w.width=b.width=h.width||+T.width.replace(/px/,""),this._height=w.height=b.height=h.height||+T.height.replace(/px/,""),this.shadowCtx=b.getContext("2d",{willReadFrequently:!0}),this.ctx=w.getContext("2d",{willReadFrequently:!0}),w.style.cssText=b.style.cssText="position:absolute;left:0;top:0;",v.style.position="relative",v.appendChild(w),this._palette=a(h),this._templates={},this._setStyles(h)}return g.prototype={renderPartial:function(h){h.data.length>0&&(this._drawAlpha(h),this._colorize())},renderAll:function(h){this._clear(),h.data.length>0&&(this._drawAlpha(y(h)),this._colorize())},_updateGradient:function(h){this._palette=a(h)},updateConfig:function(h){h.gradient&&this._updateGradient(h),this._setStyles(h)},setDimensions:function(h,v){this._width=h,this._height=v,this.canvas.width=this.shadowCanvas.width=h,this.canvas.height=this.shadowCanvas.height=v},_clear:function(){this.shadowCtx.clearRect(0,0,this._width,this._height),this.ctx.clearRect(0,0,this._width,this._height)},_setStyles:function(h){this._blur=h.blur==0?0:h.blur||h.defaultBlur,h.backgroundColor&&(this.canvas.style.backgroundColor=h.backgroundColor),this._width=this.canvas.width=this.shadowCanvas.width=h.width||this._width,this._height=this.canvas.height=this.shadowCanvas.height=h.height||this._height,this._opacity=(h.opacity||0)*255,this._maxOpacity=(h.maxOpacity||h.defaultMaxOpacity)*255,this._minOpacity=(h.minOpacity||h.defaultMinOpacity)*255,this._useGradientOpacity=!!h.useGradientOpacity},_drawAlpha:function(w){for(var v=this._min=w.min,b=this._max=w.max,w=w.data||[],T=w.length,_=1-this._blur;T--;){var x=w[T],O=x.x,R=x.y,E=x.radius,C=Math.min(x.value,b),N=O-E,A=R-E,D=this.shadowCtx,P;this._templates[E]?P=this._templates[E]:this._templates[E]=P=p(E,_);var M=(C-v)/(b-v);D.globalAlpha=M<.01?.01:M,D.drawImage(P,N,A),N<this._renderBoundaries[0]&&(this._renderBoundaries[0]=N),A<this._renderBoundaries[1]&&(this._renderBoundaries[1]=A),N+2*E>this._renderBoundaries[2]&&(this._renderBoundaries[2]=N+2*E),A+2*E>this._renderBoundaries[3]&&(this._renderBoundaries[3]=A+2*E)}},_colorize:function(){var h=this._renderBoundaries[0],v=this._renderBoundaries[1],b=this._renderBoundaries[2]-h,w=this._renderBoundaries[3]-v,T=this._width,_=this._height,x=this._opacity,O=this._maxOpacity,R=this._minOpacity,E=this._useGradientOpacity;h<0&&(h=0),v<0&&(v=0),h+b>T&&(b=T-h),v+w>_&&(w=_-v);for(var C=this.shadowCtx.getImageData(h,v,b,w),N=C.data,A=N.length,D=this._palette,P=3;P<A;P+=4){var M=N[P],q=M*4;if(q){var F;x>0?F=x:M<O?M<R?F=R:F=M:F=O,N[P-3]=D[q],N[P-2]=D[q+1],N[P-1]=D[q+2],N[P]=E?D[q+3]:F}}this.ctx.putImageData(C,h,v),this._renderBoundaries=[1e3,1e3,0,0]},getValueAt:function(h){var v,b=this.shadowCtx,w=b.getImageData(h.x,h.y,1,1),T=w.data[3],_=this._max,x=this._min;return v=Math.abs(_-x)*(T/255)>>0,v},getDataURL:function(){return this.canvas.toDataURL()}},g}(),m=function(){var a=!1;return i.defaultRenderer==="canvas2d"&&(a=u),a}(),o={merge:function(){for(var d={},a=arguments.length,p=0;p<a;p++){var y=arguments[p];for(var g in y)d[g]=y[g]}return d}},l=function(){var a=function(){function h(){this.cStore={}}return h.prototype={on:function(v,b,w){var T=this.cStore;T[v]||(T[v]=[]),T[v].push(function(_){return b.call(w,_)})},emit:function(v,b){var w=this.cStore;if(w[v])for(var T=w[v].length,_=0;_<T;_++){var x=w[v][_];x(b)}}},h}(),p=function(g){var h=g._renderer,v=g._coordinator,b=g._store;v.on("renderpartial",h.renderPartial,h),v.on("renderall",h.renderAll,h),v.on("extremachange",function(w){g._config.onExtremaChange&&g._config.onExtremaChange({min:w.min,max:w.max,gradient:g._config.gradient||g._config.defaultGradient})}),b.setCoordinator(v)};function y(){var g=this._config=o.merge(i,arguments[0]||{});if(this._coordinator=new a,g.plugin){var h=g.plugin;if(i.plugins[h]){var v=i.plugins[h];this._renderer=new v.renderer(g),this._store=new v.store(g)}else throw new Error("Plugin '"+h+"' not found. Maybe it was not registered.")}else this._renderer=new m(g),this._store=new r(g);p(this)}return y.prototype={addData:function(){return this._store.addData.apply(this._store,arguments),this},removeData:function(){return this._store.removeData&&this._store.removeData.apply(this._store,arguments),this},setData:function(){return this._store.setData.apply(this._store,arguments),this},setDataMax:function(){return this._store.setDataMax.apply(this._store,arguments),this},setDataMin:function(){return this._store.setDataMin.apply(this._store,arguments),this},configure:function(g){return this._config=o.merge(this._config,g),this._renderer.updateConfig(this._config),this._coordinator.emit("renderall",this._store._getInternalData()),this},repaint:function(){return this._coordinator.emit("renderall",this._store._getInternalData()),this},getData:function(){return this._store.getData()},getDataURL:function(){return this._renderer.getDataURL()},getValueAt:function(g){return this._store.getValueAt?this._store.getValueAt(g):this._renderer.getValueAt?this._renderer.getValueAt(g):null}},y}(),c={create:function(d){return new l(d)},register:function(d,a){i.plugins[d]=a}};return c})}(heatmap$1)),heatmap$1.exports}requireHeatmap();const G=class G extends EventEmitter{constructor(){super();z(this,"popupMap",new Map)}static getInstance(){return G.instance||(G.instance=new G),G.instance}popup(r){var c;const u=r.element;u.style.position="absolute";const m=r.viewer.container,o=()=>{l&&(l.destroy(),m.removeChild(u),this.popupMap.delete(r.id),this.emit("onUnmount",r.id))};m.appendChild(u),this.emit("onMount",r.id),(c=this.popupMap.get(r.id))==null||c.destroy();const l=new Popup(r.viewer,{position:r.position,offset:r.offset??[0,0],element:u});this.popupMap.set(r.id,{popup:l,destroy:o})}close(r){const u=this.popupMap.get(r);u&&(u.destroy(),this.popupMap.delete(r),this.emit("onUnmount",r))}closeAll(){this.popupMap.forEach(r=>r.destroy()),this.popupMap.clear()}};z(G,"instance",null);let PopupCtrl=G;function saveCameraParams(s){const i=s.camera;return{position:i.position,direction:i.direction,up:i.up,right:i.right,transform:i.transform}}function flyToCameraParams(s,i,r=1){s.camera.flyTo({destination:i.position,orientation:{direction:i.direction,up:i.up,right:i.right},duration:r})}const memoizeMap=new WeakMap;function ListenLeftClick(s){if(memoizeMap.has(s))return memoizeMap.get(s);const i=new EventEmitter;return new Cesium__namespace.ScreenSpaceEventHandler(s.scene.canvas).setInputAction(u=>{i.emit("click",u)},Cesium__namespace.ScreenSpaceEventType.LEFT_CLICK),memoizeMap.set(s,i),i}exports.ListenLeftClick=ListenLeftClick;exports.PopupCtrl=PopupCtrl;exports.ShipLayer=ShipLayer;exports.WmsLayer=WmsLayer;exports.WmsLayerController=WmsLayerController;exports.createTdtProvider=createTdtProvider;exports.createTdtTerrain=createTdtTerrain;exports.flyToCameraParams=flyToCameraParams;exports.saveCameraParams=saveCameraParams;
|
|
77
|
+
</svg>`;return{url:URL.createObjectURL(new Blob([b],{type:"image/svg+xml"})),viewBox:h,scale:v}},s=>`${s.color},${s.isMoving},${s.designBeam??0},${s.designLength??0},${s.aisFromBow??0},${s.aisFromCenter??0}`),shipTypeColorMap=new Map([[-1,"#00FF00"],[70,"#95B3D7"],[37,"#00FF00"],[50,"#366092"],[51,"#366092"],[52,"#366092"],[53,"#366092"],[54,"#366092"],[55,"#366092"],[56,"#366092"],[57,"#366092"],[58,"#366092"],[59,"#366092"],[80,"red"],[81,"red"],[82,"red"],[83,"red"],[84,"red"],[85,"red"],[86,"red"],[87,"red"],[88,"red"],[89,"red"]]);function createAlphaSampled(s){const i=new Cesium__namespace.SampledProperty(Cesium__namespace.Color),r=(s==null?void 0:s.startTime)??Cesium__namespace.JulianDate.now(),u=Cesium__namespace.JulianDate.addMinutes(r,1,new Cesium__namespace.JulianDate),m=Cesium__namespace.JulianDate.addMinutes(r,5,new Cesium__namespace.JulianDate),o=Cesium__namespace.JulianDate.fromIso8601("2100-01-01T00:00:00Z"),l=(s==null?void 0:s.color)??Cesium__namespace.Color.WHITE;return i.addSample(r,l.withAlpha(1)),i.addSample(u,l.withAlpha(1)),i.addSample(m,l.withAlpha(.2)),i.addSample(o,l.withAlpha(.1)),i}function getHideAfterFiveMinutesProperty(s){const i=s??Cesium__namespace.JulianDate.now(),r=Cesium__namespace.JulianDate.addMinutes(i,5,new Cesium__namespace.JulianDate);return new Cesium__namespace.CallbackProperty(u=>u?Cesium__namespace.JulianDate.lessThan(u,r):!0,!1)}class ShipLayer{constructor(i,r){z(this,"db");z(this,"isMounted",!1);z(this,"_viewer",null);z(this,"entityMap",new Map);z(this,"IS_MOVING_THRESHOLD",1);z(this,"shadowEntityMap",new WeakMap);this.key=i,this.zIndex=r,this.db=new Cesium__namespace.CustomDataSource(i)}show(i){this.isMounted||(i.dataSources.add(this.db),this._viewer=i,this.isMounted=!0),this.db.show=!0}hide(){this.isMounted&&(this.db.show=!1)}render(i){i.features.forEach(r=>{this.renderFeature(r)})}renderFeature(i){var c,d;const r=String(i.id),u=new Cesium__namespace.SampledPositionProperty;u.backwardExtrapolationType=Cesium__namespace.ExtrapolationType.HOLD,u.forwardExtrapolationType=Cesium__namespace.ExtrapolationType.HOLD;const m=Cesium__namespace.Cartesian3.fromDegrees(i.geometry.coordinates[0],i.geometry.coordinates[1]);u.addSample(((c=this._viewer)==null?void 0:c.clock.currentTime)??Cesium__namespace.JulianDate.now(),m);const o=((d=i.properties)==null?void 0:d.courseOverGroundTrue)??0,l=new Cesium__namespace.Entity({id:r,position:u,orientation:new Cesium__namespace.ConstantProperty(Cesium__namespace.Transforms.headingPitchRollQuaternion(m,new Cesium__namespace.HeadingPitchRoll(o,0,0))),properties:i.properties??{}});this.entityMap.set(r,l),this.db.entities.add(l),this.renderEntity(l)}update(i){var u,m,o,l,c,d,a,p;const r=this.db.entities.getById(String(i.id));if(r){const y=this.shadowEntityMap.get(r),g=((u=i.properties)==null?void 0:u.shipTypeId)??-1,h=shipTypeColorMap.get(g)??shipTypeColorMap.get(-1),[v,b]=i.geometry.coordinates,w=((m=this._viewer)==null?void 0:m.clock.currentTime)??Cesium__namespace.JulianDate.now(),T=(o=r.position)==null?void 0:o.getValue(w),_=Cesium__namespace.JulianDate.addSeconds(w,3,new Cesium__namespace.JulianDate),x=Cesium__namespace.Cartesian3.fromDegrees(v,b),O=new Cesium__namespace.SampledPositionProperty;if(O.backwardExtrapolationType=Cesium__namespace.ExtrapolationType.HOLD,O.forwardExtrapolationType=Cesium__namespace.ExtrapolationType.HOLD,O instanceof Cesium__namespace.SampledPositionProperty&&(O.addSample(Cesium__namespace.JulianDate.addSeconds(w,1,new Cesium__namespace.JulianDate),T??x),O.addSample(_,x)),r.position=O,y&&(y.position=O),r.properties)for(const[R,E]of Object.entries(i.properties??{})){if(R=="speedOverGround"){const C=r.properties.getValue().speedOverGround??0,N=Number(C)>this.IS_MOVING_THRESHOLD,A=Number(E)>this.IS_MOVING_THRESHOLD;if(N!==A&&(r.billboard&&(r.billboard.image=new Cesium__namespace.ConstantProperty(createShipIconUrl(h,A))),y!=null&&y.plane)){const D=((l=i.properties)==null?void 0:l.designBeam)??8,P=((c=i.properties)==null?void 0:c.designLength)??20,M=createShipIconV2({color:h,isMoving:A,...i.properties,designBeam:D,designLength:P}),q=(d=y.plane)==null?void 0:d.material;q&&(q.image=new Cesium__namespace.ConstantProperty(M.url),y.plane.dimensions=new Cesium__namespace.ConstantProperty(new Cesium__namespace.Cartesian2(D*M.scale.x,P*M.scale.y))),y.plane.dimensions=new Cesium__namespace.CallbackProperty(()=>new Cesium__namespace.Cartesian2(D*M.scale.x,P*M.scale.y),!0)}}if(R=="courseOverGroundTrue"){const C=((a=i.properties)==null?void 0:a.courseOverGroundTrue)??0;r.billboard.rotation=new Cesium__namespace.ConstantProperty(typeof E=="number"?-1*E:0);const N=new Cesium__namespace.ConstantProperty(Cesium__namespace.Transforms.headingPitchRollQuaternion(x,new Cesium__namespace.HeadingPitchRoll(C,0,0)));y&&(y.orientation=N)}if(R=="updateTime"){const C=Cesium__namespace.JulianDate.fromDate(new Date(E));r.billboard.color=createAlphaSampled({startTime:C});const N=(p=y==null?void 0:y.plane)==null?void 0:p.material;N&&(N.color=createAlphaSampled({startTime:C}));const A=getHideAfterFiveMinutesProperty(C);r.label.show=A,r.point.show=A}r.properties[R]=E,y!=null&&y.properties&&(y.properties[R]=E)}}else this.renderFeature(i)}renderEntity(i){var a,p,y,g,h,v,b;const r=(a=i.properties)==null?void 0:a.getValue(),u=(r==null?void 0:r.shipTypeId)??-1,m=shipTypeColorMap.get(u)??shipTypeColorMap.get(-1),o=Number((r==null?void 0:r.speedOverGround)??0),l=r!=null&&r.updateTime?new Date(r.updateTime):new Date,c=Cesium__namespace.JulianDate.fromDate(l),d=createShipIconUrl(m,o>this.IS_MOVING_THRESHOLD);i.point=new Cesium__namespace.PointGraphics({pixelSize:4,color:Cesium__namespace.Color.fromCssColorString("#8AF22C"),disableDepthTestDistance:3e6,distanceDisplayCondition:new Cesium__namespace.DistanceDisplayCondition(15e3),show:getHideAfterFiveMinutesProperty(c)}),i.billboard=new Cesium__namespace.BillboardGraphics({image:d,width:14,height:70,disableDepthTestDistance:3e6,distanceDisplayCondition:new Cesium__namespace.DistanceDisplayCondition(4e3,15e3),pixelOffset:new Cesium__namespace.Cartesian2(0,0),alignedAxis:Cesium__namespace.Cartesian3.UNIT_Z,color:createAlphaSampled({startTime:c}),rotation:new Cesium__namespace.ConstantProperty((y=(p=i.properties)==null?void 0:p.getValue())!=null&&y.courseOverGroundTrue?-1*i.properties.getValue().courseOverGroundTrue:0)}),i.label=new Cesium__namespace.LabelGraphics({font:'12px normal "微软雅黑"',backgroundColor:Cesium__namespace.Color.fromCssColorString("#E9F4FC"),fillColor:Cesium__namespace.Color.BLACK,outlineColor:Cesium__namespace.Color.BLACK,outlineWidth:2,showBackground:!0,style:Cesium__namespace.LabelStyle.FILL,pixelOffset:new Cesium__namespace.Cartesian2(0,-20),scale:1,scaleByDistance:new Cesium__namespace.NearFarScalar(3e3,1,1e4,.55),text:((h=(g=i.properties)==null?void 0:g.getValue())==null?void 0:h.name)??((v=i.properties)!=null&&v.getValue().mmsi?"mmsi:"+((b=i.properties)==null?void 0:b.getValue().mmsi):"未知"),horizontalOrigin:Cesium__namespace.HorizontalOrigin.CENTER,distanceDisplayCondition:new Cesium__namespace.DistanceDisplayCondition(0,15e3),disableDepthTestDistance:5e3,show:getHideAfterFiveMinutesProperty(c)}),this.createShipPlane(i)}createShipPlane(i){var g;const r=new Cesium__namespace.Entity({id:i.id+"_shadow",position:i.position,orientation:i.orientation,properties:i.properties});this.shadowEntityMap.set(i,r),this.db.entities.add(r);const u=(g=i.properties)==null?void 0:g.getValue(),m=u!=null&&u.updateTime?new Date(u.updateTime):new Date,o=Cesium__namespace.JulianDate.fromDate(m),l=Number((u==null?void 0:u.speedOverGround)??0),c=(u==null?void 0:u.designLength)??20,d=(u==null?void 0:u.designBeam)??8,a=(u==null?void 0:u.shipTypeId)??-1,p=shipTypeColorMap.get(a)??shipTypeColorMap.get(-1),y=createShipIconV2({color:p,isMoving:l>this.IS_MOVING_THRESHOLD,...u,designBeam:(u==null?void 0:u.designBeam)??8,designLength:(u==null?void 0:u.designLength)??20});r.plane=new Cesium__namespace.PlaneGraphics({plane:new Cesium__namespace.Plane(Cesium__namespace.Cartesian3.UNIT_Z,0),dimensions:new Cesium__namespace.Cartesian2(d*y.scale.x,c*y.scale.y),show:new Cesium__namespace.CallbackProperty(()=>{var w;if(!this._viewer)return!0;const h=this._viewer.clock.currentTime,v=(w=i.position)==null?void 0:w.getValue(h);return v?Cesium__namespace.Cartesian3.distance(this._viewer.camera.positionWC,v)<=4e3:!1},!1),material:new Cesium__namespace.ImageMaterialProperty({image:y.url,transparent:!0,repeat:new Cesium__namespace.Cartesian2(1,1),color:createAlphaSampled({startTime:o})})})}}Cesium.Color.fromCssColorString("#FC4C02");Cesium.Color.WHITE;new Cesium.Color;new Array(4);var e$2=[],t$2=[];function n$2(s,i){if(s&&typeof document<"u"){var r,u=i.prepend===!0?"prepend":"append",m=i.singleTag===!0,o=typeof i.container=="string"?document.querySelector(i.container):document.getElementsByTagName("head")[0];if(m){var l=e$2.indexOf(o);l===-1&&(l=e$2.push(o)-1,t$2[l]={}),r=t$2[l]&&t$2[l][u]?t$2[l][u]:t$2[l][u]=c()}else r=c();s.charCodeAt(0)===65279&&(s=s.substring(1)),r.styleSheet?r.styleSheet.cssText+=s:r.appendChild(document.createTextNode(s))}function c(){var d=document.createElement("style");if(d.setAttribute("type","text/css"),i.attributes)for(var a=Object.keys(i.attributes),p=0;p<a.length;p++)d.setAttribute(a[p],i.attributes[a[p]]);var y=u==="prepend"?"afterbegin":"beforeend";return o.insertAdjacentElement(y,d),d}}var css$2='.cesium-tool-tip{background:rgba(0,0,0,.6);border-radius:4px;color:#fff;left:0;line-height:30px;min-height:30px;min-width:100px;padding:0 10px;pointer-events:none;position:absolute;top:0;visibility:hidden;z-index:-1}.cesium-tool-tip:before{border-bottom:10px solid transparent;border-right:10px solid rgba(0,0,0,.6);border-top:10px solid transparent;content:"";display:block;left:-10px;pointer-events:none;position:absolute;top:calc(50% - 10px)}';n$2(css$2,{});Cesium.Color.YELLOW,Cesium.Color.YELLOW,Cesium.Color.DARKTURQUOISE.withAlpha(.5),Cesium.Color.BLUE,Cesium.Color.WHITE,Cesium.Color.YELLOW.withAlpha(.5),Cesium.Color.YELLOW.withAlpha(.5);Cesium.Color.WHITE,new Cesium.Color(.165,.165,.165,.8),new Cesium.Cartesian2(4,4),Cesium.LabelStyle.FILL_AND_OUTLINE,new Cesium.Cartesian2(4,0),new Cesium.NearFarScalar(1,.85,8e6,.75),Cesium.HeightReference.CLAMP_TO_GROUND;class Popup{constructor(i,r){z(this,"_position");z(this,"_screenPosition",new Cesium.Cartesian2);z(this,"_element");z(this,"_viewer");z(this,"_options");z(this,"_destroyed",!1);z(this,"_offset");z(this,"setPosition",()=>{if(this._position&&this._viewer&&this._position){if(this._viewer.scene.mode===Cesium.SceneMode.SCENE3D){const u=this._viewer.scene.camera.position,m=new Cesium.BoundingSphere(new Cesium.Cartesian3(0,0,0),635e4);if(!new Cesium.Occluder(m,u).isPointVisible(this._position)){this.switchElementShow(!1);return}}const i=Cesium.SceneTransforms.worldToWindowCoordinates(this._viewer.scene,this._position),{_element:r}=this;if(r&&i){if(this._screenPosition&&this._screenPosition.x===i.x&&this._screenPosition.y===i.y)return;this.switchElementShow(!0);const u=i.x-r.clientWidth/2+this._offset[0],m=i.y-r.clientHeight+this._offset[1];r.style.left=`${u}px`,r.style.top=`${m}px`,this._screenPosition=i}}});this._viewer=i,this._options=r;const{position:u,element:m,offset:o}=r;if(!m)throw Error("no element!");this._position=u?Cesium.Cartesian3.fromDegrees(u[0],u[1],u[2]):null,this._element=m,this._offset=[(o==null?void 0:o[0])??0,(o==null?void 0:o[1])??0],this.addMapListener()}set position(i){if(!i){this.switchElementShow(!1),this._position=null,this._options.position=null;return}this._position=Cesium.Cartesian3.fromDegrees(i[0],i[1],i[2]),this._options.position=i,this.setPosition()}get position(){return this._options.position}get destroyed(){return this._destroyed}switchElementShow(i){this._element&&(this._element.style.display=i?"block":"none")}addMapListener(){var i;(i=this._viewer)==null||i.scene.postRender.addEventListener(this.setPosition)}destroy(){this._viewer.isDestroyed()||this._viewer.scene.postRender.removeEventListener(this.setPosition),this.setPosition=void 0,this._destroyed=!0}}var e$1=[],t$1=[];function n$1(s,i){if(s&&typeof document<"u"){var r,u=i.prepend===!0?"prepend":"append",m=i.singleTag===!0,o=typeof i.container=="string"?document.querySelector(i.container):document.getElementsByTagName("head")[0];if(m){var l=e$1.indexOf(o);l===-1&&(l=e$1.push(o)-1,t$1[l]={}),r=t$1[l]&&t$1[l][u]?t$1[l][u]:t$1[l][u]=c()}else r=c();s.charCodeAt(0)===65279&&(s=s.substring(1)),r.styleSheet?r.styleSheet.cssText+=s:r.appendChild(document.createTextNode(s))}function c(){var d=document.createElement("style");if(d.setAttribute("type","text/css"),i.attributes)for(var a=Object.keys(i.attributes),p=0;p<a.length;p++)d.setAttribute(a[p],i.attributes[a[p]]);var y=u==="prepend"?"afterbegin":"beforeend";return o.insertAdjacentElement(y,d),d}}var css$1=".cesium-compass{cursor:pointer;height:60px;pointer-events:auto;position:absolute;right:15px;top:100px;user-select:none;width:60px}.cesium-compass .out-ring{fill:rgba(23,49,71,.702);background-repeat:no-repeat;background-size:contain;border-radius:50%;height:60px;left:0;position:absolute;top:0;transition:all .3s ease;width:60px}.cesium-compass .out-ring svg{height:60px;width:60px}.cesium-compass:hover .rotation_marker svg{height:70.2px;width:70.2px}.cesium-compass .gyro{align-items:center;background:#fff;border-radius:50%;box-sizing:border-box;display:flex;height:30px;justify-content:center;margin:0 auto;padding:4px;position:relative;text-align:center;top:50%;transform:translateY(-50%);transition:all .3s ease;width:30px}.cesium-compass .gyro svg{height:20px;width:20px}.rotation_marker{background-repeat:no-repeat;background-size:contain;border-radius:50%;position:relative}.rotation_marker svg{height:60px;left:50%;position:absolute;top:50%;transform:translate(-50%,-50%);transition:all .3s ease;width:60px}.cesium-compass .gyro-active,.cesium-compass .gyro:hover{fill:#68adfe}";n$1(css$1,{});var e=[],t=[];function n(s,i){if(s&&typeof document<"u"){var r,u=i.prepend===!0?"prepend":"append",m=i.singleTag===!0,o=typeof i.container=="string"?document.querySelector(i.container):document.getElementsByTagName("head")[0];if(m){var l=e.indexOf(o);l===-1&&(l=e.push(o)-1,t[l]={}),r=t[l]&&t[l][u]?t[l][u]:t[l][u]=c()}else r=c();s.charCodeAt(0)===65279&&(s=s.substring(1)),r.styleSheet?r.styleSheet.cssText+=s:r.appendChild(document.createTextNode(s))}function c(){var d=document.createElement("style");if(d.setAttribute("type","text/css"),i.attributes)for(var a=Object.keys(i.attributes),p=0;p<a.length;p++)d.setAttribute(a[p],i.attributes[a[p]]);var y=u==="prepend"?"afterbegin":"beforeend";return o.insertAdjacentElement(y,d),d}}var css=".cesium-zoom-controller{border-radius:100px;box-sizing:border-box;display:flex;flex-direction:column;line-height:1.2rem;pointer-events:auto;position:absolute;right:30px;text-align:center;top:187px;user-select:none}.cesium-zoom-controller .refresh,.cesium-zoom-controller .zoom-in,.cesium-zoom-controller .zoom-out{border-radius:14%;margin-bottom:5px}.cesium-zoom-controller .cesium-button{background:#2a2e39;border:none;margin-right:0;transition:all .3s cubic-bezier(.645,.045,.355,1);transition-delay:0s;transition-duration:.2s;transition-property:all;transition-timing-function:cubic-bezier(.645,.045,.355,1)}.cesium-zoom-controller .cesium-button:hover{background:#48b;box-shadow:none}.cesium-zoom-controller .cesium-button:active{fill:#edffff;background:#adf;color:#edffff}.cesium-zoom-controller .cesium-toolbar-button{align-items:center;display:flex;height:30px;justify-content:center;width:30px}";n(css,{});var heatmap$1={exports:{}},heatmap=heatmap$1.exports,hasRequiredHeatmap;function requireHeatmap(){return hasRequiredHeatmap||(hasRequiredHeatmap=1,function(s){(function(i,r,u){s.exports?s.exports=u():r[i]=u()})("h337",heatmap,function(){var i={defaultRadius:40,defaultRenderer:"canvas2d",defaultGradient:{.25:"rgb(0,0,255)",.55:"rgb(0,255,0)",.85:"yellow",1:"rgb(255,0,0)"},defaultMaxOpacity:1,defaultMinOpacity:0,defaultBlur:.85,defaultXField:"x",defaultYField:"y",defaultValueField:"value",plugins:{}},r=function(){var a=function(g){this._coordinator={},this._data=[],this._radi=[],this._min=10,this._max=1,this._xField=g.xField||g.defaultXField,this._yField=g.yField||g.defaultYField,this._valueField=g.valueField||g.defaultValueField,g.radius&&(this._cfgRadius=g.radius)},p=i.defaultRadius;return a.prototype={_organiseData:function(y,g){var h=y[this._xField],v=y[this._yField],b=this._radi,w=this._data,T=this._max,_=this._min,x=y[this._valueField]||1,O=y.radius||this._cfgRadius||p;w[h]||(w[h]=[],b[h]=[]),w[h][v]?w[h][v]+=x:(w[h][v]=x,b[h][v]=O);var R=w[h][v];return R>T?(g?this.setDataMax(R):this._max=R,!1):R<_?(g?this.setDataMin(R):this._min=R,!1):{x:h,y:v,value:x,radius:O,min:_,max:T}},_unOrganizeData:function(){var y=[],g=this._data,h=this._radi;for(var v in g)for(var b in g[v])y.push({x:v,y:b,radius:h[v][b],value:g[v][b]});return{min:this._min,max:this._max,data:y}},_onExtremaChange:function(){this._coordinator.emit("extremachange",{min:this._min,max:this._max})},addData:function(){if(arguments[0].length>0)for(var y=arguments[0],g=y.length;g--;)this.addData.call(this,y[g]);else{var h=this._organiseData(arguments[0],!0);h&&(this._data.length===0&&(this._min=this._max=h.value),this._coordinator.emit("renderpartial",{min:this._min,max:this._max,data:[h]}))}return this},setData:function(y){var g=y.data,h=g.length;this._data=[],this._radi=[];for(var v=0;v<h;v++)this._organiseData(g[v],!1);return this._max=y.max,this._min=y.min||0,this._onExtremaChange(),this._coordinator.emit("renderall",this._getInternalData()),this},removeData:function(){},setDataMax:function(y){return this._max=y,this._onExtremaChange(),this._coordinator.emit("renderall",this._getInternalData()),this},setDataMin:function(y){return this._min=y,this._onExtremaChange(),this._coordinator.emit("renderall",this._getInternalData()),this},setCoordinator:function(y){this._coordinator=y},_getInternalData:function(){return{max:this._max,min:this._min,data:this._data,radi:this._radi}},getData:function(){return this._unOrganizeData()}},a}(),u=function(){var a=function(h){var v=h.gradient||h.defaultGradient,b=document.createElement("canvas"),w=b.getContext("2d",{willReadFrequently:!0});b.width=256,b.height=1;var T=w.createLinearGradient(0,0,256,1);for(var _ in v)T.addColorStop(_,v[_]);return w.fillStyle=T,w.fillRect(0,0,256,1),w.getImageData(0,0,256,1).data},p=function(h,v){var b=document.createElement("canvas"),w=b.getContext("2d",{willReadFrequently:!0}),T=h,_=h;if(b.width=b.height=h*2,v==1)w.beginPath(),w.arc(T,_,h,0,2*Math.PI,!1),w.fillStyle="rgba(0,0,0,1)",w.fill();else{var x=w.createRadialGradient(T,_,h*v,T,_,h);x.addColorStop(0,"rgba(0,0,0,1)"),x.addColorStop(1,"rgba(0,0,0,0)"),w.fillStyle=x,w.fillRect(0,0,2*h,2*h)}return b},y=function(_){for(var v=[],b=_.min,w=_.max,T=_.radi,_=_.data,x=Object.keys(_),O=x.length;O--;)for(var R=x[O],E=Object.keys(_[R]),C=E.length;C--;){var N=E[C],A=_[R][N],D=T[R][N];v.push({x:R,y:N,value:A,radius:D})}return{min:b,max:w,data:v}};function g(h){var v=h.container,b=this.shadowCanvas=document.createElement("canvas"),w=this.canvas=h.canvas||document.createElement("canvas");this._renderBoundaries=[1e4,1e4,0,0];var T=getComputedStyle(h.container)||{};w.className="heatmap-canvas",this._width=w.width=b.width=h.width||+T.width.replace(/px/,""),this._height=w.height=b.height=h.height||+T.height.replace(/px/,""),this.shadowCtx=b.getContext("2d",{willReadFrequently:!0}),this.ctx=w.getContext("2d",{willReadFrequently:!0}),w.style.cssText=b.style.cssText="position:absolute;left:0;top:0;",v.style.position="relative",v.appendChild(w),this._palette=a(h),this._templates={},this._setStyles(h)}return g.prototype={renderPartial:function(h){h.data.length>0&&(this._drawAlpha(h),this._colorize())},renderAll:function(h){this._clear(),h.data.length>0&&(this._drawAlpha(y(h)),this._colorize())},_updateGradient:function(h){this._palette=a(h)},updateConfig:function(h){h.gradient&&this._updateGradient(h),this._setStyles(h)},setDimensions:function(h,v){this._width=h,this._height=v,this.canvas.width=this.shadowCanvas.width=h,this.canvas.height=this.shadowCanvas.height=v},_clear:function(){this.shadowCtx.clearRect(0,0,this._width,this._height),this.ctx.clearRect(0,0,this._width,this._height)},_setStyles:function(h){this._blur=h.blur==0?0:h.blur||h.defaultBlur,h.backgroundColor&&(this.canvas.style.backgroundColor=h.backgroundColor),this._width=this.canvas.width=this.shadowCanvas.width=h.width||this._width,this._height=this.canvas.height=this.shadowCanvas.height=h.height||this._height,this._opacity=(h.opacity||0)*255,this._maxOpacity=(h.maxOpacity||h.defaultMaxOpacity)*255,this._minOpacity=(h.minOpacity||h.defaultMinOpacity)*255,this._useGradientOpacity=!!h.useGradientOpacity},_drawAlpha:function(w){for(var v=this._min=w.min,b=this._max=w.max,w=w.data||[],T=w.length,_=1-this._blur;T--;){var x=w[T],O=x.x,R=x.y,E=x.radius,C=Math.min(x.value,b),N=O-E,A=R-E,D=this.shadowCtx,P;this._templates[E]?P=this._templates[E]:this._templates[E]=P=p(E,_);var M=(C-v)/(b-v);D.globalAlpha=M<.01?.01:M,D.drawImage(P,N,A),N<this._renderBoundaries[0]&&(this._renderBoundaries[0]=N),A<this._renderBoundaries[1]&&(this._renderBoundaries[1]=A),N+2*E>this._renderBoundaries[2]&&(this._renderBoundaries[2]=N+2*E),A+2*E>this._renderBoundaries[3]&&(this._renderBoundaries[3]=A+2*E)}},_colorize:function(){var h=this._renderBoundaries[0],v=this._renderBoundaries[1],b=this._renderBoundaries[2]-h,w=this._renderBoundaries[3]-v,T=this._width,_=this._height,x=this._opacity,O=this._maxOpacity,R=this._minOpacity,E=this._useGradientOpacity;h<0&&(h=0),v<0&&(v=0),h+b>T&&(b=T-h),v+w>_&&(w=_-v);for(var C=this.shadowCtx.getImageData(h,v,b,w),N=C.data,A=N.length,D=this._palette,P=3;P<A;P+=4){var M=N[P],q=M*4;if(q){var F;x>0?F=x:M<O?M<R?F=R:F=M:F=O,N[P-3]=D[q],N[P-2]=D[q+1],N[P-1]=D[q+2],N[P]=E?D[q+3]:F}}this.ctx.putImageData(C,h,v),this._renderBoundaries=[1e3,1e3,0,0]},getValueAt:function(h){var v,b=this.shadowCtx,w=b.getImageData(h.x,h.y,1,1),T=w.data[3],_=this._max,x=this._min;return v=Math.abs(_-x)*(T/255)>>0,v},getDataURL:function(){return this.canvas.toDataURL()}},g}(),m=function(){var a=!1;return i.defaultRenderer==="canvas2d"&&(a=u),a}(),o={merge:function(){for(var d={},a=arguments.length,p=0;p<a;p++){var y=arguments[p];for(var g in y)d[g]=y[g]}return d}},l=function(){var a=function(){function h(){this.cStore={}}return h.prototype={on:function(v,b,w){var T=this.cStore;T[v]||(T[v]=[]),T[v].push(function(_){return b.call(w,_)})},emit:function(v,b){var w=this.cStore;if(w[v])for(var T=w[v].length,_=0;_<T;_++){var x=w[v][_];x(b)}}},h}(),p=function(g){var h=g._renderer,v=g._coordinator,b=g._store;v.on("renderpartial",h.renderPartial,h),v.on("renderall",h.renderAll,h),v.on("extremachange",function(w){g._config.onExtremaChange&&g._config.onExtremaChange({min:w.min,max:w.max,gradient:g._config.gradient||g._config.defaultGradient})}),b.setCoordinator(v)};function y(){var g=this._config=o.merge(i,arguments[0]||{});if(this._coordinator=new a,g.plugin){var h=g.plugin;if(i.plugins[h]){var v=i.plugins[h];this._renderer=new v.renderer(g),this._store=new v.store(g)}else throw new Error("Plugin '"+h+"' not found. Maybe it was not registered.")}else this._renderer=new m(g),this._store=new r(g);p(this)}return y.prototype={addData:function(){return this._store.addData.apply(this._store,arguments),this},removeData:function(){return this._store.removeData&&this._store.removeData.apply(this._store,arguments),this},setData:function(){return this._store.setData.apply(this._store,arguments),this},setDataMax:function(){return this._store.setDataMax.apply(this._store,arguments),this},setDataMin:function(){return this._store.setDataMin.apply(this._store,arguments),this},configure:function(g){return this._config=o.merge(this._config,g),this._renderer.updateConfig(this._config),this._coordinator.emit("renderall",this._store._getInternalData()),this},repaint:function(){return this._coordinator.emit("renderall",this._store._getInternalData()),this},getData:function(){return this._store.getData()},getDataURL:function(){return this._renderer.getDataURL()},getValueAt:function(g){return this._store.getValueAt?this._store.getValueAt(g):this._renderer.getValueAt?this._renderer.getValueAt(g):null}},y}(),c={create:function(d){return new l(d)},register:function(d,a){i.plugins[d]=a}};return c})}(heatmap$1)),heatmap$1.exports}requireHeatmap();const G=class G extends EventEmitter{constructor(){super();z(this,"popupMap",new Map)}static getInstance(){return G.instance||(G.instance=new G),G.instance}popup(r){var c;const u=r.element;u.style.position="absolute";const m=r.viewer.container,o=()=>{l&&(l.destroy(),m.removeChild(u),this.popupMap.delete(r.id),this.emit("onUnmount",r.id))};m.appendChild(u),this.emit("onMount",r.id),(c=this.popupMap.get(r.id))==null||c.destroy();const l=new Popup(r.viewer,{position:r.position,offset:r.offset??[0,0],element:u});this.popupMap.set(r.id,{popup:l,destroy:o})}close(r){const u=this.popupMap.get(r);u&&(u.destroy(),this.popupMap.delete(r),this.emit("onUnmount",r))}closeAll(){this.popupMap.forEach(r=>r.destroy()),this.popupMap.clear()}};z(G,"instance",null);let PopupCtrl=G;function saveCameraParams(s){const i=s.camera;return{position:i.position,direction:i.direction,up:i.up,right:i.right,transform:i.transform}}function flyToCameraParams(s,i,r=1){s.camera.flyTo({destination:i.position,orientation:{direction:i.direction,up:i.up,right:i.right},duration:r})}const memoizeMap=new WeakMap;function ListenLeftClick(s){if(memoizeMap.has(s))return memoizeMap.get(s);const i=new EventEmitter;return new Cesium__namespace.ScreenSpaceEventHandler(s.scene.canvas).setInputAction(u=>{i.emit("click",u)},Cesium__namespace.ScreenSpaceEventType.LEFT_CLICK),memoizeMap.set(s,i),i}exports.ListenLeftClick=ListenLeftClick;exports.PopupCtrl=PopupCtrl;exports.ShipLayer=ShipLayer;exports.WmsLayer=WmsLayer;exports.WmsLayerController=WmsLayerController;exports.createTdtProvider=createTdtProvider;exports.createTdtTerrain=createTdtTerrain;exports.flyToCameraParams=flyToCameraParams;exports.saveCameraParams=saveCameraParams;
|
package/dist/cesium-utils.js
CHANGED
|
@@ -5781,7 +5781,7 @@ class ShipLayer {
|
|
|
5781
5781
|
const C = getHideAfterFiveMinutesProperty(S);
|
|
5782
5782
|
r.label.show = C, r.point.show = C;
|
|
5783
5783
|
}
|
|
5784
|
-
r.properties[R] = E;
|
|
5784
|
+
r.properties[R] = E, y != null && y.properties && (y.properties[R] = E);
|
|
5785
5785
|
}
|
|
5786
5786
|
} else
|
|
5787
5787
|
this.renderFeature(i);
|
|
@@ -5834,7 +5834,8 @@ class ShipLayer {
|
|
|
5834
5834
|
const r = new Cesium.Entity({
|
|
5835
5835
|
id: i.id + "_shadow",
|
|
5836
5836
|
position: i.position,
|
|
5837
|
-
orientation: i.orientation
|
|
5837
|
+
orientation: i.orientation,
|
|
5838
|
+
properties: i.properties
|
|
5838
5839
|
});
|
|
5839
5840
|
this.shadowEntityMap.set(i, r), this.db.entities.add(r);
|
|
5840
5841
|
const u = (g = i.properties) == null ? void 0 : g.getValue(), m = u != null && u.updateTime ? new Date(u.updateTime) : /* @__PURE__ */ new Date(), o = Cesium.JulianDate.fromDate(m), l = Number((u == null ? void 0 : u.speedOverGround) ?? 0), c = (u == null ? void 0 : u.designLength) ?? 20, d = (u == null ? void 0 : u.designBeam) ?? 8, a = (u == null ? void 0 : u.shipTypeId) ?? -1, p = shipTypeColorMap.get(a) ?? shipTypeColorMap.get(-1), y = createShipIconV2({
|
|
@@ -74,4 +74,4 @@
|
|
|
74
74
|
<path id="svg_4" data-name="svg 4" class="cls-1" d="${p}"/>
|
|
75
75
|
</g>
|
|
76
76
|
<image id="img_1" width="${i}" height="${146/124*i}" transform="translate(${-i/2+u.x} ${u.y})" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHwAAACSCAMAAACwjl5+AAAAq1BMVEUAAAD////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////Nr6iZAAAAOXRSTlMABRshFgkSZg5qJmFdWlEqOXBFPYVJQYB1VXtNLpc1mzKguZCKtJONxc69yaukwa/SqN/k1trs6fBhRQqRAAAVcElEQVR42rSX3ZKaQBCFgxoIICh/ggjiIMPPMAOy6yZ5/yfLaTBVSa5istu1Vepe+M3p7jkHPz1Vmqav99umYLxsh7bvO6oeb8ZR1XUS7TaftU8fVdqX9cWpGBt5WeJvKbwbOJvyujEPlv5RcLBXZyesc1lyMSk5qWmS0zQxNQrGVF2Fpv9hdOg+2HFzZZwPQjFWFAxV4FUNJd5VcWr4u4+hgx0YcVgVchRtOSmW50wpVoA+lS0vWB6mifkxdE2H7jSOazaVfYtJo91yHKVSUmLq/Yihp2Zi09a9N1rb7Hxi07oN/dAOgnMwB4F9E3jtW1Y1oWea2yhbve/Oa583WWR4SRLnGHAPVkd3bblpA70XvcjDKjVs24ku70rX9NU5OgIeV9ect0L03a3rbve3l5e3+6273Vp0opVVmnrG1jkFl9UX7R3HfY5c2zCTOLxKNHzobzdCv3779voK/ls3tOi+ihPPcI5uFGRrXdPeZ8t16+y7zpbgVcHFWLb9fUZ/RX0D/e2txew5zxPTcNzIP+xBR+vfgb2x9oeTe3Rs04sLXuKmDWg5sb+jFnqH9ZejrL3t1o0Oh+CcrWG1/4v//GW1OwfR6XRybC+5SrB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rsPE2a4XD+FjcLXchdE3sv75lug50pZnaf2rPbBfIvwA2jcoh9iZ//PGjxKPu4HHe3yc7cWfPU9+9hlRfZpSZyIH4gkGGezDecu9kGsSt+eGeoScy4R+Ry93v+oWfNozrDEIaiHXRD7DXkDONmzdY7oGbuAxPH/wEwphW49aD/MlAP40uv1I7bCf2a+KP+wF2p1f3pdBHHJfycnf43/AJwK37vPZnSygAAAABJRU5ErkJggg=="/>
|
|
77
|
-
</svg>`;return{url:URL.createObjectURL(new Blob([b],{type:"image/svg+xml"})),viewBox:h,scale:v}},s=>`${s.color},${s.isMoving},${s.designBeam??0},${s.designLength??0},${s.aisFromBow??0},${s.aisFromCenter??0}`),shipTypeColorMap=new Map([[-1,"#00FF00"],[70,"#95B3D7"],[37,"#00FF00"],[50,"#366092"],[51,"#366092"],[52,"#366092"],[53,"#366092"],[54,"#366092"],[55,"#366092"],[56,"#366092"],[57,"#366092"],[58,"#366092"],[59,"#366092"],[80,"red"],[81,"red"],[82,"red"],[83,"red"],[84,"red"],[85,"red"],[86,"red"],[87,"red"],[88,"red"],[89,"red"]]);function createAlphaSampled(s){const i=new Cesium__namespace.SampledProperty(Cesium__namespace.Color),r=(s==null?void 0:s.startTime)??Cesium__namespace.JulianDate.now(),u=Cesium__namespace.JulianDate.addMinutes(r,1,new Cesium__namespace.JulianDate),m=Cesium__namespace.JulianDate.addMinutes(r,5,new Cesium__namespace.JulianDate),o=Cesium__namespace.JulianDate.fromIso8601("2100-01-01T00:00:00Z"),l=(s==null?void 0:s.color)??Cesium__namespace.Color.WHITE;return i.addSample(r,l.withAlpha(1)),i.addSample(u,l.withAlpha(1)),i.addSample(m,l.withAlpha(.2)),i.addSample(o,l.withAlpha(.1)),i}function getHideAfterFiveMinutesProperty(s){const i=s??Cesium__namespace.JulianDate.now(),r=Cesium__namespace.JulianDate.addMinutes(i,5,new Cesium__namespace.JulianDate);return new Cesium__namespace.CallbackProperty(u=>u?Cesium__namespace.JulianDate.lessThan(u,r):!0,!1)}class ShipLayer{constructor(i,r){z(this,"db");z(this,"isMounted",!1);z(this,"_viewer",null);z(this,"entityMap",new Map);z(this,"IS_MOVING_THRESHOLD",1);z(this,"shadowEntityMap",new WeakMap);this.key=i,this.zIndex=r,this.db=new Cesium__namespace.CustomDataSource(i)}show(i){this.isMounted||(i.dataSources.add(this.db),this._viewer=i,this.isMounted=!0),this.db.show=!0}hide(){this.isMounted&&(this.db.show=!1)}render(i){i.features.forEach(r=>{this.renderFeature(r)})}renderFeature(i){var c,d;const r=String(i.id),u=new Cesium__namespace.SampledPositionProperty;u.backwardExtrapolationType=Cesium__namespace.ExtrapolationType.HOLD,u.forwardExtrapolationType=Cesium__namespace.ExtrapolationType.HOLD;const m=Cesium__namespace.Cartesian3.fromDegrees(i.geometry.coordinates[0],i.geometry.coordinates[1]);u.addSample(((c=this._viewer)==null?void 0:c.clock.currentTime)??Cesium__namespace.JulianDate.now(),m);const o=((d=i.properties)==null?void 0:d.courseOverGroundTrue)??0,l=new Cesium__namespace.Entity({id:r,position:u,orientation:new Cesium__namespace.ConstantProperty(Cesium__namespace.Transforms.headingPitchRollQuaternion(m,new Cesium__namespace.HeadingPitchRoll(o,0,0))),properties:i.properties??{}});this.entityMap.set(r,l),this.db.entities.add(l),this.renderEntity(l)}update(i){var u,m,o,l,c,d,a,p;const r=this.db.entities.getById(String(i.id));if(r){const y=this.shadowEntityMap.get(r),g=((u=i.properties)==null?void 0:u.shipTypeId)??-1,h=shipTypeColorMap.get(g)??shipTypeColorMap.get(-1),[v,b]=i.geometry.coordinates,w=((m=this._viewer)==null?void 0:m.clock.currentTime)??Cesium__namespace.JulianDate.now(),T=(o=r.position)==null?void 0:o.getValue(w),_=Cesium__namespace.JulianDate.addSeconds(w,3,new Cesium__namespace.JulianDate),O=Cesium__namespace.Cartesian3.fromDegrees(v,b),x=new Cesium__namespace.SampledPositionProperty;if(x.backwardExtrapolationType=Cesium__namespace.ExtrapolationType.HOLD,x.forwardExtrapolationType=Cesium__namespace.ExtrapolationType.HOLD,x instanceof Cesium__namespace.SampledPositionProperty&&(x.addSample(Cesium__namespace.JulianDate.addSeconds(w,1,new Cesium__namespace.JulianDate),T??O),x.addSample(_,O)),r.position=x,y&&(y.position=x),r.properties)for(const[R,E]of Object.entries(i.properties??{})){if(R=="speedOverGround"){const C=r.properties.getValue().speedOverGround??0,N=Number(C)>this.IS_MOVING_THRESHOLD,A=Number(E)>this.IS_MOVING_THRESHOLD;if(N!==A&&(r.billboard&&(r.billboard.image=new Cesium__namespace.ConstantProperty(createShipIconUrl(h,A))),y!=null&&y.plane)){const D=((l=i.properties)==null?void 0:l.designBeam)??8,P=((c=i.properties)==null?void 0:c.designLength)??20,M=createShipIconV2({color:h,isMoving:A,...i.properties,designBeam:D,designLength:P}),q=(d=y.plane)==null?void 0:d.material;q&&(q.image=new Cesium__namespace.ConstantProperty(M.url),y.plane.dimensions=new Cesium__namespace.ConstantProperty(new Cesium__namespace.Cartesian2(D*M.scale.x,P*M.scale.y))),y.plane.dimensions=new Cesium__namespace.CallbackProperty(()=>new Cesium__namespace.Cartesian2(D*M.scale.x,P*M.scale.y),!0)}}if(R=="courseOverGroundTrue"){const C=((a=i.properties)==null?void 0:a.courseOverGroundTrue)??0;r.billboard.rotation=new Cesium__namespace.ConstantProperty(typeof E=="number"?-1*E:0);const N=new Cesium__namespace.ConstantProperty(Cesium__namespace.Transforms.headingPitchRollQuaternion(O,new Cesium__namespace.HeadingPitchRoll(C,0,0)));y&&(y.orientation=N)}if(R=="updateTime"){const C=Cesium__namespace.JulianDate.fromDate(new Date(E));r.billboard.color=createAlphaSampled({startTime:C});const N=(p=y==null?void 0:y.plane)==null?void 0:p.material;N&&(N.color=createAlphaSampled({startTime:C}));const A=getHideAfterFiveMinutesProperty(C);r.label.show=A,r.point.show=A}r.properties[R]=E}}else this.renderFeature(i)}renderEntity(i){var a,p,y,g,h,v,b;const r=(a=i.properties)==null?void 0:a.getValue(),u=(r==null?void 0:r.shipTypeId)??-1,m=shipTypeColorMap.get(u)??shipTypeColorMap.get(-1),o=Number((r==null?void 0:r.speedOverGround)??0),l=r!=null&&r.updateTime?new Date(r.updateTime):new Date,c=Cesium__namespace.JulianDate.fromDate(l),d=createShipIconUrl(m,o>this.IS_MOVING_THRESHOLD);i.point=new Cesium__namespace.PointGraphics({pixelSize:4,color:Cesium__namespace.Color.fromCssColorString("#8AF22C"),disableDepthTestDistance:3e6,distanceDisplayCondition:new Cesium__namespace.DistanceDisplayCondition(15e3),show:getHideAfterFiveMinutesProperty(c)}),i.billboard=new Cesium__namespace.BillboardGraphics({image:d,width:14,height:70,disableDepthTestDistance:3e6,distanceDisplayCondition:new Cesium__namespace.DistanceDisplayCondition(4e3,15e3),pixelOffset:new Cesium__namespace.Cartesian2(0,0),alignedAxis:Cesium__namespace.Cartesian3.UNIT_Z,color:createAlphaSampled({startTime:c}),rotation:new Cesium__namespace.ConstantProperty((y=(p=i.properties)==null?void 0:p.getValue())!=null&&y.courseOverGroundTrue?-1*i.properties.getValue().courseOverGroundTrue:0)}),i.label=new Cesium__namespace.LabelGraphics({font:'12px normal "微软雅黑"',backgroundColor:Cesium__namespace.Color.fromCssColorString("#E9F4FC"),fillColor:Cesium__namespace.Color.BLACK,outlineColor:Cesium__namespace.Color.BLACK,outlineWidth:2,showBackground:!0,style:Cesium__namespace.LabelStyle.FILL,pixelOffset:new Cesium__namespace.Cartesian2(0,-20),scale:1,scaleByDistance:new Cesium__namespace.NearFarScalar(3e3,1,1e4,.55),text:((h=(g=i.properties)==null?void 0:g.getValue())==null?void 0:h.name)??((v=i.properties)!=null&&v.getValue().mmsi?"mmsi:"+((b=i.properties)==null?void 0:b.getValue().mmsi):"未知"),horizontalOrigin:Cesium__namespace.HorizontalOrigin.CENTER,distanceDisplayCondition:new Cesium__namespace.DistanceDisplayCondition(0,15e3),disableDepthTestDistance:5e3,show:getHideAfterFiveMinutesProperty(c)}),this.createShipPlane(i)}createShipPlane(i){var g;const r=new Cesium__namespace.Entity({id:i.id+"_shadow",position:i.position,orientation:i.orientation});this.shadowEntityMap.set(i,r),this.db.entities.add(r);const u=(g=i.properties)==null?void 0:g.getValue(),m=u!=null&&u.updateTime?new Date(u.updateTime):new Date,o=Cesium__namespace.JulianDate.fromDate(m),l=Number((u==null?void 0:u.speedOverGround)??0),c=(u==null?void 0:u.designLength)??20,d=(u==null?void 0:u.designBeam)??8,a=(u==null?void 0:u.shipTypeId)??-1,p=shipTypeColorMap.get(a)??shipTypeColorMap.get(-1),y=createShipIconV2({color:p,isMoving:l>this.IS_MOVING_THRESHOLD,...u,designBeam:(u==null?void 0:u.designBeam)??8,designLength:(u==null?void 0:u.designLength)??20});r.plane=new Cesium__namespace.PlaneGraphics({plane:new Cesium__namespace.Plane(Cesium__namespace.Cartesian3.UNIT_Z,0),dimensions:new Cesium__namespace.Cartesian2(d*y.scale.x,c*y.scale.y),show:new Cesium__namespace.CallbackProperty(()=>{var w;if(!this._viewer)return!0;const h=this._viewer.clock.currentTime,v=(w=i.position)==null?void 0:w.getValue(h);return v?Cesium__namespace.Cartesian3.distance(this._viewer.camera.positionWC,v)<=4e3:!1},!1),material:new Cesium__namespace.ImageMaterialProperty({image:y.url,transparent:!0,repeat:new Cesium__namespace.Cartesian2(1,1),color:createAlphaSampled({startTime:o})})})}}Cesium.Color.fromCssColorString("#FC4C02"),Cesium.Color.WHITE,new Cesium.Color,new Array(4);var e$2=[],t$2=[];function n$2(s,i){if(s&&typeof document<"u"){var r,u=i.prepend===!0?"prepend":"append",m=i.singleTag===!0,o=typeof i.container=="string"?document.querySelector(i.container):document.getElementsByTagName("head")[0];if(m){var l=e$2.indexOf(o);l===-1&&(l=e$2.push(o)-1,t$2[l]={}),r=t$2[l]&&t$2[l][u]?t$2[l][u]:t$2[l][u]=c()}else r=c();s.charCodeAt(0)===65279&&(s=s.substring(1)),r.styleSheet?r.styleSheet.cssText+=s:r.appendChild(document.createTextNode(s))}function c(){var d=document.createElement("style");if(d.setAttribute("type","text/css"),i.attributes)for(var a=Object.keys(i.attributes),p=0;p<a.length;p++)d.setAttribute(a[p],i.attributes[a[p]]);var y=u==="prepend"?"afterbegin":"beforeend";return o.insertAdjacentElement(y,d),d}}var css$2='.cesium-tool-tip{background:rgba(0,0,0,.6);border-radius:4px;color:#fff;left:0;line-height:30px;min-height:30px;min-width:100px;padding:0 10px;pointer-events:none;position:absolute;top:0;visibility:hidden;z-index:-1}.cesium-tool-tip:before{border-bottom:10px solid transparent;border-right:10px solid rgba(0,0,0,.6);border-top:10px solid transparent;content:"";display:block;left:-10px;pointer-events:none;position:absolute;top:calc(50% - 10px)}';n$2(css$2,{}),Cesium.Color.YELLOW,Cesium.Color.YELLOW,Cesium.Color.DARKTURQUOISE.withAlpha(.5),Cesium.Color.BLUE,Cesium.Color.WHITE,Cesium.Color.YELLOW.withAlpha(.5),Cesium.Color.YELLOW.withAlpha(.5),Cesium.Color.WHITE,new Cesium.Color(.165,.165,.165,.8),new Cesium.Cartesian2(4,4),Cesium.LabelStyle.FILL_AND_OUTLINE,new Cesium.Cartesian2(4,0),new Cesium.NearFarScalar(1,.85,8e6,.75),Cesium.HeightReference.CLAMP_TO_GROUND;class Popup{constructor(i,r){z(this,"_position");z(this,"_screenPosition",new Cesium.Cartesian2);z(this,"_element");z(this,"_viewer");z(this,"_options");z(this,"_destroyed",!1);z(this,"_offset");z(this,"setPosition",()=>{if(this._position&&this._viewer&&this._position){if(this._viewer.scene.mode===Cesium.SceneMode.SCENE3D){const u=this._viewer.scene.camera.position,m=new Cesium.BoundingSphere(new Cesium.Cartesian3(0,0,0),635e4);if(!new Cesium.Occluder(m,u).isPointVisible(this._position)){this.switchElementShow(!1);return}}const i=Cesium.SceneTransforms.worldToWindowCoordinates(this._viewer.scene,this._position),{_element:r}=this;if(r&&i){if(this._screenPosition&&this._screenPosition.x===i.x&&this._screenPosition.y===i.y)return;this.switchElementShow(!0);const u=i.x-r.clientWidth/2+this._offset[0],m=i.y-r.clientHeight+this._offset[1];r.style.left=`${u}px`,r.style.top=`${m}px`,this._screenPosition=i}}});this._viewer=i,this._options=r;const{position:u,element:m,offset:o}=r;if(!m)throw Error("no element!");this._position=u?Cesium.Cartesian3.fromDegrees(u[0],u[1],u[2]):null,this._element=m,this._offset=[(o==null?void 0:o[0])??0,(o==null?void 0:o[1])??0],this.addMapListener()}set position(i){if(!i){this.switchElementShow(!1),this._position=null,this._options.position=null;return}this._position=Cesium.Cartesian3.fromDegrees(i[0],i[1],i[2]),this._options.position=i,this.setPosition()}get position(){return this._options.position}get destroyed(){return this._destroyed}switchElementShow(i){this._element&&(this._element.style.display=i?"block":"none")}addMapListener(){var i;(i=this._viewer)==null||i.scene.postRender.addEventListener(this.setPosition)}destroy(){this._viewer.isDestroyed()||this._viewer.scene.postRender.removeEventListener(this.setPosition),this.setPosition=void 0,this._destroyed=!0}}var e$1=[],t$1=[];function n$1(s,i){if(s&&typeof document<"u"){var r,u=i.prepend===!0?"prepend":"append",m=i.singleTag===!0,o=typeof i.container=="string"?document.querySelector(i.container):document.getElementsByTagName("head")[0];if(m){var l=e$1.indexOf(o);l===-1&&(l=e$1.push(o)-1,t$1[l]={}),r=t$1[l]&&t$1[l][u]?t$1[l][u]:t$1[l][u]=c()}else r=c();s.charCodeAt(0)===65279&&(s=s.substring(1)),r.styleSheet?r.styleSheet.cssText+=s:r.appendChild(document.createTextNode(s))}function c(){var d=document.createElement("style");if(d.setAttribute("type","text/css"),i.attributes)for(var a=Object.keys(i.attributes),p=0;p<a.length;p++)d.setAttribute(a[p],i.attributes[a[p]]);var y=u==="prepend"?"afterbegin":"beforeend";return o.insertAdjacentElement(y,d),d}}var css$1=".cesium-compass{cursor:pointer;height:60px;pointer-events:auto;position:absolute;right:15px;top:100px;user-select:none;width:60px}.cesium-compass .out-ring{fill:rgba(23,49,71,.702);background-repeat:no-repeat;background-size:contain;border-radius:50%;height:60px;left:0;position:absolute;top:0;transition:all .3s ease;width:60px}.cesium-compass .out-ring svg{height:60px;width:60px}.cesium-compass:hover .rotation_marker svg{height:70.2px;width:70.2px}.cesium-compass .gyro{align-items:center;background:#fff;border-radius:50%;box-sizing:border-box;display:flex;height:30px;justify-content:center;margin:0 auto;padding:4px;position:relative;text-align:center;top:50%;transform:translateY(-50%);transition:all .3s ease;width:30px}.cesium-compass .gyro svg{height:20px;width:20px}.rotation_marker{background-repeat:no-repeat;background-size:contain;border-radius:50%;position:relative}.rotation_marker svg{height:60px;left:50%;position:absolute;top:50%;transform:translate(-50%,-50%);transition:all .3s ease;width:60px}.cesium-compass .gyro-active,.cesium-compass .gyro:hover{fill:#68adfe}";n$1(css$1,{});var e=[],t=[];function n(s,i){if(s&&typeof document<"u"){var r,u=i.prepend===!0?"prepend":"append",m=i.singleTag===!0,o=typeof i.container=="string"?document.querySelector(i.container):document.getElementsByTagName("head")[0];if(m){var l=e.indexOf(o);l===-1&&(l=e.push(o)-1,t[l]={}),r=t[l]&&t[l][u]?t[l][u]:t[l][u]=c()}else r=c();s.charCodeAt(0)===65279&&(s=s.substring(1)),r.styleSheet?r.styleSheet.cssText+=s:r.appendChild(document.createTextNode(s))}function c(){var d=document.createElement("style");if(d.setAttribute("type","text/css"),i.attributes)for(var a=Object.keys(i.attributes),p=0;p<a.length;p++)d.setAttribute(a[p],i.attributes[a[p]]);var y=u==="prepend"?"afterbegin":"beforeend";return o.insertAdjacentElement(y,d),d}}var css=".cesium-zoom-controller{border-radius:100px;box-sizing:border-box;display:flex;flex-direction:column;line-height:1.2rem;pointer-events:auto;position:absolute;right:30px;text-align:center;top:187px;user-select:none}.cesium-zoom-controller .refresh,.cesium-zoom-controller .zoom-in,.cesium-zoom-controller .zoom-out{border-radius:14%;margin-bottom:5px}.cesium-zoom-controller .cesium-button{background:#2a2e39;border:none;margin-right:0;transition:all .3s cubic-bezier(.645,.045,.355,1);transition-delay:0s;transition-duration:.2s;transition-property:all;transition-timing-function:cubic-bezier(.645,.045,.355,1)}.cesium-zoom-controller .cesium-button:hover{background:#48b;box-shadow:none}.cesium-zoom-controller .cesium-button:active{fill:#edffff;background:#adf;color:#edffff}.cesium-zoom-controller .cesium-toolbar-button{align-items:center;display:flex;height:30px;justify-content:center;width:30px}";n(css,{});var heatmap$1={exports:{}},heatmap=heatmap$1.exports,hasRequiredHeatmap;function requireHeatmap(){return hasRequiredHeatmap||(hasRequiredHeatmap=1,function(s){(function(i,r,u){s.exports?s.exports=u():r[i]=u()})("h337",heatmap,function(){var i={defaultRadius:40,defaultRenderer:"canvas2d",defaultGradient:{.25:"rgb(0,0,255)",.55:"rgb(0,255,0)",.85:"yellow",1:"rgb(255,0,0)"},defaultMaxOpacity:1,defaultMinOpacity:0,defaultBlur:.85,defaultXField:"x",defaultYField:"y",defaultValueField:"value",plugins:{}},r=function(){var a=function(g){this._coordinator={},this._data=[],this._radi=[],this._min=10,this._max=1,this._xField=g.xField||g.defaultXField,this._yField=g.yField||g.defaultYField,this._valueField=g.valueField||g.defaultValueField,g.radius&&(this._cfgRadius=g.radius)},p=i.defaultRadius;return a.prototype={_organiseData:function(y,g){var h=y[this._xField],v=y[this._yField],b=this._radi,w=this._data,T=this._max,_=this._min,O=y[this._valueField]||1,x=y.radius||this._cfgRadius||p;w[h]||(w[h]=[],b[h]=[]),w[h][v]?w[h][v]+=O:(w[h][v]=O,b[h][v]=x);var R=w[h][v];return R>T?(g?this.setDataMax(R):this._max=R,!1):R<_?(g?this.setDataMin(R):this._min=R,!1):{x:h,y:v,value:O,radius:x,min:_,max:T}},_unOrganizeData:function(){var y=[],g=this._data,h=this._radi;for(var v in g)for(var b in g[v])y.push({x:v,y:b,radius:h[v][b],value:g[v][b]});return{min:this._min,max:this._max,data:y}},_onExtremaChange:function(){this._coordinator.emit("extremachange",{min:this._min,max:this._max})},addData:function(){if(arguments[0].length>0)for(var y=arguments[0],g=y.length;g--;)this.addData.call(this,y[g]);else{var h=this._organiseData(arguments[0],!0);h&&(this._data.length===0&&(this._min=this._max=h.value),this._coordinator.emit("renderpartial",{min:this._min,max:this._max,data:[h]}))}return this},setData:function(y){var g=y.data,h=g.length;this._data=[],this._radi=[];for(var v=0;v<h;v++)this._organiseData(g[v],!1);return this._max=y.max,this._min=y.min||0,this._onExtremaChange(),this._coordinator.emit("renderall",this._getInternalData()),this},removeData:function(){},setDataMax:function(y){return this._max=y,this._onExtremaChange(),this._coordinator.emit("renderall",this._getInternalData()),this},setDataMin:function(y){return this._min=y,this._onExtremaChange(),this._coordinator.emit("renderall",this._getInternalData()),this},setCoordinator:function(y){this._coordinator=y},_getInternalData:function(){return{max:this._max,min:this._min,data:this._data,radi:this._radi}},getData:function(){return this._unOrganizeData()}},a}(),u=function(){var a=function(h){var v=h.gradient||h.defaultGradient,b=document.createElement("canvas"),w=b.getContext("2d",{willReadFrequently:!0});b.width=256,b.height=1;var T=w.createLinearGradient(0,0,256,1);for(var _ in v)T.addColorStop(_,v[_]);return w.fillStyle=T,w.fillRect(0,0,256,1),w.getImageData(0,0,256,1).data},p=function(h,v){var b=document.createElement("canvas"),w=b.getContext("2d",{willReadFrequently:!0}),T=h,_=h;if(b.width=b.height=h*2,v==1)w.beginPath(),w.arc(T,_,h,0,2*Math.PI,!1),w.fillStyle="rgba(0,0,0,1)",w.fill();else{var O=w.createRadialGradient(T,_,h*v,T,_,h);O.addColorStop(0,"rgba(0,0,0,1)"),O.addColorStop(1,"rgba(0,0,0,0)"),w.fillStyle=O,w.fillRect(0,0,2*h,2*h)}return b},y=function(_){for(var v=[],b=_.min,w=_.max,T=_.radi,_=_.data,O=Object.keys(_),x=O.length;x--;)for(var R=O[x],E=Object.keys(_[R]),C=E.length;C--;){var N=E[C],A=_[R][N],D=T[R][N];v.push({x:R,y:N,value:A,radius:D})}return{min:b,max:w,data:v}};function g(h){var v=h.container,b=this.shadowCanvas=document.createElement("canvas"),w=this.canvas=h.canvas||document.createElement("canvas");this._renderBoundaries=[1e4,1e4,0,0];var T=getComputedStyle(h.container)||{};w.className="heatmap-canvas",this._width=w.width=b.width=h.width||+T.width.replace(/px/,""),this._height=w.height=b.height=h.height||+T.height.replace(/px/,""),this.shadowCtx=b.getContext("2d",{willReadFrequently:!0}),this.ctx=w.getContext("2d",{willReadFrequently:!0}),w.style.cssText=b.style.cssText="position:absolute;left:0;top:0;",v.style.position="relative",v.appendChild(w),this._palette=a(h),this._templates={},this._setStyles(h)}return g.prototype={renderPartial:function(h){h.data.length>0&&(this._drawAlpha(h),this._colorize())},renderAll:function(h){this._clear(),h.data.length>0&&(this._drawAlpha(y(h)),this._colorize())},_updateGradient:function(h){this._palette=a(h)},updateConfig:function(h){h.gradient&&this._updateGradient(h),this._setStyles(h)},setDimensions:function(h,v){this._width=h,this._height=v,this.canvas.width=this.shadowCanvas.width=h,this.canvas.height=this.shadowCanvas.height=v},_clear:function(){this.shadowCtx.clearRect(0,0,this._width,this._height),this.ctx.clearRect(0,0,this._width,this._height)},_setStyles:function(h){this._blur=h.blur==0?0:h.blur||h.defaultBlur,h.backgroundColor&&(this.canvas.style.backgroundColor=h.backgroundColor),this._width=this.canvas.width=this.shadowCanvas.width=h.width||this._width,this._height=this.canvas.height=this.shadowCanvas.height=h.height||this._height,this._opacity=(h.opacity||0)*255,this._maxOpacity=(h.maxOpacity||h.defaultMaxOpacity)*255,this._minOpacity=(h.minOpacity||h.defaultMinOpacity)*255,this._useGradientOpacity=!!h.useGradientOpacity},_drawAlpha:function(w){for(var v=this._min=w.min,b=this._max=w.max,w=w.data||[],T=w.length,_=1-this._blur;T--;){var O=w[T],x=O.x,R=O.y,E=O.radius,C=Math.min(O.value,b),N=x-E,A=R-E,D=this.shadowCtx,P;this._templates[E]?P=this._templates[E]:this._templates[E]=P=p(E,_);var M=(C-v)/(b-v);D.globalAlpha=M<.01?.01:M,D.drawImage(P,N,A),N<this._renderBoundaries[0]&&(this._renderBoundaries[0]=N),A<this._renderBoundaries[1]&&(this._renderBoundaries[1]=A),N+2*E>this._renderBoundaries[2]&&(this._renderBoundaries[2]=N+2*E),A+2*E>this._renderBoundaries[3]&&(this._renderBoundaries[3]=A+2*E)}},_colorize:function(){var h=this._renderBoundaries[0],v=this._renderBoundaries[1],b=this._renderBoundaries[2]-h,w=this._renderBoundaries[3]-v,T=this._width,_=this._height,O=this._opacity,x=this._maxOpacity,R=this._minOpacity,E=this._useGradientOpacity;h<0&&(h=0),v<0&&(v=0),h+b>T&&(b=T-h),v+w>_&&(w=_-v);for(var C=this.shadowCtx.getImageData(h,v,b,w),N=C.data,A=N.length,D=this._palette,P=3;P<A;P+=4){var M=N[P],q=M*4;if(q){var F;O>0?F=O:M<x?M<R?F=R:F=M:F=x,N[P-3]=D[q],N[P-2]=D[q+1],N[P-1]=D[q+2],N[P]=E?D[q+3]:F}}this.ctx.putImageData(C,h,v),this._renderBoundaries=[1e3,1e3,0,0]},getValueAt:function(h){var v,b=this.shadowCtx,w=b.getImageData(h.x,h.y,1,1),T=w.data[3],_=this._max,O=this._min;return v=Math.abs(_-O)*(T/255)>>0,v},getDataURL:function(){return this.canvas.toDataURL()}},g}(),m=function(){var a=!1;return i.defaultRenderer==="canvas2d"&&(a=u),a}(),o={merge:function(){for(var d={},a=arguments.length,p=0;p<a;p++){var y=arguments[p];for(var g in y)d[g]=y[g]}return d}},l=function(){var a=function(){function h(){this.cStore={}}return h.prototype={on:function(v,b,w){var T=this.cStore;T[v]||(T[v]=[]),T[v].push(function(_){return b.call(w,_)})},emit:function(v,b){var w=this.cStore;if(w[v])for(var T=w[v].length,_=0;_<T;_++){var O=w[v][_];O(b)}}},h}(),p=function(g){var h=g._renderer,v=g._coordinator,b=g._store;v.on("renderpartial",h.renderPartial,h),v.on("renderall",h.renderAll,h),v.on("extremachange",function(w){g._config.onExtremaChange&&g._config.onExtremaChange({min:w.min,max:w.max,gradient:g._config.gradient||g._config.defaultGradient})}),b.setCoordinator(v)};function y(){var g=this._config=o.merge(i,arguments[0]||{});if(this._coordinator=new a,g.plugin){var h=g.plugin;if(i.plugins[h]){var v=i.plugins[h];this._renderer=new v.renderer(g),this._store=new v.store(g)}else throw new Error("Plugin '"+h+"' not found. Maybe it was not registered.")}else this._renderer=new m(g),this._store=new r(g);p(this)}return y.prototype={addData:function(){return this._store.addData.apply(this._store,arguments),this},removeData:function(){return this._store.removeData&&this._store.removeData.apply(this._store,arguments),this},setData:function(){return this._store.setData.apply(this._store,arguments),this},setDataMax:function(){return this._store.setDataMax.apply(this._store,arguments),this},setDataMin:function(){return this._store.setDataMin.apply(this._store,arguments),this},configure:function(g){return this._config=o.merge(this._config,g),this._renderer.updateConfig(this._config),this._coordinator.emit("renderall",this._store._getInternalData()),this},repaint:function(){return this._coordinator.emit("renderall",this._store._getInternalData()),this},getData:function(){return this._store.getData()},getDataURL:function(){return this._renderer.getDataURL()},getValueAt:function(g){return this._store.getValueAt?this._store.getValueAt(g):this._renderer.getValueAt?this._renderer.getValueAt(g):null}},y}(),c={create:function(d){return new l(d)},register:function(d,a){i.plugins[d]=a}};return c})}(heatmap$1)),heatmap$1.exports}requireHeatmap();const H=class H extends EventEmitter{constructor(){super();z(this,"popupMap",new Map)}static getInstance(){return H.instance||(H.instance=new H),H.instance}popup(r){var c;const u=r.element;u.style.position="absolute";const m=r.viewer.container,o=()=>{l&&(l.destroy(),m.removeChild(u),this.popupMap.delete(r.id),this.emit("onUnmount",r.id))};m.appendChild(u),this.emit("onMount",r.id),(c=this.popupMap.get(r.id))==null||c.destroy();const l=new Popup(r.viewer,{position:r.position,offset:r.offset??[0,0],element:u});this.popupMap.set(r.id,{popup:l,destroy:o})}close(r){const u=this.popupMap.get(r);u&&(u.destroy(),this.popupMap.delete(r),this.emit("onUnmount",r))}closeAll(){this.popupMap.forEach(r=>r.destroy()),this.popupMap.clear()}};z(H,"instance",null);let PopupCtrl=H;function saveCameraParams(s){const i=s.camera;return{position:i.position,direction:i.direction,up:i.up,right:i.right,transform:i.transform}}function flyToCameraParams(s,i,r=1){s.camera.flyTo({destination:i.position,orientation:{direction:i.direction,up:i.up,right:i.right},duration:r})}const memoizeMap=new WeakMap;function ListenLeftClick(s){if(memoizeMap.has(s))return memoizeMap.get(s);const i=new EventEmitter;return new Cesium__namespace.ScreenSpaceEventHandler(s.scene.canvas).setInputAction(u=>{i.emit("click",u)},Cesium__namespace.ScreenSpaceEventType.LEFT_CLICK),memoizeMap.set(s,i),i}exports.ListenLeftClick=ListenLeftClick,exports.PopupCtrl=PopupCtrl,exports.ShipLayer=ShipLayer,exports.WmsLayer=WmsLayer,exports.WmsLayerController=WmsLayerController,exports.createTdtProvider=createTdtProvider,exports.createTdtTerrain=createTdtTerrain,exports.flyToCameraParams=flyToCameraParams,exports.saveCameraParams=saveCameraParams,Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"})});
|
|
77
|
+
</svg>`;return{url:URL.createObjectURL(new Blob([b],{type:"image/svg+xml"})),viewBox:h,scale:v}},s=>`${s.color},${s.isMoving},${s.designBeam??0},${s.designLength??0},${s.aisFromBow??0},${s.aisFromCenter??0}`),shipTypeColorMap=new Map([[-1,"#00FF00"],[70,"#95B3D7"],[37,"#00FF00"],[50,"#366092"],[51,"#366092"],[52,"#366092"],[53,"#366092"],[54,"#366092"],[55,"#366092"],[56,"#366092"],[57,"#366092"],[58,"#366092"],[59,"#366092"],[80,"red"],[81,"red"],[82,"red"],[83,"red"],[84,"red"],[85,"red"],[86,"red"],[87,"red"],[88,"red"],[89,"red"]]);function createAlphaSampled(s){const i=new Cesium__namespace.SampledProperty(Cesium__namespace.Color),r=(s==null?void 0:s.startTime)??Cesium__namespace.JulianDate.now(),u=Cesium__namespace.JulianDate.addMinutes(r,1,new Cesium__namespace.JulianDate),m=Cesium__namespace.JulianDate.addMinutes(r,5,new Cesium__namespace.JulianDate),o=Cesium__namespace.JulianDate.fromIso8601("2100-01-01T00:00:00Z"),l=(s==null?void 0:s.color)??Cesium__namespace.Color.WHITE;return i.addSample(r,l.withAlpha(1)),i.addSample(u,l.withAlpha(1)),i.addSample(m,l.withAlpha(.2)),i.addSample(o,l.withAlpha(.1)),i}function getHideAfterFiveMinutesProperty(s){const i=s??Cesium__namespace.JulianDate.now(),r=Cesium__namespace.JulianDate.addMinutes(i,5,new Cesium__namespace.JulianDate);return new Cesium__namespace.CallbackProperty(u=>u?Cesium__namespace.JulianDate.lessThan(u,r):!0,!1)}class ShipLayer{constructor(i,r){z(this,"db");z(this,"isMounted",!1);z(this,"_viewer",null);z(this,"entityMap",new Map);z(this,"IS_MOVING_THRESHOLD",1);z(this,"shadowEntityMap",new WeakMap);this.key=i,this.zIndex=r,this.db=new Cesium__namespace.CustomDataSource(i)}show(i){this.isMounted||(i.dataSources.add(this.db),this._viewer=i,this.isMounted=!0),this.db.show=!0}hide(){this.isMounted&&(this.db.show=!1)}render(i){i.features.forEach(r=>{this.renderFeature(r)})}renderFeature(i){var c,d;const r=String(i.id),u=new Cesium__namespace.SampledPositionProperty;u.backwardExtrapolationType=Cesium__namespace.ExtrapolationType.HOLD,u.forwardExtrapolationType=Cesium__namespace.ExtrapolationType.HOLD;const m=Cesium__namespace.Cartesian3.fromDegrees(i.geometry.coordinates[0],i.geometry.coordinates[1]);u.addSample(((c=this._viewer)==null?void 0:c.clock.currentTime)??Cesium__namespace.JulianDate.now(),m);const o=((d=i.properties)==null?void 0:d.courseOverGroundTrue)??0,l=new Cesium__namespace.Entity({id:r,position:u,orientation:new Cesium__namespace.ConstantProperty(Cesium__namespace.Transforms.headingPitchRollQuaternion(m,new Cesium__namespace.HeadingPitchRoll(o,0,0))),properties:i.properties??{}});this.entityMap.set(r,l),this.db.entities.add(l),this.renderEntity(l)}update(i){var u,m,o,l,c,d,a,p;const r=this.db.entities.getById(String(i.id));if(r){const y=this.shadowEntityMap.get(r),g=((u=i.properties)==null?void 0:u.shipTypeId)??-1,h=shipTypeColorMap.get(g)??shipTypeColorMap.get(-1),[v,b]=i.geometry.coordinates,w=((m=this._viewer)==null?void 0:m.clock.currentTime)??Cesium__namespace.JulianDate.now(),T=(o=r.position)==null?void 0:o.getValue(w),_=Cesium__namespace.JulianDate.addSeconds(w,3,new Cesium__namespace.JulianDate),O=Cesium__namespace.Cartesian3.fromDegrees(v,b),x=new Cesium__namespace.SampledPositionProperty;if(x.backwardExtrapolationType=Cesium__namespace.ExtrapolationType.HOLD,x.forwardExtrapolationType=Cesium__namespace.ExtrapolationType.HOLD,x instanceof Cesium__namespace.SampledPositionProperty&&(x.addSample(Cesium__namespace.JulianDate.addSeconds(w,1,new Cesium__namespace.JulianDate),T??O),x.addSample(_,O)),r.position=x,y&&(y.position=x),r.properties)for(const[R,E]of Object.entries(i.properties??{})){if(R=="speedOverGround"){const C=r.properties.getValue().speedOverGround??0,N=Number(C)>this.IS_MOVING_THRESHOLD,A=Number(E)>this.IS_MOVING_THRESHOLD;if(N!==A&&(r.billboard&&(r.billboard.image=new Cesium__namespace.ConstantProperty(createShipIconUrl(h,A))),y!=null&&y.plane)){const D=((l=i.properties)==null?void 0:l.designBeam)??8,P=((c=i.properties)==null?void 0:c.designLength)??20,M=createShipIconV2({color:h,isMoving:A,...i.properties,designBeam:D,designLength:P}),q=(d=y.plane)==null?void 0:d.material;q&&(q.image=new Cesium__namespace.ConstantProperty(M.url),y.plane.dimensions=new Cesium__namespace.ConstantProperty(new Cesium__namespace.Cartesian2(D*M.scale.x,P*M.scale.y))),y.plane.dimensions=new Cesium__namespace.CallbackProperty(()=>new Cesium__namespace.Cartesian2(D*M.scale.x,P*M.scale.y),!0)}}if(R=="courseOverGroundTrue"){const C=((a=i.properties)==null?void 0:a.courseOverGroundTrue)??0;r.billboard.rotation=new Cesium__namespace.ConstantProperty(typeof E=="number"?-1*E:0);const N=new Cesium__namespace.ConstantProperty(Cesium__namespace.Transforms.headingPitchRollQuaternion(O,new Cesium__namespace.HeadingPitchRoll(C,0,0)));y&&(y.orientation=N)}if(R=="updateTime"){const C=Cesium__namespace.JulianDate.fromDate(new Date(E));r.billboard.color=createAlphaSampled({startTime:C});const N=(p=y==null?void 0:y.plane)==null?void 0:p.material;N&&(N.color=createAlphaSampled({startTime:C}));const A=getHideAfterFiveMinutesProperty(C);r.label.show=A,r.point.show=A}r.properties[R]=E,y!=null&&y.properties&&(y.properties[R]=E)}}else this.renderFeature(i)}renderEntity(i){var a,p,y,g,h,v,b;const r=(a=i.properties)==null?void 0:a.getValue(),u=(r==null?void 0:r.shipTypeId)??-1,m=shipTypeColorMap.get(u)??shipTypeColorMap.get(-1),o=Number((r==null?void 0:r.speedOverGround)??0),l=r!=null&&r.updateTime?new Date(r.updateTime):new Date,c=Cesium__namespace.JulianDate.fromDate(l),d=createShipIconUrl(m,o>this.IS_MOVING_THRESHOLD);i.point=new Cesium__namespace.PointGraphics({pixelSize:4,color:Cesium__namespace.Color.fromCssColorString("#8AF22C"),disableDepthTestDistance:3e6,distanceDisplayCondition:new Cesium__namespace.DistanceDisplayCondition(15e3),show:getHideAfterFiveMinutesProperty(c)}),i.billboard=new Cesium__namespace.BillboardGraphics({image:d,width:14,height:70,disableDepthTestDistance:3e6,distanceDisplayCondition:new Cesium__namespace.DistanceDisplayCondition(4e3,15e3),pixelOffset:new Cesium__namespace.Cartesian2(0,0),alignedAxis:Cesium__namespace.Cartesian3.UNIT_Z,color:createAlphaSampled({startTime:c}),rotation:new Cesium__namespace.ConstantProperty((y=(p=i.properties)==null?void 0:p.getValue())!=null&&y.courseOverGroundTrue?-1*i.properties.getValue().courseOverGroundTrue:0)}),i.label=new Cesium__namespace.LabelGraphics({font:'12px normal "微软雅黑"',backgroundColor:Cesium__namespace.Color.fromCssColorString("#E9F4FC"),fillColor:Cesium__namespace.Color.BLACK,outlineColor:Cesium__namespace.Color.BLACK,outlineWidth:2,showBackground:!0,style:Cesium__namespace.LabelStyle.FILL,pixelOffset:new Cesium__namespace.Cartesian2(0,-20),scale:1,scaleByDistance:new Cesium__namespace.NearFarScalar(3e3,1,1e4,.55),text:((h=(g=i.properties)==null?void 0:g.getValue())==null?void 0:h.name)??((v=i.properties)!=null&&v.getValue().mmsi?"mmsi:"+((b=i.properties)==null?void 0:b.getValue().mmsi):"未知"),horizontalOrigin:Cesium__namespace.HorizontalOrigin.CENTER,distanceDisplayCondition:new Cesium__namespace.DistanceDisplayCondition(0,15e3),disableDepthTestDistance:5e3,show:getHideAfterFiveMinutesProperty(c)}),this.createShipPlane(i)}createShipPlane(i){var g;const r=new Cesium__namespace.Entity({id:i.id+"_shadow",position:i.position,orientation:i.orientation,properties:i.properties});this.shadowEntityMap.set(i,r),this.db.entities.add(r);const u=(g=i.properties)==null?void 0:g.getValue(),m=u!=null&&u.updateTime?new Date(u.updateTime):new Date,o=Cesium__namespace.JulianDate.fromDate(m),l=Number((u==null?void 0:u.speedOverGround)??0),c=(u==null?void 0:u.designLength)??20,d=(u==null?void 0:u.designBeam)??8,a=(u==null?void 0:u.shipTypeId)??-1,p=shipTypeColorMap.get(a)??shipTypeColorMap.get(-1),y=createShipIconV2({color:p,isMoving:l>this.IS_MOVING_THRESHOLD,...u,designBeam:(u==null?void 0:u.designBeam)??8,designLength:(u==null?void 0:u.designLength)??20});r.plane=new Cesium__namespace.PlaneGraphics({plane:new Cesium__namespace.Plane(Cesium__namespace.Cartesian3.UNIT_Z,0),dimensions:new Cesium__namespace.Cartesian2(d*y.scale.x,c*y.scale.y),show:new Cesium__namespace.CallbackProperty(()=>{var w;if(!this._viewer)return!0;const h=this._viewer.clock.currentTime,v=(w=i.position)==null?void 0:w.getValue(h);return v?Cesium__namespace.Cartesian3.distance(this._viewer.camera.positionWC,v)<=4e3:!1},!1),material:new Cesium__namespace.ImageMaterialProperty({image:y.url,transparent:!0,repeat:new Cesium__namespace.Cartesian2(1,1),color:createAlphaSampled({startTime:o})})})}}Cesium.Color.fromCssColorString("#FC4C02"),Cesium.Color.WHITE,new Cesium.Color,new Array(4);var e$2=[],t$2=[];function n$2(s,i){if(s&&typeof document<"u"){var r,u=i.prepend===!0?"prepend":"append",m=i.singleTag===!0,o=typeof i.container=="string"?document.querySelector(i.container):document.getElementsByTagName("head")[0];if(m){var l=e$2.indexOf(o);l===-1&&(l=e$2.push(o)-1,t$2[l]={}),r=t$2[l]&&t$2[l][u]?t$2[l][u]:t$2[l][u]=c()}else r=c();s.charCodeAt(0)===65279&&(s=s.substring(1)),r.styleSheet?r.styleSheet.cssText+=s:r.appendChild(document.createTextNode(s))}function c(){var d=document.createElement("style");if(d.setAttribute("type","text/css"),i.attributes)for(var a=Object.keys(i.attributes),p=0;p<a.length;p++)d.setAttribute(a[p],i.attributes[a[p]]);var y=u==="prepend"?"afterbegin":"beforeend";return o.insertAdjacentElement(y,d),d}}var css$2='.cesium-tool-tip{background:rgba(0,0,0,.6);border-radius:4px;color:#fff;left:0;line-height:30px;min-height:30px;min-width:100px;padding:0 10px;pointer-events:none;position:absolute;top:0;visibility:hidden;z-index:-1}.cesium-tool-tip:before{border-bottom:10px solid transparent;border-right:10px solid rgba(0,0,0,.6);border-top:10px solid transparent;content:"";display:block;left:-10px;pointer-events:none;position:absolute;top:calc(50% - 10px)}';n$2(css$2,{}),Cesium.Color.YELLOW,Cesium.Color.YELLOW,Cesium.Color.DARKTURQUOISE.withAlpha(.5),Cesium.Color.BLUE,Cesium.Color.WHITE,Cesium.Color.YELLOW.withAlpha(.5),Cesium.Color.YELLOW.withAlpha(.5),Cesium.Color.WHITE,new Cesium.Color(.165,.165,.165,.8),new Cesium.Cartesian2(4,4),Cesium.LabelStyle.FILL_AND_OUTLINE,new Cesium.Cartesian2(4,0),new Cesium.NearFarScalar(1,.85,8e6,.75),Cesium.HeightReference.CLAMP_TO_GROUND;class Popup{constructor(i,r){z(this,"_position");z(this,"_screenPosition",new Cesium.Cartesian2);z(this,"_element");z(this,"_viewer");z(this,"_options");z(this,"_destroyed",!1);z(this,"_offset");z(this,"setPosition",()=>{if(this._position&&this._viewer&&this._position){if(this._viewer.scene.mode===Cesium.SceneMode.SCENE3D){const u=this._viewer.scene.camera.position,m=new Cesium.BoundingSphere(new Cesium.Cartesian3(0,0,0),635e4);if(!new Cesium.Occluder(m,u).isPointVisible(this._position)){this.switchElementShow(!1);return}}const i=Cesium.SceneTransforms.worldToWindowCoordinates(this._viewer.scene,this._position),{_element:r}=this;if(r&&i){if(this._screenPosition&&this._screenPosition.x===i.x&&this._screenPosition.y===i.y)return;this.switchElementShow(!0);const u=i.x-r.clientWidth/2+this._offset[0],m=i.y-r.clientHeight+this._offset[1];r.style.left=`${u}px`,r.style.top=`${m}px`,this._screenPosition=i}}});this._viewer=i,this._options=r;const{position:u,element:m,offset:o}=r;if(!m)throw Error("no element!");this._position=u?Cesium.Cartesian3.fromDegrees(u[0],u[1],u[2]):null,this._element=m,this._offset=[(o==null?void 0:o[0])??0,(o==null?void 0:o[1])??0],this.addMapListener()}set position(i){if(!i){this.switchElementShow(!1),this._position=null,this._options.position=null;return}this._position=Cesium.Cartesian3.fromDegrees(i[0],i[1],i[2]),this._options.position=i,this.setPosition()}get position(){return this._options.position}get destroyed(){return this._destroyed}switchElementShow(i){this._element&&(this._element.style.display=i?"block":"none")}addMapListener(){var i;(i=this._viewer)==null||i.scene.postRender.addEventListener(this.setPosition)}destroy(){this._viewer.isDestroyed()||this._viewer.scene.postRender.removeEventListener(this.setPosition),this.setPosition=void 0,this._destroyed=!0}}var e$1=[],t$1=[];function n$1(s,i){if(s&&typeof document<"u"){var r,u=i.prepend===!0?"prepend":"append",m=i.singleTag===!0,o=typeof i.container=="string"?document.querySelector(i.container):document.getElementsByTagName("head")[0];if(m){var l=e$1.indexOf(o);l===-1&&(l=e$1.push(o)-1,t$1[l]={}),r=t$1[l]&&t$1[l][u]?t$1[l][u]:t$1[l][u]=c()}else r=c();s.charCodeAt(0)===65279&&(s=s.substring(1)),r.styleSheet?r.styleSheet.cssText+=s:r.appendChild(document.createTextNode(s))}function c(){var d=document.createElement("style");if(d.setAttribute("type","text/css"),i.attributes)for(var a=Object.keys(i.attributes),p=0;p<a.length;p++)d.setAttribute(a[p],i.attributes[a[p]]);var y=u==="prepend"?"afterbegin":"beforeend";return o.insertAdjacentElement(y,d),d}}var css$1=".cesium-compass{cursor:pointer;height:60px;pointer-events:auto;position:absolute;right:15px;top:100px;user-select:none;width:60px}.cesium-compass .out-ring{fill:rgba(23,49,71,.702);background-repeat:no-repeat;background-size:contain;border-radius:50%;height:60px;left:0;position:absolute;top:0;transition:all .3s ease;width:60px}.cesium-compass .out-ring svg{height:60px;width:60px}.cesium-compass:hover .rotation_marker svg{height:70.2px;width:70.2px}.cesium-compass .gyro{align-items:center;background:#fff;border-radius:50%;box-sizing:border-box;display:flex;height:30px;justify-content:center;margin:0 auto;padding:4px;position:relative;text-align:center;top:50%;transform:translateY(-50%);transition:all .3s ease;width:30px}.cesium-compass .gyro svg{height:20px;width:20px}.rotation_marker{background-repeat:no-repeat;background-size:contain;border-radius:50%;position:relative}.rotation_marker svg{height:60px;left:50%;position:absolute;top:50%;transform:translate(-50%,-50%);transition:all .3s ease;width:60px}.cesium-compass .gyro-active,.cesium-compass .gyro:hover{fill:#68adfe}";n$1(css$1,{});var e=[],t=[];function n(s,i){if(s&&typeof document<"u"){var r,u=i.prepend===!0?"prepend":"append",m=i.singleTag===!0,o=typeof i.container=="string"?document.querySelector(i.container):document.getElementsByTagName("head")[0];if(m){var l=e.indexOf(o);l===-1&&(l=e.push(o)-1,t[l]={}),r=t[l]&&t[l][u]?t[l][u]:t[l][u]=c()}else r=c();s.charCodeAt(0)===65279&&(s=s.substring(1)),r.styleSheet?r.styleSheet.cssText+=s:r.appendChild(document.createTextNode(s))}function c(){var d=document.createElement("style");if(d.setAttribute("type","text/css"),i.attributes)for(var a=Object.keys(i.attributes),p=0;p<a.length;p++)d.setAttribute(a[p],i.attributes[a[p]]);var y=u==="prepend"?"afterbegin":"beforeend";return o.insertAdjacentElement(y,d),d}}var css=".cesium-zoom-controller{border-radius:100px;box-sizing:border-box;display:flex;flex-direction:column;line-height:1.2rem;pointer-events:auto;position:absolute;right:30px;text-align:center;top:187px;user-select:none}.cesium-zoom-controller .refresh,.cesium-zoom-controller .zoom-in,.cesium-zoom-controller .zoom-out{border-radius:14%;margin-bottom:5px}.cesium-zoom-controller .cesium-button{background:#2a2e39;border:none;margin-right:0;transition:all .3s cubic-bezier(.645,.045,.355,1);transition-delay:0s;transition-duration:.2s;transition-property:all;transition-timing-function:cubic-bezier(.645,.045,.355,1)}.cesium-zoom-controller .cesium-button:hover{background:#48b;box-shadow:none}.cesium-zoom-controller .cesium-button:active{fill:#edffff;background:#adf;color:#edffff}.cesium-zoom-controller .cesium-toolbar-button{align-items:center;display:flex;height:30px;justify-content:center;width:30px}";n(css,{});var heatmap$1={exports:{}},heatmap=heatmap$1.exports,hasRequiredHeatmap;function requireHeatmap(){return hasRequiredHeatmap||(hasRequiredHeatmap=1,function(s){(function(i,r,u){s.exports?s.exports=u():r[i]=u()})("h337",heatmap,function(){var i={defaultRadius:40,defaultRenderer:"canvas2d",defaultGradient:{.25:"rgb(0,0,255)",.55:"rgb(0,255,0)",.85:"yellow",1:"rgb(255,0,0)"},defaultMaxOpacity:1,defaultMinOpacity:0,defaultBlur:.85,defaultXField:"x",defaultYField:"y",defaultValueField:"value",plugins:{}},r=function(){var a=function(g){this._coordinator={},this._data=[],this._radi=[],this._min=10,this._max=1,this._xField=g.xField||g.defaultXField,this._yField=g.yField||g.defaultYField,this._valueField=g.valueField||g.defaultValueField,g.radius&&(this._cfgRadius=g.radius)},p=i.defaultRadius;return a.prototype={_organiseData:function(y,g){var h=y[this._xField],v=y[this._yField],b=this._radi,w=this._data,T=this._max,_=this._min,O=y[this._valueField]||1,x=y.radius||this._cfgRadius||p;w[h]||(w[h]=[],b[h]=[]),w[h][v]?w[h][v]+=O:(w[h][v]=O,b[h][v]=x);var R=w[h][v];return R>T?(g?this.setDataMax(R):this._max=R,!1):R<_?(g?this.setDataMin(R):this._min=R,!1):{x:h,y:v,value:O,radius:x,min:_,max:T}},_unOrganizeData:function(){var y=[],g=this._data,h=this._radi;for(var v in g)for(var b in g[v])y.push({x:v,y:b,radius:h[v][b],value:g[v][b]});return{min:this._min,max:this._max,data:y}},_onExtremaChange:function(){this._coordinator.emit("extremachange",{min:this._min,max:this._max})},addData:function(){if(arguments[0].length>0)for(var y=arguments[0],g=y.length;g--;)this.addData.call(this,y[g]);else{var h=this._organiseData(arguments[0],!0);h&&(this._data.length===0&&(this._min=this._max=h.value),this._coordinator.emit("renderpartial",{min:this._min,max:this._max,data:[h]}))}return this},setData:function(y){var g=y.data,h=g.length;this._data=[],this._radi=[];for(var v=0;v<h;v++)this._organiseData(g[v],!1);return this._max=y.max,this._min=y.min||0,this._onExtremaChange(),this._coordinator.emit("renderall",this._getInternalData()),this},removeData:function(){},setDataMax:function(y){return this._max=y,this._onExtremaChange(),this._coordinator.emit("renderall",this._getInternalData()),this},setDataMin:function(y){return this._min=y,this._onExtremaChange(),this._coordinator.emit("renderall",this._getInternalData()),this},setCoordinator:function(y){this._coordinator=y},_getInternalData:function(){return{max:this._max,min:this._min,data:this._data,radi:this._radi}},getData:function(){return this._unOrganizeData()}},a}(),u=function(){var a=function(h){var v=h.gradient||h.defaultGradient,b=document.createElement("canvas"),w=b.getContext("2d",{willReadFrequently:!0});b.width=256,b.height=1;var T=w.createLinearGradient(0,0,256,1);for(var _ in v)T.addColorStop(_,v[_]);return w.fillStyle=T,w.fillRect(0,0,256,1),w.getImageData(0,0,256,1).data},p=function(h,v){var b=document.createElement("canvas"),w=b.getContext("2d",{willReadFrequently:!0}),T=h,_=h;if(b.width=b.height=h*2,v==1)w.beginPath(),w.arc(T,_,h,0,2*Math.PI,!1),w.fillStyle="rgba(0,0,0,1)",w.fill();else{var O=w.createRadialGradient(T,_,h*v,T,_,h);O.addColorStop(0,"rgba(0,0,0,1)"),O.addColorStop(1,"rgba(0,0,0,0)"),w.fillStyle=O,w.fillRect(0,0,2*h,2*h)}return b},y=function(_){for(var v=[],b=_.min,w=_.max,T=_.radi,_=_.data,O=Object.keys(_),x=O.length;x--;)for(var R=O[x],E=Object.keys(_[R]),C=E.length;C--;){var N=E[C],A=_[R][N],D=T[R][N];v.push({x:R,y:N,value:A,radius:D})}return{min:b,max:w,data:v}};function g(h){var v=h.container,b=this.shadowCanvas=document.createElement("canvas"),w=this.canvas=h.canvas||document.createElement("canvas");this._renderBoundaries=[1e4,1e4,0,0];var T=getComputedStyle(h.container)||{};w.className="heatmap-canvas",this._width=w.width=b.width=h.width||+T.width.replace(/px/,""),this._height=w.height=b.height=h.height||+T.height.replace(/px/,""),this.shadowCtx=b.getContext("2d",{willReadFrequently:!0}),this.ctx=w.getContext("2d",{willReadFrequently:!0}),w.style.cssText=b.style.cssText="position:absolute;left:0;top:0;",v.style.position="relative",v.appendChild(w),this._palette=a(h),this._templates={},this._setStyles(h)}return g.prototype={renderPartial:function(h){h.data.length>0&&(this._drawAlpha(h),this._colorize())},renderAll:function(h){this._clear(),h.data.length>0&&(this._drawAlpha(y(h)),this._colorize())},_updateGradient:function(h){this._palette=a(h)},updateConfig:function(h){h.gradient&&this._updateGradient(h),this._setStyles(h)},setDimensions:function(h,v){this._width=h,this._height=v,this.canvas.width=this.shadowCanvas.width=h,this.canvas.height=this.shadowCanvas.height=v},_clear:function(){this.shadowCtx.clearRect(0,0,this._width,this._height),this.ctx.clearRect(0,0,this._width,this._height)},_setStyles:function(h){this._blur=h.blur==0?0:h.blur||h.defaultBlur,h.backgroundColor&&(this.canvas.style.backgroundColor=h.backgroundColor),this._width=this.canvas.width=this.shadowCanvas.width=h.width||this._width,this._height=this.canvas.height=this.shadowCanvas.height=h.height||this._height,this._opacity=(h.opacity||0)*255,this._maxOpacity=(h.maxOpacity||h.defaultMaxOpacity)*255,this._minOpacity=(h.minOpacity||h.defaultMinOpacity)*255,this._useGradientOpacity=!!h.useGradientOpacity},_drawAlpha:function(w){for(var v=this._min=w.min,b=this._max=w.max,w=w.data||[],T=w.length,_=1-this._blur;T--;){var O=w[T],x=O.x,R=O.y,E=O.radius,C=Math.min(O.value,b),N=x-E,A=R-E,D=this.shadowCtx,P;this._templates[E]?P=this._templates[E]:this._templates[E]=P=p(E,_);var M=(C-v)/(b-v);D.globalAlpha=M<.01?.01:M,D.drawImage(P,N,A),N<this._renderBoundaries[0]&&(this._renderBoundaries[0]=N),A<this._renderBoundaries[1]&&(this._renderBoundaries[1]=A),N+2*E>this._renderBoundaries[2]&&(this._renderBoundaries[2]=N+2*E),A+2*E>this._renderBoundaries[3]&&(this._renderBoundaries[3]=A+2*E)}},_colorize:function(){var h=this._renderBoundaries[0],v=this._renderBoundaries[1],b=this._renderBoundaries[2]-h,w=this._renderBoundaries[3]-v,T=this._width,_=this._height,O=this._opacity,x=this._maxOpacity,R=this._minOpacity,E=this._useGradientOpacity;h<0&&(h=0),v<0&&(v=0),h+b>T&&(b=T-h),v+w>_&&(w=_-v);for(var C=this.shadowCtx.getImageData(h,v,b,w),N=C.data,A=N.length,D=this._palette,P=3;P<A;P+=4){var M=N[P],q=M*4;if(q){var F;O>0?F=O:M<x?M<R?F=R:F=M:F=x,N[P-3]=D[q],N[P-2]=D[q+1],N[P-1]=D[q+2],N[P]=E?D[q+3]:F}}this.ctx.putImageData(C,h,v),this._renderBoundaries=[1e3,1e3,0,0]},getValueAt:function(h){var v,b=this.shadowCtx,w=b.getImageData(h.x,h.y,1,1),T=w.data[3],_=this._max,O=this._min;return v=Math.abs(_-O)*(T/255)>>0,v},getDataURL:function(){return this.canvas.toDataURL()}},g}(),m=function(){var a=!1;return i.defaultRenderer==="canvas2d"&&(a=u),a}(),o={merge:function(){for(var d={},a=arguments.length,p=0;p<a;p++){var y=arguments[p];for(var g in y)d[g]=y[g]}return d}},l=function(){var a=function(){function h(){this.cStore={}}return h.prototype={on:function(v,b,w){var T=this.cStore;T[v]||(T[v]=[]),T[v].push(function(_){return b.call(w,_)})},emit:function(v,b){var w=this.cStore;if(w[v])for(var T=w[v].length,_=0;_<T;_++){var O=w[v][_];O(b)}}},h}(),p=function(g){var h=g._renderer,v=g._coordinator,b=g._store;v.on("renderpartial",h.renderPartial,h),v.on("renderall",h.renderAll,h),v.on("extremachange",function(w){g._config.onExtremaChange&&g._config.onExtremaChange({min:w.min,max:w.max,gradient:g._config.gradient||g._config.defaultGradient})}),b.setCoordinator(v)};function y(){var g=this._config=o.merge(i,arguments[0]||{});if(this._coordinator=new a,g.plugin){var h=g.plugin;if(i.plugins[h]){var v=i.plugins[h];this._renderer=new v.renderer(g),this._store=new v.store(g)}else throw new Error("Plugin '"+h+"' not found. Maybe it was not registered.")}else this._renderer=new m(g),this._store=new r(g);p(this)}return y.prototype={addData:function(){return this._store.addData.apply(this._store,arguments),this},removeData:function(){return this._store.removeData&&this._store.removeData.apply(this._store,arguments),this},setData:function(){return this._store.setData.apply(this._store,arguments),this},setDataMax:function(){return this._store.setDataMax.apply(this._store,arguments),this},setDataMin:function(){return this._store.setDataMin.apply(this._store,arguments),this},configure:function(g){return this._config=o.merge(this._config,g),this._renderer.updateConfig(this._config),this._coordinator.emit("renderall",this._store._getInternalData()),this},repaint:function(){return this._coordinator.emit("renderall",this._store._getInternalData()),this},getData:function(){return this._store.getData()},getDataURL:function(){return this._renderer.getDataURL()},getValueAt:function(g){return this._store.getValueAt?this._store.getValueAt(g):this._renderer.getValueAt?this._renderer.getValueAt(g):null}},y}(),c={create:function(d){return new l(d)},register:function(d,a){i.plugins[d]=a}};return c})}(heatmap$1)),heatmap$1.exports}requireHeatmap();const H=class H extends EventEmitter{constructor(){super();z(this,"popupMap",new Map)}static getInstance(){return H.instance||(H.instance=new H),H.instance}popup(r){var c;const u=r.element;u.style.position="absolute";const m=r.viewer.container,o=()=>{l&&(l.destroy(),m.removeChild(u),this.popupMap.delete(r.id),this.emit("onUnmount",r.id))};m.appendChild(u),this.emit("onMount",r.id),(c=this.popupMap.get(r.id))==null||c.destroy();const l=new Popup(r.viewer,{position:r.position,offset:r.offset??[0,0],element:u});this.popupMap.set(r.id,{popup:l,destroy:o})}close(r){const u=this.popupMap.get(r);u&&(u.destroy(),this.popupMap.delete(r),this.emit("onUnmount",r))}closeAll(){this.popupMap.forEach(r=>r.destroy()),this.popupMap.clear()}};z(H,"instance",null);let PopupCtrl=H;function saveCameraParams(s){const i=s.camera;return{position:i.position,direction:i.direction,up:i.up,right:i.right,transform:i.transform}}function flyToCameraParams(s,i,r=1){s.camera.flyTo({destination:i.position,orientation:{direction:i.direction,up:i.up,right:i.right},duration:r})}const memoizeMap=new WeakMap;function ListenLeftClick(s){if(memoizeMap.has(s))return memoizeMap.get(s);const i=new EventEmitter;return new Cesium__namespace.ScreenSpaceEventHandler(s.scene.canvas).setInputAction(u=>{i.emit("click",u)},Cesium__namespace.ScreenSpaceEventType.LEFT_CLICK),memoizeMap.set(s,i),i}exports.ListenLeftClick=ListenLeftClick,exports.PopupCtrl=PopupCtrl,exports.ShipLayer=ShipLayer,exports.WmsLayer=WmsLayer,exports.WmsLayerController=WmsLayerController,exports.createTdtProvider=createTdtProvider,exports.createTdtTerrain=createTdtTerrain,exports.flyToCameraParams=flyToCameraParams,exports.saveCameraParams=saveCameraParams,Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"})});
|