1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
| const viewer = new Cesium.Viewer("cesiumContainer");
const redLine = viewer.entities.add({ name: "红色虚线", polyline: { positions: Cesium.Cartesian3.fromDegreesArrayHeights([ -75, 38, 250000, -125, 38, 250000, ]), width: 5, material: new Cesium.PolylineDashMaterialProperty({ color: Cesium.Color.RED, }), }, });
const blueLine = viewer.entities.add({ name: "宽的蓝黄相间的虚线", 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, }), }, });
const orangeLine = viewer.entities.add({ name: "橙色的虚线,且设置了虚线的短划线长度", polyline: { positions: Cesium.Cartesian3.fromDegreesArrayHeights([ -75, 42, 250000, -125, 42, 250000, ]), width: 5, material: new Cesium.PolylineDashMaterialProperty({ color: Cesium.Color.ORANGE, dashLength: 8.0, }), }, });
const cyanLine = viewer.entities.add({ name: "带有虚线图案的青色虚线", polyline: { positions: Cesium.Cartesian3.fromDegreesArrayHeights([ -75, 44, 250000, -125, 44, 250000, ]), width: 10, material: new Cesium.PolylineDashMaterialProperty({ color: Cesium.Color.CYAN,
dashPattern: parseInt("110000001111", 2), }), }, });
const yellowLine = viewer.entities.add({ name: "带有虚线图案的黄色虚线", polyline: { positions: Cesium.Cartesian3.fromDegreesArrayHeights([ -75, 46, 250000, -125, 46, 250000, ]), width: 10, material: new Cesium.PolylineDashMaterialProperty({ color: Cesium.Color.YELLOW,
dashPattern: parseInt("1010101010101010", 2), }), }, });
viewer.zoomTo(viewer.entities);
|