Showing
3 changed files
with
26 additions
and
7 deletions
| ... | @@ -12,6 +12,8 @@ const testInfo = [ | ... | @@ -12,6 +12,8 @@ const testInfo = [ |
| 12 | [120.587736, 31.314093], | 12 | [120.587736, 31.314093], |
| 13 | [120.5875, 31.31407], | 13 | [120.5875, 31.31407], |
| 14 | [120.587103, 31.314234], | 14 | [120.587103, 31.314234], |
| 15 | + [120.587046,31.314125], | ||
| 16 | + [120.586958,31.314132], | ||
| 15 | [120.586912, 31.314195], | 17 | [120.586912, 31.314195], |
| 16 | [120.586812, 31.314049], | 18 | [120.586812, 31.314049], |
| 17 | ], | 19 | ], |
| ... | @@ -29,8 +31,11 @@ const testInfo = [ | ... | @@ -29,8 +31,11 @@ const testInfo = [ |
| 29 | [120.587811, 31.313508], | 31 | [120.587811, 31.313508], |
| 30 | [120.587736, 31.314093], | 32 | [120.587736, 31.314093], |
| 31 | [120.5875, 31.31407], | 33 | [120.5875, 31.31407], |
| 34 | + [120.587458,31.314335], | ||
| 35 | + [120.587707,31.314354], | ||
| 32 | [120.58769, 31.314535], | 36 | [120.58769, 31.314535], |
| 33 | [120.587352, 31.314496], | 37 | [120.587352, 31.314496], |
| 38 | + [120.587352,31.31482], | ||
| 34 | [120.587176, 31.314839], | 39 | [120.587176, 31.314839], |
| 35 | [120.587113, 31.314473], | 40 | [120.587113, 31.314473], |
| 36 | [120.586966, 31.314526], | 41 | [120.586966, 31.314526], |
| ... | @@ -52,9 +57,15 @@ const testInfo = [ | ... | @@ -52,9 +57,15 @@ const testInfo = [ |
| 52 | [120.587811, 31.313508], | 57 | [120.587811, 31.313508], |
| 53 | [120.587736, 31.314093], | 58 | [120.587736, 31.314093], |
| 54 | [120.587985, 31.31411], | 59 | [120.587985, 31.31411], |
| 60 | + [120.587958,31.314381], | ||
| 61 | + [120.587698,31.314349], | ||
| 55 | [120.58769, 31.314535], | 62 | [120.58769, 31.314535], |
| 63 | + [120.587882,31.314598], | ||
| 56 | [120.58798, 31.314679], | 64 | [120.58798, 31.314679], |
| 57 | [120.58791, 31.314799], | 65 | [120.58791, 31.314799], |
| 66 | + [120.587621,31.31513], | ||
| 67 | + [120.58758,31.315273], | ||
| 68 | + [120.5874,31.315266], | ||
| 58 | [120.587295, 31.315548], | 69 | [120.587295, 31.315548], |
| 59 | [120.587574, 31.315582], | 70 | [120.587574, 31.315582], |
| 60 | [120.587853, 31.315603], | 71 | [120.587853, 31.315603], |
| ... | @@ -65,5 +76,5 @@ const testInfo = [ | ... | @@ -65,5 +76,5 @@ const testInfo = [ |
| 65 | 76 | ||
| 66 | // 照壁[120.587882,31.312884]-双桥[120.588164,31.31305]-牌坊[120.587823,31.313276]-山门[120.587811,31.313508]-鼓楼[120.5875,31.31407]-公共厕所[120.587103,31.314234]-包子铺[120.586912,31.314195]-开水房[120.586812,31.314049]; | 77 | // 照壁[120.587882,31.312884]-双桥[120.588164,31.31305]-牌坊[120.587823,31.313276]-山门[120.587811,31.313508]-鼓楼[120.5875,31.31407]-公共厕所[120.587103,31.314234]-包子铺[120.586912,31.314195]-开水房[120.586812,31.314049]; |
| 67 | // 照壁[120.587882,31.312884]-双桥[120.588164,31.31305]-牌坊[120.587823,31.313276]-山门[120.587811,31.313508]-鼓楼[120.5875,31.31407]-天王殿[120.58769,31.314535]-素食馆[120.587352,31.314496]-罗汉堂[120.587176,31.314839]-集云轩[120.587113,31.314473]-般若堂[120.586966,31.314526]-茶室[120.58681,31.314981]-湖心亭[120.58653,31.315118]-神鼋[120.586157,31.315011]; | 78 | // 照壁[120.587882,31.312884]-双桥[120.588164,31.31305]-牌坊[120.587823,31.313276]-山门[120.587811,31.313508]-鼓楼[120.5875,31.31407]-天王殿[120.58769,31.314535]-素食馆[120.587352,31.314496]-罗汉堂[120.587176,31.314839]-集云轩[120.587113,31.314473]-般若堂[120.586966,31.314526]-茶室[120.58681,31.314981]-湖心亭[120.58653,31.315118]-神鼋[120.586157,31.315011]; |
| 68 | -// 照壁[120.587882,31.312884]-双桥[120.588164,31.31305]-牌坊[120.587823,31.313276]-山门[120.587811,31.313508]-钟楼[120.587985,31.31411]-天王殿[120.58769,31.314535]-客堂、行政办公室[120.58798,31.314679]-观音殿[120.58791,31.314799]-大雄宝殿[,]-老念佛堂[120.587295,31.315548]-挂单寮[120.587574,31.315582]-地藏殿[120.587853,31.315603]; | 79 | +// 照壁[120.587882,31.312884]-双桥[120.588164,31.31305]-牌坊[120.587823,31.313276]-山门[120.587811,31.313508]-钟楼[120.587985,31.31411]-天王殿[120.58769,31.314535]-客堂、行政办公室[120.58798,31.314679]-观音殿[120.58791,31.314799]-大雄宝殿[120.587621,31.31513]-老念佛堂[120.587295,31.315548]-挂单寮[120.587574,31.315582]-地藏殿[120.587853,31.315603]; |
| 69 | export default testInfo; | 80 | export default testInfo; | ... | ... |
| 1 | <!-- | 1 | <!-- |
| 2 | * @Date: 2023-05-19 14:54:27 | 2 | * @Date: 2023-05-19 14:54:27 |
| 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 4 | - * @LastEditTime: 2023-07-19 16:32:10 | 4 | + * @LastEditTime: 2023-07-19 17:05:37 |
| 5 | * @FilePath: /map-demo/src/views/index.vue | 5 | * @FilePath: /map-demo/src/views/index.vue |
| 6 | * @Description: 地图主体页面 | 6 | * @Description: 地图主体页面 |
| 7 | --> | 7 | --> |
| ... | @@ -658,10 +658,14 @@ export default { | ... | @@ -658,10 +658,14 @@ export default { |
| 658 | } | 658 | } |
| 659 | }) | 659 | }) |
| 660 | }); | 660 | }); |
| 661 | - const lngLat = [120.587234, 31.314147]; // 左边 | 661 | + let lngLat = [120.587234, 31.314147]; // 左边 |
| 662 | // const lngLat = [120.588178, 31.314396]; // 右边 | 662 | // const lngLat = [120.588178, 31.314396]; // 右边 |
| 663 | // 构建路线结构 | 663 | // 构建路线结构 |
| 664 | - const route_obj = array; | 664 | + // 如果建筑不在导航路径上面需要单独处理, 直接查询建筑离哪个导航路径最近显示出来 |
| 665 | + const route_obj = array.length ? array: my_router; | ||
| 666 | + if (!array.length) { | ||
| 667 | + lngLat = position; // 当前导航建筑经纬度 | ||
| 668 | + } | ||
| 665 | // 计算距离最近的路径 | 669 | // 计算距离最近的路径 |
| 666 | route_obj.forEach((line) => { | 670 | route_obj.forEach((line) => { |
| 667 | line.distance = AMap.GeometryUtil.distanceToLine(lngLat, line.path); | 671 | line.distance = AMap.GeometryUtil.distanceToLine(lngLat, line.path); | ... | ... |
| 1 | <!-- | 1 | <!-- |
| 2 | * @Date: 2023-05-19 14:54:27 | 2 | * @Date: 2023-05-19 14:54:27 |
| 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 4 | - * @LastEditTime: 2023-07-19 16:34:32 | 4 | + * @LastEditTime: 2023-07-19 17:06:18 |
| 5 | * @FilePath: /map-demo/src/views/inner.vue | 5 | * @FilePath: /map-demo/src/views/inner.vue |
| 6 | * @Description: 地图主体页面 | 6 | * @Description: 地图主体页面 |
| 7 | --> | 7 | --> |
| ... | @@ -728,10 +728,14 @@ export default { | ... | @@ -728,10 +728,14 @@ export default { |
| 728 | } | 728 | } |
| 729 | }) | 729 | }) |
| 730 | }); | 730 | }); |
| 731 | - const lngLat = [120.587234, 31.314147]; // 左边 | 731 | + let lngLat = [120.587234, 31.314147]; // 左边 |
| 732 | // const lngLat = [120.588178, 31.314396]; // 右边 | 732 | // const lngLat = [120.588178, 31.314396]; // 右边 |
| 733 | // 构建路线结构 | 733 | // 构建路线结构 |
| 734 | - const route_obj = array; | 734 | + // 如果建筑不在导航路径上面需要单独处理, 直接查询建筑离哪个导航路径最近显示出来 |
| 735 | + const route_obj = array.length ? array : my_router; | ||
| 736 | + if (!array.length) { | ||
| 737 | + lngLat = position; // 当前导航建筑经纬度 | ||
| 738 | + } | ||
| 735 | // 计算距离最近的路径 | 739 | // 计算距离最近的路径 |
| 736 | route_obj.forEach((line) => { | 740 | route_obj.forEach((line) => { |
| 737 | line.distance = AMap.GeometryUtil.distanceToLine(lngLat, line.path); | 741 | line.distance = AMap.GeometryUtil.distanceToLine(lngLat, line.path); | ... | ... |
-
Please register or login to post a comment