This commit is contained in:
ylj20011123 2025-08-15 19:46:24 +08:00
parent a3085e2727
commit ea104ba2f7
3 changed files with 663030 additions and 2 deletions

662965
src/options/YNHighWayLine.js Normal file

File diff suppressed because it is too large Load Diff

View File

@ -5,6 +5,7 @@ import { GaodeMap, LineLayer, PointLayer, Scene } from '@antv/l7';
import { handleGetServerpartList, handleGetServerPartListJava } from '../../service'; import { handleGetServerpartList, handleGetServerPartListJava } from '../../service';
// @ts-ignore // @ts-ignore
import yunNanData from '../../../../options/anhuiLine.js' import yunNanData from '../../../../options/anhuiLine.js'
import YNHighWayLine from '../../../../options/YNHighWayLine.js'
// //
const scene = ref<any>(); const scene = ref<any>();
@ -75,9 +76,28 @@ onMounted(async () => {
// //
handleGetAnHuiBoundary() handleGetAnHuiBoundary()
// 线
handleGetExpressway()
hoverPoint.value = handlePointHover(); hoverPoint.value = handlePointHover();
}) })
// 线
const handleGetExpressway = async () => {
const higeWayLin = new LineLayer();
higeWayLin.name = "higeWayLin";
// 线
let list: any = YNHighWayLine
higeWayLin.source(list).size(1).style({
opacity: 1,
sourceColor: "#ebaf60",
targetColor: "#ebaf60",
linearDir: "horizontal",
});
scene.value.addLayer(higeWayLin);
}
// //
const handleGetServiceList = async () => { const handleGetServiceList = async () => {
const req: any = { const req: any = {
@ -201,7 +221,7 @@ const handleAllServiceMarkedPoint = async () => {
scene.value.addLayer(pointLayer); scene.value.addLayer(pointLayer);
} }
// //
const handleGetAnHuiBoundary = () => { const handleGetAnHuiBoundary = () => {
const blurLine = new LineLayer(); const blurLine = new LineLayer();
blurLine.name = "blurLine"; blurLine.name = "blurLine";
@ -375,6 +395,9 @@ const emit = defineEmits<{
<template> <template>
<div class="PageMapBox" style="position: relative;"> <div class="PageMapBox" style="position: relative;">
<div class="mapContent" id="map"></div> <div class="mapContent" id="map">
</div>
</div> </div>
</template> </template>

View File

@ -467,6 +467,43 @@ const handleStopPrint = () => {
} }
const handleGetHighWayData = async () => {
const origin = "101.52942,21.467193"; //
const destination = "101.284056,21.706735"; //
const strategy = "20"; //
const extensions = "all"; //
const key = "6e96a801bcea5290d3dcbf100358a6b3"; // key
const url = `https://restapi.amap.com/v3/direction/driving?origin=${origin}&destination=${destination}&strategy=${strategy}&extensions=${extensions}&output=json&key=${key}`;
try {
const res = await fetch(url);
if (!res.ok) throw new Error(`HTTP错误: ${res.status}`);
const data = await res.json();
//
const paths = data.route?.paths?.[0]?.steps || [];
const coords: number[][] = [];
paths.forEach(step => {
if (step.polyline) {
const points = step.polyline.split(";").map(p => {
const [lng, lat] = p.split(",").map(Number);
return [lng, lat];
});
coords.push(...points);
}
});
console.log("二维数组坐标:", coords);
return coords;
} catch (err) {
console.error("请求出错:", err);
return [];
}
};
</script> </script>
<template> <template>
@ -529,6 +566,8 @@ const handleStopPrint = () => {
style="position: relative;z-index: 9;" /> style="position: relative;z-index: 9;" />
<div v-show="selectPageTab === 1 && !showDialogBox"> <div v-show="selectPageTab === 1 && !showDialogBox">
<!-- 地图 --> <!-- 地图 -->
<PageMap @handleGetCurrentService="handleGetCurrentService" :noticeMessageObj="noticeMessageObj" <PageMap @handleGetCurrentService="handleGetCurrentService" :noticeMessageObj="noticeMessageObj"
:selectPointServicePart="noticeAllServicePartId" :mapClickComeForm="mapClickComeForm" :selectPointServicePart="noticeAllServicePartId" :mapClickComeForm="mapClickComeForm"
@ -537,6 +576,7 @@ const handleStopPrint = () => {
<div class="AreaLegend"> <div class="AreaLegend">
<div class="AreaLegendContent"> <div class="AreaLegendContent">
<!-- <span style="font-size: 60px;color: #fff;" @click="handleGetHighWayData">拿数据</span> -->
<!-- 图例组件 --> <!-- 图例组件 -->
<AreaLegend :mapLegend="mapLegend" /> <AreaLegend :mapLegend="mapLegend" />
</div> </div>