当前位置:网站首页 > C++编程 > 正文

Cesium:entity实体二维贴地运动+模型转向

var viewer = new Cesium.Viewer('cesiumContainer', { sceneMode: 2, infoBox: false, //Disable InfoBox widget selectionIndicator: false, //Disable selection indicator shouldAnimate: true, // Enable animations terrainProvider: Cesium.createWorldTerrain() }); //Enable lighting based on the sun position viewer.scene.globe.enableLighting = true; //Enable depth testing so things behind the terrain disappear. viewer.scene.globe.depthTestAgainstTerrain = true; //Set the random number seed for consistent results. Cesium.Math.setRandomNumberSeed(3); //Set bounds of our simulation time var start = Cesium.JulianDate.fromDate(new Date(2015, 2, 25, 16)); var stop = Cesium.JulianDate.addSeconds(start, 360, new Cesium.JulianDate()); //Make sure viewer is at the desired time. viewer.clock.startTime = start.clone(); viewer.clock.stopTime = stop.clone(); viewer.clock.currentTime = start.clone(); viewer.clock.clockRange = Cesium.ClockRange.LOOP_STOP; //Loop at the end viewer.clock.multiplier = 10; //Set timeline to simulation bounds viewer.timeline.zoomTo(start, stop); function computeCirclularFlight(start) { var polyLinePositions=[ [70, 20, ,], [-80, 44, ,], [-90, 18, ,], [-98, 52, ,] ] var property = new Cesium.SampledPositionProperty(); for (var i = 0; i < polyLinePositions.length; i++) { var time = Cesium.JulianDate.addSeconds(start, i * 10, new Cesium.JulianDate()); // 将经纬度坐标转换为三维空间坐标 var position = Cesium.Cartesian3.fromDegrees(polyLinePositions[i][0], polyLinePositions[i][1], polyLinePositions[i][2]); // Property最大的特点是和时间相互关联,在不同的时间可以动态地返回不同的属性值; // Entity则可以感知这些Property的变化,在不同的时间驱动物体进行动态展示; property.addSample(time, position); } return property; } //Compute the entity position property. var position = computeCirclularFlight(start); //Actually create the entity var entity = viewer.entities.add({ //Set the entity availability to the same interval as the simulation time. availability : new Cesium.TimeIntervalCollection([new Cesium.TimeInterval({ start : start, stop : stop })]), //Use our computed positions position : position,//Automatically compute orientation based on position movement. orientation : new Cesium.VelocityOrientationProperty(position), //Load the Cesium plane model to represent the entity "billboard" : { "image" : "data:image/svg+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ljc0NTg4MnpNNTQ0LjUyNzA1OSA4OTAuMjc3NjQ3bDkuNjM3NjQ3LTI2MC4yMTY0NzEtMTguMDcwNTg4IDMuNjE0MTE4IDguNDMyOTQxIDI1Ni42MDIzNTN6IiBwLWlkPSIzNjA0IiBmaWxsPSIjZDgxZTA2Ij48L3BhdGg+PC9zdmc+", "scale" : 0.5, "alignedAxis" : new Cesium.VelocityVectorProperty(position, true) }, //将路径显示为以0.1秒为增量采样的路径线。 path : { resolution : 0.1, material : new Cesium.PolylineGlowMaterialProperty({ glowPower : 0.1, color : Cesium.Color.YELLOW }), width :3 }, // 贴底线 // polyline : { // positions : Cesium.Cartesian3.fromDegreesArray([70, 20,-80, 44,-90, 18,-98, 52,]), // width : 3, // material : Cesium.Color.YELLOW, // clampToGround : true // } }); //~~~~~~~~~~~~~~~~~~~~平滑插值~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // entity.position.setInterpolationOptions({ // interpolationDegree:5, //1 2 5 // interpolationAlgorithm: Cesium.LagrangePolynomialApproximation // })

到此这篇Cesium:entity实体二维贴地运动+模型转向的文章就介绍到这了,更多相关内容请继续浏览下面的相关推荐文章,希望大家都能在编程的领域有一番成就!

版权声明


相关文章:

  • Cesium基于czml的model模型转向2024-12-02 20:27:06
  • ElementUI 遍历实现checkbox组件的多选全选功能2024-12-02 20:27:06
  • Cesium绘制矩形2024-12-02 20:27:06
  • Cesium鼠标移出地图控件时执行相应操作2024-12-02 20:27:06
  • cesium切换图层及初始时定位至中国2024-12-02 20:27:06
  • Ceisum二维状态下czml贴地光滑运动2024-12-02 20:27:06
  • cesium经纬度转笛卡尔坐标2024-12-02 20:27:06
  • Cesium笛卡尔坐标转wgs84坐标x、y、z2024-12-02 20:27:06
  • Cesium-CZML介绍2024-12-02 20:27:06
  • ElementUI 根据条件筛选符合条件的下拉框选项@visible-change2024-12-02 20:27:06
  • 全屏图片