vue3+vite+superMap(超图)实现通视分析

<template>
    <div>
        <el-dialog draggable destroy-on-close v-if="changeVisibilityState" :modal="false" v-model="changeVisibilityState"
            close-icon="" title="通视分析" width="20%" :before-close="handleClose" @opened="getIntervisOpen()"
            :close-on-click-modal="false">
            <div class="el-h-line">
                <p class="p">观察者信息</p>
                <el-row :gutter="10">
                    <el-col :span="6">
                        <p class="font-big">经度</p>
                    </el-col>
                    <el-col :span="18">
                        <div class="slider-demo-block">
                            <el-input v-model="longitude" placeholder="显示经度" :disabled="true" />
                        </div>
                    </el-col>
                </el-row>
            </div>

            <div class="el-h-line">
                <el-row :gutter="10">
                    <el-col :span="6">
                        <p class="font-big">纬度</p>
                    </el-col>
                    <el-col :span="18">
                        <div class="slider-demo-block">
                            <el-input v-model="latitude" placeholder="显示纬度" :disabled="true" />
                        </div>
                    </el-col>
                </el-row>
            </div>

            <div class="el-h-line">
                <el-row :gutter="10">
                    <el-col :span="6">
                        <p class="font-big">高程</p>
                    </el-col>
                    <el-col :span="18">
                        <div class="slider-demo-block">
                            <el-input v-model="height" placeholder="显示高程" :disabled="true" />
                        </div>
                    </el-col>
                </el-row>
            </div>
            <!--可见颜色-->
            <div class="el-h-line">
                <el-row :gutter="10">
                    <el-col :span="6">
                        <p class="font-big">可见颜色</p>
                    </el-col>
                    <el-col :span="18">
                        <div class="slider-demo-block">
                            <el-color-picker v-model="visibleColor" @change="visibleColorChange" />
                        </div>
                    </el-col>
                </el-row>
            </div>
            <!--不可见颜色-->
            <div class="el-h-line">
                <el-row :gutter="10">
                    <el-col :span="6">
                        <p class="font-big">不可见颜色</p>
                    </el-col>
                    <el-col :span="18">
                        <div class="slider-demo-block">
                            <div class="el-demo">
                                <el-color-picker v-model="hiddenColor" @change="hiddenColorChange" />
                            </div>
                        </div>
                    </el-col>
                </el-row>
            </div>
            <template #footer>
                <span class="dialog-footer">
                    <el-button @click="addObserverPoint">添加观察点</el-button>
                    <el-button @click="addTargetPoint">添加目标点</el-button>
                    <el-button type="primary" @click="clearVisibility" style="background-color: #1d888b;">清除</el-button>
                </span>
            </template>
        </el-dialog>
    </div>
</template>
<script setup lang="ts">
import { ref, onMounted, onBeforeUnmount } from 'vue'
// 组件传值
import emitter from "../../../utils/bus";
const changeVisibilityState = ref<Boolean>(true)
const longitude = ref()
const latitude = ref()
const height = ref()
const visibleColor = ref('#0e9dec')
const hiddenColor = ref('#ffb200')
const sightlineWidth = ref<number>()
const sightline = ref(null)
// 当前点击状态是否是 添加观察点
const addViewFlag = ref(false)
// 当前点击状态是否是 添加目标点
const addTargetFlag = ref(false)
// 添加的目标点的点号
const num = ref(0)
// 是否能移除目标点
const couldRemove = ref(false)
const handlerPoint = ref(null)
const pointEventHandler = ref(null)
const Cesium = window.Cesium

const handleClose = (done: () => void) => {
    done()
    clearVisibility()
}
// 接受layoutMenu传过来的值
emitter.on("visibilityState", (data: any) => {
    changeVisibilityState.value = data
});

const init = () => {
    if (!sightline.value) {
        sightline.value = new Cesium.Sightline(window.viewer.scene)
    }
    sightline.value.build()
    addViewFlag.value = false // 当前点击状态是否是 添加观察点
    addTargetFlag.value = false // 当前点击状态是否是 添加目标点
    num.value = 0 // 添加的目标点的点号
    couldRemove.value = false // 是否能移除目标点
}

