vue cesium定位到指定位置
window.viewer.camera.flyTo({destination: Cesium.Cartesian3.fromDegrees(point.longDeg, point.latDeg, 6500000), orientation: {heading: 6.2079384332084935, roll: 0.00031509431759868534, pitch: -1.535}, duration: 3})
vue cesium加载点
// 加载点位
function addPoints(pointArr, point, show) {let shenhaiPoint = ''if (boatLayer.length != 0) {boatLayer.forEach(item => {window.viewer.entities.remove(item)})}pointArr.forEach((item, i) => {boatLayer[i] = window.viewer.entities.add({id: item.id, name: item.name, position: Cesium.Cartesian3.fromDegrees(item.jd, item.wd, 0), billboard: {// 图像地址,URI或Canvas的属性image: item.img || '/static/img/earth/boat_point.png', // image: item.img,// 设置颜色和透明度// color: Cesium.Color.WHITE.withAlpha(0.8),// 高度(以像素为单位)height: 20, // 宽度(以像素为单位)width: 15, // 逆时针旋转,表示Billboard绕其原点旋转的角度(弧度)rotation: -((item.hdg > 360 ? item.cog : item.hdg) * Math.PI / 180), // rotation:-Cesium.Math.PI_OVER_FOUR *2,// 大小是否以米为单位sizeInMeters: false, // 相对于坐标的垂直位置// verticalOrigin: Cesium.VerticalOrigin.CENTER,// 相对于坐标的水平位置// horizontalOrigin: Cesium.HorizontalOrigin.CENTER,// 该属性指定标签在屏幕空间中距此标签原点的像素偏移量// pixelOffset: new Cesium.Cartesian2(-7, 0),scaleByDistance: new Cesium.NearFarScalar(2000, 1, 100000000, 0.1), // 显示在距相机的距离处的属性,多少区间内是可以显示的distanceDisplayCondition: new Cesium.DistanceDisplayCondition(0, 100000000), show: true, // 是否显示alignedAxis: Cesium.Cartesian3.ZERO, // defaultheightReference: Cesium.HeightReference.CLAMP_TO_GROUND,}, label: {text: item.name,show:true,font: "10px Source Han Sans CN", //字体样式fillColor: Cesium.Color.WHITE, //字体颜色backgroundColor: Cesium.Color.fromCssColorString('red').withAlpha(0), //背景颜色showBackground: true, //是否显示背景颜色style: Cesium.LabelStyle.FILL_AND_OUTLINE, //label样式outlineWidth: 3, // verticalOrigin: Cesium.VerticalOrigin.CENTER, //垂直位置// horizontalOrigin: Cesium.HorizontalOrigin.LEFT, //水平位置pixelOffset: new Cesium.Cartesian2(0, -15) //偏移}, clampToGround: true});})
}