Compare commits

..

15 Commits

51 changed files with 1473 additions and 677 deletions

View File

@ -1,6 +1,6 @@
server:
host: 127.0.0.1
port: 8859
port: 8848
path: C:\Users\Administrator\AppData\Roaming\dzsp_shijingjun_offline_Y_save
poi:
global:

Binary file not shown.

View File

@ -23,6 +23,7 @@
height: 100vh;
display: flex;
flex-direction: column;
overflow: hidden;
/* height: 100vh; background-color: rgba(255, 255, 255, 0.014); */
/*color: red;*/
}
@ -302,7 +303,19 @@
if (this.activeItem.type === '全景图') {
getIframe(this.activeItem.url, '')
} else {
getImg(this.activeItem.url)
if (!this.isPicture) {
this.checkImageUrlWithFetch(this.activeItem.url).then(res => {
if (res) {
this.isPicture = true
setTimeout(() => {
getImg(this.activeItem.url)
}, 0);
}
})
}
else {
getImg(this.activeItem.url)
}
}
// if (!Boolean(this.info.panorama.length)) {
// console.log('图片渲染', 1232132);
@ -313,6 +326,25 @@
}, 0)
},
async checkImageUrlWithFetch(url) {
try {
// 发送HEAD请求优先减少数据传输如果不支持则用GET
const response = await fetch(url, { method: 'HEAD' });
if (!response.ok) return false;
// 获取Content-Type
const contentType = response.headers.get('content-type');
// 判断是否为图片类型
if (!contentType || !contentType.startsWith('image/')) {
return false;
}
return true;
} catch (error) {
// 网络错误、跨域等情况直接返回false
return false;
}
}
},
mounted() {
window.ssssssssssssss = this.tabsData
@ -416,29 +448,29 @@
if (hasVr) {
this.info.vr.forEach(item => {
if (fs.existsSync(item.url)) {
let url = ""
if (item.url.startsWith("http"))
url = item.url
else {
//说明是本地的json在磁盘中存在的
if (item.url.includes(":")) {
url = obj.host + "/fileInfo/previewLocal?fileAbsolutePath=" + encodeURIComponent(item.url)
} else {
if (obj.host) {
let o = new URL(object.url, obj.host)
url = o.href
} else
url = item.url
let url = ""
if (item.url.startsWith("http"))
url = item.url
else {
//说明是本地的json在磁盘中存在的
if (item.url.includes(":")) {
url = obj.host + "/fileInfo/previewLocal?fileAbsolutePath=" + encodeURIComponent(item.url)
} else {
if (obj.host) {
let o = new URL(object.url, obj.host)
url = o.href
} else
url = item.url
}
}
item.url = url
} else {
if (!item.url.startsWith('http')) {
// item.url = this.info.env + "/" + item.url
item.url = obj.host + item.url
}
}
item.url = url
} else {
if (!item.url.startsWith('http')) {
// item.url = this.info.env + "/" + item.url
item.url = obj.host + item.url
}
}
this.tabsData.unshift({ name: "全景图", type: '全景图', url: item.url })
this.tabsData.unshift({ name: item.name, type: '全景图', url: item.url })
})
this.activeItem = this.tabsData[this.activeIndex]
this.renderImgView()

File diff suppressed because one or more lines are too long

View File

@ -52,7 +52,6 @@
*::after {
box-sizing: border-box;
margin: 0;
font-weight: normal;
}
ul {

File diff suppressed because one or more lines are too long

Binary file not shown.

View File

@ -441,6 +441,9 @@ img {
.ztree .checkbox_false_full + a,.ztree .checkbox_false_full_focus + a {
color: #d7d7d7;
.svg-icon {
fill: #d7d7d7 !important;
}
}
.ztree li a.curSelectedNode {
background-color: #ffffff00;
@ -450,6 +453,8 @@ img {
.svg-icon {
color: rgba(var(--color-base1), 1) !important;
fill: rgba(var(--color-base1), 1) !important;
stroke: rgba(var(--color-base1), 1) !important;
}
}

View File

@ -11,7 +11,7 @@
</div>
<div class="boxBody">
<el-form :model="form" :rules="rules" ref="ruleForm" label-width="80px"
@keyup.enter.native="submitForm(ruleForm)" @submit.native.prevent>
@keyup.enter.native="submitForm(ruleForm)" @submit.native.prevent>
<el-form-item label="名称:" prop="sourceName">
<!-- @input="removeSpaces" -->
<el-input v-model.trim="form.sourceName" placeholder="节点名称"></el-input>
@ -29,12 +29,13 @@
</template>
<script lang="ts" setup>
import { $changeComponentPop } from '@/utils/communication'
import { throttle } from '@/utils/index'
import { ElMessage, FormInstance } from 'element-plus'
import { TreeApi } from '@/api/tree'
import { useTreeNode } from '@/views/components/tree/hooks/treeNode'
const { getKeyOfSelectedNode, getSelectedNode, cusUpdateNode, getSameLevel, getSelectedNodes } = useTreeNode()
import {$changeComponentPop} from '@/utils/communication'
import {throttle} from '@/utils/index'
import {ElMessage, FormInstance} from 'element-plus'
import {TreeApi} from '@/api/tree'
import {useTreeNode} from '@/views/components/tree/hooks/treeNode'
const {getKeyOfSelectedNode, getSelectedNode, cusUpdateNode, getSameLevel, getSelectedNodes} = useTreeNode()
const title = ref('编辑节点')
const sourceId = ref('')
let form: any = reactive({
@ -42,7 +43,7 @@ let form: any = reactive({
})
const ruleForm = ref()
const rules = reactive({
sourceName: [{ required: true, message: '请输入名称', trigger: 'blur' }]
sourceName: [{required: true, message: '请输入名称', trigger: 'blur'}]
})
const removeSpaces = (value: string) => {
form.sourceName = value.replace(/\s/g, '')
@ -70,7 +71,7 @@ const add = throttle(async () => {
id: sourceId.value,
sourceName: form.sourceName
})
cusUpdateNode({ id: sourceId.value, sourceName: form.sourceName, params: undefined })
cusUpdateNode({id: sourceId.value, sourceName: form.sourceName, params: undefined})
close()
// console.log(res)
}, 3000)
@ -117,6 +118,7 @@ defineExpose({
<style lang="scss">
.editdirectoryBox {
user-select: none;
width: 100vw;
height: 100vh;

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 22 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 22 KiB

View File

@ -106,6 +106,18 @@ const initTreeCallBack = () => {
TsApi.queryTsSource(formData).then(async res => {
console.log('queryTsSource', res)
if (res.code == 200) {
res.data.sort((a: any, b: any) => {
if ((a.treeIndex || a.treeIndex == 0) && (b.treeIndex || b.treeIndex == 0)) {
return a.treeIndex - b.treeIndex
}
if (a.treeIndex) {
return -1;
}
if (b.treeIndex) {
return 1;
}
return 0;
});
for (let i = res.data.length - 1; i >= 0; i--) {
res.data[i].svg = await cusNodeIcon(res.data[i]);
@ -416,12 +428,12 @@ let rightClick = (event: MouseEvent, treeId: string, treeNode: any) => {
let menus = showRightMenuTs(event, treeObj.value, getSelectedNodes(treeObj.value), nodeType)
// console.log("menus", menus)
// canCheckType.includes(treeNode.sourceType) 包含的类型才有视角
if (treeNode && treeNode.sourceType != 'directory') {
if (treeNode && treeNode.sourceType != 'directory' && selectNodes.length == 1) {
let customView
let entity = window['_entityMap'].get(treeNode.id)
customView = Boolean(entity.customView && entity.customView.orientation)
menus = [...menus, customView ? 'resetView' : 'setView']
// customView ? 'resetView' : 'setView'
menus = [...menus, 'resetView', 'setView']
}
// console.log('menus', menus)
if (menus.length == 0) {

View File

@ -25,7 +25,11 @@ const eventBus: any = inject('bus')
const props = defineProps(['eventList', 'hr', 'originHrOffset', 'scrollLeft'])
let clickEventBar = (event) => {
console.log("点击事件块", selectedEventId.value, event)
let entity = window['_entityMap'].get(event.sourceId)
let key = event.sourceId
/* if (event.callback == 'move')
key = event.id + "move" + event.sourceId*/
// console.log(key)
let entity = window['_entityMap'].get(key)
entity && entity.flyTo()
selectedEventId.value = (selectedEventId.value == null || selectedEventId.value != event.id) ? event.id : null
eventBus.emit('click-event-show-plane', selectedEventId.value ? event : null)

View File

@ -110,13 +110,27 @@ const updateEvent = () => {
let durationS = eventObj.value.duration_time
// console.log("eventObj.value", eventObj.value)
// console.log("eventObj.value", durationS)
// 数据是否合法有效
let isRight = true
let errorFields:any = []//数据错误的字段
if (!durationS)
durationS = (eventObj.value.endTime - eventObj.value.startTime) / 1000
switch (eventObj.value.callback) {
case "flicker":
detail.value.times = Number((durationS / detail.value.numbers).toFixed(2))
if (Number(obj.numbers) == 0 || !Number(obj.numbers)) {
isRight = false
errorFields.push("闪烁次数")
}
if (isRight) {
detail.value.times = Number((durationS / detail.value.numbers).toFixed(2))
}
break
}
if (!isRight) {
let eventType = eventObj.value.name.split("-")[0] + "事件"
ElMessage({message: eventType + errorFields.join("、") + "数据不合法", type: "warning"})
return
}
obj.detail = JSON.stringify(detail.value)
console.log(obj)
delete obj.createdAt
@ -127,12 +141,13 @@ const updateEvent = () => {
if (res.code == 200) {
eventBus.emit('update-event', obj)
ElMessage({type: "success", message: "操作成功"})
cancel()
cancel(false)
}
})
}
const cancel = () => {
const cancel = (cancel = true) => {
if (cancel)
revert()
eventObj.value = null
detail.value = {}
eventBus.emit('click-cancel-hide-plane',)
@ -140,6 +155,13 @@ const cancel = () => {
eventBus.on('delete-event', () => {
cancel()
})
const revert = () => {
let entity = window['_entityMap'].get(eventObj.value.id + "move" + eventObj.value.sourceId)
console.log(eventObj.value)
let detail = JSON.parse(eventObj.value.detail)
entity.lineShow = detail.line.show
entity.smooth = detail.line.smooth
}
</script>
<style lang="scss" scoped>

View File

@ -32,7 +32,6 @@
import {$changeComponentPop} from '@/utils/communication'
import {throttle} from '@/utils/index'
import {ElMessage, FormInstance} from 'element-plus'
import {TreeApi} from '@/api/tree'
import {useTreeNode} from '@/views/components/tree/hooks/treeNode'
import {addMapSource} from "../entity";
import {useI18n} from 'vue-i18n'
@ -51,7 +50,7 @@ const removeSpaces = (value: string) => {
form.sourceName = value.replace(/\s/g, '')
}
const close = () => {
$changeComponentPop('.adddirectory', false)
$changeComponentPop('.tsdirectory', false)
}
const submitForm = async (formEl: FormInstance | undefined) => {
if (!formEl) return
@ -75,66 +74,8 @@ const add = throttle(async () => {
cancel()
}
})
/* const res: any = await TreeApi.addDirectory({
id: new YJ.Tools().randomString(),
sourceName: form.sourceName,
parentId: parentId || undefined
})
console.log(res)
if (res.code == 0 || res.code == 200) {
const node = {
...res.data
}
let addNode = await cusAddNodes(window.treeObj, getSelectedNode(window.treeObj), [node], true) //添加节点
//获取该节点下的同级节点
const someNode: any = getSameLevel(window.treeObj, addNode[0])
console.log('someNode', someNode)
const newNode = someNode.map((item: any) => {
let index = item.getIndex()
item.treeIndex = index + 1
return {
...item,
treeIndex: item.getIndex()
}
})
ElMessage({
message: '添加成功',
type: 'success'
})
cancel()
} else {
ElMessage({
message: '添加失败',
type: 'error'
})
}*/
// console.log(res)
}, 3000)
////上传或修改树的层级
// const updateTree = async (newNode: any) => {
// const list = newNode.map((item: any) => {
// return {
// id: item.id,
// treeIndex: item.treeIndex,
// parentId: item.parentId
// }
// })
// console.log(list)
// const res = await TreeApi.updateTree({ list })
// if (res.code == 0) {
// ElMessage({
// message: '添加成功',
// type: 'success'
// })
// cancel()
// } else {
// ElMessage({
// message: '添加失败',
// type: 'error'
// })
// }
// }
}, 3000)
const cancel = () => {
$changeComponentPop('.tsdirectory', false)

View File

@ -191,6 +191,11 @@ let formatTime = (timeStamp) => {
return props.TSOBJ.parseTime(timeStamp)
}
let play = () => {
if (props.TSOBJ._Store._currentTimestamp >= props.TSOBJ._Store.getTotalTime()) {
ElMessage.warning("到达推演终点")
return
}
props.TSOBJ._Clock._status = "play"
console.log(props.TSOBJ._Clock._status)
// return

View File

@ -171,6 +171,8 @@
<deduction :TSOBJ="tsOBJ"></deduction>
<newEvent></newEvent>
<addDirectory class="adddirectoryBox absolute zIndex999"></addDirectory>
<directoryTs ref="editDirectoryTsBox" class="editDirectoryTsBox absolute zIndex999"></directoryTs>
<mouseRight></mouseRight>
<component :is="currentComponent" ref="dynamicComponentRef"/>
<!-- 方案描述编辑框 -->
@ -319,11 +321,13 @@ import {ElMessage} from "element-plus";
import {addMapSource} from "../../common/addMapSource";
import {$changeComponentShow} from "../../utils/communication";
import {useI18n} from "vue-i18n";
import directoryTs from "./edit/directoryTs.vue";
import billboardObject from "./edit/billboardObjectTs.vue";
import polylineObject from "./edit/polylineObjectTs.vue";
import polygonObject from "./edit/polygonObjectTs.vue";
const {t} = useI18n()
let editDirectoryTsBox = ref()
const planInfo = ref({})
const isShowPup = ref(false)
const showStandText = ref(false)
@ -403,6 +407,10 @@ let submit = () => {
})
}
let submitStandText = (flag) => {
if (standText.value.trim() == '' && flag) {
ElMessage.warning("内容不能为空")
return
}
showStandText.value = false
/* let res = {
currentDrawItem: currentDrawItem.value,
@ -565,6 +573,10 @@ eventBus.on('openDialog', async (sourceType: any, id: any) => {
dynamicComponentRef.value.close()
}
switch (sourceType) {
case 'directory':
console.log(editDirectoryTsBox.value)
editDirectoryTsBox.value.open()
break
case 'point':
currentComponent.value = billboardObject
await nextTick()
@ -744,7 +756,7 @@ eventBus.on('destroyComponent', (id) => {
cursor: pointer;
}
.adddirectoryBox {
.adddirectoryBox, .editDirectoryTsBox {
display: none;
}
}

View File

@ -0,0 +1,228 @@
<template>
<div class="directoryTs">
<div class="box">
<div class="boxHeader nav">
<!-- <span></span> -->
<span class="label">{{ title }}</span>
<div class="close-box" @click="close">
<span class="close"></span>
<i>x</i>
</div>
</div>
<div class="boxBody">
<el-form :model="form" :rules="rules" ref="ruleForm" label-width="80px"
@keyup.enter.native="submitForm(ruleForm)" @submit.native.prevent>
<el-form-item label="名称:" prop="sourceName">
<!-- @input="removeSpaces" -->
<el-input v-model.trim="form.sourceName" placeholder="节点名称"></el-input>
</el-form-item>
<el-form-item>
<div class="btnOption">
<el-button type="primary" @click="submitForm(ruleForm)">确定</el-button>
<el-button @click="close">取消</el-button>
</div>
</el-form-item>
</el-form>
</div>
</div>
</div>
</template>
<script setup lang="ts">
import {inject, ref} from "vue";
import {$changeComponentPop} from "../../../utils/communication";
import {FormInstance} from "element-plus";
import {throttle} from '@/utils/index'
import {useTreeNode} from "../../components/tree/hooks/treeNode";
import {TsApi} from "../../../api/ts";
const {getSelectedNodes, cusSelectNode, getSameLevel, cusNodeIcon, nodeType, cusUpdateNode} = useTreeNode()
const title = ref('编辑节点')
const eventBus: any = inject('bus')
const baseDialog: any = ref(null)
const sourceId = ref('')
let form: any = reactive({
sourceName: ''
})
const ruleForm = ref()
const rules = reactive({
sourceName: [{required: true, message: '请输入名称', trigger: 'blur'}]
})
const close = () => {
$changeComponentPop('.editDirectoryTsBox', false)
setTimeout(() => {
sourceId.value = ''
form.sourceName = ''
ruleForm.value?.resetFields()
}, 200);
}
const submitForm = async (formEl: FormInstance | undefined) => {
if (!formEl) return
await formEl.validate((valid, fields) => {
if (valid) {
add()
} else {
console.log('error submit!', fields)
}
})
}
const add = throttle(async () => {
const res: any = await TsApi.updateTsSource({
id: sourceId.value,
sourceName: form.sourceName
})
cusUpdateNode({id: sourceId.value, sourceName: form.sourceName, params: undefined})
close()
console.log(res, form.sourceName)
}, 3000)
const open = () => {
console.log("文件夹编辑框")
let selectNodes = getSelectedNodes(window.treeObj);
if (selectNodes && selectNodes[selectNodes.length - 1]) {
sourceId.value = selectNodes[selectNodes.length - 1].id
form.sourceName = selectNodes[selectNodes.length - 1].sourceName
$changeComponentPop('.editDirectoryTsBox', true)
}
}
const closeCallback = () => {
/* entityOptions.value.originalOptions = structuredClone(originalOptions)
that.positionEditing = false
that.reset()*/
eventBus?.emit('destroyComponent')
}
defineExpose({
open,
})
</script>
<style lang="scss" scoped>
.directoryTs {
user-select: none;
width: 100vw;
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
.box {
width: 20vw;
height: 10vw;
display: flex;
flex-direction: column;
position: absolute;
left: 50%;
top: 45%;
transform: translate(-50%, -50%);
color: var(--color-sdk-auxiliary-public);
font-size: 14px;
// z-index: 999999;
background: linear-gradient(0deg, var(--color-sdk-bg-gradual)), rgba(0, 0, 0, 0.6);
border: 1.5px solid;
backdrop-filter: blur(2px);
border-image: linear-gradient(to bottom, var(--color-sdk-gradual)) 1;
text-align: left;
font-family: 'sy-boldface';
.boxHeader {
display: flex;
justify-content: space-between;
font-size: 18px;
line-height: 46px;
padding: 5px 16px 5px 16px;
height: 46px;
.label {
font-family: 'Ali-mother-counts-bold';
font-size: 18px;
font-weight: 400;
color: rgba(255, 255, 255, 1);
text-align: left;
text-shadow: 0px 0px 9px rgb(20 118 255);
}
.close-box {
position: absolute;
top: -1px;
right: 0;
height: 30px;
cursor: pointer;
width: 30px;
border-radius: 0 0 0 90%;
overflow: hidden;
.close {
display: block;
width: 100%;
height: 100%;
background: rgba(var(--color-base1), 1);
opacity: 0.5;
}
i {
font-style: normal;
font-size: 18px;
font-weight: 900;
position: absolute;
top: -13px;
left: 11px;
}
}
}
.boxBody {
flex: auto;
flex-direction: column;
display: flex;
flex-wrap: wrap;
justify-content: space-between;
padding: 20px;
.el-form--label-top .el-form-item__label {
padding: 0;
}
.el-form-item {
margin-bottom: 10px;
}
:deep(.el-form-item__label) {
color: #fff;
}
.el-input__wrapper {
background-color: rgba(0, 0, 0, 0.5);
border: 0.2px solid rgba(var(--color-base1), 0.5);
box-shadow: 0 0 0 0.2px rgba(var(--color-base1), 0.5) inset !important;
/* 新增此行 */
}
.el-input__inner {
background-color: transparent;
color: #fff;
// border-color: rgba(var(--color-base1), 0.5) !important;
}
.btnOption {
margin-top: 5px;
text-align: right;
}
.el-button {
background: rgba(var(--color-base1), 0.2);
border-color: rgba(var(--color-base1), 0.5) !important;
color: #ffffff;
padding: 8px 16px;
}
.el-button:hover {
border-color: rgba(var(--color-base1), 1) !important;
}
}
}
}
</style>

View File

@ -217,13 +217,23 @@ const lists = ref([])
const elementList = ref([])
let input2 = ref('')
watch(input2, (val) => {
console.log("activIndex", activIndex.value)
console.log("input2", val)
console.log("lists", lists)
console.log("lists", lists.value.filter(item => item.name.includes(val)))
if (val == '') {
handleTabClick(tabs[activIndex.value], activIndex.value)
if (dataType.value == 'tree') {
if (activIndex.value == 0) {
getModelTypeList(input2.value)
} else if (activIndex.value == 1) {
getGraphTypeList(input2.value)
}
} else {
lists.value = lists.value.filter(item => item.name.includes(val))
if (val == '') {
handleTabClick(tabs[activIndex.value], activIndex.value)
} else {
lists.value = lists.value.filter(item => item.name.includes(val))
}
}
treeRef.value && treeRef.value!.filter(val)
})
@ -240,6 +250,7 @@ const filterNode = (value: string, data: Tree) => {
const handleTabClick = (item, index) => {
activIndex.value = index
currentTypeId.value = ""
input2.value = ""
elementList.value = []
console.log(item)
@ -290,14 +301,21 @@ const getModelListByType = (id) => {
}
}
// 获取模型类型列表
let getModelTypeList = async () => {
let res = await ModelApi.modelTypeList()
let getModelTypeList = async (modelName = null) => {
let Obj = {modelName}
if (modelName == null)
delete Obj.modelName
let res = await ModelApi.modelTypeList(Obj)
if (res.code == 200) {
modelTypes.value = res.data
treeData.value = modelTypes.value
}
}
let getGraphTypeList = async () => {
let res = await GraphApi.modelTypeList()
let getGraphTypeList = async (militaryName = null) => {
let Obj = {militaryName}
if (militaryName == null)
delete Obj.militaryName
let res = await GraphApi.modelTypeList(Obj)
if (res.code == 200) {
graphTypes.value = res.data
}
@ -339,6 +357,13 @@ let addMarker = (item, needSendEvent = true) => {
window.draw.start((a, position) => {
console.log(position)
if (position != undefined) {
if (position.length == 0 && item.type == "standText") {
item.source_name = ""
return;
}
if (position.length < 2 && item.type == "waterL") {
return;
}
let obj = {id, name: item.source_name, position}
switch (item.type) {
case 'model':
@ -385,10 +410,8 @@ let addMarker = (item, needSendEvent = true) => {
if (item.type == "standText") {
item.source_name = ""
}
}
})
}

View File

@ -219,8 +219,12 @@ const handleNodeClick = (data: Tree, node, TreeNode, event) => {
form.name = data.name + '-' + zNode.value.sourceName
}
const drawLine = () => {
$(".newEvent")[0].style.display = "none"
let draw = new YJ.Draw.DrawPolyline(window['earth_ts'])
draw.start((error, p) => {
if (p != undefined) {
$(".newEvent")[0].style.display = "block"
}
positions.value = p
})
}
@ -344,6 +348,7 @@ const reset = (changeEventType = false) => {
numbers.value = 0
times.value = 1
form.name = '闪烁-'
positions.value = []
// datetime: '',
form['datetime'] = new Date(window['tsObj']._Store._currentTimestamp)

View File

@ -37,7 +37,8 @@ export class Clock {
nowTime = now
// 设置时间指示器位置
store.setCursorLeft(store._currentTimestamp)
if (store._currentTimestamp >= store.getTotalTime()) {
if (store._currentTimestamp > store.getTotalTime()) {
eventCallback()
this.stopAnimation()
this._status = "stop"
}

View File

@ -62,6 +62,7 @@ export class TS extends Tools {
const value = l.num
// 第几个大格,小标-=1
this.setWheel(value)
this._Store.setCursorLeft(this._Store._currentTimestamp)
break;
case "scroll-chart":
this._Store._scales.scrollTop = obj.top

View File

@ -502,6 +502,7 @@ const addModelDB = (path) => {
if (res.code == 0 || res.code == 200) {
ElMessage.success('导入成功')
modelList.value = []
currModelList.value = []
getModelList()
}
})
@ -668,7 +669,9 @@ const toggleExpand = (row: any) => {
// loadModelsByType(row.id)
contextMenu.visible && (contextMenu.visible = false)
}
let clickTypeId = null //存储点击数据,用来删除时更新右侧列表
const getModelListByType = (id) => {
clickTypeId = id
let formData = new FormData()
formData.append('militaryTypeId', id)
formData.append('name', photoName.value)
@ -835,6 +838,10 @@ const handleDeleteType = (row: TypeNode) => {
if (res.code == 0 || res.code == 200) {
ElMessage.success('删除成功')
getModelList()
if (row.id === clickTypeId) {
modelList.value = []
currModelList.value = []
}
}
})
})

View File

@ -183,6 +183,7 @@ import type { DragEvents } from 'element-plus/es/components/tree/src/model/useDr
import type { AllowDropType, NodeDropType, RenderContentContext } from 'element-plus'
import { ModelApi } from '@/api/model/index'
import { ElMessage, ElMessageBox } from 'element-plus'
import {
$sendElectronChanel,
$recvElectronChanel,
@ -551,6 +552,7 @@ const addModelDB = (path) => {
if (res.code == 0 || res.code == 200) {
ElMessage.success('导入成功')
modelList.value = []
currModelList.value = []
getModelList()
}
})
@ -889,6 +891,7 @@ const handleDeleteType = (row: TypeNode) => {
//如果删除当前选中数据 清空右侧列表
if (row.id === clickTypeId) {
modelList.value = []
currModelList.value = []
}
}
})

View File

@ -592,6 +592,8 @@ const addModelDB = (path) => {
PhotoApi.importModelDB(formData).then((res) => {
if (res.code == 0 || res.code == 200) {
ElMessage.success('导入成功')
modelList.value = []
currModelList.value = []
getModelList()
}
})
@ -760,12 +762,14 @@ const toggleExpand = (row: any) => {
// loadModelsByType(row.id)
contextMenu.visible && (contextMenu.visible = false)
}
let clickTypeId = null //存储点击数据,用来删除时更新右侧列表
const getModelListByType = async (id) => {
if (activeIndex.value === 0) {
modelList.value = threePhoto
} else if (activeIndex.value === 1) {
modelList.value = ordinaryPhoto
} else {
clickTypeId = id
let formData = new FormData()
formData.append('iconTypeId', id)
formData.append('name', photoName.value)
@ -924,6 +928,10 @@ const handleDeleteType = (row: TypeNode) => {
PhotoApi.delModelType(formData).then((res) => {
if (res.code == 0 || res.code == 200) {
ElMessage.success('删除成功')
if (row.id === clickTypeId) {
currModelList.value = []
modelList.value = []
}
getModelList()
}
})

View File

@ -1,5 +1,6 @@
<template>
<Dialog ref="baseDialog" :title="title + '属性'" left="180px" top="100px" className="circle" :closeCallback="closeCallback">
<Dialog ref="baseDialog" :title="title + '属性'" left="180px" top="100px" className="circle"
:closeCallback="closeCallback">
<template #content>
<span class="custom-divider"></span>
<div class="div-item">
@ -24,7 +25,7 @@
</div>
</div>
</div>
<div class="div-item">
<div>
<div class="row">
<el-tabs v-model="activeName">
<el-tab-pane label="属性信息" name="1">
@ -91,22 +92,24 @@
</div>
</el-tab-pane>
<el-tab-pane label="面风格" name="3">
<div class="row">
<div class="col">
<span class="label">面颜色</span>
<div class="color" ref="colorRef"></div>
</div>
<div class="col">
<span class="label">描边颜色</span>
<div class="lineColor" ref="lineColorRef"></div>
</div>
<div class="col">
<span class="label">描边宽度</span>
<div class="input-number input-number-unit-2">
<input class="input" type="number" title="" min="0" max="99" v-model="entityOptions.lineWidth"
@input="$handleInputLimit">
<span class="unit">px</span>
<span class="arrow"></span>
<div class="div-item">
<div class="row">
<div class="col">
<span class="label">面颜色</span>
<div class="color" ref="colorRef"></div>
</div>
<div class="col">
<span class="label">描边颜色</span>
<div class="lineColor" ref="lineColorRef"></div>
</div>
<div class="col">
<span class="label">描边宽度</span>
<div class="input-number input-number-unit-2">
<input class="input" type="number" title="" min="0" max="99" v-model="entityOptions.lineWidth"
@input="$handleInputLimit">
<span class="unit">px</span>
<span class="arrow"></span>
</div>
</div>
</div>
</div>
@ -301,7 +304,9 @@ const inputBlurCallBack = (event, i, name, digit = 2) => {
}
}
const translate = () => {
const translate = async () => {
entityOptions.value.closeNodeEdit()
await nextTick()
that.openPositionEditing(() => {
entityOptions.value.options.center = structuredClone(that.options.center)
})
@ -397,4 +402,5 @@ defineExpose({
flex: 0 0 76px !important;
}
}
}</style>
}
</style>

View File

@ -1,13 +1,6 @@
<template>
<Dialog
ref="baseDialog"
class="fly-roam"
title="飞行漫游"
width="460px"
left="180px"
top="100px"
:closeCallback="closeCallBack"
>
<Dialog ref="baseDialog" class="fly-roam" title="飞行漫游" width="460px" left="180px" top="100px"
:closeCallback="closeCallBack">
<template #content v-if="show">
<span class="custom-divider"></span>
<div class="div-item">
@ -113,16 +106,8 @@
<div class="col" style="flex: 0 0 300px">
<span class="label">默认时长</span>
<div class="input-number input-number-unit-3">
<input
class="input total-time"
type="number"
title=""
min="0"
max="999999.99"
step="0.01"
name="defaultTime"
value="5"
/>
<input class="input total-time" type="number" title="" min="0" max="999999.99" step="0.01"
name="defaultTime" value="5" />
<span class="unit" style="top: 6px">s</span>
<span class="arrow"></span>
</div>
@ -150,28 +135,15 @@
/> -->
<span class="label">设置总时长</span>
<div class="input-number input-number-unit-3">
<input
class="input total-time"
type="number"
title=""
min="0"
max="999999.99"
step="0.01"
name="totalTime"
value="0"
/>
<input class="input total-time" type="number" title="" min="0" max="999999.99" step="0.01"
name="totalTime" value="0" />
<span class="unit" style="top: 6px">s</span>
<span class="arrow"></span>
</div>
<button class="isTotalTime" style="margin-left: 10px">应用</button>
<input
type="checkbox"
name="repeat"
class="YJ-custom-checkbox"
style="cursor: pointer; width: auto; margin-right: 5px; margin-left: 10px"
/>
<input type="checkbox" name="repeat" class="YJ-custom-checkbox"
style="cursor: pointer; width: auto; margin-right: 5px; margin-left: 10px" />
<span class="label">循环</span>
<!-- <button style="margin-left: 10px" @click="apply">应用</button> -->
</div>
</div>
<div class="table">
@ -236,39 +208,386 @@ let viewPointHeight: any = ref(0)
var show: any = ref(false)
var flyRoam: any = reactive([])
eventBus.on('flyRoamDialog', () => {
show.value = true
baseDialog.value?.open()
setTimeout(() => {
flyRoam = YJ.Global.FlyRoam.open(window.earth, { repeat: Infinity }, {}, draw)
}, 100)
})
let beforeData = []
const open = (data) => {
beforeData = data
show.value = true
baseDialog.value?.open()
if (data) {
let roamData = JSON.parse(data.params)
setTimeout(() => {
flyRoam = YJ.Global.FlyRoam.open(window.earth, roamData, {}, draw)
}, 100)
} else {
setTimeout(() => {
flyRoam = YJ.Global.FlyRoam.open(window.earth, { repeat: Infinity }, {}, draw)
}, 100)
}
}
let allData: any = reactive({
let roamData: any = reactive({
name: '',
points: [],
repeat: '',
defaultTime: 5,
totalTime: 0
})
eventBus.on('closeFlyRoamDialogById', (id) => {
if(id && id ===beforeData.id) {
close()
}
})
let beforeData = {}
const open = async (data) => {
beforeData = data
show.value = true
baseDialog.value?.open()
await nextTick()
if (data) {
roamData = JSON.parse(data.params)
} else {
roamData = {
name: '',
points: [],
repeat: Infinity,
defaultTime: 5,
totalTime: 0
}
}
let name = roamData.name || '漫游路径'
roamData.points || (roamData.points = [])
let repeat = 0
if (roamData.repeat) {
repeat = Number(roamData.repeat)
}
let contentElm = document.getElementsByClassName('fly-roam')[0]
if (!contentElm) {
return
}
if (roamData.defaultTime) {
contentElm.querySelector("input[name='defaultTime']").value = roamData.defaultTime
}
if (roamData.totalTime) {
contentElm.querySelector("input[name='totalTime']").value = roamData.totalTime
}
let viewer = window.earth.viewer
let tools = new YJ.Tools(window.earth)
let active = 0
let tableBody = contentElm.getElementsByClassName('table-body')[0];
let tableEmpty = contentElm.getElementsByClassName('table-empty')[0]
let handler = {
set: function (target, prop, value) {
target[prop] = value;
if (target.length > 0) {
tableEmpty.style.display = 'none'
}
else {
tableEmpty.style.display = 'flex'
}
return true;
},
};
let i = 0
let points = new Proxy([], handler);
for (i = 0; i < roamData.points.length; i++) {
points.push(roamData.points[i])
addTrElm(roamData.points[i])
}
let nameElm = contentElm.querySelector("input[name='name']")
nameElm.value = name
nameElm.addEventListener('input', () => {
name = nameElm.value
draw({
name: name,
points: points,
repeat: repeat + '',
defaultTime: defaultTimeDom.value,
totalTime: totalTimeElm.value
})
})
let defaultTimeDom = contentElm.querySelector("input[name='defaultTime']")
nameElm.addEventListener('input', () => {
draw({
name: name,
points: points,
repeat: repeat + '',
defaultTime: defaultTimeDom.value,
totalTime: totalTimeElm.value
})
})
// let addListBtn = document.createElement('button');
let addListBtn = document.getElementsByClassName('saveRoam')[0];
// addListBtn.innerHTML = '保存'
addListBtn.addEventListener('click', () => {
if (!name) {
name = '漫游路径'
nameElm.value = name
}
let newPoints = []
points.map((item) => {
newPoints.push(item)
})
draw({
name: name,
points: newPoints,
repeat: repeat + '',
defaultTime: defaultTimeDom.value,
totalTime: totalTimeElm.value
})
// _Dialog.clickSavePath && _Dialog.clickSavePath(
// {
// name: name,
// points: newPoints,
// repeat: repeat + ''
// }
// )
})
let endBtn = contentElm.getElementsByClassName('cease')[0]
endBtn.addEventListener('click', () => {
viewer.camera.cancelFlight()
})
let flyBtn = contentElm.getElementsByClassName('afreshPlay')[0]
flyBtn.addEventListener('click', () => {
if (points.length > 0) {
YJ.Global.FlyRoam.flyTo(window.earth, points, 0)
}
})
let addBtn = contentElm.getElementsByClassName('add-point')[0]
addBtn.addEventListener('click', () => {
let position = tools.cartesian3Towgs84(viewer.camera.position, viewer)
let defaultTime = Number(contentElm.querySelector("input[name='defaultTime']").value)
let time = points.length === active ? 0 : defaultTime
let data = {
duration: time,
position: position,
orientation: {
heading: viewer.camera.heading,
pitch: viewer.camera.pitch,
roll: viewer.camera.roll
}
}
if (points.length === active && active !== 0) {
points[points.length - 1].duration = defaultTime
let trList = tableBody.getElementsByClassName('tr')
trList[points.length - 1].querySelector("input[name='time']").value = defaultTime
}
points.splice(active, 0, data)
addTrElm(data)
i++
draw({
name: name,
points: points,
repeat: repeat + '',
defaultTime: defaultTimeDom.value,
totalTime: totalTimeElm.value
})
})
let totalTimeElm = contentElm.querySelector("input[name='totalTime']")
// let isTotalTimeElm = contentElm.querySelector("input[name='isTotalTime']")
let isTotalTimeElm = contentElm.getElementsByClassName('isTotalTime')[0]
let repeatElm = contentElm.querySelector("input[name='repeat']")
isTotalTimeElm.addEventListener('click', () => {
let trList = tableBody.getElementsByClassName('tr')
// if (isTotalTimeElm.checked && trList.length > 0) {
if (trList.length > 0) {
let time = Number((Number(totalTimeElm.value) / (trList.length - 1)).toFixed(2))
for (let i = 0; i < trList.length - 1; i++) {
points[i].duration = time
trList[i].querySelector("input[name='time']").value = time
}
trList[trList.length - 1].querySelector("input[name='time']").value = 0
totalTimeElm.value = 0//点击应用后默认时间清零
}
})
totalTimeElm.addEventListener('blur', () => {
let trList = tableBody.getElementsByClassName('tr')
totalTimeElm.value = Number(totalTimeElm.value)
if (totalTimeElm.value < 0) {
totalTimeElm.value = 0
}
if (isTotalTimeElm.checked && trList.length > 0) {
let time = Number((Number(totalTimeElm.value) / (trList.length - 1)).toFixed(2))
for (let i = 0; i < trList.length - 1; i++) {
points[i].duration = time
trList[i].querySelector("input[name='time']").value = time
}
trList[trList.length - 1].querySelector("input[name='time']").value = 0
}
draw({
name: name,
points: points,
repeat: repeat + '',
defaultTime: defaultTimeDom.value,
totalTime: totalTimeElm.value
})
})
repeatElm.checked = (repeat === Infinity ? true : false)
repeatElm.addEventListener('change', () => {
if (repeatElm.checked) {
repeat = Infinity
}
else {
repeat = 0
}
draw({
name: name,
points: points,
repeat: repeat + '',
defaultTime: defaultTimeDom.value,
totalTime: totalTimeElm.value
})
})
function addTrElm(data) {
let trList = tableBody.getElementsByClassName('tr')
if (trList.length > 0) {
trList[trList.length - 1].querySelector("input[name='time']").disabled = undefined
}
let tr_active = tableBody.getElementsByClassName('tr active')[0]
tr_active && (tr_active.className = 'tr')
let tr = document.createElement('div');
tr.className = 'tr active'
tr.innerHTML = `
<div class="td" style="justify-content: center;">视点${i + 1}</div>
<div class="td">
<input class="input time" type="number" title="" min="0" max="999.99" step="0.01" name="time" value="${data.duration}">
</div>
<div class="td action">
<button title="更新视角" class='iconBut'><svg class="icon-resetView modify-point" style='width:20px;height:20px;cursor: pointer;'><use xlink:href="#yj-icon-resetView"></use></svg></button>
<button title="播放" class='iconBut'><svg class="icon-play play" style='width:15px;height:15px;cursor: pointer;margin-top: -4px;'><use xlink:href="#yj-icon-play"></use></svg></button>
<button title="删除" class='iconBut'><svg class="icon-delete delete" style='width:20px;height:20px;cursor: pointer;'><use xlink:href="#yj-icon-delete"></use></svg></button>
</div>
`
tr.addEventListener('click', (v) => {
if (v.target.parentNode === tr) {
let tr_active = tableBody.getElementsByClassName('tr active')[0]
tr_active && (tr_active.className = 'tr')
tr.className = 'tr active'
for (let m = 0; m < trList.length; m++) {
if (trList[m] === tr) {
active = m + 1
break
}
}
}
})
tr.addEventListener('dblclick', (v) => {
if (v.target.parentNode === tr) {
for (let m = 0; m < trList.length; m++) {
if (trList[m] === tr) {
viewer.camera.flyTo({
destination: Cesium.Cartesian3.fromDegrees(points[m].position.lng, points[m].position.lat, points[m].position.alt),
orientation: points[m].orientation,
duration: 1
})
break
}
}
}
})
let e_play = tr.getElementsByClassName('play')[0]
let e_delete = tr.getElementsByClassName('delete')[0]
let e_time = tr.querySelector("input[name='time']")
let modifyBtn = tr.getElementsByClassName('modify-point')[0]
modifyBtn.addEventListener('click', () => {
for (let m = 0; m < trList.length; m++) {
if (trList[m] === e_delete.parentNode.parentNode.parentNode) {
let position = tools.cartesian3Towgs84(viewer.camera.position, viewer)
points[m].position = position
points[m].orientation = {
heading: viewer.camera.heading,
pitch: viewer.camera.pitch,
roll: viewer.camera.roll
}
ElMessage({
message: '更新视角成功',
type: 'success'
})
}
}
})
e_play.addEventListener('click', () => {
for (let m = 0; m < trList.length; m++) {
if (trList[m] === e_play.parentNode.parentNode.parentNode) {
if(beforeData.id) {
window.earth.flyRoamId = beforeData.id
}
YJ.Global.FlyRoam.flyTo(window.earth, points, m)
}
}
})
e_delete.addEventListener("click", (v) => {
for (let m = 0; m < trList.length; m++) {
if (trList[m] === e_delete.parentNode.parentNode.parentNode) {
points.splice(m, 1)
points[points.length - 1] && (points[points.length - 1].duration = 0)
tableBody.removeChild(tr)
if (active > m + 1) {
active--
trList[active - 1].className = 'tr active'
}
else if (active == m + 1) {
if (trList.length == m) {
active -= 1
}
if (trList.length != 0) {
trList[active - 1].className = 'tr active'
}
}
// else if(active == m) {
// console.log(trList.length-1, active)
// if (trList.length == active-1) {
// trList[active-2].className = 'tr active'
// }
// else {
// trList[active-1].className = 'tr active'
// }
// }
if (trList.length > 0) {
let lastElm = trList[trList.length - 1].querySelector("input[name='time']")
lastElm.disabled = 'disabled'
lastElm.value = 0
}
break
}
}
// points.splice(i, 1)
// tableBody.removeChild(tr)
// if (trList.length > 0) {
// trList[trList.length - 1].querySelector("input[name='time']").disabled = 'disabled'
// }
draw({
name: roamData.name,
points: roamData.points,
repeat: roamData.repeat + '',
defaultTime: defaultTimeDom.value,
totalTime: totalTimeElm.value
})
})
e_time.addEventListener('input', (v) => {
isTotalTimeElm.checked = false
data.duration = Number(e_time.value)
if (data.duration < 0) {
data.duration = 0
}
})
e_time.addEventListener('blur', () => {
e_time.value = Number(Number(e_time.value).toFixed(2))
if (e_time.value < 0) {
e_time.value = 0
}
});
tableBody.insertBefore(tr, trList[active])
active++
trList[trList.length - 1].querySelector("input[name='time']").disabled = 'disabled'
}
}
const save = async () => {
if (allData.points.length != 0) {
if (roamData.points.length != 0) {
let selectedNodes = window.treeObj.getSelectedNodes()
let node = selectedNodes && selectedNodes[selectedNodes.length - 1]
let parentId
@ -281,13 +600,12 @@ const save = async () => {
}
let id = (beforeData && beforeData.id) || new YJ.Tools().randomString()
let paramsData: any = {
params: allData,
params: roamData,
id,
sourceName: allData.name || t(`default.roam`),
sourceName: roamData.name || t(`default.roam`),
sourceType: 'roam',
parentId: parentId
parentId: parentId,
}
if (beforeData && beforeData.id) {
// let params2 = {
// "id": params.id,
@ -298,16 +616,22 @@ const save = async () => {
// TreeApi.updateDirectoryInfo(params2)
delete paramsData.sourceType
delete paramsData.parentId
paramsData.isShow = allData.isShow
paramsData.isShow = roamData.repeat == 'Infinity' ? 1 : 0
TreeApi.updateDirectoryInfo(paramsData)
cusUpdateNode({
id: paramsData.id,
sourceName: paramsData.sourceName,
params: JSON.stringify(paramsData.params)
})
let node = window.treeObj.getNodeByParam(
"id",
paramsData.id,
null
);
window.treeObj.checkNode(node, paramsData.isShow, true);
} else {
let res = await TreeApi.addOtherSource(paramsData)
if(![0, 200].includes(res.code)) {
if (![0, 200].includes(res.code)) {
return
}
ElMessage.closeAll()
@ -315,8 +639,17 @@ const save = async () => {
message: '添加成功',
type: 'success'
})
paramsData.isShow = true
let sourceType = paramsData.sourceType
let parentId = paramsData.parentId
delete paramsData.sourceType
delete paramsData.parentId
paramsData.isShow = roamData.repeat == 'Infinity' ? 1 : 0
if(!paramsData.isShow) {
TreeApi.updateDirectoryInfo(paramsData)
}
paramsData.params = JSON.stringify(paramsData.params)
paramsData.sourceType = sourceType
paramsData.parentId = parentId
cusAddNodes(window.treeObj, paramsData.parentId, [paramsData])
}
@ -329,7 +662,7 @@ const save = async () => {
}
}
const draw = (data) => {
allData = data
roamData = data
}
const startVideo = () => {
@ -352,25 +685,20 @@ const startVideo = () => {
window.addEventListener('keydown', handleKeyDown)
}
const clangeViewPointHeight = () => {}
const viewPointHeightInput = () => {
let dom: any = document.getElementById('viewPointHeight')
if (viewPointHeight.value < dom.min * 1) {
viewPointHeight.value = dom.min * 1
} else if (viewPointHeight.value > dom.max * 1) {
viewPointHeight.value = dom.max * 1
}
}
const closeCallBack = (e) => {
YJ.Global.FlyRoam.cease(window.earth)
YJ.Global.FlyRoam.close()
let contentElm = document.getElementsByClassName('fly-roam')[0]
if (contentElm) {
let tableBody = contentElm.getElementsByClassName('table-body')[0];
let trList = tableBody.getElementsByClassName('tr')
for (let i = trList.length - 1; i >= 0; i--) {
tableBody.removeChild(trList[i])
}
}
}
onBeforeUnmount(() => {
closeCallBack('')
})
const apply = (e) => {
YJ.Global.FlyRoam.apply()
}
const close = (e) => {
show.value = false
baseDialog.value?.close()
@ -405,12 +733,10 @@ defineExpose({
}
.video {
background: linear-gradient(
180deg,
background: linear-gradient(180deg,
rgba(71, 27, 5, 0.3) 0%,
rgba(71, 27, 5, 0.3) 0%,
rgba(255, 143, 87, 0) 100%
),
rgba(255, 143, 87, 0) 100%),
rgba(0, 0, 0, 0.5) !important;
border: 1px solid rgba(255, 165, 92, 1) !important;
color: rgba(255, 165, 92, 1) !important;

View File

@ -140,10 +140,10 @@
<script setup lang="ts">
//@ts-nocheck
import {ref, reactive, onBeforeUnmount} from 'vue'
import {inject} from 'vue'
import { ref, reactive, onBeforeUnmount } from 'vue'
import { inject } from 'vue'
import Dialog from '@/components/dialog/baseDialog.vue'
import {RouteApi} from '@/api/route/index'
import { RouteApi } from '@/api/route/index'
const baseDialog: any = ref(null)
const eventBus: any = inject('bus')
@ -223,7 +223,7 @@ const open = () => {
//加载路网数据
const addRoute = async (fileId) => {
let res = await RouteApi.loadRoute({fileId})
let res = await RouteApi.loadRoute({ fileId })
}
const getList = async () => {
let list = await RouteApi.getRouteList()
@ -238,6 +238,7 @@ const closeCallBack = (e) => {
startLat.value = null
endLng.value = null
endLat.value = null
routePlanning.destroyMouse()
}
onBeforeUnmount(() => {
closeCallBack('')
@ -251,8 +252,7 @@ const routeQuery = async (e) => {
waypoints: []
})
}
const clearRoute = (e) => {
}
const clearRoute = (e) => {}
const pickStartPos = () => {
routePlanning.pickStartPos((position) => {
startLng.value = position.lng

View File

@ -45,6 +45,7 @@
max="100"
min="0"
step="0.01"
disabled
v-model="progressVal"
/>
</div>
@ -101,6 +102,7 @@ const closeCallBack = (e) => {
progressVal.value = 0
scale.value = 1
modify.value = false
eventBus.emit('closeScreenShot', false)
}
onBeforeUnmount(() => {
closeCallBack('')
@ -124,8 +126,10 @@ const getResultData = (data) => {
// eventBus.emit('mapPrintDialog')
}
}
const name = 'ScreenShotHD'
defineExpose({
open
open,
name
})
</script>

View File

@ -2,9 +2,10 @@
<Dialog ref="baseDialog" :title="t('bottomMenu.groundText')" left="calc(50% - 198px)" top="calc(50% - 120px)"
:closeCallback="closeCallBack">
<template #content>
<textarea style="height: 40px; width: 348px;margin-bottom: 10px;" maxlength="80" v-model="text"></textarea>
<textarea style="height: 40px; width: 348px;margin-bottom: 10px;" maxlength="80" v-model="text" @focus="error = false"></textarea>
<span style="position: absolute;bottom: 66px;right: 26px;font-size: 12px;color: #c5c5c5;font-family: Arial;">{{
text.length }}/80</span>
<span v-if="error" style="top: unset;bottom: 72px;left: 26px;" class="el-form-item__error">内容不能为空</span>
</template>
<template #footer>
<button @click="confirm">{{ t('btn.confirm') }}</button>
@ -26,6 +27,7 @@ const { cusAddNodes } = useTreeNode()
const baseDialog: any = ref(null)
const eventBus: any = inject('bus')
const error = ref(false)
const text = ref('')
eventBus.on('openStandTextAdd', () => {
baseDialog.value?.open()
@ -35,6 +37,7 @@ const open = () => {
}
const confirm = () => {
if (!text.value) {
error.value = true
return
}
text.value = text.value.trim()
@ -112,6 +115,7 @@ const confirm = () => {
}
const closeCallBack = () => {
text.value = ''
error.value = false
}
defineExpose({
open

View File

@ -2,9 +2,10 @@
<Dialog ref="baseDialog" :title="t('bottomMenu.standText')" left="calc(50% - 198px)" top="calc(50% - 120px)"
:closeCallback="closeCallBack">
<template #content>
<textarea style="height: 40px; width: 348px;margin-bottom: 10px;" maxlength="80" v-model="text"></textarea>
<textarea style="height: 40px; width: 348px;margin-bottom: 10px;" maxlength="80" v-model="text" @focus="error = false"></textarea>
<span style="position: absolute;bottom: 66px;right: 26px;font-size: 12px;color: #c5c5c5;font-family: Arial;">{{
text.length }}/80</span>
<span v-if="error" style="top: unset;bottom: 72px;left: 26px;" class="el-form-item__error">内容不能为空</span>
</template>
<template #footer>
<button @click="confirm">{{ t('btn.confirm') }}</button>
@ -26,6 +27,7 @@ const { cusAddNodes } = useTreeNode()
const baseDialog: any = ref(null)
const eventBus: any = inject('bus')
const error = ref(false)
const text = ref('')
eventBus.on('openStandTextAdd', () => {
baseDialog.value?.open()
@ -34,11 +36,9 @@ const open = () => {
baseDialog.value?.open()
}
const confirm = () => {
if (!text.value) {
return
}
text.value = text.value.trim()
if (!text.value) {
error.value = true
return
}
let name = text.value
@ -107,6 +107,7 @@ const confirm = () => {
}
const closeCallBack = () => {
text.value = ''
error.value = false
}
defineExpose({
open

View File

@ -28,7 +28,8 @@
<div class="col">
<span class="label">动画时长</span>
<div class="input-number input-number-unit-3">
<input class="input blur" type="number" title="" min="500" max="9999999" v-model="entityOptions.spreadTime" @input="$handleInputLimit">
<input class="input blur" type="number" title="" min="500" max="9999999"
v-model="entityOptions.spreadTime" @input="$handleInputLimit">
<span class="unit">ms</span>
<span class="arrow"></span>
</div>
@ -37,7 +38,7 @@
<div class="row">
<div class="col">
<span class="label">动画</span>
<input class="btn-switch" type="checkbox" v-model="entityOptions.spreadState">
<input class="btn-switch" type="checkbox" v-model="spreadState" @change="spreadStateChange">
</div>
<div class="col">
<span class="label">动画重复</span>
@ -47,61 +48,66 @@
</div>
</div>
</div>
<div class="div-item">
<div>
<div class="row">
<el-tabs v-model="activeName">
<el-tab-pane label="属性信息" name="1">
<attribute :entityOptions="entityOptions"></attribute>
</el-tab-pane>
<el-tab-pane label="空间信息" name="2">
<div class="row">
<div class="col height-mode-box">
<span class="label" style="flex: 0 0 56px;">高度模式</span>
<el-select class="input input-select height-mode-scelect" style="width: 155px;margin-left: 20px"
v-model="heightMode" @change="heightModeChange" placeholder="请选择">
<el-option v-for="item in heightModeData" :key="item.key" :label="item.name" :value="item.key">
</el-option>
</el-select>
</div>
<div class="col">
<span class="label">Z值统一增加</span>
<div class="input-number input-number-unit-1 height-box" :class="{ 'disabled': heightMode == 2 }">
<input class="input height" type="number" title="" min="-9999999" max="999999999" v-model="height" @input="$handleInputLimit">
<span class="unit">m</span>
<span class="arrow"></span>
<div class="div-item">
<div class="row">
<div class="col height-mode-box">
<span class="label" style="flex: 0 0 56px;">高度模式</span>
<el-select class="input input-select height-mode-scelect" style="width: 155px;margin-left: 20px"
v-model="heightMode" @change="heightModeChange" placeholder="请选择">
<el-option v-for="item in heightModeData" :key="item.key" :label="item.name" :value="item.key">
</el-option>
</el-select>
</div>
<button class="confirm height-confirm" style="margin-left: 5px;" @click="heightConfirm"
:disabled="heightMode == 2">应用</button>
</div>
</div>
<div class="row">
<div class="table spatial-info-table">
<div class="table-head">
<div class="tr">
<div class="th"></div>
<div class="th">经度X</div>
<div class="th">纬度Y</div>
<div class="th">高度Z</div>
<div class="col">
<span class="label">Z值统一增加</span>
<div class="input-number input-number-unit-1 height-box" :class="{ 'disabled': heightMode == 2 }">
<input class="input height" type="number" title="" min="-9999999" max="999999999" v-model="height"
@input="$handleInputLimit">
<span class="unit">m</span>
<span class="arrow"></span>
</div>
<button class="confirm height-confirm" style="margin-left: 5px;" @click="heightConfirm"
:disabled="heightMode == 2">应用</button>
</div>
<div class="table-body">
<div class="tr" v-for="(item, i) in entityOptions.options.positions" :key="i">
<div class="td">{{ i + 1 }}</div>
<div class="td lng align-center" @dblclick="inputDblclick($event, i, 'lng')">
<input class="input" @blur="inputBlurCallBack($event, i, 'lng', 8)" type="number"
v-model="item.lng" min="-180" max="180" v-if="activeTd.index == i && activeTd.name == 'lng'" @input="$handleInputLimit">
<span style="pointer-events: none;" v-else>{{ (item.lng).toFixed(8) }}</span>
</div>
<div class="row">
<div class="table spatial-info-table">
<div class="table-head">
<div class="tr">
<div class="th"></div>
<div class="th">经度X</div>
<div class="th">纬度Y</div>
<div class="th">高度Z</div>
</div>
<div class="td lat align-center" @dblclick="inputDblclick($event, i, 'lat')">
<input class="input" @blur="inputBlurCallBack($event, i, 'lat', 8)" type="number"
v-model="item.lat" min="-180" max="180" v-if="activeTd.index == i && activeTd.name == 'lat'" @input="$handleInputLimit">
<span style="pointer-events: none;" v-else>{{ (item.lat).toFixed(8) }}</span>
</div>
<div class="td alt align-center" @dblclick="inputDblclick($event, i, 'alt')">
<input class="input" @blur="inputBlurCallBack($event, i, 'alt', 2)" type="number"
v-model="entityOptions.height" min="-9999999" max="999999999"
v-if="activeTd.index == i && activeTd.name == 'alt'" @input="$handleInputLimit">
<span style="pointer-events: none;" v-else>{{ (entityOptions.height).toFixed(2) }}</span>
</div>
<div class="table-body">
<div class="tr" v-for="(item, i) in entityOptions.options.positions" :key="i">
<div class="td">{{ i + 1 }}</div>
<div class="td lng align-center" @dblclick="inputDblclick($event, i, 'lng')">
<input class="input" @blur="inputBlurCallBack($event, i, 'lng', 8)" type="number"
v-model="item.lng" min="-180" max="180" v-if="activeTd.index == i && activeTd.name == 'lng'"
@input="$handleInputLimit">
<span style="pointer-events: none;" v-else>{{ (item.lng).toFixed(8) }}</span>
</div>
<div class="td lat align-center" @dblclick="inputDblclick($event, i, 'lat')">
<input class="input" @blur="inputBlurCallBack($event, i, 'lat', 8)" type="number"
v-model="item.lat" min="-180" max="180" v-if="activeTd.index == i && activeTd.name == 'lat'"
@input="$handleInputLimit">
<span style="pointer-events: none;" v-else>{{ (item.lat).toFixed(8) }}</span>
</div>
<div class="td alt align-center" @dblclick="inputDblclick($event, i, 'alt')">
<input class="input" @blur="inputBlurCallBack($event, i, 'alt', 2)" type="number"
v-model="entityOptions.height" min="-9999999" max="999999999"
v-if="activeTd.index == i && activeTd.name == 'alt'" @input="$handleInputLimit">
<span style="pointer-events: none;" v-else>{{ (entityOptions.height).toFixed(2) }}</span>
</div>
</div>
</div>
</div>
@ -109,21 +115,24 @@
</div>
</el-tab-pane>
<el-tab-pane label="面风格" name="3">
<div class="row">
<div class="col">
<span class="label">面颜色</span>
<div class="color" ref="colorRef"></div>
</div>
<div class="col">
<span class="label">描边颜色</span>
<div class="lineColor" ref="lineColorRef"></div>
</div>
<div class="col">
<span class="label">描边宽度</span>
<div class="input-number input-number-unit-2">
<input class="input" type="number" title="" min="0" max="99" v-model="entityOptions.lineWidth" @input="$handleInputLimit">
<span class="unit">px</span>
<span class="arrow"></span>
<div class="div-item">
<div class="row">
<div class="col">
<span class="label">面颜色</span>
<div class="color" ref="colorRef"></div>
</div>
<div class="col">
<span class="label">描边颜色</span>
<div class="lineColor" ref="lineColorRef"></div>
</div>
<div class="col">
<span class="label">描边宽度</span>
<div class="input-number input-number-unit-2">
<input class="input" type="number" title="" min="0" max="99" v-model="entityOptions.lineWidth"
@input="$handleInputLimit">
<span class="unit">px</span>
<span class="arrow"></span>
</div>
</div>
</div>
</div>
@ -208,9 +217,12 @@ const heightMode = ref(0)
const entityOptions: any = ref({});
let originalOptions: any
let that: any
const spreadState = ref(false)
const open = async (id: any, type: any) => {
if(type && type === 'pincerArrow') {
if (type && type === 'pincerArrow') {
title.value = '双箭头'
}
that = window.earth.entityMap.get(id)
@ -239,10 +251,10 @@ const open = async (id: any, type: any) => {
area.value = entityOptions.value.areaByMeter
}
}
let spreadState = entityOptions.value.spreadState
heightModeChange(heightMode.value)
spreadState.value = entityOptions.value.spreadState
that.heightMode = heightMode.value
setTimeout(() => {
entityOptions.value.spreadState = spreadState
that.spreadState = spreadState.value
}, 50);
baseDialog.value?.open()
@ -279,8 +291,14 @@ const open = async (id: any, type: any) => {
const heightModeChange = (val) => {
that.heightMode = heightMode.value
entityOptions.value.spreadState = false
that.spreadState = false
spreadState.value = false
}
const spreadStateChange = (val) => {
that.spreadState = spreadState.value
}
const heightConfirm = () => {
if (entityOptions.value.operate.positionEditing) {
@ -316,8 +334,11 @@ const inputBlurCallBack = (event, i, name, digit = 2) => {
}
}
const translate = () => {
entityOptions.value.spreadState = false
const translate = async () => {
that.spreadState = false
spreadState.value = false
entityOptions.value.closeNodeEdit()
await nextTick()
that.openPositionEditing(() => {
entityOptions.value.options.positions = structuredClone(that.options.positions)
})
@ -332,7 +353,8 @@ const closeCallback = () => {
}
const nodeEdit = () => {
entityOptions.value.spreadState = false
that.spreadState = false
spreadState.value = false
that.nodeEdit((e, positions, areaByMeter) => {
entityOptions.value.options.positions = structuredClone(positions)
})
@ -370,31 +392,31 @@ watch(
const remove = () => {
close()
ElMessageBox.confirm('此操作将永久删除节点及所有子节点, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(async () => {
let node = window.treeObj.getNodeByParam('id', that.options.id, null)
let source_ids = cusRemoveNode(window.treeObj, [node])
const res = await TreeApi.removeDirectory({ ids: source_ids })
if (res.code == 0 || res.code == 200) {
ElMessage({
message: '删除成功',
type: 'success'
})
that.remove()
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(async () => {
let node = window.treeObj.getNodeByParam('id', that.options.id, null)
let source_ids = cusRemoveNode(window.treeObj, [node])
const res = await TreeApi.removeDirectory({ ids: source_ids })
if (res.code == 0 || res.code == 200) {
ElMessage({
message: '删除成功',
type: 'success'
})
that.remove()
(window as any)._entityMap.delete(source_ids[0])
} else {
ElMessage({
message: res.msg || '删除失败',
type: 'error'
})
}
})
.catch(() => {
// 用户点击取消,不执行任何操作
})
} else {
ElMessage({
message: res.msg || '删除失败',
type: 'error'
})
}
})
.catch(() => {
// 用户点击取消,不执行任何操作
})
}
defineExpose({
@ -406,6 +428,7 @@ defineExpose({
<style scoped lang="scss">
.attackArrow.dialog-en {
::v-deep>.content {
.attribute-content-link .table .tr .td.operation button,
.attribute-content-vr .table .tr .td.operation button,
.attribute-content-rtmp .table .tr .td.operation button {

View File

@ -620,7 +620,10 @@ const vrDelete = (index: any) => {
attribute.value.vr.content.splice(index, 1)
}
const vrConfirmEdit = (index: string | number) => {
attribute.value.vr.content[index] = vrEditActive.value
attribute.value.vr.content[index] = {
name: vrEditActive.value.name,
url: vrEditActive.value.url
}
vrEditActive.value = {}
}
const vrCancelEdit = () => {
@ -691,7 +694,12 @@ const changeAttributeGoods = (item) => {
}
const changeAttributeCamera = (e) => {
console.log(e)
props.entityOptions.attributeCamera = [{...e}]
if(e.checked) {
props.entityOptions.attributeCamera = [{...e}]
}
else {
props.entityOptions.attributeCamera = []
}
for (let i = 0; i < cameraList.value.length; i++) {
if (cameraList.value[i].id !== e.id) {
cameraList.value[i].checked = false

View File

@ -59,13 +59,13 @@
<div class="row">
<div class="col">
<span class="label">线段缓冲</span>
<input class="btn-switch" type="checkbox" v-model="entityOptions.extend" @change="lineExtendchange" />
<input class="btn-switch" type="checkbox" v-model="extend" @change="lineExtendchange" />
</div>
<div class="col" style="flex: 0 0 33%">
<span class="label">缓冲宽度</span>
<div class="input-number input-number-unit-1" style="width: 80px">
<input class="input" type="number" title="" min="0" data-min="0.01" max="999999" @input="$handleInputLimit"
v-model="entityOptions.extendWidth" />
<input class="input" type="number" title="" min="0" data-min="0.01" max="999999"
@input="$handleInputLimit" v-model="extendWidth" @change="extendWidthchange" />
<span class="unit">m</span>
<span class="arrow"></span>
</div>
@ -113,59 +113,61 @@
<attribute :entityOptions="entityOptions"></attribute>
</el-tab-pane>
<el-tab-pane label="空间信息" name="2">
<div class="row">
<div class="col height-mode-box">
<span class="label" style="flex: 0 0 56px">高度模式</span>
<el-select class="input input-select height-mode-scelect" style="width: 155px; margin-left: 20px"
v-model="heightMode" @change="heightModeChange" placeholder="请选择">
<el-option v-for="item in heightModeData" :key="item.key" :label="item.name" :value="item.key">
</el-option>
</el-select>
</div>
<div class="col">
<span class="label">Z值统一增加</span>
<div class="input-number input-number-unit-1 height-box" :class="{ disabled: heightMode == 2 }">
<input class="input height" type="number" title="" min="-9999999" max="999999999"
@input="$handleInputLimit" v-model="height" />
<span class="unit">m</span>
<span class="arrow"></span>
<div class="div-item">
<div class="row">
<div class="col height-mode-box">
<span class="label" style="flex: 0 0 56px">高度模式</span>
<el-select class="input input-select height-mode-scelect" style="width: 155px; margin-left: 20px"
v-model="heightMode" @change="heightModeChange" placeholder="请选择">
<el-option v-for="item in heightModeData" :key="item.key" :label="item.name" :value="item.key">
</el-option>
</el-select>
</div>
<button class="confirm height-confirm" style="margin-left: 5px" @click="heightConfirm"
:disabled="heightMode == 2">
应用
</button>
</div>
</div>
<div class="row">
<div class="table spatial-info-table">
<div class="table-head">
<div class="tr">
<div class="th"></div>
<div class="th">经度X</div>
<div class="th">纬度Y</div>
<div class="th">高度Z</div>
<div class="col">
<span class="label">Z值统一增加</span>
<div class="input-number input-number-unit-1 height-box" :class="{ disabled: heightMode == 2 }">
<input class="input height" type="number" title="" min="-9999999" max="999999999"
@input="$handleInputLimit" v-model="height" />
<span class="unit">m</span>
<span class="arrow"></span>
</div>
<button class="confirm height-confirm" style="margin-left: 5px" @click="heightConfirm"
:disabled="heightMode == 2">
应用
</button>
</div>
<div class="table-body">
<div class="tr" v-for="(item, i) in entityOptions.options.positions" :key="i">
<div class="td">{{ i + 1 }}</div>
<div class="td lng align-center" @dblclick="inputDblclick($event, i, 'lng')">
<input class="input" @blur="inputBlurCallBack($event, i, 'lng', 8)" type="number"
v-model="item.lng" min="-180" max="180" @input="$handleInputLimit"
v-if="activeTd.index == i && activeTd.name == 'lng'" />
<span style="pointer-events: none" v-else>{{ item.lng.toFixed(8) }}</span>
</div>
<div class="row">
<div class="table spatial-info-table">
<div class="table-head">
<div class="tr">
<div class="th"></div>
<div class="th">经度X</div>
<div class="th">纬度Y</div>
<div class="th">高度Z</div>
</div>
<div class="td lat align-center" @dblclick="inputDblclick($event, i, 'lat')">
<input class="input" @blur="inputBlurCallBack($event, i, 'lat', 8)" type="number"
v-model="item.lat" min="-180" max="180" @input="$handleInputLimit"
v-if="activeTd.index == i && activeTd.name == 'lat'" />
<span style="pointer-events: none" v-else>{{ item.lat.toFixed(8) }}</span>
</div>
<div class="td alt align-center" @dblclick="inputDblclick($event, i, 'alt')">
<input class="input" @blur="inputBlurCallBack($event, i, 'alt', 2)" type="number"
v-model="item.alt" min="-9999999" max="999999999" @input="$handleInputLimit"
v-if="activeTd.index == i && activeTd.name == 'alt'" />
<span style="pointer-events: none" v-else>{{ item.alt.toFixed(2) }}</span>
</div>
<div class="table-body">
<div class="tr" v-for="(item, i) in entityOptions.options.positions" :key="i">
<div class="td">{{ i + 1 }}</div>
<div class="td lng align-center" @dblclick="inputDblclick($event, i, 'lng')">
<input class="input" @blur="inputBlurCallBack($event, i, 'lng', 8)" type="number"
v-model="item.lng" min="-180" max="180" @input="$handleInputLimit"
v-if="activeTd.index == i && activeTd.name == 'lng'" />
<span style="pointer-events: none" v-else>{{ item.lng.toFixed(8) }}</span>
</div>
<div class="td lat align-center" @dblclick="inputDblclick($event, i, 'lat')">
<input class="input" @blur="inputBlurCallBack($event, i, 'lat', 8)" type="number"
v-model="item.lat" min="-180" max="180" @input="$handleInputLimit"
v-if="activeTd.index == i && activeTd.name == 'lat'" />
<span style="pointer-events: none" v-else>{{ item.lat.toFixed(8) }}</span>
</div>
<div class="td alt align-center" @dblclick="inputDblclick($event, i, 'alt')">
<input class="input" @blur="inputBlurCallBack($event, i, 'alt', 2)" type="number"
v-model="item.alt" min="-9999999" max="999999999" @input="$handleInputLimit"
v-if="activeTd.index == i && activeTd.name == 'alt'" />
<span style="pointer-events: none" v-else>{{ item.alt.toFixed(2) }}</span>
</div>
</div>
</div>
</div>
@ -329,6 +331,8 @@ const colorRef = ref(null)
const extendColorRef = ref(null)
const heightMode = ref(0)
const wordsName = ref(0)
const extend = ref(false)
const extendWidth = ref(0)
let originalOptions
let that
@ -338,6 +342,7 @@ const open = async (id, type) => {
sourceType.value = type
originalOptions = structuredClone(that.options)
entityOptions.value = that
extendWidth.value = that.extendWidth
wordsName.value = Number(entityOptions.value.wordsName)
heightMode.value = entityOptions.value.heightMode
length.value = entityOptions.value.lengthByMeter
@ -350,6 +355,7 @@ const open = async (id, type) => {
}
}
heightModeChange(heightMode.value)
extend.value = that.extend
baseDialog.value?.open()
await nextTick()
@ -382,8 +388,12 @@ const open = async (id, type) => {
} //点击清空按钮事件回调
})
}
const extendWidthchange = (val) => {
that.extendWidth = extendWidth.value
}
const heightModeChange = (val) => {
that.heightMode = heightMode.value
extend.value = false
// @ts-ignore
if (heightMode.value === 0 || heightMode.value === '0' || heightMode.value === 1 || heightMode.value === '1') {
entityOptions.value.extend = false
@ -431,6 +441,7 @@ const lineExtendchange = (e) => {
if (e.target.checked) {
heightMode.value = 2
}
that.extend = extend.value
}
const nodeEdit = () => {
entityOptions.value.positionEditing = false
@ -446,7 +457,9 @@ const nodeEdit = () => {
}
})
}
const translate = () => {
const translate = async () => {
entityOptions.value.closeNodeEdit()
await nextTick()
that.openPositionEditing(() => {
entityOptions.value.options.positions = structuredClone(that.options.positions)
if (lengthUnit.value == 'km') {
@ -556,8 +569,10 @@ defineExpose({
}
}
}
.polyline.dialog-en {
::v-deep>.content {
.attribute-content-link .table .tr .td.operation button,
.attribute-content-vr .table .tr .td.operation button,
.attribute-content-rtmp .table .tr .td.operation button {

View File

@ -63,9 +63,12 @@ let func = (data) => {
rowData.name = data.modelName
baseDialog.value?.open()
setTimeout(() => {
initThreeJS()
loadModel()
animate()
// initThreeJS()
// loadModel()
// animate()
(window as any).viewGlb = new viewGlbByEarth('threeCanvas');
console.log(service.value + rowData.modelDataUrl, 'cccccc');
(window as any).viewGlb.addGltf(service.value + rowData.modelDataUrl);
})
}
onMounted(() => {
@ -197,7 +200,7 @@ const viewPointHeightInput = () => {
}
}
const closeCallBack = (e) => {
renderer.domElement.remove() // 从DOM中移除渲染器。
renderer?.domElement.remove() // 从DOM中移除渲染器。
imageData.value = null
rowData = []
//打开系统设置弹框
@ -206,25 +209,19 @@ const closeCallBack = (e) => {
var posterLoading: any = ref(false)
const setImage = (e) => {
renderer.render(scene, camera) // 确保场景已渲染
const canvas = renderer.domElement
canvas.toBlob((blob) => {
const file = new File([blob], 'filename.png', { type: 'image/png' })
imageData.value = file
(window as any).viewGlb.canvasToBase((file) => {
console.log(file, 'file')
const formData = new FormData()
formData.append('modelId', rowData.id)
// rowData.name && formData.append('modelName', rowData.name)
imageData.value && formData.append('file', imageData.value)
file && formData.append('file', file)
ModelApi.updatePoster(formData).then((res) => {
if (res.code == 0 || res.code == 200) {
ElMessage.success('设置成功')
}
})
});
// ElMessage.warning('设置成功')
}, 'image/png')
// })
// const formData = new FormData()
// formData.append('modelId', rowData.id)

View File

@ -315,7 +315,6 @@ watch(modelName, (val) => {
// treeRef.value!.filter(val)
// }
categories.value = []
currModelList.value = []
getModelList()
})
@ -510,10 +509,41 @@ const modelClick = (index, row) => {
const renderModel = async (data, model) => {
let selectedNode = window.treeObj.getSelectedNodes()[0]
let z
let index = 0
let ids:any = []
if (data.positions.length > 0) {
data.positions.forEach(async (position, index) => {
// let source_id = this.$md5(new Date().getTime() + model.model_name+index);
data.positions.forEach(async (position, i) => {
// let source_id = this.$md5(new Date().getTime() + model.model_name+i);
let id = new YJ.Tools().randomString()
ids.push(id)
if (data.type == '面') {
z = data.rotate - 90
} else if (data.type == '线') {
z = data.rotate[i] - 90
}
let option = {
id: id,
position,
name: model.modelName + i,
show: true,
scale: { x: 1, y: 1, z: 1 },
url: service.value + model.modelDataUrl,
maximumScale: 1,
// host: 'http://127.0.0.1:8848',
rotate: {
x: 0,
y: 0,
z
}
}
let Model = await new YJ.Obj.Model(window.earth, option);
// //鼠标右键点击事件
Model.onRightClick = () => {};
(window as any)._entityMap.set(id, Model)
})
for (let position of data.positions) {
let id = ids[index]
if (data.type == '面') {
z = data.rotate - 90
} else if (data.type == '线') {
@ -535,9 +565,7 @@ const renderModel = async (data, model) => {
z
}
}
let Model = await new YJ.Obj.Model(window.earth, option)
;(window as any)._entityMap.set(id, Model)
await new Promise(resolve => setTimeout(resolve, 50))
let DbOption: any = {
params: option,
id,
@ -550,34 +578,21 @@ const renderModel = async (data, model) => {
: undefined
}
let res = await TreeApi.addOtherSource(DbOption)
if(![0, 200].includes(res.code)) {
if (![0, 200].includes(res.code)) {
return
}
ElMessage.closeAll()
ElMessage({
message: '添加成功',
type: 'success'
})
DbOption.isShow = true
DbOption.params = JSON.stringify(DbOption.params)
cusAddNodes(window.treeObj, DbOption.parentId, [DbOption])
// //鼠标右键点击事件
Model.onRightClick = () => {}
// window._entityMap.set(option.id, Model);
// Model.onClick = () => {
// leftClick(node);
// };
// let detailOption = JSON.parse(JSON.stringify(Model.options));
// detailOption.url = model.model_id + ".glb";
// let node = getNodeData(DbOption, detailOption);
// addSource(node).then((res) => {
// if ([0, 200].includes(res.code)) {
// // cusRenderNode(DbOption) DbOption.p_id
// cusAddNodes(this.treeObj, DbOption.p_id, [node]);
// }
// });
})
index++
if (index >= data.positions.length - 1) {
ElMessage.closeAll()
ElMessage({
message: '添加成功',
type: 'success'
})
}
}
}
}

View File

@ -270,6 +270,7 @@ const translate = () => {
}
}
const confirm = () => {
that.positionEditing && (that.positionEditing = false)
originalOptions = structuredClone(that.options)
baseDialog.value?.close()
let params = structuredClone(that.options)
@ -350,10 +351,8 @@ const changeMaximumParticleLife = (event) => {
const closeCallback = async () => {
entityOptions.value.originalOptions = structuredClone(originalOptions)
that.positionEditing = false
that.positionEditing && (that.positionEditing = false)
that.reset()
await YJ.Global.multiViewportMode.syncData(window.earth, that.options.id)
await YJ.Global.splitScreen.syncData(window.earth, that.options.id)
eventBus?.emit("destroyComponent")
}

View File

@ -25,65 +25,67 @@
</div>
</div>
</div>
<div class="div-item">
<div>
<div class="row">
<el-tabs v-model="activeName">
<el-tab-pane label="属性信息" name="1">
<attribute :entityOptions="entityOptions"></attribute>
</el-tab-pane>
<el-tab-pane label="空间信息" name="2">
<div class="row">
<div class="col height-mode-box">
<span class="label" style="flex: 0 0 56px;">高度模式</span>
<el-select class="input input-select height-mode-scelect" style="width: 155px;margin-left: 20px"
v-model="heightMode" @change="heightModeChange" placeholder="请选择">
<el-option v-for="item in heightModeData" :key="item.key" :label="item.name" :value="item.key">
</el-option>
</el-select>
</div>
<div class="col">
<span class="label">Z值统一增加</span>
<div class="input-number input-number-unit-1 height-box" :class="{ 'disabled': heightMode == 2 }">
<input class="input height" type="number" title="" min="-9999999" max="999999999" v-model="height"
@input="$handleInputLimit" />
<span class="unit">m</span>
<span class="arrow"></span>
<div class="div-item">
<div class="row">
<div class="col height-mode-box">
<span class="label" style="flex: 0 0 56px;">高度模式</span>
<el-select class="input input-select height-mode-scelect" style="width: 155px;margin-left: 20px"
v-model="heightMode" @change="heightModeChange" placeholder="请选择">
<el-option v-for="item in heightModeData" :key="item.key" :label="item.name" :value="item.key">
</el-option>
</el-select>
</div>
<button class="confirm height-confirm" style="margin-left: 5px;" @click="heightConfirm"
:disabled="heightMode == 2">应用</button>
</div>
</div>
<div class="row">
<div class="table spatial-info-table">
<div class="table-head">
<div class="tr">
<div class="th"></div>
<div class="th">经度X</div>
<div class="th">纬度Y</div>
<div class="th">高度Z</div>
<div class="col">
<span class="label">Z值统一增加</span>
<div class="input-number input-number-unit-1 height-box" :class="{ 'disabled': heightMode == 2 }">
<input class="input height" type="number" title="" min="-9999999" max="999999999" v-model="height"
@input="$handleInputLimit" />
<span class="unit">m</span>
<span class="arrow"></span>
</div>
<button class="confirm height-confirm" style="margin-left: 5px;" @click="heightConfirm"
:disabled="heightMode == 2">应用</button>
</div>
<div class="table-body">
<div class="tr" v-for="(item, i) in entityOptions.options.positions" :key="i">
<div class="td">{{ i + 1 }}</div>
<div class="td lng align-center" @dblclick="inputDblclick($event, i, 'lng')">
<input class="input" @blur="inputBlurCallBack($event, i, 'lng', 8)" type="number"
v-model="item.lng" min="-180" max="180" v-if="activeTd.index == i && activeTd.name == 'lng'"
@input="$handleInputLimit" />
<span style="pointer-events: none;" v-else>{{ (item.lng).toFixed(8) }}</span>
</div>
<div class="row">
<div class="table spatial-info-table">
<div class="table-head">
<div class="tr">
<div class="th"></div>
<div class="th">经度X</div>
<div class="th">纬度Y</div>
<div class="th">高度Z</div>
</div>
<div class="td lat align-center" @dblclick="inputDblclick($event, i, 'lat')">
<input class="input" @blur="inputBlurCallBack($event, i, 'lat', 8)" type="number"
v-model="item.lat" min="-180" max="180" v-if="activeTd.index == i && activeTd.name == 'lat'"
</div>
<div class="table-body">
<div class="tr" v-for="(item, i) in entityOptions.options.positions" :key="i">
<div class="td">{{ i + 1 }}</div>
<div class="td lng align-center" @dblclick="inputDblclick($event, i, 'lng')">
<input class="input" @blur="inputBlurCallBack($event, i, 'lng', 8)" type="number"
v-model="item.lng" min="-180" max="180" v-if="activeTd.index == i && activeTd.name == 'lng'"
@input="$handleInputLimit" />
<span style="pointer-events: none;" v-else>{{ (item.lng).toFixed(8) }}</span>
</div>
<div class="td lat align-center" @dblclick="inputDblclick($event, i, 'lat')">
<input class="input" @blur="inputBlurCallBack($event, i, 'lat', 8)" type="number"
v-model="item.lat" min="-180" max="180" v-if="activeTd.index == i && activeTd.name == 'lat'"
@input="$handleInputLimit">
<span style="pointer-events: none;" v-else>{{ (item.lat).toFixed(8) }}</span>
</div>
<div class="td alt align-center" @dblclick="inputDblclick($event, i, 'alt')"
@input="$handleInputLimit">
<span style="pointer-events: none;" v-else>{{ (item.lat).toFixed(8) }}</span>
</div>
<div class="td alt align-center" @dblclick="inputDblclick($event, i, 'alt')"
@input="$handleInputLimit">
<input class="input" @blur="inputBlurCallBack($event, i, 'alt', 2)" type="number"
v-model="entityOptions.height" min="-9999999" max="999999999"
v-if="activeTd.index == i && activeTd.name == 'alt'">
<span style="pointer-events: none;" v-else>{{ (entityOptions.height).toFixed(2) }}</span>
<input class="input" @blur="inputBlurCallBack($event, i, 'alt', 2)" type="number"
v-model="entityOptions.height" min="-9999999" max="999999999"
v-if="activeTd.index == i && activeTd.name == 'alt'">
<span style="pointer-events: none;" v-else>{{ (entityOptions.height).toFixed(2) }}</span>
</div>
</div>
</div>
</div>
@ -91,22 +93,24 @@
</div>
</el-tab-pane>
<el-tab-pane label="面风格" name="3">
<div class="row">
<div class="col">
<span class="label">面颜色</span>
<div class="color" ref="colorRef"></div>
</div>
<div class="col">
<span class="label">描边颜色</span>
<div class="lineColor" ref="lineColorRef"></div>
</div>
<div class="col">
<span class="label">描边宽度</span>
<div class="input-number input-number-unit-2">
<input class="input" type="number" title="" min="0" max="99" v-model="entityOptions.lineWidth"
@input="$handleInputLimit">
<span class="unit">px</span>
<span class="arrow"></span>
<div class="div-item">
<div class="row">
<div class="col">
<span class="label">面颜色</span>
<div class="color" ref="colorRef"></div>
</div>
<div class="col">
<span class="label">描边颜色</span>
<div class="lineColor" ref="lineColorRef"></div>
</div>
<div class="col">
<span class="label">描边宽度</span>
<div class="input-number input-number-unit-2">
<input class="input" type="number" title="" min="0" max="99" v-model="entityOptions.lineWidth"
@input="$handleInputLimit">
<span class="unit">px</span>
<span class="arrow"></span>
</div>
</div>
</div>
</div>
@ -298,7 +302,9 @@ const inputBlurCallBack = (event, i, name, digit = 2) => {
}
}
const translate = () => {
const translate = async () => {
entityOptions.value.closeNodeEdit()
await nextTick()
that.openPositionEditing(() => {
entityOptions.value.options.positions = structuredClone(that.options.positions)
})
@ -314,7 +320,7 @@ const closeCallback = () => {
const nodeEdit = () => {
that.nodeEdit((e, positions, areaByMeter) => {
if(positions) {
if (positions) {
entityOptions.value.options.positions = structuredClone(positions)
}
})

View File

@ -70,13 +70,13 @@
<div class="row">
<div class="col">
<span class="label">线段缓冲</span>
<input class="btn-switch" type="checkbox" v-model="entityOptions.extend" @change="lineExtendchange" />
<input class="btn-switch" type="checkbox" v-model="extend" @change="lineExtendchange" />
</div>
<div class="col" style="flex: 0 0 33%">
<span class="label">缓冲宽度</span>
<div class="input-number input-number-unit-1" style="width: 80px">
<input class="input" type="number" title="" min="0" data-min="0.01" max="999999"
@input="$handleInputLimit" v-model="entityOptions.extendWidth" />
@input="$handleInputLimit" v-model="extendWidth" @change="extendWidthchange" />
<span class="unit">m</span>
<span class="arrow"></span>
</div>
@ -337,6 +337,8 @@ const colorRef = ref(null)
const extendColorRef = ref(null)
const heightMode = ref(0)
const wordsName = ref(0)
const extend = ref(false)
const extendWidth = ref(0)
let originalOptions: any
let that: any
@ -346,6 +348,7 @@ const open = async (id: any, type) => {
sourceType.value = type
originalOptions = structuredClone(that.options)
entityOptions.value = that
extendWidth.value = that.extendWidth
heightMode.value = entityOptions.value.heightMode
wordsName.value = Number(entityOptions.value.wordsName)
length.value = entityOptions.value.lengthByMeter
@ -358,6 +361,7 @@ const open = async (id: any, type) => {
}
}
heightModeChange(heightMode.value)
extend.value = that.extend
baseDialog.value?.open()
await nextTick()
@ -390,8 +394,13 @@ const open = async (id: any, type) => {
} //点击清空按钮事件回调
})
}
const extendWidthchange = (val) => {
that.extendWidth = extendWidth.value
}
const heightModeChange = (val) => {
that.heightMode = heightMode.value
extend.value = false
// @ts-ignore
if (heightMode.value === 0 || heightMode.value === '0' || heightMode.value === 1 || heightMode.value === '1') {
entityOptions.value.extend = false
@ -439,6 +448,7 @@ const lineExtendchange = (e) => {
if (e.target.checked) {
heightMode.value = 2
}
that.extend = extend.value
}
const nodeEdit = () => {
entityOptions.value.positionEditing = false
@ -454,7 +464,9 @@ const nodeEdit = () => {
}
})
}
const translate = () => {
const translate = async () => {
entityOptions.value.closeNodeEdit()
await nextTick()
that.openPositionEditing(() => {
entityOptions.value.options.positions = structuredClone(that.options.positions)
if (lengthUnit.value == 'km') {

View File

@ -146,7 +146,7 @@
</div>
<div class="col">
<span class="label">轨迹动画</span>
<input class="btn-switch" type="checkbox" v-model="entityOptions.state">
<input class="btn-switch" type="checkbox" v-model="entityOptions.state" @click="changeState">
</div>
</div>
<div class="row">
@ -156,7 +156,7 @@
</div>
<div class="col" style="margin-right: 33px;">
<span class="label">视角跟随</span>
<input class="btn-switch" type="checkbox" v-model="entityOptions.viewFollow">
<input class="btn-switch" type="checkbox" v-model="entityOptions.viewFollow" @click="changeViewFollow">
</div>
<div class="col" style="margin: 0px;">
<span class="label">模型动画</span>
@ -411,6 +411,13 @@ const changeFirstPersonView = (state) => {
entityOptions.value.firstPersonView = state
}
const changeState = () => {
modelRotateState.value && (modelRotateState.value = that.modelRotate())
}
const changeViewFollow = () => {
modelRotateState.value && (modelRotateState.value = that.modelRotate())
}
defineExpose({
open,
close

View File

@ -1,137 +1,132 @@
import * as THREE from "three";
import * as THREE from 'three'
//导入轨道控制器
import { OrbitControls } from "three/examples/jsm/controls/OrbitControls";
import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls'
//导入GLTF模型加载器
import { GLTFLoader } from "three/examples/jsm/loaders/GLTFLoader";
import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader'
class viewGlb {
constructor(selector) {
this.canvasWidth = 900;
this.canvasHeight = 650;
this.container = document.querySelector(selector); //获取容器
this.modelInfo = {};
this.scene = null;
this.camera = null;
this.renderer = null;
this.controls = null;
this.init(); //初始化
this.animate(); //循环函数
this.canvasWidth = 900
this.canvasHeight = 650
this.container = document.querySelector(selector) //获取容器
this.modelInfo = {}
this.scene = null
this.camera = null
this.renderer = null
this.controls = null
this.init() //初始化
this.animate() //循环函数
}
init() {
// 初始化场景
this.initScene();
this.initScene()
// 初始化辅助轴
this.initAxesHelper();
this.initAxesHelper()
// 初始化灯光
this.initLight();
this.initLight()
// 初始化相机
this.initCamera();
this.initCamera()
// 初始化渲染器
this.initRender();
this.initRender()
// 初始化轨道控制器
this.initControls();
this.initControls()
// 监听场景大小改变,重新渲染尺寸
window.addEventListener("resize", this.onWindowResize.bind(this));
window.addEventListener('resize', this.onWindowResize.bind(this))
// this.addGLTFModel()
}
initScene() {
this.scene = new THREE.Scene();
this.scene = new THREE.Scene()
// this.scene.background = new THREE.Color(0xffffff)
}
initAxesHelper() {
const axesHelper = new THREE.AxesHelper(5);
this.scene.add(axesHelper);
const axesHelper = new THREE.AxesHelper(5)
this.scene.add(axesHelper)
}
initLight() {
const hesLight = new THREE.HemisphereLight(0xffffff, 0x444444);
hesLight.intensity = 0.6;
this.scene.add(hesLight);
const hesLight = new THREE.HemisphereLight(0xffffff, 0x444444)
hesLight.intensity = 0.6
this.scene.add(hesLight)
const dirLight = new THREE.DirectionalLight();
dirLight.position.set(5, 5, 5);
this.scene.add(dirLight);
const dirLight = new THREE.DirectionalLight()
dirLight.position.set(5, 5, 5)
this.scene.add(dirLight)
}
initCamera() {
this.camera = new THREE.PerspectiveCamera(
75,
this.canvasWidth / this.canvasHeight,
0.1,
100
);
this.camera = new THREE.PerspectiveCamera(75, this.canvasWidth / this.canvasHeight, 0.1, 100)
// this.camera.position.set(1.5, 1.5, 1.5)
this.camera.position.set(2, 2, 2);
this.camera.position.set(2, 2, 2)
}
initRender() {
this.renderer = new THREE.WebGLRenderer({
antialias: true,
alpha: true,
alpha: true
// preserveDrawingBuffer: true
}); //设置抗锯齿
}) //设置抗锯齿
//设置屏幕像素比
this.renderer.setPixelRatio(window.devicePixelRatio);
this.renderer.setPixelRatio(window.devicePixelRatio)
//渲染的尺寸大小
this.renderer.setSize(this.canvasWidth, this.canvasHeight);
this.renderer.setSize(this.canvasWidth, this.canvasHeight)
//gltf格式模型纹理贴图
this.renderer.outputEncoding = THREE.sRGBEncoding;
this.renderer.outputEncoding = THREE.sRGBEncoding
// 设置背景颜色
this.renderer.setClearColor(0x000000, 0);
this.renderer.setClearColor(0x000000, 0)
// 添加到容器
this.container.appendChild(this.renderer.domElement);
this.container.appendChild(this.renderer.domElement)
}
render() {
this.renderer.render(this.scene, this.camera);
this.renderer.render(this.scene, this.camera)
}
animate() {
this.renderer.setAnimationLoop(this.render.bind(this));
this.renderer.setAnimationLoop(this.render.bind(this))
}
initControls() {
this.controls = new OrbitControls(this.camera, this.renderer.domElement);
this.controls = new OrbitControls(this.camera, this.renderer.domElement)
}
onWindowResize() {
this.camera.aspect = this.canvasWidth / this.canvasHeight;
this.camera.updateProjectionMatrix(); //更新矩阵将3d内容投射到2d画面上转换
this.renderer.setSize(this.canvasWidth, this.canvasHeight);
this.camera.aspect = this.canvasWidth / this.canvasHeight
this.camera.updateProjectionMatrix() //更新矩阵将3d内容投射到2d画面上转换
this.renderer.setSize(this.canvasWidth, this.canvasHeight)
}
addGLTFModel(obj) {
this.modelInfo = obj;
this.modelInfo = obj
return new Promise((resolve, reject) => {
const loader = new GLTFLoader(); //.setPath('3dModels/')
const loader = new GLTFLoader() //.setPath('3dModels/')
loader.load(obj.model_url, (gltf) => {
console.log(gltf);
this.scene.add(gltf.scene);
resolve("模型添加成功");
});
});
console.log(gltf)
this.scene.add(gltf.scene)
resolve('模型添加成功')
})
})
}
canvasToBase(cb) {
this.renderer.render(this.scene, this.camera);
let imgData = this.renderer.domElement.toDataURL("image/png");
console.log(imgData);
let base64 = imgData.replace(/^data:image\/\w+;base64,/, "");
let dataBuffer = new Buffer(base64, "base64");
base64ToFile(base64, "image/png", "poster.png");
console.log(process.cwd());
$root_home_index.$sendElectronChanel("newDir", {
this.renderer.render(this.scene, this.camera)
let imgData = this.renderer.domElement.toDataURL('image/png')
console.log(imgData)
let base64 = imgData.replace(/^data:image\/\w+;base64,/, '')
let dataBuffer = new Buffer(base64, 'base64')
base64ToFile(base64, 'image/png', 'poster.png')
console.log(process.cwd())
$root_home_index.$sendElectronChanel('newDir', {
name: this.modelInfo.model_name,
paths: [process.cwd(), "model_thumb"],
buffer: dataBuffer,
});
$root_home_index.$recvElectronChanel("newDirRes", (e, res) => {
paths: [process.cwd(), 'model_thumb'],
buffer: dataBuffer
})
$root_home_index.$recvElectronChanel('newDirRes', (e, res) => {
// $root_home_index.$message.info(res)
cb(res);
});
cb(res)
})
/*;*/
}
@ -139,33 +134,33 @@ class viewGlb {
clearScene() {
this.scene.traverse((child) => {
if (child.material) {
child.material.dispose();
child.material.dispose()
}
if (child.geometry) {
child.geometry.dispose();
child.geometry.dispose()
}
child = null;
});
this.container.childNodes[1].remove();
this.renderer.forceContextLoss();
this.renderer.dispose();
this.scene.clear();
this.modelInfo = {};
this.scene = null;
this.camera = null;
this.controls = null;
this.renderer.domElement = null;
this.renderer = null;
this.container = null;
child = null
})
this.container.childNodes[1].remove()
this.renderer.forceContextLoss()
this.renderer.dispose()
this.scene.clear()
this.modelInfo = {}
this.scene = null
this.camera = null
this.controls = null
this.renderer.domElement = null
this.renderer = null
this.container = null
}
}
class viewGlbByEarth {
constructor(selector) {
this.viewer = null;
this.modelInfo = null;
this.selector = selector;
this.init(selector);
this.viewer = null
this.modelInfo = null
this.selector = selector
this.init(selector)
}
init(selector) {
@ -177,22 +172,24 @@ class viewGlbByEarth {
baseLayerPicker: false,
sceneModePicker: false,
animation: false,
});
const scene = this.viewer.scene;
fullscreenButton: false, // 禁用全屏按钮
geocoder: false
})
const scene = this.viewer.scene
/*this.viewer.scene.screenSpaceCameraController.tiltEventTypes = [
Cesium.CameraEventType.PINCH,
Cesium.CameraEventType.RIGHT_DRAG,
]*/
scene.screenSpaceCameraController.zoomEventTypes = [
Cesium.CameraEventType.WHEEL,
Cesium.CameraEventType.PINCH,
];
Cesium.CameraEventType.PINCH
]
scene.screenSpaceCameraController.tiltEventTypes = [
Cesium.CameraEventType.PINCH,
Cesium.CameraEventType.RIGHT_DRAG,
];
this.viewer._cesiumWidget._creditContainer.style.display = "none";
scene.globe.depthTestAgainstTerrain = true;
Cesium.CameraEventType.RIGHT_DRAG
]
this.viewer._cesiumWidget._creditContainer.style.display = 'none'
scene.globe.depthTestAgainstTerrain = true
// scene.globe.show = false;
// scene.sun.show = false;
// scene.moon.show = false;
@ -201,46 +198,45 @@ class viewGlbByEarth {
}
addGltf(obj) {
this.modelInfo = obj;
this.modelInfo = obj
const czml = [
{
id: "aircraft model",
name: "Cesium Air",
id: 'aircraft model',
name: 'Cesium Air',
position: {
cartographicDegrees: [-77, 37, 10000],
cartographicDegrees: [-77, 37, 10000]
},
model: {
gltf: obj.model_url,
// gltf: obj.model_url,
gltf: obj,
scale: 2.0,
minimumPixelSize: 128,
},
},
];
minimumPixelSize: 128
}
}
]
let entity = this.viewer.entities.add({
position: Cesium.Cartesian3.fromRadians(
106.31593773128115,
29.625102082951624
),
position: Cesium.Cartesian3.fromRadians(106.31593773128115, 29.625102082951624),
model: {
uri: obj.model_url,
},
});
// uri: obj.model_url,
uri: obj
}
})
this.viewer.trackedEntity = entity;
this.viewer.trackedEntity = entity
}
canvasToBase(cb) {
// let imgData = $(`#${this.selector}`).find("canvas")[0].toDataURL("image/png");
// console.log(imgData)
this.viewer.render();
let imgData = this.viewer.scene.canvas.toDataURL("image/png");
let base64 = imgData.replace(/^data:image\/\w+;base64,/, "");
let dataBuffer = new Buffer(base64, "base64");
let file = this.base64ToFile(base64, "image/png", "poster.png");
this.viewer.render()
let imgData = this.viewer.scene.canvas.toDataURL('image/png')
let base64 = imgData.replace(/^data:image\/\w+;base64,/, '')
let dataBuffer = new Buffer(base64, 'base64')
let file = this.base64ToFile(base64, 'image/png', 'poster.png')
// console.log("ddddddddddddd", file);
cb(file);
cb(file)
// $root_home_index.$sendElectronChanel("newDir", {
// name: this.modelInfo.model_name, //+ "_" + new Date().getTime(),
// paths: [process.cwd(), "model_thumb"],
@ -255,25 +251,25 @@ class viewGlbByEarth {
}
base64ToFile(base64, mime, filename) {
// let arr = base64.split(",");
let type = mime || arr[0].match(/:(.*?);/)[1];
let type = mime || arr[0].match(/:(.*?);/)[1]
// let suffix = mine.split("/")[1];
// let fileName = filename || `未命名.${suffix}`;
let fileName = filename || `未命名.png`;
let bstr = atob(base64);
let n = bstr.length;
let u8arr = new Uint8Array(n);
let fileName = filename || `未命名.png`
let bstr = atob(base64)
let n = bstr.length
let u8arr = new Uint8Array(n)
while (n--) {
u8arr[n] = bstr.charCodeAt(n);
u8arr[n] = bstr.charCodeAt(n)
}
return new File([u8arr], fileName, { type });
return new File([u8arr], fileName, { type })
}
clearScene() {
this.viewer.destroy();
this.viewer = null;
this.modelInfo = null;
this.selector = "";
this.viewer.destroy()
this.viewer = null
this.modelInfo = null
this.selector = ''
}
}
export { viewGlb, viewGlbByEarth };
export { viewGlb, viewGlbByEarth }

View File

@ -203,6 +203,7 @@ const open = async (id: any) => {
})
}
const confirm = () => {
that.closeNodeEdit()
originalOptions = structuredClone(that.options)
baseDialog.value?.close()
let params = structuredClone(that.options)

View File

@ -156,6 +156,7 @@ const open = async (id: any) => {
})
}
const confirm = () => {
that.closeNodeEdit()
originalOptions = structuredClone(that.options)
baseDialog.value?.close()
let params = structuredClone(that.options)

View File

@ -367,6 +367,19 @@ export const useRightOperate = () => {
entity.remove();
(window as any)._entityMap.delete(entity.options.id)
}
else {
let entity = (window as any).pressModelEntities.get(item)
if (entity) {
entity.remove();
(window as any).pressModelEntities.delete(entity.options.id)
}
else {
if (window.earth.flyRoamId === item) {
YJ.Global.FlyRoam.cease(window.earth)
}
eventBus.emit('closeFlyRoamDialogById', item)
}
}
// let node = window.treeObj.getNodeByParam("id", item, null);
eventBus.emit("destroyComponent", item);
});

View File

@ -85,11 +85,11 @@ async function leftClick(options) {
|| node.sourceType === "model" || node.sourceType === "military" || node.sourceType === "wallStereoscopic" || node.sourceType === "entityWall" || node.sourceType === "diffuseScan" || node.sourceType === "radarScan" || node.sourceType === "scanStereoscopic" || node.sourceType === "polyhedronObject")) {
if (
!options.richTextContent &&
!info.hrefs.length &&
!info.vr.length &&
!info.rtmp.length &&
!info.goods.length &&
!info.camera.length
(!info.hrefs || !info.hrefs.length) &&
(!info.vr || !info.vr.length) &&
(!info.rtmp || !info.rtmp.length) &&
(!info.goods || !info.goods.length) &&
(!info.camera || !info.camera.length)
) {
// $root_home.$message.info("该标注标绘无属性信息");
ElMessage({
@ -295,6 +295,7 @@ const goodsSelect = async (goods) => {
if ('id' in allGoodsList[m]) {
if (allGoodsList[m].id === goods[i].id) {
flag = true
goods[i].name = allGoodsList[m].name
break
}
}

View File

@ -1,3 +1,4 @@
// @ts-nocheck
import {$changeComponentShow} from '@/utils/communication'
import {useTreeNode} from './treeNode'
import {TreeApi} from '@/api/tree'
@ -106,6 +107,9 @@ export const useTree = () => {
type: 'success'
})
let params = JSON.parse(treeNode.params)
window.earth.flyRoamId = treeNode.id
console.log('params.repeat', params.repeat)
YJ.Global.FlyRoam.setRepeat(params.repeat)
YJ.Global.FlyRoam.flyTo((window as any).earth, params.points);
return;
} else {
@ -330,6 +334,7 @@ export const useTree = () => {
})
}
} else {
let params = JSON.parse(node.params)
if (node.sourceType === 'tileset') {
if (node.children && node.children.length > 0) {
node.children.forEach((item) => {
@ -337,7 +342,17 @@ export const useTree = () => {
})
}
}
let params = JSON.parse(node.params)
else if (node.sourceType == 'roam') {
YJ.Global.FlyRoam.setRepeat(node.isShow ? Infinity : 0)
params.repeat = node.isShow ? 'Infinity' : 0
let paramsData: any = {
params: params,
id: node.id,
sourceName: node.sourceName,
parentId: node.parentId,
}
TreeApi.updateDirectoryInfo(paramsData)
}
let entityObject
if (node.sourceType == 'pressModel') {
let id = node.id + '_' + params.modelId
@ -359,15 +374,9 @@ export const useTree = () => {
}
if (entityObject) {
entityObject.show = node.isShow;
params.show = node.isShow
let params2 = {
"id": node.id,
"params": params,
"sourceName": node.sourceName,
"isShow": node.isShow ? 1 : 0,
}
cusUpdateNode({id: node.id, sourceName: node.sourceName, params: JSON.stringify(params)})
}
params.show = node.isShow
cusUpdateNode({id: node.id, sourceName: node.sourceName, params: JSON.stringify(params)})
}
}
@ -485,6 +494,7 @@ export const useTree = () => {
const onClick = (event: MouseEvent, treeId: string, treeNode: any) => {
console.log('selectNode', treeNode)
$changeComponentShow('.rightMenu', false)
let isShift = event.shiftKey
let isCtrl = event.ctrlKey
if (!isCtrl || !isShift) {
@ -549,16 +559,7 @@ export const useTree = () => {
}
// 树的数据
const zNodes = ref([
{
id: 1,
parentId: 0,
sourceName: '111',
isShow: true,
sourceType: '',
params: ''
}
])
const zNodes = ref([])
const getTime = () => {
var now = new Date(),
@ -692,6 +693,9 @@ export const useTree = () => {
if ('show' in params) {
params.show = zNodes.value[i].isShow ? true : false
}
else {
params.show = zNodes.value[i].isShow ? true : false
}
if (!params.id) {
params.id = zNodes.value[i].id
}
@ -706,7 +710,9 @@ export const useTree = () => {
}
)
} else {
initMapData(zNodes.value[i].sourceType, {...detail, ...params}, null)
window.earth.readyPromise().then(()=>{
initMapData(zNodes.value[i].sourceType, {...detail, ...params}, null)
})
}
}
layers.sort((obj1, obj2) => {

View File

@ -490,7 +490,7 @@ export const useTreeNode = () => {
// return (type === 'directory' || type === 'FeatureCollection') ? undefined : `http://localhost:${availablePort}/icon/${name}.png`;
return (type === 'directory' || type === 'FeatureCollection' || type === 'folder') ? undefined : `
<svg class="svg-icon" style="color: rgba(var(--color-base2), 1);margin-top: 1px;width:100%;height:100%;fill: currentColor !important;stroke: currentColor !important;stroke-width: ${strokeWidth} !important;shape-rendering: geometricPrecision;">
<svg class="svg-icon" style="color: rgba(var(--color-base2), 1);margin-top: 1px;width:100%;height:100%;fill: #fff;stroke: #fff;stroke-width: ${strokeWidth} !important;shape-rendering: geometricPrecision;">
<use xlink:href="#icon-${name}" />
</svg>
`;

View File

@ -262,6 +262,8 @@ import { get } from 'jquery'
const { initTree, rightMenuRef, initTreeCallBack } = useTree()
const eventBus: any = inject('bus')
const { t } = useI18n()
const isShow = ref(false)
const select = ref('poi')
@ -570,6 +572,7 @@ const locationChange = () => {
window.searchPlaceMap.set(id, entity)
}
onMounted(() => {
eventBus?.emit("destroyComponent")
initTree()
// ipcRenderer.on('renderNode-reply', (event: any, data: any) => {
// initTree()
@ -836,7 +839,7 @@ defineExpose({
// .custom-dropdown2 {
// width: 380px !important;
// }
.el-select-dropdown__empty,
.custom-dropdown .el-select-dropdown__empty,
.el-select-dropdown__loading {
margin-top: -150px !important;
}

View File

@ -137,6 +137,7 @@ import { getdefaultLabelStyle } from '../components/propertyBox/defaultLabelStyl
import { setEventBus } from './eventBus'
import router from '@renderer/router'
import { ElMessage, ElMessageBox } from 'element-plus'
const { rightMenus } = useRightOperate()
const firstMenuRef = ref(null)
@ -162,8 +163,27 @@ if (!localStorage.getItem('defaultLabelStyle')) {
}
//移除天气设置
localStorage.removeItem('weartherSetting')
eventBus.on('closeScreenShot', () => {
if (currentComponent.value?.__name == 'ScreenShot') {
currentComponent.value = undefined
}
})
eventBus.on('openDialog', async (sourceType: any, id: any) => {
if (dynamicComponentRef.value?.name == 'ScreenShotHD') {
ElMessageBox.confirm('此操作将会打开新弹窗关闭高清截图功能, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(() => {
openOtherDialog(sourceType, id)
})
.catch(() => {})
} else {
openOtherDialog(sourceType, id)
}
})
const openOtherDialog = async (sourceType: any, id: any) => {
if (dynamicComponentRef.value && dynamicComponentRef.value.close) {
dynamicComponentRef.value.close()
}
@ -445,7 +465,7 @@ eventBus.on('openDialog', async (sourceType: any, id: any) => {
break
}
id && dynamicComponentRef.value && (dynamicComponentRef.value.id = id)
})
}
eventBus.on('openSelectImg', (selected, entity) => {
// $sendElectronChanel("requireGEMarkerName", {
// dirName: "GEMarker",

View File

@ -708,18 +708,21 @@ function importAuth() {
filters: [{ name: '授权文件', extensions: ['YJ'] }]
}
$sendElectronChanel('open-directory-dialog', option)
$recvElectronChanel('selectedItem', (e, paths) => {
console.log(e, paths, 'oopop')
if (paths.length != 0) {
let formdata = new FormData()
formdata.append('filePath', paths[0])
try {
let res = AuthApi.authImport(formdata)
$recvElectronChanel('selectedItem', async (e, paths) => {
let formdata = new FormData()
if(!paths[0]) {
return
}
formdata.append('filePath', paths[0])
try {
let res = await AuthApi.authImport(formdata)
if(res.code === 0 || res.code === 200) {
ElMessage.success('文件授权成功')
isAuth.value = false
baseDialog.value?.close()
} catch (error) {}
}
} else {
}
} catch (error) {}
})
}
// setTimeout(() => {