const addObserverPoint = (): void => {
    addViewFlag.value = true
    sightline.value.lineWidth = 5
    handlerPoint.value = new Cesium.DrawHandler(
        window.viewer,
        Cesium.DrawMode.Point
    )

    handlerPoint.value.drawEvt.addEventListener((result: object) => {
        // 添加观察点
        if (addViewFlag.value) {
            var point = result.object
            // point.show = false;
            var position = result.object.position

            // 将获取的点的位置转化成经纬度
            var cartographic = Cartesian2toDegrees(position)

            longitude.value = cartographic[0]
            latitude.value = cartographic[1]
            height.value = cartographic[2]
            // 设置观察点
            sightline.value.viewPosition = cartographic
            addViewFlag.value = false
        }
        handlerPoint.value.deactivate()
    })
    if (handlerPoint.value.active) {
        return
    }
    window.viewer.entities.removeAll()
    if (couldRemove.value) {
        sightline.value.removeAllTargetPoint()
    }

    if (longitude.value && latitude.value && height.value) {
        sightline.value.viewPosition = [parseFloat(longitude.value), parseFloat(latitude.value), parseFloat(height.value)]
        addViewFlag.value = false
    } else {
        handlerPoint.value.activate()
    }

    if (addViewFlag.value || addTargetFlag.value) {
        window.viewer.enableCursorStyle = false
        window.viewer._element.style.cursor = ''
    }
}

const addTargetPoint = (): void => {
   
    addViewFlag.value = false
    addTargetFlag.value = true
    sightline.value.visibleColor = Cesium.Color.fromCssColorString(visibleColor.value)
    sightline.value.hiddenColor = Cesium.Color.fromCssColorString(hiddenColor.value)
    if (!pointEventHandler.value) {
        pointEventHandler.value = new Cesium.ScreenSpaceEventHandler(
            window.viewer.scene.canvas
        )
    }
    if (addViewFlag.value || addTargetFlag.value) {
        window.viewer.enableCursorStyle = false
        window.viewer._element.style.cursor = ''
    }

    // 鼠标点击事件,添加点
    pointEventHandler.value.setInputAction((e: any) => {
        var position = window.viewer.scene.pickPosition(e.position)
        addTarget(position)
    }, Cesium.ScreenSpaceEventType.LEFT_CLICK)

    // 鼠标移动事件,更新点
    pointEventHandler.value.setInputAction((evt: any) => {
        if (num.value > 0) {
            // 鼠标移动,更新最后一次添加的目标点的位置
            var position = window.viewer.scene.pickPosition(evt.endPosition)
            sightline.value.removeTargetPoint('point0')

            var cartographic = Cartesian2toDegrees(position)

            var flag = sightline.value.addTargetPoint({
                position: cartographic,
                name: 'point0'
            })
        }
    }, Cesium.ScreenSpaceEventType.MOUSE_MOVE)

    // 鼠标右键事件,结束
    pointEventHandler.value.setInputAction(() => {
        window.viewer.enableCursorStyle = true

        if (pointEventHandler.value) {
            pointEventHandler.value.removeInputAction(
                Cesium.ScreenSpaceEventType.MOUSE_MOVE
            )
            pointEventHandler.value.removeInputAction(
                Cesium.ScreenSpaceEventType.LEFT_CLICK
            )
        }
    }, Cesium.ScreenSpaceEventType.RIGHT_CLICK)
}

// 添加通视点
const addTarget = (CartesianPosition: object) => {
    if (addViewFlag.value === false && addTargetFlag.value) {
        num.value += 1
        // 将获取的点的位置转化成经纬度
        var cartographic = Cartesian2toDegrees(CartesianPosition)
        // 添加目标点
        var name = 'point' + num.value
        var flag = sightline.value.addTargetPoint({
            position: cartographic,
            name: name
        })
        couldRemove.value = true
    }
}

// 笛卡尔转换为经纬度
const Cartesian2toDegrees = (position: object) => {
    var cartographic = Cesium.Cartographic.fromCartesian(position)
    var longitude = Cesium.Math.toDegrees(cartographic.longitude)
    var latitude = Cesium.Math.toDegrees(cartographic.latitude)
    var height = cartographic.height

    return [longitude, latitude, height]
}

const clearVisibility = (): void => {
    addViewFlag.value = false
    addTargetFlag.value = false
    if (handlerPoint.value) {
        handlerPoint.value.clear()
    }
    num.value = 0
    window.viewer.entities.removeAll()
    if (couldRemove.value) {
        sightline.value.removeAllTargetPoint()
        couldRemove.value = false
    }
    window.viewer.enableCursorStyle = true
    longitude.value = null
    latitude.value = null
    height.value = null
    visibleColor.value = '#0e9dec'
    hiddenColor.value = '#ffb200'
}
// 可视线实时的颜色的改变,
const hiddenColorChange = (val: Number) => {
    sightline.value.visibleColor = Cesium.Color.fromCssColorString(val)
}
const visibleColorChange = (val: Number) => {
    sightline.value.hiddenColor = Cesium.Color.fromCssColorString(val)
}
onMounted(() => {
    init()
    onDialog()
});

