GroundPolylineGeometry
GroundPolylineGeometry是一个类,用于创建一个放置在地面的折线几何体。
使用方法
要使用GroundPolylineGeometry类,需要添加一个示例到场景中。示例代码如下:
var viewer = new Cesium.Viewer('cesiumContainer');
var positions = Cesium.Cartesian3.fromDegreesArray([
-90.0, 32.0,
-85.0, 32.0,
-80.0, 34.0,
-75.0, 34.0,
-70.0, 36.0 ]);
var groundPolyline = new Cesium.GroundPolylineGeometry({
width: 3,
positions: positions
});
var geometryInstance = new Cesium.GeometryInstance({
geometry: groundPolyline
});
viewer.scene.primitives.add(new Cesium.Primitive({
geometryInstances: geometryInstance,
appearance: new Cesium.PolylineMaterialAppearance({})
}));
属性
GroundPolylineGeometry具有以下属性:
示例
以下代码展示了如何使用GroundPolylineGeometry创建一个放置在地面的折线几何体:
var viewer = new Cesium.Viewer('cesiumContainer');
var positions = Cesium.Cartesian3.fromDegreesArray([
-90.0, 32.0,
-85.0, 32.0,
-80.0, 34.0,
-75.0, 34.0,
-70.0, 36.0 ]);
var groundPolyline = new Cesium.GroundPolylineGeometry({
width: 3,
positions: positions
});
var geometryInstance = new Cesium.GeometryInstance({
geometry: groundPolyline,
attributes: {
color: Cesium.ColorGeometryInstanceAttribute.fromColor(Cesium.Color.RED)
}
});
viewer.scene.primitives.add(new Cesium.Primitive({
geometryInstances: geometryInstance,
appearance: new Cesium.PolylineColorAppearance()
}));
该折线使用红色颜色,宽度为3个像素,放置在地面上。
相关链接