cesium初始化设置 雾气、 版权信息、vue拦截、汉化帮助按钮

初始化设置 关闭雾气、 版权信息
    viewer.scene.fog.enabled = false;//关闭雾气
    viewer.scene.globe.showGroundAtmosphere = false;//关闭大器
    viewer.scene.globe.baseColor = Color.fromCssColorString(CONFIG.backColor);//设置地球默认背景颜色
    viewer._cesiumWidget._creditContainer.style.display = "none";// 去掉版权信息
vue与cesium结合,不让vue拦截cesium

为了不让vue 拦截cesium对象,与cesium相关的属性对象前缀必须是’_‘或’$
Properties that start with _ or $ will not be proxied on the component instance because they may conflict with Vue’s internal properties and API methods. You will have to access them as vm.$data._property.

cesium帮助按钮汉化:
function navigationHelpButtonLang(_viewer) {
   
  var viewer = _viewer;
  if (viewer.navigationHelpButton) {
   
    viewer.navigationHelpButton.viewModel.tooltip = "操作指南";

    var clickHelper = viewer.navigationHelpButton.container.getElementsByClassName(
      "cesium-click-navigation-help"
    )
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Vue项目中,可以使用`vue-cesium`库来初始化Cesium。具体步骤如下: 1. 安装`vue-cesium`库 ``` npm install vue-cesium --save ``` 2. 在`main.js`中引入`vue-cesium` ```javascript import VueCesium from 'vue-cesium' Vue.use(VueCesium); ``` 3. 在Vue组件中使用`cesium-viewer`组件来初始化Cesium ```html <template> <cesium-viewer :options="cesiumOptions"></cesium-viewer> </template> <script> export default { data() { return { cesiumOptions: { animation: false, baseLayerPicker: false, fullscreenButton: false, geocoder: false, homeButton: false, infoBox: false, sceneModePicker: false, selectionIndicator: false, timeline: false, navigationHelpButton: false, navigationInstructionsInitiallyVisible: false, scene3DOnly: true, imageryProvider: new Cesium.UrlTemplateImageryProvider({ url: 'http://www.example.com/{z}/{x}/{y}.jpg' }), terrainProvider: new Cesium.CesiumTerrainProvider({ url: 'http://www.example.com/terrain', requestVertexNormals: true }), skyBox: new Cesium.SkyBox({ sources: { positiveX: 'http://www.example.com/skybox/px.jpg', negativeX: 'http://www.example.com/skybox/nx.jpg', positiveY: 'http://www.example.com/skybox/py.jpg', negativeY: 'http://www.example.com/skybox/ny.jpg', positiveZ: 'http://www.example.com/skybox/pz.jpg', negativeZ: 'http://www.example.com/skybox/nz.jpg' } }), skyAtmosphere: new Cesium.SkyAtmosphere() } } } } </script> ``` 在`cesiumOptions`中设置Cesium初始化选项,例如`imageryProvider`用于指定底图,`terrainProvider`用于指定地形数据,`skyBox`和`skyAtmosphere`用于指定天空盒和大气效果。 更多初始化选项可以参考[Cesium文档](https://cesium.com/docs/cesiumjs-ref-doc/Viewer.html)。 4. 样式处理 `vue-cesium`的样式需要手动引入,可以在`App.vue`中引入: ```html <template> <div id="app"> <cesium> <router-view /> </cesium> </div> </template> <script> import 'vue-cesium/dist/vue-cesium.css' export default { name: 'App' } </script> ```

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值