// 弹框打开之后的回调再次穿透页面
const getIntervisOpen = () => {
    onDialog()
}

onBeforeUnmount(() => {
    clearVisibility()
    handlerPoint.value = null
    pointEventHandler.value = null
})

// 解决弹框打开时可操作操作其他Dom的问题
const onDialog = () => {
    var box = document.querySelector(".el-overlay-dialog");
    // 获取.el-overlay-dialog父级
    var boxa = box.parentNode;
    //  使用pointerEvents 进行页面穿透
    boxa.style.pointerEvents = "none";
}
</script>
<style lang='scss' scoped>
//解决弹框打开时可操作操作其他Dom的问题
:deep(.el-dialog) {
    pointer-events: auto !important;
}

.p-font {
    font-size: 16px;
    height: 36px;
    color: aqua;
}

:deep(.el-dialog__header) {
    background-color: #012728;
    margin-right: 0px;
    height: var(--el-hov);
    padding: var(--hoverc);
}

:deep(.el-dialog__title) {
    line-height: var(--line-h);
    font-size: var(--el-dialog-title-font-size);
    color: var(--text-color);
    margin-left: var(--m-l);
}

:deep(.el-slider__runway) {
    height: var(--el-h);
    background-color: var(--el-color);
    border: 1px solid var(--el-border);
}

:deep(.el-slider__bar) {
    height: var(--el-h);
    background-color: var(--el-bj);
}

:deep(.el-slider .el-slider__runway .el-slider__button-wrapper .el-slider__button) {
    display: inline-block;
    width: 2px;
    height: 36px;
    margin-top: 13px;
}

:deep(.el-slider__button) {
    background-color: #1df9fc;
    border-radius: 0%;
    border: solid 0px var(--el-slider-main-bg-color);
}

:deep(.el-input-number__increase) {
    background: var(--el-color);
    color: var(--el-bj);
    border-left: 1px solid var(--el-border)
}

:deep(.el-input__wrapper) {
    background-color: var(--el-color);
    border: 1px solid var(--el-border);
    box-shadow: 0 0 0 0 var(--el-input-hover-border-color) inset;
}

:deep(.el-input-number__decrease) {
    background: var(--el-color);
    color: var(--el-bj);
    border-right: 1px solid var(--el-border)
}

:deep(.el-input__wrapper:hover) {
    box-shadow: 0 0 0 0 var(--el-input-hover-border-color) inset;
}

:deep(.el-input__inner) {
    color: var(--text-color)
}

.font-big {
    font-size: var(--el-font);
    color: var(--text-color);
    line-height: var(--el-line);
}

:deep(.el-dialog--center) {
    text-align: left;
}

:deep(.el-color-picker__trigger) {
    width: 340px;
}

:deep(.el-color-picker__color-inner) {
    background-color: #00CC66;
    height: 32px;
}

:deep(.el-color-picker__trigger) {
    border: 0px solid var(--el-border-color);
    height: 28px;
}

:deep(.el-color-picker__color) {
    width: 100%;
    height: 32px;
    text-align: center;
    border: 0px solid var(--el-text-color-secondary);
    margin-left: 5px;
}

.el-h-line {
    margin-top: var(--el-h-line);
}

:deep(.el-color-picker:hover:not(.is-disabled) .el-color-picker__trigger) {
    border: 0 solid var(--el-border-color-hover);
}

:deep(.el-button.is-text:not(.is-disabled):focus, .el-button.is-text:not(.is-disabled):hover) {
    background-color: var(--el-fill-color-light);
    background-color: #34E0A8;
}

:deep(.el-button.is-text:not(.is-disabled):focus, .el-button.is-text:not(.is-disabled)) {
    background-color: var(--el-fill-color-light);
    background-color: #34E0A8;
}

:deep(.el-dialog--center .el-dialog__footer) {
    text-align: end;
    border-top: 1px solid #466c64;
}

:deep(.el-button) {
    background-color: var(--el-h-bj);
    color: var(--text-color);
    font-size: 15px;
}

:deep(.el-dialog__footer) {
    padding: var(--el-dialog-padding-primary);
    padding-top: 15px;
    padding-bottom: 15px;
    border-top: 1px solid #466C64;
}

:deep(.el-dialog) {
    margin-right: 380px;
}

.el-dialog::after {
    clear: both;
}

.p {
    line-height: 52px;
    color: #34e0a8;
    margin-top: -18px;
    font-size: 15px;
    font-weight: 600;

}

