diff --git a/public/img/map/changeScene.svg b/public/img/map/changeScene.svg new file mode 100644 index 0000000..ce8f133 --- /dev/null +++ b/public/img/map/changeScene.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/img/map/dike_four.png b/public/img/map/dike_four.png new file mode 100644 index 0000000..82a2c33 Binary files /dev/null and b/public/img/map/dike_four.png differ diff --git a/public/img/map/dike_one.png b/public/img/map/dike_one.png new file mode 100644 index 0000000..b09c1bf Binary files /dev/null and b/public/img/map/dike_one.png differ diff --git a/public/img/map/dike_two_three.png b/public/img/map/dike_two_three.png new file mode 100644 index 0000000..e67ecb9 Binary files /dev/null and b/public/img/map/dike_two_three.png differ diff --git a/public/img/map/icon-folder.png b/public/img/map/icon-folder.png new file mode 100644 index 0000000..02622d7 Binary files /dev/null and b/public/img/map/icon-folder.png differ diff --git a/public/img/map/icon-layer.png b/public/img/map/icon-layer.png new file mode 100644 index 0000000..98de3e1 Binary files /dev/null and b/public/img/map/icon-layer.png differ diff --git a/public/img/map/layer.svg b/public/img/map/layer.svg new file mode 100644 index 0000000..a8a2351 --- /dev/null +++ b/public/img/map/layer.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/img/map/reservoir_big.png b/public/img/map/reservoir_big.png new file mode 100644 index 0000000..7c4b908 Binary files /dev/null and b/public/img/map/reservoir_big.png differ diff --git a/public/img/map/reservoir_normal.png b/public/img/map/reservoir_normal.png new file mode 100644 index 0000000..a54f862 Binary files /dev/null and b/public/img/map/reservoir_normal.png differ diff --git a/public/img/map/reservoir_small.png b/public/img/map/reservoir_small.png new file mode 100644 index 0000000..66cd15d Binary files /dev/null and b/public/img/map/reservoir_small.png differ diff --git a/public/img/map/sluice_big.png b/public/img/map/sluice_big.png new file mode 100644 index 0000000..bda2876 Binary files /dev/null and b/public/img/map/sluice_big.png differ diff --git a/public/img/map/sluice_middle.png b/public/img/map/sluice_middle.png new file mode 100644 index 0000000..ca83f36 Binary files /dev/null and b/public/img/map/sluice_middle.png differ diff --git a/public/img/map/sluice_small.png b/public/img/map/sluice_small.png new file mode 100644 index 0000000..0f60459 Binary files /dev/null and b/public/img/map/sluice_small.png differ diff --git a/src/hooks/web/useProject.tsx b/src/hooks/web/useProject.tsx index 85afcc3..22c92e5 100644 --- a/src/hooks/web/useProject.tsx +++ b/src/hooks/web/useProject.tsx @@ -1,7 +1,9 @@ import { reactive } from 'vue'; import * as SyCim from 'sy-cesium-sdk'; import { LayerTypeEnum } from '@/enums/projectEnum'; +import { queryLayersByPos } from "@/utils/mapUtils"; import axios from 'axios'; +import { throttle } from "lodash-es"; const clustering = reactive({ enabled: true, pixelRange: 200, @@ -105,7 +107,7 @@ const layerActions: Record = { export const getFeatures: any = (data: any, filter: '1=1') => { return new Promise(async (resolve, reject) => { - const { url } = data; + const { url, serviceToken } = data; let newUrl = decodeURI(url).split("maps/")[0].replace("map-", "data-"); const reg2 = /([^/]+)$/; const decodeUrl: any = decodeURI(url); @@ -113,16 +115,20 @@ export const getFeatures: any = (data: any, filter: '1=1') => { const l = newLayerName?.split("%40"); const datasourceName = `${l?.[1]}:${l?.[0]}`; let queryUrl = `${newUrl}data/featureResults.geojson?returnContent=true`; + let params: any = { + getFeatureMode: 'SQL', + datasetNames: [datasourceName], + maxFeatures: 100000000, + queryParameter: { + attributeFilter: filter + } + }; + if (serviceToken) { + params.k = serviceToken; + } const result = await axios.post( queryUrl, - JSON.stringify({ - getFeatureMode: 'SQL', - datasetNames: [datasourceName], - maxFeatures: 100000000, - queryParameter: { - attributeFilter: filter - } - }), + JSON.stringify(params), { headers: { 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8' @@ -283,6 +289,7 @@ export function useLayer() { if (!layerType || !(action = layerActions[layerType as string])) return; let layer: any = await action(layerData); if (isNeedCluster === '1' && layerData.nameCn === "水库点") { + let baseUrl = import.meta.env.VITE_BASE_URL; const data = await getFeatures(layerData); if (data?.features?.[0]?.geometry?.type === 'Point') { let layerConfig = {}; @@ -298,7 +305,7 @@ export function useLayer() { { name: "4.0", attr: "image", value: "reservoir_small.png" }, { name: "5.0", attr: "image", value: "reservoir_small.png" }, ], - image: "reservoir_small.png", + image: "map-title-o.png", }; break; } @@ -306,7 +313,7 @@ export function useLayer() { data, symbol: { type: "billboardP", - imageProxy: "/src/assets/map/", // 图片代理 + imageProxy: `${baseUrl}/img/map/`, // 图片代理 style: { clampToGround: false, image: "reservoir_small.png", @@ -359,10 +366,21 @@ export function useLayer() { const { layerType } = data; zoomToLayerActions[layerType as string]?.(data); }; + const viewerClick = throttle((e) => { + console.log(e); + }, 500); + const addViewerMouseClick = () => { + window.viewer?.on(SyCim.MouseEventType.MOUSE_MOVE, viewerClick); + }; + const removeViewerMouseClick = () => { + window.viewer?.off(SyCim.MouseEventType.MOUSE_MOVE, viewerClick); + }; return { addLayer, removeLayer, - zoomToLayer + zoomToLayer, + addViewerMouseClick, + removeViewerMouseClick }; } diff --git a/src/store/modules/project.ts b/src/store/modules/project.ts index 991d134..27171bb 100644 --- a/src/store/modules/project.ts +++ b/src/store/modules/project.ts @@ -71,6 +71,21 @@ function filterTreeData(data: any[]) { .filter(Boolean) ); } +function getLayerByName(data: any[], name: string) { + let layer = null; + const fn = (data: any[], name: string) => { + for (const item of data) { + if (item.nameCn === name) { + layer = item; + return; + } else if (item.children && item.children.length >= 0) { + fn(item.children, name); + } + } + }; + fn(data, name); + return layer; +} const { addLayer, removeLayer } = useLayer(); export const useProjectStore = defineStore("project", { @@ -185,6 +200,9 @@ export const useProjectStore = defineStore("project", { this.selectedLayers = _nodeTemp.filter((key) => !nodes.includes(key)); } }, + getLayerByName(name: string) { + return getLayerByName(this.layerData, name); + }, async fetchFirstScene() { const rData = await getFirstScene(); if (rData.code === 200) { diff --git a/src/views/BottomPanel/index.vue b/src/views/BottomPanel/index.vue index c88900e..bfa0e10 100644 --- a/src/views/BottomPanel/index.vue +++ b/src/views/BottomPanel/index.vue @@ -1,15 +1,48 @@