赞
踩
设置代码中的homeButton
var TDT_IMG_C = "https://{s}.tianditu.gov.cn/img_c/wmts?service=wmts&request=GetTile&version=1.0.0" + "&LAYER=img&tileMatrixSet=c&TileMatrix={TileMatrix}&TileRow={TileRow}&TileCol={TileCol}" + "&style=default&format=tiles&tk=fa7ec9766b2c00747e3dd60ab3d05892"; var viewer = new Cesium.Viewer('map', { baseLayerPicker: false, // 影像切换 animation: false, //是否显示动画控件 timeline: false, //是否显示时间线控件 infoBox: false, //是否显示点击要素之后显示的信息 geocoder: false, //是否显示地名查找控件 navigationHelpButton: false, //是否显示帮助信息控件 homeButton:true,//控制home键显隐 imageryProvider: new Cesium.WebMapTileServiceImageryProvider({ url: TDT_IMG_C, layer: "tdtImg_c", style: "default", format: "tiles", tileMatrixSetID: "c", subdomains: ["t0", "t1", "t2", "t3", "t4", "t5", "t6", "t7"], tilingScheme: new Cesium.GeographicTilingScheme(), tileMatrixLabels: ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19"], maximumLevel: 50, show: false }) })
// 创建 Cesium Viewer
var viewer = new Cesium.Viewer('cesiumContainer');
// 设置 home 键
viewer.homeButton.viewModel.command = function() {
// 设置相机位置
viewer.camera.setView({
destination: Cesium.Cartesian3.fromDegrees(120.678594, 24.803711, 1000),
orientation: {
heading: Cesium.Math.toRadians(0),
pitch: Cesium.Math.toRadians(-30),
roll: 0.0
}
});
};
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。