:deep(.el-color-picker__color-inner) {

    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 78%;
    height: 100%;
    margin-left: -88px;
}

:deep(.el-input.is-disabled .el-input__wrapper) {
    background-color: #123435;
    box-shadow: 0 0 0 0 #19686c inset;
}
</style>
<style lang='scss' >
.el-dialog {
    --el-dialog-width: 50%;
    --el-dialog-bg-color: #1B3A39;
}

.el-dialog__headerbtn {
    top: -5px;
    right: -5px;
}

.slider-demo-block {
    display: flex;
    align-items: center;
}

.slider-demo-block .el-slider {
    margin-top: 0;
    margin-left: 8px;
}

.el-popper.is-light {
    width: 293px !important;
    opacity: 0.9;
}

.el-input__wrapper {
    background-color: #012728;
    border: 1 solid #00CC66;
    // box-shadow: 0 0 0 0 var(--el-input-border-color, var(--el-border-color)) inset;
}

.el-input--small {
    --el-input-height: var(--el-component-size-small);
    border: 1;
    border: 1px solid #1df9fc;
}

.el-popper.is-light {
    background: #012324 !important;
    border: 0 solid var(--el-border-color-light) !important;
}
</style>

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mfbz.cn/a/557272.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

es安装中文分词器

下载地址&#xff0c;尽量选择和自己本地es差不多的版本 https://github.com/infinilabs/analysis-ik/releases 下载好&#xff0c;解压&#xff0c;把里面的文件放到es的plugins/ik目录下 把plugin-descriptor.properties文件里的es版本改成自己对应的 再启动es&#xff0c;能…

2W 3KVDC 隔离单、双输出 DC/DC 电源模块——TPH 系列

TPH系列是一款2W&#xff0c;单、双输出隔离电源模块&#xff0c;特别适合板上只有一种电压而要求有正负电源的场合&#xff0c;工业级温度范围–40℃到105℃&#xff0c;在此温度范围内都可以稳定输出2W&#xff0c;并且效率非常高&#xff0c;高达86%&#xff0c;温升非常低&…

OKCC搭建配置什么样的服务器合适

OKCC呼叫中心系统是一种采用软硬件结合的架构方式、及分布式的IP技术&#xff0c;从多角度为企业提供整合的一体化解决方案。因此&#xff0c;搭建OKCC呼叫中心系统所使用的服务器应该满足以下几点要求&#xff1a; 稳定性&#xff1a;服务器需要具有较高的稳定性和可靠性&…

MinIO + Prometheus + Grafana docker部署

文章目录 说明MinIO简介MinIO 容器化部署Prometheus服务地址配置方法一&#xff1a;先部署后修改方法二&#xff1a;部署时修改compose文件&#xff08;未验证&#xff09; MinIO Access Key配置Prometheus 容器化部署MinIO 生成抓取配置修改Prometheus配置文件Grafana 容器化部…

iframe和 blob实现JS,CSS,HTML直接当前页预览

先贴效果图&#xff1a; <template><div><div class"aaa"></div><div class"btn-run" click"tres">运行</div></div></template><script>import { mapState } from vuex;export default …

在线编辑器 CodeMirror

如何优雅的在网页显示代码 如果开发在线编辑器 引入资源&#xff1a; <link rel"stylesheet" href"https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.60.0/codemirror.min.css"><script src"https://cdnjs.cloudflare.com/ajax/libs/c…

【网安小白成长之路】8.sql注入操作1

&#x1f42e;博主syst1m 带你 acquire knowledge&#xff01; ✨博客首页——syst1m的博客&#x1f498; &#x1f51e; 《网安小白成长之路(我要变成大佬&#x1f60e;&#xff01;&#xff01;)》真实小白学习历程&#xff0c;手把手带你一起从入门到入狱&#x1f6ad; &…

店前台安装水离子雾化壁炉前和装后对比

当酒店前台装上水离子雾化壁炉后&#xff0c;整体氛围和客户体验都会发生显著的变化&#xff1a; 装前&#xff1a; 普通的前台氛围&#xff1a;前台可能显得比较普通和传统&#xff0c;可能缺乏独特的装饰元素或视觉焦点。 视觉上缺乏吸引力&#xff1a;前台空间可能比较朴…

现代商业中首席人工智能官(CAIO)的角色与影响

每周跟踪AI热点新闻动向和震撼发展 想要探索生成式人工智能的前沿进展吗&#xff1f;订阅我们的简报&#xff0c;深入解析最新的技术突破、实际应用案例和未来的趋势。与全球数同行一同&#xff0c;从行业内部的深度分析和实用指南中受益。不要错过这个机会&#xff0c;成为AI领…

