feat: 空间分析功能新增

This commit is contained in:
kun 2023-10-18 18:35:30 +08:00
parent 22480ff8e8
commit 2ba165a7a3
7 changed files with 1209 additions and 406 deletions

471
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -24,6 +24,7 @@
"@amap/amap-jsapi-loader": "^1.0.1", "@amap/amap-jsapi-loader": "^1.0.1",
"@amap/amap-jsapi-types": "^0.0.13", "@amap/amap-jsapi-types": "^0.0.13",
"@element-plus/icons-vue": "^2.0.10", "@element-plus/icons-vue": "^2.0.10",
"@turf/turf": "^6.5.0",
"@vueup/vue-quill": "^1.0.0-alpha.40", "@vueup/vue-quill": "^1.0.0-alpha.40",
"@vueuse/core": "^9.12.0", "@vueuse/core": "^9.12.0",
"@wangeditor/editor": "^5.1.12", "@wangeditor/editor": "^5.1.12",
@ -42,8 +43,8 @@
"js-base64": "^3.7.5", "js-base64": "^3.7.5",
"js-md5": "^0.7.3", "js-md5": "^0.7.3",
"jszip": "^3.10.1", "jszip": "^3.10.1",
"mars3d": "^3.5.6", "mars3d": "^3.6.9",
"mars3d-cesium": "^1.105.0", "mars3d-cesium": "^1.110.0",
"mitt": "^3.0.0", "mitt": "^3.0.0",
"moment": "^2.29.4", "moment": "^2.29.4",
"mqtt": "^2.18.8", "mqtt": "^2.18.8",

View File

@ -14,15 +14,3 @@ export function initVue3Popup(comp: any, para: any) {
vNode.mount(vNodeDom); vNode.mount(vNodeDom);
return vNode._container; return vNode._container;
} }
/**
* "经度,纬度"
*
* @export
* @param {string} text
* @return {boolean} ,
*/
export function isLonLat(text: string): boolean {
const reg = /^-?((0|1?[0-7]?[0-9]?)(([.][0-9]*)?)|180(([.][0]*)?)),-?((0|[1-8]?[0-9]?)(([.][0-9]*)?)|90(([.][0]*)?))$/;
return reg.test(text);
}

View File

