primitive方式要复杂一些,但是效率要高一些
primitive方式
function createPrimitive(coordinate) { let polyline = new Cesium.GroundPolylineGeometry({ positions: Cesium.Cartesian3.fromDegreesArray(coordinate.flat()), width: 25, }) let instance = new Cesium.GeometryInstance({ geometry : polyline, }) let primitive = new Cesium.GroundPolylinePrimitive({ geometryInstances : instance, appearance : new Cesium.PolylineMaterialAppearance({ material: new Cesium.Material({ fabric : { type : 'PolylineGlow', uniforms : { color: Cesium.Color.fromCssColorString("#1039ff"), glowPower: 0.1, } } }) }) }) viewer.scene.primitives.add(primitive); }
entity方式
function createEntity(coordinate) { viewer.entities.add({ polyline: { positions: Cesium.Cartesian3.fromDegreesArray(coordinate.flat()), width: 25, material: new Cesium.PolylineGlowMaterialProperty({ glowPower: 0.1, color: Cesium.Color.fromCssColorString("#1039ff"), }), clampToGround: true, } }) }
效果
标签:primitive,entity,coordinate,polyline,Cesium,new From: https://www.cnblogs.com/LcxSummer/p/17777743.html