万字总结!Docker简介及底层关键技术剖析

本文首发在个人博客上&#xff1a;万字总结&#xff01;Docker简介及底层关键技术剖析 Docker 简介 Docker 是一个开源的应用容器引擎&#xff0c;基于 Go 语言 并遵从 Apache2.0 协议开源。Docker 可以让开发者打包他们的应用以及依赖包到一个轻量级、可移植的容器中&#x…

PVE grub resue错误修复 lvmid BUG

服务器断电后启动不起来&#xff0c;显示grub resue 找了半天没有找到修复方法。看官方文档有一处Recovering from grub “disk not found” error when booting from LVM 极为类似。https://pve.proxmox.com/wiki/Recover_From_Grub_Failure 下面是处理过程。 使用PVE 6.4启…

使用示例解释.NET中的Mocking是什么?

让我们踏上探索.NET软件开发中Mocking概念的旅程&#xff0c;让我们深入了解Mocking是多么简单易懂、易于访问。请与我一起穿越这个主题&#xff0c;我将涵盖以下内容&#xff1a; 理解Mocking&#xff1a;为何它对于构建强大的测试策略至关重要。探索一些最常见的Mocking库&a…

python教学入门:字典和集合

字典&#xff08;Dictionary&#xff09;&#xff1a; 定义&#xff1a; 字典是 Python 中的一种数据结构&#xff0c;用于存储键值对&#xff08;key-value pairs&#xff09;。字典使用花括号 {} 定义&#xff0c;键值对之间用冒号 : 分隔&#xff0c;每对键值对之间用逗号 …

SQL-Oracle 获取最大值,第二大,第三大,第 N 大值

目录 1、原始数据2、获取最大值记录3、获取第二大值记录4、获取第三大值记录 1、原始数据 select * from test_2024_04_15_001 order by 销量 desc,渠道2、获取最大值记录 select 渠道,销量 from ( select a.渠道, a.销量 from test_2024_04_15_001 a order by a.销量 desc,…

AI边坡监测识别摄像机

AI边坡监测识别摄像机是一种利用人工智能技术进行边坡监测的智能设备&#xff0c;其作用是及时监测边坡变化并识别潜在的滑坡、崩塌等危险情况&#xff0c;以提供及时预警和采取必要的安全措施。这种摄像机通过高清摄像头实时捕捉边坡的图像&#xff0c;并利用AI算法对边坡的形…

实验室三大常用仪器2---函数信号发生器的基本使用方法(笔记)

目录 函数信号发生器的基本使用方法 如何连接函数信号发生器和示波器 实验室三大常用仪器1---示波器的基本使用方法&#xff08;笔记&#xff09;-CSDN博客 实验室三大常用仪器3---交流毫伏表的使用方法&#xff08;笔记&#xff09;-CSDN博客 示波器是用来显示和测量信号的…

Java | Leetcode Java题解之第35题搜索插入位置

题目&#xff1a; 题解&#xff1a; class Solution {public int searchInsert(int[] nums, int target) {int n nums.length;int left 0, right n - 1, ans n;while (left < right) {int mid ((right - left) >> 1) left;if (target < nums[mid]) {ans mi…

阿里云图片处理之 图片样式(裁剪)

文档 : https://help.aliyun.com/zh/oss/user-guide/image-styles?spma2c4g.11186623.0.0.5961fe7aq3111v 需求 : 由于客户端界面展示的图片较多, 而且每个图片都过大并且高清高分辨率的, 导致打开页面时图片加载很慢, 而且是缩略图, 对图片清晰度要求不是那么得高, 因此可以…

ASP.NET MVC企业级程序设计 (商品管理:小计,总计,删除,排序)

目录 效果图 实现过程 1创建数据库 2创建项目文件 3创建控制器&#xff0c;右键添加&#xff0c;控制器 ​编辑 注意这里要写Home​编辑 创建成功 数据模型创建过程之前作品有具体过程​编辑 4创建DAL 5创建BLL 6创建视图&#xff0c;右键添加视图 ​编辑 7HomeCont…

【问题处理】银河麒麟操作系统实例分享,adb读写缓慢问题分析

1.问题环境 处理器&#xff1a; HUAWEI Kunpeng 920 5251K 内存&#xff1a; 512 GiB 整机类型/架构&#xff1a; TaiShan 200K (Model 2280K) BIOS版本&#xff1a; Byosoft Corp. 1.81.K 内核版本 4.19.90-23.15.v2101.ky10.aarch64 第三方应用 数据库 2.问题…
最新文章