使用viewer.entities.add
方式加载Entity
类型的polyline
var blueLine = viewer.entities.add({
name : 'Wide blue dashed line with a gap color',
polyline : {
positions : Cesium.Cartesian3.fromDegreesArrayHeights([-75, 40, 250000,
-125, 40, 250000]),
width : 30,
material : new Cesium.PolylineDashMaterialProperty({
color : Cesium.Color.BLUE,
gapColor: Cesium.Color.YELLOW
}),
clampToGround : true,
}
});
可以直接设置其线宽:
blueLine.polyline.width=10;
如果改为使用GroundPolylinePrimitive
创建贴地线,怎么动态改变其线宽
// Polyline Outline
scene.groundPrimitives.add(new Cesium.GroundPolylinePrimitive({
geometryInstances : new Cesium.GeometryInstance({
geometry : new Cesium.GroundPolylineGeometry({
positions : Cesium.Cartesian3.fromDegreesArray([
-122.2558, 46.1995,
-122.1058, 46.1995
]),
width : 10.0 //??怎么动态修改
})
}),
appearance : new Cesium.PolylineMaterialAppearance({
material : Cesium.Material.fromType(Cesium.Material.PolylineOutlineType)
})
}));