|
|
1 hete | |
|---|---|---|
| .. | ||
| components | 1 hete | |
| config | 1 hete | |
| js | 1 hete | |
| resource | 2 hónapja | |
| style | 2 hónapja | |
| views | 3 hete | |
| App.vue | 2 hónapja | |
| README.md | 2 hónapja | |
这是一个可直接复制到其他项目中使用的 SuperMap Cesium 3D 地图功能模块,包含完整的侧边栏控制界面和 Cesium 3D 场景功能。
supermap-cesium-module/
├── components/ # 核心 Vue 组件
│ ├── viewer/ # Cesium 场景初始化组件
│ └── loading.vue # 加载动画组件
├── js/ # 工具类
│ ├── common/ # 图层管理、相机操作等
│ ├── store/ # 状态管理
│ └── tool/ # 工具函数
├── style/ # 样式和图标
│ ├── font/ # 图标字体
│ └── images/ # 图片资源
├── config/ # 配置文件
│ ├── server_config.js # 服务配置
│ ├── server_position_config.js # 服务定位配置
│ └── views_config.js # 组件配置
├── views/ # 界面组件
│ └── layout/ # 布局组件
│ ├── aside.vue # 侧边栏组件
│ ├── header.vue # 头部组件
│ └── index.vue # 布局索引组件
├── App.vue # 模块入口组件
└── README.md # 集成说明文档
将 supermap-cesium-module/ 目录复制到目标项目的 src/ 目录中。
在目标项目的 package.json 中添加必要的依赖:
"dependencies": {
"vue": "^3.5.0",
"element-plus": "^2.13.0",
"echarts": "^6.0.0",
"@supermap/iclient3d-vue-for-webgl": "^1.2.2"
}
在目标项目的 vite.config.js 文件中添加必要的配置:
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import path from 'path'
export default defineConfig({
plugins: [vue()],
resolve: {
alias: {
'@': path.resolve(__dirname, 'src'),
'cesium': path.resolve(__dirname, 'node_modules/cesium')
}
},
optimizeDeps: {
include: ['cesium']
}
})
在目标项目的 index.html 中添加 Cesium 库的引用:
<script src="/Cesium/Cesium.js"></script>
<link rel="stylesheet" href="/Cesium/Widgets/widgets.css">
在目标项目的路由或组件中引入模块:
// router/index.js
import { createRouter, createWebHistory } from 'vue-router'
import SupermapCesiumModule from '../supermap-cesium-module/App.vue'
const routes = [
{
path: '/3d-map',
name: 'SupermapCesiumModule',
component: SupermapCesiumModule
}
]
const router = createRouter({
history: createWebHistory(process.env.BASE_URL),
routes
})
export default router
<template>
<div class="app">
<h1>我的应用</h1>
<SupermapCesiumModule />
</div>
</template>
<script setup>
import SupermapCesiumModule from './supermap-cesium-module/App.vue'
</script>
直接访问集成后的路由路径,即可看到完整的 3D 地图界面,包含:
编辑 config/server_config.js 文件,可添加或修改服务配置:
// 示例:添加自定义服务
const server_config = [
{
id: 'webServe',
name: '公共服务',
children: [
{
name: '示例场景',
type: 'SCENE',
proxiedUrl: 'http://www.supermapol.com/realspace/services/3D-ZF_normal/rest/realspace',
thumbnail: 'path/to/thumbnail.png'
}
]
}
]
编辑 config/server_config.js 文件中的底图配置部分:
// 底图配置
{
id: 'baseLayer',
name: '底图',
children: [
{
name: '天地图影像',
type: 'TIANDITU',
proxiedUrl: 'http://t0.tianditu.com/img_w/wmts',
thumbnail: 'path/to/tianditu.png'
}
]
}
config/ 中的服务配置本模块基于 SuperMap iClient3D Vue for Cesium 开发,遵循 Apache License 2.0 开源协议。
如有问题或建议,请联系 SuperMap 技术支持。