当前位置: 首页 > news >正文

衡阳商城网站制作中国大连网站

衡阳商城网站制作,中国大连网站,网站建设审核,越秀区建网站的公司使用ViteVue3.2Cesium。Vite需要Node.js版本14.18及以上版本。Vite命令创建的工程会自动生成vite.config.js文件,来配置一些相关的参数。 1、使用Vite创建vue3项目 # npm npm init vitelatest cesium-app -- --template vue # yarn yarn create vite cesium-app…

        使用Vite+Vue3.2+Cesium。Vite需要Node.js版本14.18+及以上版本。Vite命令创建的工程会自动生成vite.config.js文件,来配置一些相关的参数。

1、使用Vite创建vue3项目

#  npm

npm init vite@latest cesium-app -- --template vue

#  yarn 

yarn create vite cesium-app --template vue

#  pnpm 

pnpm create vite cesium-app -- --template vue

***注:设置项目名称为cesium-app

2、引入Cesium插件

#  npm

npm install cesium vite-plugin-cesium vite -D

#  yarn 

yarn add cesium vite-plugin-cesium vite -D

#  pnpm 

pnpm install cesium vite-plugin-cesium vite -D

3、创建vite.config.js

import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import cesium from 'vite-plugin-cesium';
export default defineConfig({plugins: [vue(),cesium()]
});

4、页面中使用

<template><div><div class="full-container" :style="viewStyle" id="cesiumContainer" /><div id="loadingOverlay"><h1>Loading...</h1></div></div>
</template><script setup>
import { reactive, onMounted } from "vue";
import * as Cesium from "cesium";const props = defineProps({viewStyle: {},viewerProperty: {},dropBackground: {default: false,},
});onMounted(() => {const _this = this;const tianDiTuToken = "自己注册的天地图key";// 服务负载子域const subdomains = ["0", "1", "2", "3", "4", "5", "6", "7"];// 创建图层const viewer = new Cesium.Viewer("cesiumContainer", {animation: false, //是否创建动画小器件,左下角仪表timeline: false, //是否显示时间轴geocoder: false, //是否显示geocoder小器件,右上角查询按钮baseLayerPicker: false, //是否显示图层选择器fullscreenButton: false, //是否显示全屏按钮homeButton: true, //是否显示Home按钮infoBox: false, //是否显示信息框sceneModePicker: false, //是否显示3D/2D选择器scene3DOnly: false, //如果设置为true,则所有几何图形以3D模式绘制以节约GPU资源selectionIndicator: false, //是否显示选取指示器组件navigationHelpButton: false, //是否显示右上角的帮助按钮baselLayerPicker: false, // 将图层选择的控件关掉,才能添加其他影像数据shadows: true, //是否显示背影imageryProvider: new Cesium.WebMapTileServiceImageryProvider({// 影像底图url: `http://t0.tianditu.com/img_w/wmts?service=wmts&request=GetTile&version=1.0.0&LAYER=img&tileMatrixSet=w&TileMatrix={TileMatrix}&TileRow={TileRow}&TileCol={TileCol}&style=default&format=tiles&tk=${tianDiTuToken}`,layer: "tdtBasicLayer",style: "default",format: "image/jpeg",subdomains: subdomains,tileMatrixSetID: "GoogleMapsCompatible",maximumLevel: 18,}),});//   将图层挂载到window上window.cesiumViewer = viewer;viewer.imageryLayers.addImageryProvider(new Cesium.WebMapTileServiceImageryProvider({//影像注记url: `http://t0.tianditu.com/cia_w/wmts?service=wmts&request=GetTile&version=1.0.0&LAYER=cia&tileMatrixSet=w&TileMatrix={TileMatrix}&TileRow={TileRow}&TileCol={TileCol}&style=default.jpg&tk=${tianDiTuToken}`,subdomains: subdomains,layer: "tdtCiaLayer",style: "default",format: "image/jpeg",tileMatrixSetID: "GoogleMapsCompatible",maximumLevel: 18,}));//优化项--关闭相关特效viewer.scene.debugShowFramesPerSecond = false; //显示fpsviewer.scene.moon.show = false; //月亮viewer.scene.fog.enabled = false; //雾viewer.scene.sun.show = false; //太阳viewer.scene.skyBox.show = false; //天空盒viewer.resolutionScale = 1.0; //画面细度,默认值为1.0//去除版权信息viewer._cesiumWidget._creditContainer.style.display = "none";// 将三维球定位到中国viewer.camera.flyTo({destination: Cesium.Cartesian3.fromDegrees(103.84, 31.15, 17850000),orientation: {heading: Cesium.Math.toRadians(348.4202942851978),pitch: Cesium.Math.toRadians(-89.74026687972041),roll: Cesium.Math.toRadians(0),},complete: function callback() {// 定位完成之后的回调函数},});
});
</script><style lang="scss" scoped>
.fullSize,
.full-container {position: absolute;/*top: 0;*//*left: 0;*/border: none;height: 100%;width: 100%;margin: 0px;display: inherit;
}
.doubleViewer {width: 50%;
}#loadingOverlay {position: absolute;top: 0;left: 0;opacity: 0.9;width: 100%;height: 100%;display: none;
}#loadingOverlay h1 {text-align: center;position: relative;top: 50%;margin-top: -0.5em;
}#mousePositionId {position: absolute;right: 30px;bottom: 50px;z-index: 100;font-size: 20px;
}
.layer-picker-class {float: right;
}
</style>
<style>
html {overflow-x: hidden;overflow-y: hidden;
}
</style>

http://www.yayakq.cn/news/306376/

相关文章:

  • 网站改版总结酒业网站模板下载
  • 做网站什么分类流量多wordpress原生html5播放器
  • 内外网网站栏目建设方案长春网站建设流程
  • 查看网站有多少空间好发信息网网站建设
  • 做网站会遇到哪些问题宁波seo怎么推广
  • 山西网站建设开发团队带登录网站模板
  • 桂林生活网官方网站什么时候网站建设
  • 做环保是跑还是网站卖网站建设需要哪些功能
  • 太原招聘网站开发网站界面设计稿
  • 做影视网站赚钱wordpress扁平主题
  • wordpress网站建小程序郑州建设局官网
  • js网站登录怎么做哪个外包公司比较好
  • 网站建设与管理实践报告总结一级域名免费申请
  • 网站建设视觉营销帐号售卖网站建设
  • cms做企业网站建站系统深圳最新消息
  • 站长之家0网页制作图片教程
  • 网站建设容易出现的问题设计公司加盟
  • 网站建站公司多少钱海外学校网站建设
  • 深圳的网站建设公司网页设计实训报告心得体会
  • 电商网站的建设与安全都哪些网站可以做gif
  • 大淘客网站建设app做羊水亲子鉴定网站
  • 厦门专业建站系统制作公司网站建设外贸
  • 外贸网站建设专业高端服装产品网站建设
  • 清远网站推广优化公司岳阳推广公司
  • 设计网站的意义网站建设有哪些优质公众号
  • 用flash制作网站海口网络建站模板
  • 宁夏网站制作哪家好中企动力济南分公司
  • 网站 用什么数据库网站显示结算
  • 打赏网站怎么建设牛商网站建设
  • 上海手机网站建设哪家专业郑州网站建设q.479185700棒