702 lines
25 KiB
Vue
702 lines
25 KiB
Vue
<template>
|
||
<Headers></Headers>
|
||
<div id="earthContainer" class="fullSize"></div>
|
||
<Tree class="tree" ref="tree"></Tree>
|
||
<component :is="currentComponent" ref="dynamicComponentRef" />
|
||
<richText></richText>
|
||
<addDirectory ref="adddirectoryBox" class="adddirectoryBox absolute zIndex999"></addDirectory>
|
||
<editDirectory ref="editdirectoryBox" class="editdirectoryBox absolute zIndex999"></editDirectory>
|
||
<!-- <addStandText ref="addStandTextRef"></addStandText> -->
|
||
<!--左侧一级菜单-->
|
||
<firstMenu class="absolute zIndex9" ref="firstMenuRef"></firstMenu>
|
||
<!--底部菜单-->
|
||
<bottomMenu class="absolute zIndex9" ref="bottomMenuRef"></bottomMenu>
|
||
<input type="file" id="fileInputlink" style="display: none" multiple accept=".jpeg,.png,.jpg,.mp4,.pdf"
|
||
@input="uploadFile" />
|
||
|
||
<!-- 多点视线分析 -->
|
||
<!-- <Visibility ref="visibility"></Visibility> -->
|
||
<!-- <CircleViewShed ref="circleViewShed"></CircleViewShed> -->
|
||
<!-- <Submerge ref="submerge"></Submerge> -->
|
||
<!-- <Profile ref="profile"></Profile> -->
|
||
<!-- <ViewShed ref="viewShed"></ViewShed> -->
|
||
<!-- <CutFill ref="cutFill"></CutFill> -->
|
||
<!-- <Contour ref="contour"></Contour> -->
|
||
<!-- <RoutePlanning ref="routePlanning"></RoutePlanning> -->
|
||
<!-- <Graffiti ref="graffiti"></Graffiti> -->
|
||
<FlyRoam ref="flyRoam"></FlyRoam>
|
||
<!-- <CoorLocation ref="coorLocation"></CoorLocation> -->
|
||
<!-- <ScreenShot ref="screenShot"></ScreenShot> -->
|
||
<!-- <TerrainExcavation ref="terrainExcavation"></TerrainExcavation> -->
|
||
<!-- <ProjConvert ref="projConvert"></ProjConvert> -->
|
||
<!-- <ProjectionConvert ref="projectionConvert"></ProjectionConvert> -->
|
||
<!-- <GoodsSearchCircle ref="goodsSearchCircle"></GoodsSearchCircle> -->
|
||
<!-- <GoodsSearchPolgon ref="goodsSearchPolgon"></GoodsSearchPolgon> -->
|
||
<tufuSelect ref="tufuselect"></tufuSelect>
|
||
<imagePop ref="imagepop"></imagePop>
|
||
<model ref="Model"></model>
|
||
<graph ref="Graph"></graph>
|
||
<graphSetting ref="graphsetting"></graphSetting>
|
||
<photo ref="Photo"></photo>
|
||
|
||
<!-- 图标列表 -->
|
||
<selectImg ref="selectImgRef"></selectImg>
|
||
<modelSetting ref="modelsetting"></modelSetting>
|
||
<modelObject ref="modelobject"></modelObject>
|
||
<graphObject ref="graphobject"></graphObject>
|
||
<addDevice ref="adddevice"></addDevice>
|
||
<addMaterials ref="addmaterials"></addMaterials>
|
||
</template>
|
||
|
||
<script setup lang="ts">
|
||
import { inject, shallowRef, ref } from 'vue'
|
||
import { AuthApi } from '@/api/setting/auth'
|
||
import {
|
||
$sendElectronChanel,
|
||
$recvElectronChanel,
|
||
$changeComponentShow,
|
||
$changeComponentPop
|
||
} from '@/utils/communication'
|
||
import Headers from '../components/headers/index.vue'
|
||
import Tree from '../components/tree/index.vue'
|
||
import addStandText from '../components/propertyBox/addStandText.vue'
|
||
import addGroundText from '../components/propertyBox/addGroundText.vue'
|
||
import billboardObject from '../components/propertyBox/billboardObject.vue'
|
||
import polygonObject from '../components/propertyBox/polygonObject.vue'
|
||
import polyhedronObject from '../components/propertyBox/polyhedronObject.vue'
|
||
import polylineObject from '../components/propertyBox/polylineObject.vue'
|
||
import curvelineObject from '../components/propertyBox/curvelineObject.vue'
|
||
import attackArrow from '../components/propertyBox/attackArrow.vue'
|
||
import richText from '../components/propertyBox/richText.vue'
|
||
import groundText from '../components/propertyBox/groundText.vue'
|
||
import standText from '../components/propertyBox/standText.vue'
|
||
import circleObject from '../components/propertyBox/CircleObject.vue'
|
||
import addDirectory from '@/components/dialog/directory.vue'
|
||
import editDirectory from '@/components/dialog/directoryEdit.vue'
|
||
import firstMenu from '@/views/components/leftSide/leftSideFirst.vue'
|
||
import bottomMenu from '@/views/components/bottomSide/bottomSide.vue'
|
||
import Visibility from '../components/propertyBox/Visibility.vue'
|
||
import CircleViewShed from '../components/propertyBox/CircleViewShed.vue'
|
||
import Submerge from '../components/propertyBox/Submerge.vue'
|
||
import Profile from '../components/propertyBox/Profile.vue'
|
||
import ViewShed from '../components/propertyBox/ViewShed.vue'
|
||
import CutFill from '../components/propertyBox/CutFill.vue'
|
||
import Contour from '../components/propertyBox/Contour.vue'
|
||
import RoutePlanning from '../components/propertyBox/RoutePlanning.vue'
|
||
import Graffiti from '../components/propertyBox/Graffiti.vue'
|
||
import FlyRoam from '../components/propertyBox/FlyRoam.vue'
|
||
import CoorLocation from '../components/propertyBox/CoorLocation.vue'
|
||
import ScreenShot from '../components/propertyBox/ScreenShot.vue'
|
||
import tileset from '../components/propertyBox/tileset.vue'
|
||
import layer from '../components/propertyBox/layer.vue'
|
||
import trajectoryMotion from '../components/propertyBox/trajectoryMotion.vue'
|
||
import wallStereoscopic from '../components/propertyBox/wallStereoscopic.vue'
|
||
import wallRealStereoscopic from '../components/propertyBox/wallRealStereoscopic.vue'
|
||
import circleDiffuse from '../components/propertyBox/circleDiffuse.vue'
|
||
import radarScan from '../components/propertyBox/radarScan.vue'
|
||
import radarScanStereoscopic from '../components/propertyBox/radarScanStereoscopic.vue'
|
||
import TerrainExcavation from '../components/propertyBox/TerrainExcavation.vue'
|
||
import ProjConvert from '../components/propertyBox/ProjConvert.vue'
|
||
import ProjectionConvert from '../components/propertyBox/ProjectionConvert.vue'
|
||
import GoodsSearchCircle from '../components/propertyBox/GoodsSearchCircle.vue'
|
||
import GoodsSearchPolgon from '../components/propertyBox/GoodsSearchPolgon.vue'
|
||
import flat from '../components/propertyBox/flat.vue'
|
||
import terrain from '../components/propertyBox/terrain.vue'
|
||
import { useRightOperate } from '../components/tree/components/hooks/rightOperate'
|
||
import selectImg from '../components/selectImg/index.vue'
|
||
import tufuSelect from '../components/headers/components/tufu_select.vue'
|
||
import imagePop from '../components/propertyBox/imagePop.vue'
|
||
import model from '../components/propertyBox/model.vue'
|
||
import waterSurface from '../components/propertyBox/waterSurface.vue'
|
||
import { addMapSource } from '../../common/addMapSource'
|
||
import modelSetting from '../components/propertyBox/modelSetting.vue'
|
||
import modelObject from '../components/propertyBox/modelObject.vue'
|
||
import particleEffects from '../components/propertyBox/particleEffects.vue'
|
||
import flyLine from '../components/propertyBox/flyLine.vue'
|
||
import explosion from '../components/propertyBox/explosion.vue'
|
||
import vector from '../components/propertyBox/vector.vue'
|
||
import vectorAttr from '../components/propertyBox/vectorAttr.vue'
|
||
|
||
import graphObject from '../components/propertyBox/graphObject.vue'
|
||
import graph from '../components/propertyBox/graph.vue'
|
||
import graphSetting from '../components/propertyBox/graphSetting.vue'
|
||
import photo from '../components/propertyBox/photo.vue'
|
||
import addDevice from '../components/propertyBox/addDevice.vue'
|
||
import addMaterials from '../components/propertyBox/addMaterials.vue'
|
||
|
||
import { GisApi } from '@/api/gisApi'
|
||
import { sysChange as utilsSysChange } from '@/utils/sysChange'
|
||
import { getdefaultStyle } from '../components/propertyBox/defaultStyle/style'
|
||
import { getdefaultLabelStyle } from '../components/propertyBox/defaultLabelStyle/style'
|
||
|
||
const { rightMenus } = useRightOperate()
|
||
const firstMenuRef = ref(null)
|
||
const bottomMenuRef = ref(null)
|
||
const eventBus: any = inject('bus')
|
||
let currentComponent = shallowRef()
|
||
let dynamicComponentRef = ref()
|
||
let addStandTextRef = ref()
|
||
let tree = ref()
|
||
let selectImgRef = ref()
|
||
let editdirectoryBox = ref()
|
||
|
||
// 标注标绘默认样式
|
||
if (!localStorage.getItem('defaultStyle')) {
|
||
let defaultStyle = getdefaultStyle(null)
|
||
localStorage.setItem('defaultStyle', JSON.stringify(defaultStyle))
|
||
}
|
||
if (!localStorage.getItem('defaultLabelStyle')) {
|
||
let defaultLabelStyle = getdefaultLabelStyle(null)
|
||
localStorage.setItem('defaultLabelStyle', JSON.stringify(defaultLabelStyle))
|
||
}
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
eventBus.on('openDialog', async (sourceType: any, id: any) => {
|
||
if (dynamicComponentRef.value && dynamicComponentRef.value.close) {
|
||
dynamicComponentRef.value.close()
|
||
}
|
||
switch (sourceType) {
|
||
case 'directory':
|
||
editdirectoryBox.value.open()
|
||
// currentComponent.value = addDirectory
|
||
// await nextTick()
|
||
// dynamicComponentRef.value?.open()
|
||
break
|
||
case 'addGroundText':
|
||
currentComponent.value = addGroundText
|
||
await nextTick()
|
||
dynamicComponentRef.value?.open()
|
||
break
|
||
case 'groundText':
|
||
currentComponent.value = groundText
|
||
await nextTick()
|
||
dynamicComponentRef.value?.open(id)
|
||
break
|
||
case 'addStandText':
|
||
currentComponent.value = addStandText
|
||
await nextTick()
|
||
dynamicComponentRef.value?.open()
|
||
break
|
||
case 'standText':
|
||
currentComponent.value = standText
|
||
await nextTick()
|
||
dynamicComponentRef.value?.open(id)
|
||
break
|
||
case 'point':
|
||
case 'linkImage':
|
||
case 'vrImage':
|
||
currentComponent.value = billboardObject
|
||
await nextTick()
|
||
dynamicComponentRef.value?.open(id, sourceType)
|
||
break
|
||
case 'line':
|
||
currentComponent.value = polylineObject
|
||
await nextTick()
|
||
dynamicComponentRef.value?.open(id, sourceType)
|
||
break
|
||
case 'curve':
|
||
currentComponent.value = curvelineObject
|
||
await nextTick()
|
||
dynamicComponentRef.value?.open(id, sourceType)
|
||
break
|
||
case 'panel':
|
||
currentComponent.value = polygonObject
|
||
await nextTick()
|
||
dynamicComponentRef.value?.open(id)
|
||
break
|
||
case 'circle':
|
||
currentComponent.value = circleObject
|
||
await nextTick()
|
||
dynamicComponentRef.value?.open(id, 'circle')
|
||
break
|
||
case 'ellipse':
|
||
currentComponent.value = circleObject
|
||
await nextTick()
|
||
dynamicComponentRef.value?.open(id, 'ellipse')
|
||
break
|
||
case 'sector':
|
||
currentComponent.value = circleObject
|
||
await nextTick()
|
||
dynamicComponentRef.value?.open(id, 'sector')
|
||
break
|
||
case 'rectangle':
|
||
currentComponent.value = polygonObject
|
||
await nextTick()
|
||
dynamicComponentRef.value?.open(id, 'rectangle')
|
||
break
|
||
case 'rendezvous':
|
||
currentComponent.value = polygonObject
|
||
await nextTick()
|
||
dynamicComponentRef.value?.open(id, 'rendezvous')
|
||
break
|
||
case 'polyhedronObject':
|
||
currentComponent.value = polyhedronObject
|
||
await nextTick()
|
||
dynamicComponentRef.value?.open(id)
|
||
break
|
||
case 'attackArrow':
|
||
currentComponent.value = attackArrow
|
||
await nextTick()
|
||
dynamicComponentRef.value?.open(id, 'attackArrow')
|
||
break
|
||
case 'pincerArrow':
|
||
currentComponent.value = attackArrow
|
||
await nextTick()
|
||
dynamicComponentRef.value?.open(id, 'pincerArrow')
|
||
break
|
||
case 'tileset':
|
||
currentComponent.value = tileset
|
||
await nextTick()
|
||
dynamicComponentRef.value?.open(id)
|
||
break
|
||
case 'layer':
|
||
case 'gdslImagery':
|
||
case 'gdlwImagery':
|
||
case 'arcgisBlueImagery':
|
||
case 'arcgisWximagery':
|
||
currentComponent.value = layer
|
||
await nextTick()
|
||
dynamicComponentRef.value?.open(id)
|
||
break
|
||
case 'path':
|
||
currentComponent.value = trajectoryMotion
|
||
await nextTick()
|
||
dynamicComponentRef.value?.open(id)
|
||
break
|
||
case 'wallStereoscopic':
|
||
currentComponent.value = wallStereoscopic
|
||
await nextTick()
|
||
dynamicComponentRef.value?.open(id)
|
||
break
|
||
case 'entityWall':
|
||
currentComponent.value = wallRealStereoscopic
|
||
await nextTick()
|
||
dynamicComponentRef.value?.open(id)
|
||
break
|
||
case 'diffuseScan':
|
||
currentComponent.value = circleDiffuse
|
||
await nextTick()
|
||
dynamicComponentRef.value?.open(id)
|
||
break
|
||
case 'radarScan':
|
||
currentComponent.value = radarScan
|
||
await nextTick()
|
||
dynamicComponentRef.value?.open(id)
|
||
break
|
||
case 'scanStereoscopic':
|
||
currentComponent.value = radarScanStereoscopic
|
||
await nextTick()
|
||
dynamicComponentRef.value?.open(id)
|
||
break
|
||
case 'model':
|
||
currentComponent.value = modelObject
|
||
await nextTick()
|
||
dynamicComponentRef.value?.open(id, 'model')
|
||
break
|
||
case 'military':
|
||
currentComponent.value = graphObject
|
||
await nextTick()
|
||
dynamicComponentRef.value?.open(id, 'military')
|
||
break
|
||
case 'pressModel':
|
||
currentComponent.value = flat
|
||
await nextTick()
|
||
dynamicComponentRef.value?.open(id, 'pressModel')
|
||
break
|
||
case 'terrain':
|
||
currentComponent.value = terrain
|
||
await nextTick()
|
||
dynamicComponentRef.value?.open(id)
|
||
break
|
||
case 'water':
|
||
currentComponent.value = waterSurface
|
||
await nextTick()
|
||
dynamicComponentRef.value?.open(id)
|
||
break
|
||
case 'fountain':
|
||
case 'fire':
|
||
case 'smoke':
|
||
case 'waterL':
|
||
currentComponent.value = particleEffects
|
||
await nextTick()
|
||
dynamicComponentRef.value?.open(id, sourceType)
|
||
break
|
||
case 'flyLine':
|
||
currentComponent.value = flyLine
|
||
await nextTick()
|
||
dynamicComponentRef.value?.open(id)
|
||
break
|
||
case 'explosion':
|
||
currentComponent.value = explosion
|
||
await nextTick()
|
||
dynamicComponentRef.value?.open(id)
|
||
break
|
||
case 'vector':
|
||
currentComponent.value = vector
|
||
await nextTick()
|
||
dynamicComponentRef.value?.open(id)
|
||
break
|
||
case 'vectorAttr':
|
||
currentComponent.value = vectorAttr
|
||
await nextTick()
|
||
dynamicComponentRef.value?.open(id)
|
||
break
|
||
//分析库
|
||
case 'submergeDialog': //淹没分析
|
||
currentComponent.value = Submerge
|
||
await nextTick()
|
||
dynamicComponentRef.value?.open(id)
|
||
break
|
||
case 'profileDialog': //剖面分析
|
||
currentComponent.value = Profile
|
||
await nextTick()
|
||
dynamicComponentRef.value?.open(id)
|
||
break
|
||
case 'analysisDialog': //视线分析
|
||
currentComponent.value = Visibility
|
||
await nextTick()
|
||
dynamicComponentRef.value?.open(id)
|
||
break
|
||
case 'viewShedDialog': //视域分析
|
||
currentComponent.value = ViewShed
|
||
await nextTick()
|
||
dynamicComponentRef.value?.open(id)
|
||
break
|
||
case 'circleViewShedDialog': //圆形视域分析
|
||
currentComponent.value = CircleViewShed
|
||
await nextTick()
|
||
dynamicComponentRef.value?.open(id)
|
||
break
|
||
case 'cutFillDialog': //填挖方分析
|
||
currentComponent.value = CutFill
|
||
await nextTick()
|
||
dynamicComponentRef.value?.open(id)
|
||
break
|
||
case 'contourDialog': //全局等高线分析
|
||
currentComponent.value = Contour
|
||
await nextTick()
|
||
dynamicComponentRef.value?.open(id)
|
||
break
|
||
//工具库
|
||
case 'routePlanningDialog': //路径规划
|
||
currentComponent.value = RoutePlanning
|
||
await nextTick()
|
||
dynamicComponentRef.value?.open(id)
|
||
break
|
||
case 'graffitiDialog': //涂鸦
|
||
currentComponent.value = Graffiti
|
||
await nextTick()
|
||
dynamicComponentRef.value?.open(id)
|
||
break
|
||
case 'flyRoamDialog': //飞行漫游
|
||
currentComponent.value = FlyRoam
|
||
await nextTick()
|
||
dynamicComponentRef.value?.open(id)
|
||
break
|
||
case 'coorLocationDialog': //坐标定位
|
||
currentComponent.value = CoorLocation
|
||
await nextTick()
|
||
dynamicComponentRef.value?.open(id)
|
||
break
|
||
case 'screenShotDialog': //高清出图
|
||
currentComponent.value = ScreenShot
|
||
await nextTick()
|
||
dynamicComponentRef.value?.open(id)
|
||
break
|
||
case 'terrainExcavationDialog': //地形开挖
|
||
currentComponent.value = TerrainExcavation
|
||
await nextTick()
|
||
dynamicComponentRef.value?.open(id)
|
||
break
|
||
case 'projConvertDialog': //度分秒
|
||
currentComponent.value = ProjConvert
|
||
await nextTick()
|
||
dynamicComponentRef.value?.open(id)
|
||
break
|
||
case 'ProjectionConvertDialog': //投影转换
|
||
currentComponent.value = ProjectionConvert
|
||
await nextTick()
|
||
dynamicComponentRef.value?.open(id)
|
||
break
|
||
case 'goodsSearchCircleDialog': //圆形统计
|
||
currentComponent.value = GoodsSearchCircle
|
||
await nextTick()
|
||
dynamicComponentRef.value?.open(id)
|
||
break
|
||
case 'goodsSearchPolgonDialog': //多边形统计
|
||
currentComponent.value = GoodsSearchPolgon
|
||
await nextTick()
|
||
dynamicComponentRef.value?.open(id)
|
||
break
|
||
default:
|
||
break
|
||
}
|
||
id && (dynamicComponentRef.value.id = id)
|
||
})
|
||
eventBus.on('openSelectImg', (selected, entity) => {
|
||
// $sendElectronChanel("requireGEMarkerName", {
|
||
// dirName: "GEMarker",
|
||
// dirName1s: "GEMarker1s",
|
||
// });
|
||
// $recvElectronChanel("dirFiles", (e, res) => {
|
||
// selectImgRef.value?.open()
|
||
// selectImgRef.value?.init(res, selected)
|
||
// })
|
||
// eventBus.on("selectedImg", (data) => {
|
||
// if (data.flag == "billboardImage" && data.onLine == false) {
|
||
// entity.billboardImage =
|
||
// `http://localhost:${window.staticPort}/` + data.img;
|
||
// }
|
||
// if (data.flag == "billboardImage" && data.onLine == true) {
|
||
// entity.billboardImage = new URL(window.location.href).origin + data.img;
|
||
// }
|
||
// });
|
||
})
|
||
eventBus.on('destroyComponent', (id) => {
|
||
if (id) {
|
||
if (dynamicComponentRef.value && dynamicComponentRef.value.id == id) {
|
||
dynamicComponentRef.value?.close()
|
||
currentComponent.value = undefined
|
||
}
|
||
} else {
|
||
currentComponent.value = undefined
|
||
}
|
||
})
|
||
|
||
utilsSysChange(eventBus)
|
||
|
||
const createEarth = async () => {
|
||
window.earth = await new YJ.YJEarth('earthContainer')
|
||
let openLeftClick = await new YJ.Global.openLeftClick(window.earth)
|
||
let openRightClick = await new YJ.Global.openRightClick(window.earth)
|
||
YJ.Global.MouseRightMenu(window.earth, true, (text, object) => {
|
||
switch (text) {
|
||
case 'rotateAround':
|
||
YJ.Global.rotateAround(window.earth, object.position)
|
||
break
|
||
case 'textBox':
|
||
let id = new YJ.Tools().randomString()
|
||
let name = '文本框'
|
||
addMapSource({
|
||
type: 'textBox',
|
||
id: id,
|
||
sourceName: name,
|
||
opt: {
|
||
id: id,
|
||
position: object.position
|
||
}
|
||
})
|
||
break
|
||
case 'attribute':
|
||
let node = window.treeObj.getNodeByParam('id', object.id, null)
|
||
rightMenus.edit.callback(eventBus, node)
|
||
break
|
||
}
|
||
})
|
||
|
||
tree.value.initTreeCallBack()
|
||
utilsSysChange(eventBus)
|
||
// @ts-ignore
|
||
let options = JSON.parse(localStorage.getItem('defaultView'))
|
||
YJ.Global.setDefaultView(window.earth, options)
|
||
setTimeout(() => {
|
||
new YJ.Tools(window.earth).flyHome()
|
||
}, 1000)
|
||
// YJ.Global.setDefaultView(window.earth, {
|
||
// destination: { lng: 100, lat: 30, alt: 10 },
|
||
// orientation: {
|
||
// heading: 0.0,
|
||
// pitch: -90.0,
|
||
// roll: 0.0
|
||
// }
|
||
// })
|
||
// new YJ.Tools(window.earth).flyHome(0)
|
||
}
|
||
|
||
let clickAddLinkCb
|
||
|
||
eventBus.on('defineClickAddLinkCb', (fun) => {
|
||
clickAddLinkCb = fun
|
||
})
|
||
|
||
const uploadFile = (event) => {
|
||
let files = event.target.files
|
||
if (files.length > 0) {
|
||
const formData = new FormData()
|
||
for (let i = 0; i < files.length; i++) {
|
||
const element = files[i]
|
||
formData.append('files', element)
|
||
}
|
||
GisApi.linkFile(formData).then((res) => {
|
||
if (res.code == 0 || res.code == 200) {
|
||
ElMessage({
|
||
message: '上传成功',
|
||
type: 'success'
|
||
})
|
||
// this.$sendChanel("linkFileData", res.data);
|
||
clickAddLinkCb && clickAddLinkCb(res.data)
|
||
}
|
||
})
|
||
}
|
||
}
|
||
const getAuthInfo = async () => {
|
||
const res = await AuthApi.showAuth()
|
||
if (typeof res.data === 'object') {
|
||
let time = res.data.expireTime
|
||
getStatus(time)
|
||
}
|
||
}
|
||
|
||
const getStatus = (time) => {
|
||
const timestamp = new Date(time).getTime()
|
||
|
||
const currentTimestamp = Date.now()
|
||
|
||
if (timestamp > currentTimestamp) {
|
||
; (window as any).checkAuthIsValid = true
|
||
} else {
|
||
; (window as any).checkAuthIsValid = false
|
||
}
|
||
}
|
||
|
||
onMounted(async () => {
|
||
let baseURL = localStorage.getItem('ip')
|
||
getAuthInfo()
|
||
await YJ.on({ host: baseURL, token: localStorage.getItem('Authorization') })
|
||
createEarth()
|
||
})
|
||
|
||
// function getLatLngBySheetNumber(sheetNumber) {
|
||
// // 比例尺代码映射(逆向):代码 -> 比例尺及步长
|
||
// const scaleInfoMap = {
|
||
// '': { scale: '1:100万', lngStep: 6, latStep: 4 },
|
||
// 'B': { scale: '1:50万', lngStep: 3, latStep: 2 },
|
||
// 'C': { scale: '1:25万', lngStep: 1.5, latStep: 1 },
|
||
// 'D': { scale: '1:10万', lngStep: 0.5, latStep: 1 / 3 },
|
||
// 'E': { scale: '1:5万', lngStep: 0.25, latStep: 1 / 6 },
|
||
// 'F': { scale: '1:2.5万', lngStep: 0.125, latStep: 1 / 12 },
|
||
// 'G': { scale: '1:1万', lngStep: 0.0625, latStep: 1 / 24 },
|
||
// 'H': { scale: '1:5000', lngStep: 0.03125, latStep: 1 / 48 }
|
||
// };
|
||
|
||
// // 1:100万行号字母对应表(A-V对应1-22)
|
||
// const rowChars = 'ABCDEFGHIJKLMNOPQRSTUV';
|
||
|
||
// // 解析编号结构
|
||
// let scaleCode, row100WChar, col100W, subRow, subCol;
|
||
|
||
// // 1:100万编号格式:1个字母 + 2位数字(如J50)
|
||
// if (sheetNumber.length === 3) {
|
||
// scaleCode = '';
|
||
// row100WChar = sheetNumber[0];
|
||
// col100W = parseInt(sheetNumber.slice(1), 10);
|
||
// subRow = 1; // 1:100万无细分,默认第1行
|
||
// subCol = 1; // 1:100万无细分,默认第1列
|
||
// }
|
||
// // 其他比例尺:1个字母 + 2位数字 + 1位代码 + 3位行 + 3位列(如J50E001001)
|
||
// else if (sheetNumber.length === 10) {
|
||
// row100WChar = sheetNumber[0];
|
||
// col100W = parseInt(sheetNumber.slice(1, 3), 10);
|
||
// scaleCode = sheetNumber[3];
|
||
// subRow = parseInt(sheetNumber.slice(4, 7), 10);
|
||
// subCol = parseInt(sheetNumber.slice(7, 10), 10);
|
||
// } else {
|
||
// throw new Error('无效的图幅编号格式,请检查输入');
|
||
// }
|
||
|
||
// // 验证行字母合法性(A-V)
|
||
// const row100WIndex = rowChars.indexOf(row100WChar);
|
||
// if (row100WIndex === -1) {
|
||
// throw new Error('无效的1:100万图幅行字母(必须为A-V)');
|
||
// }
|
||
// const row100W = row100WIndex + 1; // 行号(1-22)
|
||
|
||
// // 验证列号合法性(1-60)
|
||
// if (col100W < 1 || col100W > 60) {
|
||
// throw new Error('无效的1:100万图幅列号(必须为1-60)');
|
||
// }
|
||
|
||
// // 验证比例尺代码和细分行列号
|
||
// const scaleInfo = scaleInfoMap[scaleCode];
|
||
// if (!scaleInfo) {
|
||
// throw new Error('不支持的比例尺代码(必须为B-H或空)');
|
||
// }
|
||
// if (subRow < 1 || subCol < 1) {
|
||
// throw new Error('细分行列号必须为正整数');
|
||
// }
|
||
|
||
// // 计算1:100万图幅的经纬度范围
|
||
// const minLng100W = (col100W - 31) * 6; // 1:100万图幅西边界经度
|
||
// const maxLng100W = minLng100W + 6; // 1:100万图幅东边界经度
|
||
// const maxLat100W = row100W * 4; // 1:100万图幅北边界纬度
|
||
// const minLat100W = maxLat100W - 4; // 1:100万图幅南边界纬度
|
||
|
||
// // 计算当前比例尺图幅在1:100万内的偏移量,反推精确范围
|
||
// const { lngStep, latStep, scale } = scaleInfo;
|
||
// const minLng = minLng100W + (subCol - 1) * lngStep; // 图幅西边界经度
|
||
// const maxLng = minLng + lngStep; // 图幅东边界经度
|
||
// const maxLat = maxLat100W - (subRow - 1) * latStep; // 图幅北边界纬度(注意纬度方向是从北向南递增)
|
||
// const minLat = maxLat - latStep; // 图幅南边界纬度
|
||
|
||
// let object = {
|
||
// scale,
|
||
// longitude: [minLng, maxLng], // [西经, 东经]
|
||
// latitude: [minLat, maxLat] // [南纬, 北纬]
|
||
// }
|
||
// highlightSheetIndex(window.earth, object)
|
||
// return object;
|
||
// }
|
||
|
||
// function highlightSheetIndex(sdk, object) {
|
||
// let viewer = sdk.viewer;
|
||
|
||
// let height = 8849
|
||
// let positions = [
|
||
// Cesium.Cartesian3.fromDegrees(object.longitude[0], object.latitude[0], height),
|
||
// Cesium.Cartesian3.fromDegrees(object.longitude[1], object.latitude[0], height),
|
||
// Cesium.Cartesian3.fromDegrees(object.longitude[1], object.latitude[1], height),
|
||
// Cesium.Cartesian3.fromDegrees(object.longitude[0], object.latitude[1], height),
|
||
// Cesium.Cartesian3.fromDegrees(object.longitude[0], object.latitude[0], height),
|
||
// ]
|
||
// let gridPrimitives = new Cesium.PrimitiveCollection();
|
||
// gridPrimitives.name = 'highlightSheetIndexGridPrimitives';
|
||
// viewer.scene.primitives.add(gridPrimitives);
|
||
// const geometryInstances = new Cesium.GeometryInstance({
|
||
// geometry: new Cesium.PolylineGeometry({
|
||
// positions: positions,
|
||
// width: 5,
|
||
// vertexFormat: Cesium.PerInstanceColorAppearance.VERTEX_FORMAT,
|
||
// arcType: Cesium.ArcType.RHUMB,
|
||
// })
|
||
// });
|
||
|
||
// gridPrimitives.add(new Cesium.Primitive({
|
||
// geometryInstances: geometryInstances,
|
||
// appearance: new Cesium.PolylineMaterialAppearance({
|
||
// material: Cesium.Material.fromType('Color', {
|
||
// color: Cesium.Color.fromCssColorString('#f00')
|
||
// })
|
||
// })
|
||
// }));
|
||
// }
|
||
|
||
// window.getLatLngBySheetNumber = getLatLngBySheetNumber
|
||
</script>
|
||
|
||
<style scoped lang="scss">
|
||
.fullSize {
|
||
width: 100%;
|
||
height: 100%;
|
||
}
|
||
|
||
.adddirectoryBox,
|
||
.editdirectoryBox {
|
||
display: none;
|
||
}
|
||
</style>
|