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
| var viewer = new Cesium.Viewer('cesiumContainer');
//添加一个多边形 var wyoming = viewer.entities.add({ name : 'Wyoming', polygon : { hierarchy : Cesium.Cartesian3.fromDegreesArray([ -109,45, -105,45, -104,44, -104,43, -104,41, -105,40, -107,41, -109,40, -111,40, -111,42, -111,44, -111,45 ]), minimumPixelSize : 800, maximumScale : 1000, height : 0, material : Cesium.Color.RED.withAlpha(0.5), outline : true, outlineColor : Cesium.Color.BLACK } });
var heading = Cesium.Math.toRadians(90); var pitch = Cesium.Math.toRadians(-30);
viewer.zoomTo(wyoming, new Cesium.HeadingPitchRange(heading, pitch));
viewer.flyTo(wyoming).then(function(){ if(result){ viewer.selectedEntity = wyoming; } });
|