Cesium 加载czml用相机跟踪实体模型

Cesium 加载czml用相机跟踪实体模型关键步骤:viewer.dataSources.add(Cesium.CzmlDataSource.load(czml)).then(function (ds) { viewer.trackedEntity = ds.entities.getById("KongKeA310");// 用相机跟踪车辆。 // 取消双击事件-追踪该位置 viewer.cesiumWidget.screenSpaceEventHandler.removeInpu
摘要由CSDN通过智能技术生成

Cesium 加载czml用相机跟踪实体模型

  1. 关键步骤:
viewer.dataSources.add(Cesium.CzmlDataSource.load(czml)).then(function (ds) {
   
    viewer.trackedEntity = ds.entities.getById("KongKeA310");// 用相机跟踪车辆。 
  // 取消双击事件-追踪该位置
	viewer.cesiumWidget.screenSpaceEventHandler.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK);
  // 取消左键单击事件-追踪该位置
	viewer.cesiumWidget.screenSpaceEventHandler.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_CLICK);
});
  1. demo:
var czml = [
    {
   
        "id": "document", 
        "version": "1.0", 
        "clock": {
   
            "currentTime": "2020-12-01T03:20:00+00:00", 
            "multiplier": 1, 
            "interval": "2020-12-01T03:20:00+00:00/2020-12-01T04:50:27+00:00", 
            "range": "LOOP_STOP", 
            "step": "SYSTEM_CLOCK_MULTIPLIER"
        }
    }, 
    {
   
        "id": "KongKeA310", 
        "availability": "2020-12-01T03:20:00+00:00/2020-12-01T04:50:27+00:00", 
        "polygon": {
   
            "perPositionHeight": true, 
            "material": {
   
                "solidColor": {
   
                    "color": {
   
                        "rgba": [
                            255, 
                            114, 
                            86, 
                            255
                        ]
                    }
                }
            }, 
            "positions": {
   
                "references": [
                    "KongKeA310_4#position", 
                    "KongKeA310_5#position", 
                    "KongKeA310_6#position", 
                    "KongKeA310_7#position"
                ]
            }
        }
    }, 
    {
   
        "id": "KongKeA310", 
        "availability": "2020-12-01T03:20:00+00:00/2020-12-01T04:50:27+00:00", 
        "polyline": {
   
            "material": {
   
                "solidColor": {
   
                    "color": {
   
                        "rgba": [
                            255, 
                            0, 
                            0, 
                            255
                        ]
                    }
                }
            }, 
            "positions": {
   
                "references": [
                    "KongKeA310_0#position", 
                    "KongKeA310_1#position"
                ]
            }
        }
    }, 
    {
   
        "id": "KongKeA310", 
        "availability": "2020-12-01T03:20:00+00:00/2020-12-01T04:50:27+00:00", 
        "polyline": {
   
            "material": {
   
                "solidColor": {
   
                    "color": {
   
                        "rgba": [
                            0, 
                            0, 
                            255, 
                            255
                        ]
                    }
                }
            }, 
            "positions": {
   
                "references": [
                    "KongKeA310_0#position", 
                    "KongKeA310_2#position"
                ]
            }
        }
    }, 
    {
   
        "id": "KongKeA310", 
        "availability": "2020-12-01T03:20:00+00:00/2020-12-01T04:50:27+00:00", 
        "polyline": {
   
            "material": {
   
                "solidColor": {
   
                    "color": {
   
                        "rgba": [
                            255, 
                            0, 
                            0, 
                            255
                        ]
                    }
                }
            }, 
            "positions": {
   
                "references": [
                    "KongKeA310_0#position", 
                    "KongKeA310_3#position"
                ]
            }
        }
    }, 
    {
   
        "id": "KongKeA310", 
        "availability": "2020-12-01T03:20:00+00:00/2020-12-01T04:50:27+00:00", 
        "polyline": {
   
            "material": {
   
                "solidColor": {
   
                    "color": {
   
                        "rgba": [
                            255, 
                            0, 
                            0, 
                            255
                        ]
                    }
                }
            }, 
            "positions": {
   
                "references": [
                    "KongKeA310_1#position", 
                    "KongKeA310_3#position"
                ]
            }
        }
    }, 
    {
   
        "id": "KongKeA310", 
        "description": {
   
            "string": "空客A310"
        }, 
        "availability": "2020-12-01T03:20:00+00:00/2020-12-01T04:50:27+00:00", 
        "position": {
   
            "epoch": "2020-12-01T03:20:00+00:00", 
            "cartographicDegrees": [
                0.0, 
                -53.99217623754123, 
                -66.47123684645398, 
                798615.7786471198, 
                60.0, 
                -57.16387921611274, 
                -63.12886332648312, 
                797526.816446686, 
                120.0, 
                -59.729380298369406, 
                -59.7366182305942, 
                796325.6737133545, 
                180.0, 
                -61.867247689314645, 
                -56.30867765487782, 
                795027.5593473859, 
                240.0, 
                -63.69401218847015, 
                -52.8540814614167, 
                793648.9366656838, 
                300.0, 
                -65.28851243691038, 
                -49.378844476215505, 
                792207.2897266326, 
                360.0, 
                -66.70582901504315, 
                -45.88712531611388, 
                790720.8732153882, 
                420.0, 
                -67.98555883240657, 
                -42.38190463761466, 
                789208.4492946145, 
                480.0, 
                -69.1569045622752, 
                -38.865395251403406, 
                787689.0151358651, 
                540.0, 
                -70.24190891707195, 
                -35.339296716916515, 
                786181.5241183981, 
                600.0, 
                -71.25756772357742, 
                -31.804970762341828, 
                784704.6109508212, 
                660.0, 
                -72.21725768381961, 
                -28.263537023768173, 
                783276.309931657, 
                720.0, 
                -73.1317132110749, 
                -24.715956812085718, 
                781913.7910875436, 
                780.0, 
                -74.0097201927269, 
                -21.16308177633271, 
                780633.1034314288, 
                840.0, 
                -74.85861600439537, 
                -17.605689311706683, 
                779448.9358334215, 
                900.0, 
                -75.68465957245597, 
                -14.044507276059532, 
                778374.3987000191, 
                960.0, 
                -76.49331232263592, 
                -10.480231274609304, 
                777420.8303946496, 
                1020.0, 
                -77.28945786948975, 
                -6.913536744247636, 
                776597.6319547945, 
                1080.0, 
                -78.07757997087978, 
                -3.3450874251680833, 
                775912.1331896539, 
                1140.0, 
                -78.86191298498645, 
                0.22445859570551052, 
                775369.4926867306, 
                1200.0, 
                -79.64657630827502, 
                3.7944467274243814, 
                774972.6334117515, 
                1260.0, 
                -80.43569869328141, 
                7.3642124448230435, 
                774722.2165205788, 
                1320.0, 
                -81.23354855854369, 
                10.933091761433342, 
                774616.650137009, 
                1380.0, 
                -82.04466808624262, 
                14.500406985151741, 
                774652.1381855634, 
                1440.0, 
                -82.8740283103151, 
                18.065462848492572, 
                774822.7640743598, 
                1500.0, 
                -83.72721348560147, 
                21.62753767242053, 
                775120.6093538798, 
                1560.0, 
                -84.61065031048479, 
                25.185870706520927, 
                775535.9047115108, 
                1620.0, 
                -85.53190281174459, 
                28.73964395190442, 
                776057.2103837895, 
                1680.0, 
                -86.50006277523634, 
                32.2879560714587, 
                776671.6225540314, 
                1740.0, 
                -87.52627996234972, 
                35.829784865203926, 
                777365.0018783823, 
                1800.0, 
                -88.6244993917573, 
                39.36393296191117, 
                778122.2199555824, 
                1860.0, 
                -89.81251152037522, 
                42.88895070865625, 
                778927.4198807596, 
                1920.0, 
                -91.11347868510664, 
                46.403008553978076, 
                779764.2830441484, 
                1980.0, 
                -92.55822715583326, 
                49.90373180298083, 
                780616.3057983423, 
                2040.0, 
                -94.18875972579261, 
                53.387911536241745, 
                781467.0706310599, 
                2100.0, 
                -96.0638260007596, 
                56.851057449533016, 
                782300.5155241127, 
                2160.0, 
                -98.26804269052126, 
                60.28664828117913, 
                783101.1941301204, 
                2220.0, 
                -100.92737330926431, 
                63.68482791170181, 
                783854.5233765577, 
                2280.0, 
                -104.23639629479999, 
                67.03002504405283, 
                784547.0148882202, 
                2340.0, 
                -108.50799810576987, 
                70.29636868191491, 
                785166.4869603548, 
                2400.0, 
                -114.26549556241477, 
                73.43835566854796, 
                785702.2541804373, 
                2460.0, 
                -122.40589023449701, 
                76.37099035361557, 
                786145.2921784526, 
                2520.0, 
                -134.4095951479454, 
                78.92795290413083, 
                786488.3753753313, 
                2580.0, 
                -152.1115468857496, 
                80.79197290549683, 
                786726.1861169143, 
                2640.0, 
                -175.27894840466038, 
                81.4953552797138, 
                786855.3930374832, 
                2700.0, 
                161.61345342765466, 
                80.76916746789958, 
                786874.6999193392, 
                2760.0, 
                144.01701629211746, 
                78.89017730446922, 
                786784.8612878101, 
                2820.0, 
                132.09352113800446, 
                76.32523478301769, 
                786588.6671467246, 
                2880.0, 
                124.0033532096746, 
                73.38856884619494, 
                786290.8959630061, 
                2940.0, 
                118.27679063192181, 
                70.24462351268402, 
                785898.2366925412, 
                3000.0, 
                114.02487138345691, 
                66.97747127521171, 
                785419.1808309994, 
                3060.0, 
                110.72890862606408, 
                63.632163184931265, 
                784863.8858614527, 
                3120.0, 
                108.07859807251837, 
                60.23433700366141, 
                784244.0118596142, 
                3180.0, 
                105.88083517360282, 
                56.79943564406006, 
                783572.533405674, 
                3240.0, 
                104.01052834170896, 
                53.337237375074075, 
                782863.5288505016, 
                3300.0, 
                102.3836008797955, 
                49.854220627727535, 
                782131.9527409489, 
                3360.0, 
                100.94164497981869, 
                46.35484146442443, 
                781393.387458419, 
                3420.0, 
                99.64288417607032, 
                42.84228580487493, 
                780663.7872197804, 
                3480.0, 
                98.45664666295396, 
                39.318912965351664, 
                779959.2112279384, 
                3540.0, 
                97.35987565463864, 
                35.786533154793744, 
                779295.5529369329, 
                3600.0, 
                96.33485796088384, 
                32.246585635355196, 
                778688.2693114479, 
                3660.0, 
                95.36770426002302, 
                28.700256111850443, 
                778152.1145531591, 
                3720.0, 
                94.44730616585011, 
                25.148555717363706, 
                777700.8828168124, 
                3780.0, 
                93.56460318427324, 
                21.59237501761411, 
                777347.1644018892, 
                3840.0, 
                92.71205536109605, 
                18.03252134793047, 
                777102.1197749503, 
                3900.0, 
                91.8832542797516, 
                14.469742403508056, 
                776975.2755061567, 
                3960.0, 
                91.07263177670045, 
                10.904753916679939, 
                776974.3462688726, 
                4020.0, 
                90.27522839251621, 
                7.338237962009254, 
                777105.085198323, 
                4080.0, 
                89.48651197469054, 
                3.7708613528226533, 
                777371.1672042642, 
                4140.0, 
                88.70222310890854, 
                0.20327954119284827, 
                777774.1060266686, 
                4200.0, 
                87.9182393541507, 
                -3.3638586762854303, 
                778313.2073503787, 
                4260.0, 
                87.13044843809344, 
                -6.92990722211762, 
                778985.5587980347, 
                4320.0, 
                86.33462213732386, 
                -10.494218834120444, 
                779786.0570283089, 
                4380.0, 
                85.5262826445403, 
                -14.056140463699704, 
                780707.4714423213, 
                4440.0, 
                84.70055238873164, 
                -17.615007184831764, 
                781740.5432940938, 
                4500.0, 
                83.8519763818854, 
                -21.170133680213443, 
                782874.1183283605, 
                4560.0, 
                82.97430228441287, 
                -24.720804503445773, 
                784095.3112973204, 
                4620.0, 
                82.06020227636824, 
                -28.266247253846906, 
                785389.6942878726, 
                4680.0, 
                81.1009000675712, 
                -31.805622145163312, 
                786741.517799139, 
                4740.0, 
                80.0856738757026, 
                -35.33797709468924, 
                788133.9442703321, 
                4800.0, 
                79.00116471146922, 
                -38.862199141796665, 
                789549.3020749345, 
                4860.0, 
                77.830397535215, 
                -42.37694024876411, 
                790969.3508347146, 
                4920.0, 
                76.55136058418572, 
                -45.880507572313185, 
                792375.5544214929, 
                4980.0, 
                75.13489461236917, 
                -49.370697842018004, 
                793749.3572291749, 
                5040.0, 
                73.54146569172563, 
                -52.84454096398179, 
                795072.459383208, 
                5100.0, 
                71.71608780139051, 
                -56.29789088347948, 
                796327.0867123109, 
                5160.0, 
                69.58006908582051, 
                -59.724749084819834, 
                797496.2515239409, 
                5220.0, 
                67.01711501887196, 
                -63.11609903085753, 
                798564.0004909518, 
                5280.0, 
                63.84905029042485, 
                -66.45780359709025, 
                799515.6468556231, 
                5340.0, 
                59.79192109330672, 
                -69.72659072168626, 
                800337.9802230602, 
                5400.0, 
                54.3748372471523, 
                -72.88201254281361, 
                801019.460619205
            ], 
            "interpolationAlgorithm": "LAGRANGE", 
            "referenceFrame": "FIXED"
        }, 
        "label": {
   
            "show": true, 
            "text": "KongKeA310", 
            "horizontalOrigin": "LEFT", 
            "pixelOffset": {
   
                "cartesian2": [
                    12, 
                    0
                ]
            }, 
            "font": "11pt Lucida Console", 
            "fillColor": {
   
                "rgba": [
                    213, 
                    0, 
                    255, 
                    255
                ]
            }
        }, 
        "path": {
   
            "show": true, 
            "width": 2, 
            "resolution": 120, 
            "material": {
   
                "solidColor": {
   
                    "color": {
   
                        "rgba": [
                            213, 
                            0, 
                            255, 
                            255
                        ]
                    }
                }
            }
        }, 
        "orientation": {
   
            "velocityReference": "#position"
        }, 
        "model": {
   
            "gltf": "../SampleData/models/CesiumAir/Cesium_Air.glb",
            "scale": 10000
        }
    }, 
    {
   
        "id": "KongKeA310", 
        "availability": "2020-12-01T03:20:00+00:00/2020-12-01T04:50:27+00:00", 
        "position": {
   
            "epoch": "2020-12-01T03:20:00+00:00", 
            "cartographicDegrees": [
                0.0, 
                -54.17218036546724, 
                -66.56020883419973, 
                0.0, 
                60.0, 
                -57.34770220657406, 
                -63.20748176201181, 
                0.0, 
                120.0, 
                -59.910562679573246, 
                -59.80552638827344, 
                0.0, 
                180.0, 
                -62.042313557826304, 
                -56.369148436979394, 
                0.0, 
                240.0, 
                -63.86153731444026, 
                -52.90752110226652, 
                0.0, 
                300.0, 
                -65.44825423573391, 
                -49.42654128293074, 
                0.0, 
                360.0, 
                -66.85814667927941, 
                -45.93016698549559, 
                0.0, 
                420.0, 
                -68.13108062083508, 
                -42.42117656861693, 
                0.0, 
                480.0, 
                -69.29635227300676, 
                -38.90160816246923, 
                0.0, 
                540.0, 
                -
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

浮年似水

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值