cesium两种方式添加发光贴地线

一:实体entity

viewer.entities.add({
    name:"",
    polyline: {
        positions: Cesium.Cartesian3.fromDegreesArrayHeights([104.57311103029339,30.71454550939871,451.0205115032204,104.57369073762032,30.71350155773247,437.4264690503778,104.57414650599235,30.7135714014856,444.54897812734873,104.5740256006362,30.714837602541927,448.69868845044147,104.57483833991859,30.72413178951584,445.16245273847795]),
        width: 15,
        material: new Cesium.PolylineGlowMaterialProperty({
            glowPower: 0.1,
            color: Cesium.Color.fromCssColorString('#ff0000')
        }),
        clampToGround: true,
    },
});

二:图元primitives

let instance = new Cesium.GeometryInstance({
    geometry : new Cesium.GroundPolylineGeometry({//贴地折线geomotry类
        positions : Cesium.Cartesian3.fromDegreesArrayHeights([104.57311103029339,30.71454550939871,451.0205115032204,104.57369073762032,30.71350155773247,437.4264690503778,104.57414650599235,30.7135714014856,444.54897812734873,104.5740256006362,30.714837602541927,448.69868845044147,104.57483833991859,30.72413178951584,445.16245273847795]),
        width : 18.0
    })
});


let groundPolylinePrimitive = new Cesium.GroundPolylinePrimitive({//贴地折线primitive类
    geometryInstances : instance,
    appearance : new Cesium.PolylineMaterialAppearance({
        material: new Cesium.Material({
            fabric : {
                type : Cesium.Material.PolylineGlowType,
                uniforms: {
                    color:  Cesium.Color.fromCssColorString('#0000ff'),
                    glowPower:0.1,
                }
            }
        })
    })
});

viewer.scene.primitives.add(groundPolylinePrimitive);

你可能感兴趣的:(javascript)