Cesium小功能
2019-03-15 16:07:32 来源:admin 点击:1469
Cesium定位高度相机和中心点
viewer.camera.flyTo({
destination : Cesium.Cartesian3.fromDegrees(116.3436, 39.97505,15000000),
});
设置homebutton的位置
Cesium.Camera.DEFAULT_VIEW_RECTANGLE =
Cesium.Rectangle.fromDegrees(110.15, 34.54, 110.25, 34.56);//Rectangle(west, south, east, north)
设置初始位置
viewer.camera.setView({
destination: Cesium.Cartesian3.fromDegrees(110.20, 34.55, 3000000)
});
去掉logo
viewer._cesiumWidget._creditContainer.style.display = "none";
2. 如何显示帧速(FPS)
viewer.scene.debugShowFramesPerSecond = true;
3. 如何关闭大气层显示
scene.skyAtmosphere.show = false;
4. 如何使用本地底图代替服务
var viewer = new Cesium.Viewer('cesiumContainer', { //1.Cesium本地服务 //imageryProvider: Cesium.createTileMapServiceImageryProvider({ //url: Cesium.buildModuleUrl('Assets/Textures/NaturalEarthII') //}), //2.本地图片 imageryProvider: new Cesium.SingleTileImageryProvider({ url : 'Assets/Textures/worldimage.jpg' }) });
5.控制图层显隐
var data; viewer.dataSources.add(Cesium.KmlDataSource.load('facilities.kml', options)).then(function(dataSource) { data = dataSource; }); //这里可以控制 data.show = false;
6.点击view home 按钮之后跳转到自定义位置
// Override behavior of home button viewer.homeButton.viewModel.command.beforeExecute.addEventListener(function(commandInfo) { // Fly to custom position viewer.camera.flyToBoundingSphere(boundingSphere); // Tell the home button not to do anything commandInfo.cancel = true; });
7.控制视角不转到地下
this.viewer.scene.globe.depthTestAgainstTerrain = true;
8. 如何禁止entity选中
varviewer = newCesium.Viewer(‘cesiumContainer’, {
…
selectionIndicator:false
});