@ -36,9 +36,10 @@ import * as Cesium from "mars3d-cesium";
//mars3d //mars3d
import "mars3d/dist/mars3d.css"; import "mars3d/dist/mars3d.css";
import * as mars3d from "mars3d"; import * as mars3d from "mars3d";
import { ref, watch, onMounted } from "vue"; import { ref, watch, onMounted, onUnmounted } from "vue";
const props = defineProps(["show", "mapInstance"]); const props = defineProps(["mapInstance"]);
const emits = defineEmits(["hiddenConfim"]); const emits = defineEmits(["hiddenConfim"]);
const operateName = ref("");
const echartShow = ref<boolean>(false); const echartShow = ref<boolean>(false);
const unitList = ref([ const unitList = ref([
{ name: "自动", value: "auto" }, { name: "自动", value: "auto" },
@ -79,6 +80,7 @@ const closeDiv = () => {
}; };
const mapOperate = (name: any) => { const mapOperate = (name: any) => {
console.log(name); console.log(name);
operateName.value = name;
if (name == "空间距离") { if (name == "空间距离") {
measure.distance({ measure.distance({
showAddText: true, showAddText: true,
@ -164,11 +166,17 @@ onMounted(() => {
}); });
// //
measure.on(mars3d.EventType.end, function (e: any) { measure.on(mars3d.EventType.end, function (e: any) {
console.log(e); console.log("开始分析", e);
formData.value.distanceVal = e.label; formData.value.distanceVal = e.label;
// echartShow.value = true; if (operateName.value == "剖面") {
echartShow.value = true;
}
}); });
}); });
onUnmounted(() => {
map = null;
measure = null;
});
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
@ -208,7 +216,7 @@ onMounted(() => {
background-color: #173147; background-color: #173147;
span { span {
font-size: 16px; font-size: 16px;
color: white; color: #0089fe;
margin-right: auto; margin-right: auto;
} }
:deep() { :deep() {

File diff suppressed because it is too large Load Diff

View File

@ -13,8 +13,9 @@
"fog": true, "fog": true,
"fxaa": true, "fxaa": true,
"requestRenderMode": true, "requestRenderMode": true,
"orderIndependentTranslucency": false,
"globe": { "globe": {
"depthTestAgainstTerrain": false, "depthTestAgainstTerrain": true,
"baseColor": "#546a53", "baseColor": "#546a53",
"showGroundAtmosphere": true, "showGroundAtmosphere": true,
"enableLighting": false "enableLighting": false

View File

@ -80,6 +80,8 @@
</div> </div>
<!-- 图上量算弹框 --> <!-- 图上量算弹框 -->
<MapMeasurement :mapInstance="map" v-if="measurementShow" @hiddenConfim="measurementShow = false" /> <MapMeasurement :mapInstance="map" v-if="measurementShow" @hiddenConfim="measurementShow = false" />
<!-- 空间分析弹框 -->
<SpaceAnalysis :mapInstance="map" v-if="analysisShow" @hiddenConfim="analysisShow = false"></SpaceAnalysis>
</div> </div>
<!-- <div class="option-list"> <!-- <div class="option-list">
@ -153,23 +155,6 @@
</div> </div>
</div> </div>
</div> </div>
<div class="option-list-item">
<span>日照效果</span>
<div class="item-classify">
<div class="item-classify-item">
<span>日期选择</span>
<el-date-picker v-model="sunProperty.timeVal" type="date" format="YYYY-MM-DD" value-format="YYYY-MM-DD" />
</div>
<div class="item-classify-item">
<span>时间选择</span>
<el-slider v-model="sunProperty.currDate" :min="0" :max="1440" :step="1" @change="timeChange" />
</div>
<div class="item-classify-item">
<span>当前时间</span>
<span>{{ sunProperty.timeVal }} {{ hours }} {{ minutes }}</span>
</div>
</div>
</div>
<div class="option-list-item"> <div class="option-list-item">
<span>近地天空盒</span> <span>近地天空盒</span>
<div class="item-classify"> <div class="item-classify">
@ -202,6 +187,8 @@ import { datas } from "@/enums/company/SetpsEnum";
import { initVue3Popup } from "@/utils/file-util"; import { initVue3Popup } from "@/utils/file-util";
import QueryPopup from "./components/query-popup.vue"; import QueryPopup from "./components/query-popup.vue";
import MapMeasurement from "./components/mapMeasurement.vue"; import MapMeasurement from "./components/mapMeasurement.vue";
import SpaceAnalysis from "./components/spaceAnalysis.vue";
const analysisShow = ref(false); //
const measurementShow = ref(false); // const measurementShow = ref(false); //
const layersShow = ref(false); // const layersShow = ref(false); //
const basicMapShow = ref(false); // const basicMapShow = ref(false); //
@ -255,7 +242,6 @@ let rainEffect: any; // 雨天气
let fogEffect: any; // let fogEffect: any; //
let snowEffect: any; // let snowEffect: any; //
let snowCover: any; // let snowCover: any; //
let shadows: any; //
let currSkyBox: any; // Skybox let currSkyBox: any; // Skybox
let defaultSkybox: any; // cesiumSkybox let defaultSkybox: any; // cesiumSkybox
let graphicLayer: any; // let graphicLayer: any; //
@ -354,6 +340,9 @@ const clickMenu = (name: any) => {
console.log(name); console.log(name);
if (name == "图上量算") { if (name == "图上量算") {
measurementShow.value = true; measurementShow.value = true;
} else if (name == "空间分析") {
console.log(666);
analysisShow.value = true;
} }
}; };
// Canvas // Canvas
@ -588,9 +577,6 @@ const initMars3d = (option: any) => {
// alpha: 0.6, // alpha: 0.6,
// maxHeight: 8000 // // maxHeight: 8000 //
// }); // });
// shadows = new mars3d.thing.Shadows({
// multiplier: 1600
// });
// defaultSkybox = map.scene.skyBox; // defaultSkybox = map.scene.skyBox;
// currSkyBox = qingtianSkybox; // currSkyBox = qingtianSkybox;
// map.on(mars3d.EventType.postRender, function () { // map.on(mars3d.EventType.postRender, function () {
@ -612,7 +598,6 @@ const initMars3d = (option: any) => {
// map.addEffect(fogEffect); // map.addEffect(fogEffect);
// map.addEffect(snowEffect); // map.addEffect(snowEffect);
// map.addEffect(snowCover); // map.addEffect(snowCover);
// map.addThing(shadows);
}; };
// config.json // config.json
const getBasicMaps = () => { const getBasicMaps = () => {
@ -781,11 +766,6 @@ const jxOperate = (e: any, label: any) => {
console.log(e, label); console.log(e, label);
snowCover[label] = e; snowCover[label] = e;
}; };
//
const timeChange = (e: any) => {
const dateTime = new Date(`${sunProperty.value.timeVal} ${hours.value}:${minutes.value}:00`);
shadows.time = dateTime;
};
// //
const boxChange = (e: any) => { const boxChange = (e: any) => {
switch (e) { switch (e) {