Commit 39edb35e authored by wuqinghua's avatar wuqinghua

Merge remote-tracking branch 'origin/master'

parents 4610f2da 78459def
/* /*
* @Author: your name * @Author: your name
* @Date: 2022-01-11 13:45:12 * @Date: 2022-01-11 13:45:12
* @LastEditTime: 2022-03-03 11:51:16 * @LastEditTime: 2022-03-15 13:50:27
* @LastEditors: Please set LastEditors * @LastEditors: Please set LastEditors
* @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
* @FilePath: /test/hello-world/src/utils/mapClass.js * @FilePath: /test/hello-world/src/utils/mapClass.js
...@@ -14,6 +14,8 @@ import { pipeColor, svgUrl, svgAlarm } from "@/utils/mapClass/config.js"; ...@@ -14,6 +14,8 @@ import { pipeColor, svgUrl, svgAlarm } from "@/utils/mapClass/config.js";
export class EditorMap { export class EditorMap {
// 地图的对象实例 // 地图的对象实例
map = null; map = null;
// 外部传进来的中心店
center = null;
// 父vue的实例 // 父vue的实例
vue = null; vue = null;
// 操作 新建,编辑,删除,编辑跟删除只对已经在图上的设备有效 默认值:0, 新建:1,编辑:2, 删除: 3。 // 操作 新建,编辑,删除,编辑跟删除只对已经在图上的设备有效 默认值:0, 新建:1,编辑:2, 删除: 3。
...@@ -49,6 +51,8 @@ export class EditorMap { ...@@ -49,6 +51,8 @@ export class EditorMap {
zoom: 14, zoom: 14,
...config, ...config,
}); });
const { center } = config;
this.center = center;
this.vue = vue; this.vue = vue;
this.init(); this.init();
} }
...@@ -60,6 +64,36 @@ export class EditorMap { ...@@ -60,6 +64,36 @@ export class EditorMap {
this.mouseAddDevice(); this.mouseAddDevice();
// this.mouseAddMarker(); // this.mouseAddMarker();
// this.mouseAddPipeline(); // this.mouseAddPipeline();
// 地图边界
this.map.getCity((res) => {
const city = res.district;
this.mapBound(city);
}, this.center);
}
mapBound(city) {
var district = new AMap.DistrictSearch({
extensions: "all", // 返回行政区边界坐标等具体信息
level: "district", // 设置查询行政区级别为 区
});
district.search(city, (status, result) => {
// 获取朝阳区的边界信息
var bounds = result.districtList[0].boundaries;
var polygons = [];
if (bounds) {
for (var i = 0, l = bounds.length; i < l; i++) {
//生成行政区划polygon
new AMap.Polygon({
map: this.map,
strokeWeight: 2,
path: bounds[i],
fillOpacity: 1,
fillColor: "transparent",
strokeColor: "#09f",
});
// polygons.push(polygon);
}
}
});
} }
// map的事件监听 // map的事件监听
mapEvent() { mapEvent() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment