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