var viewer = new Cesium.Viewer(‘cs‘);// viewer.entities.add({//正方形// position:Cesium.Cartesian3.fromDegrees(-9300,1000,1400),// box:{// dimensions:new Cesium.Cartesian3(800000.0, 800000.0,800000.0),// material:‘/img/cesium.png‘// }// })// viewer.entities.add({//球体// position: Cesium.Cartesian3.fromDegrees(-300,100,400),// ellipsoid:{// radii :new Cesium.Cartesian3(800000.0, 800000.0,800000.0),// material:‘/img/cesium.png‘// }// })// viewer.entities.add({//圆柱// position: Cesium.Cartesian3.fromDegrees(-300,100,400),// cylinder :{// length : 400000.0,// topRadius : 200000.0,// bottomRadius : 200000.0,// material : Cesium.Color.GREEN.withAlpha(0.5),// outline : true,// outlineColor : Cesium.Color.DARK_GREEN//// }// })// viewer.entities.add({//圆锥// position: Cesium.Cartesian3.fromDegrees(116.423241,43.920026, 200000.0),// cylinder : {// length : 400000.0,// topRadius : 0.0,// bottomRadius : 200000.0,// material : Cesium.Color.RED// }// })viewer.entities.add({ polygon: { hierarchy: Cesium.Cartesian3.fromDegreesArray([ -197.0, 231.0, -97.0, 339.0, -87.0, 359.0, -8237.0, 31.0]), height : 500000,//多边形高度 material : Cesium.Color.RED.withAlpha(1),//红色不透明 outline : true, outlineColor : Cesium.Color.ORANGE//橘色轮廓线 }})viewer.entities.add({ polyline : { positions : Cesium.Cartesian3.fromDegreesArray([-75, 35, -125, 35]), width : 5, material : Cesium.Color.RED }}); viewer.entities.add({ polyline : { positions : Cesium.Cartesian3.fromDegreesArray([-75, 37, -125, 37]), width : 10, material : new Cesium.PolylineGlowMaterialProperty({ glowPower : 0.2,//发光强度的属性,以总线宽度的百分比表示。 color : Cesium.Color.BLUE }) }}); viewer.entities.add({ polyline : { positions : Cesium.Cartesian3.fromDegreesArrayHeights([-75, 39, 250000, -125, 39, 250000]), width : 5, material : new Cesium.PolylineOutlineMaterialProperty({ color : Cesium.Color.ORANGE, outlineWidth : 2, outlineColor : Cesium.Color.BLACK }) }}); viewer.entities.add({ polyline : { positions : Cesium.Cartesian3.fromDegreesArrayHeights([-75, 43, 500000, -125, 43, 500000]), width : 10, followSurface : false, material : new Cesium.PolylineArrowMaterialProperty(Cesium.Color.PURPLE) }}); viewer.entities.add({//蓝色多边形 polygon : { hierarchy : { positions : Cesium.Cartesian3.fromDegreesArray([-99.0, 30.0, -85.0, 30.0, -85.0, 40.0, -99.0, 40.0]), holes : [{ positions : Cesium.Cartesian3.fromDegreesArray([ -97.0, 31.0, -97.0, 39.0, -87.0, 39.0, -87.0, 31.0 ]), holes : [{ positions : Cesium.Cartesian3.fromDegreesArray([ -95.0, 33.0, -89.0, 33.0, -89.0, 37.0, -95.0, 37.0 ]), holes : [{ positions : Cesium.Cartesian3.fromDegreesArray([ -93.0, 34.0, -91.0, 34.0, -91.0, 36.0, -93.0, 36.0 ]) }] }] }] }, material : Cesium.Color.BLUE.withAlpha(0.5), outline : true, outlineColor : Cesium.Color.BLACK }}); viewer.entities.add({//绿色多边形 polygon : { hierarchy : Cesium.Cartesian3.fromDegreesArray([-108.0, 42.0, -100.0, 42.0, -104.0, 40.0]), extrudedHeight: 500000.0, material : Cesium.Color.GREEN, closeTop : false, closeBottom : false }});
原文地址:https://www.cnblogs.com/-llf/p/9929959.html
时间: 2024-10-11 03:28:18