代码为:
polylineGeometry = viewer.entities.add({ name: "newPolygon", polyline: { positions: new CallbackProperty(e => { return tempPoints; }, false), clampToGround: true,//贴地画线 width: 5.0, material: new PolylineGlowMaterialProperty(cesiumColor.GOLD), depthFailMaterial: new PolylineGlowMaterialProperty(cesiumColor.GOLD), } });
贴地划线的主要代码为:clampToGround: true,//贴地画线,加上后就可以进行线贴地了。
效果如下: