简单修改
This commit is contained in:
@@ -12,6 +12,7 @@ import { CesiumUtilsSingleton } from '@/utils/cesium/CesiumUtils';
|
||||
import AdministrativeDivision from './AdministrativeDivision.vue';
|
||||
import { useViewerStore } from '@/stores/useViewerStore';
|
||||
import { useLoadingInformationStore } from '@/stores/useLoadingInformation';
|
||||
import Xian from '@/assets/json/XiAn.json'
|
||||
|
||||
onBeforeMount(() => {
|
||||
// 初始化为false
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJiNjczZTVlMy1kNDEwLTRhZWItYWM0NS1mNjYxMzJjODMwYTQiLCJpZCI6MzIxMzI2LCJpYXQiOjE3NzU2NDU1OTd9._MPcZQsxK1dGPl8IMVhKHV3PIPu4-TaOUgzsUUOP6WE"
|
||||
],
|
||||
"defaultPosition": [108.948024, 34.263161, 300000],
|
||||
|
||||
"prefix": {
|
||||
"hiddenDangerPointId": "hidden-danger-point-",
|
||||
"riskPointId": "risk-point-"
|
||||
|
||||
@@ -33,11 +33,11 @@ export class CesiumUtils {
|
||||
/**
|
||||
* 初始化 Cesium Viewer
|
||||
* @param options - Viewer 初始化选项
|
||||
* @param tdMapToken - 天地图 Token 数组(可选)
|
||||
* @param type - 底图类型:0=影像图,1=矢量图(默认 0)
|
||||
* @param tdMapToken - 天地图 Token 数组(可选)
|
||||
*/
|
||||
initCesiumViewer(options: CesiumInitOptions, tdMapToken?: string[], type: number = 0): void {
|
||||
this.#viewerManager.initCesiumViewer(options, tdMapToken, type)
|
||||
initCesiumViewer(options: CesiumInitOptions, type: number = 0, tdMapToken?: string[]): void {
|
||||
this.#viewerManager.initCesiumViewer(options, type, tdMapToken)
|
||||
|
||||
const viewer = this.#viewerManager.getViewer()
|
||||
if (viewer) {
|
||||
|
||||
@@ -4,7 +4,6 @@ import {
|
||||
Ion,
|
||||
WebMapTileServiceImageryProvider,
|
||||
ImageryProvider,
|
||||
createWorldTerrain,
|
||||
} from 'cesium'
|
||||
import type { CesiumInitOptions } from '@/types/cesium/CesiumInitOptions'
|
||||
import config from '@/config/config.json'
|
||||
@@ -62,10 +61,11 @@ export class CesiumViewerManager {
|
||||
/**
|
||||
* 初始化 Cesium Viewer
|
||||
* @param options - Viewer 初始化选项
|
||||
* @param tdMapToken - 天地图 Token 数组(可选)
|
||||
* @param geoJson - GeoJSON 数据,如果要突出显示某一区域,就传递改值
|
||||
* @param type - 底图类型:0=影像图,1=矢量图(默认 0)
|
||||
* @param tdMapToken - 天地图 Token 数组(可选)
|
||||
*/
|
||||
initCesiumViewer(options: CesiumInitOptions, tdMapToken?: string[], type: number = 0): void {
|
||||
initCesiumViewer(options: CesiumInitOptions, type: number = 0, tdMapToken?: string[]): void {
|
||||
const defaultOptions: CesiumInitOptions = {
|
||||
containerId: options.containerId,
|
||||
shouldAnimate: true,
|
||||
@@ -91,10 +91,8 @@ export class CesiumViewerManager {
|
||||
|
||||
const viewer = new Viewer(container, {
|
||||
...finalOptions,
|
||||
terrainProvider: createWorldTerrain({
|
||||
requestVertexNormals: false,
|
||||
requestWaterMask: false,
|
||||
}),
|
||||
// 不加载默认地形
|
||||
terrainProvider: undefined,
|
||||
selectionIndicator: false,
|
||||
baseLayerPicker: false,
|
||||
contextOptions: {
|
||||
@@ -160,7 +158,7 @@ export class CesiumViewerManager {
|
||||
minimumLevel: 0,
|
||||
maximumLevel: 18,
|
||||
credit: 'Tianditu',
|
||||
subdomains: ['t0', 't1', 't2', 't3', 't4', 't5', 't6', 't7'],
|
||||
subdomains: ['t0', 't1', 't2', 't3', 't4', 't5', 't6', 't7']
|
||||
}
|
||||
|
||||
const token = tdMapToken[Math.floor(Math.random() * tdMapToken.length)]
|
||||
|
||||
Reference in New Issue
Block a user