lcw
This commit is contained in:
@ -79,8 +79,6 @@ let map;
|
||||
let mapLayer;
|
||||
let mapLayer1;
|
||||
onMounted(() => {
|
||||
console.log("xxxxxxx");
|
||||
|
||||
emitter.on("followUp", (res) => {
|
||||
let box = document.getElementsByClassName("changeMap_box");
|
||||
if (!box) return;
|
||||
@ -113,7 +111,7 @@ onMounted(() => {
|
||||
})
|
||||
zoomTarget.value = map.mapboxGLMap.getZoom();
|
||||
// 地图加载完成后发出事件
|
||||
emit('mapLoaded')
|
||||
// emit('mapLoaded')
|
||||
});
|
||||
mapUtil.value = new MapUtil(map);
|
||||
// map = new EliMap({
|
||||
|
||||
@ -9,7 +9,7 @@ export function MapUtil(map) {
|
||||
_that.idsBox = {} //存放id的容器(需要某个标记单个删除的时候存储)
|
||||
_that.isCheck = false
|
||||
/**
|
||||
* 设置地图中心点以
|
||||
* 设置地图中心点以
|
||||
* @param {*} location 中心坐标 [jd,wd]
|
||||
* @param {*} zoomLevel 层级 10
|
||||
*/
|
||||
@ -141,10 +141,10 @@ export function MapUtil(map) {
|
||||
}
|
||||
|
||||
// 信息框展示
|
||||
MapUtil.prototype.makerShowTitle = (item,points,flag,text) =>{
|
||||
let T = flag == 'rx' ? 'rxTitle' :'Title'
|
||||
let flagT = flag+T;
|
||||
if(!_that._self[flagT]) _that._self[flagT] = [];
|
||||
MapUtil.prototype.makerShowTitle = (item, points, flag, text) => {
|
||||
let T = flag == 'rx' ? 'rxTitle' : 'Title'
|
||||
let flagT = flag + T;
|
||||
if (!_that._self[flagT]) _that._self[flagT] = [];
|
||||
|
||||
// 展示名字
|
||||
let textTitle = item.jzMc ? item.jzMc : item.fzrXm + '警组';
|
||||
@ -242,7 +242,7 @@ export function MapUtil(map) {
|
||||
}
|
||||
|
||||
/**
|
||||
* 聚合撒点
|
||||
* 聚合撒点
|
||||
* @param {*} coords 点位数据 geojson lng lat
|
||||
* @param {*} icon 点位图
|
||||
*/
|
||||
@ -287,9 +287,9 @@ export function MapUtil(map) {
|
||||
* @param {*} coords 数组
|
||||
*/
|
||||
MapUtil.prototype.showHeatDrawing = (res) => {
|
||||
let { coords, flag,isclear ,color} = res;
|
||||
if(!_that._self[flag]) _that._self[flag] = [];
|
||||
if(isclear) _that.removeElement(flag) //清除热力
|
||||
let { coords, flag, isclear, color } = res;
|
||||
if (!_that._self[flag]) _that._self[flag] = [];
|
||||
if (isclear) _that.removeElement(flag) //清除热力
|
||||
let data = {
|
||||
type: 'FeatureCollection',
|
||||
features: []
|
||||
@ -315,12 +315,12 @@ export function MapUtil(map) {
|
||||
|
||||
// 清除所有
|
||||
MapUtil.prototype.removeAll = () => {
|
||||
for(let key in _that._self){
|
||||
if(key != 'rx' && key !='gpsZb' && !key.includes('rxTitle')){
|
||||
for (let key in _that._self) {
|
||||
if (key != 'rx' && key != 'gpsZb' && !key.includes('rxTitle')) {
|
||||
let list = _that._self[key]
|
||||
for (let i = 0; i < list.length; i++) {
|
||||
const el = list[i];
|
||||
if(el && typeof el == 'object') el.destroy() //destory()销毁 , show(false) false:隐藏 true :展示
|
||||
if (el && typeof el == 'object') el.destroy() //destory()销毁 , show(false) false:隐藏 true :展示
|
||||
}
|
||||
_that._self[key] = [];
|
||||
}
|
||||
@ -342,7 +342,7 @@ export function MapUtil(map) {
|
||||
}
|
||||
}
|
||||
}
|
||||
if(layer == 'rx') _that.idsBox[layer] = [];
|
||||
if (layer == 'rx') _that.idsBox[layer] = [];
|
||||
// 其他图层
|
||||
if (!_that._self[layer]) return false;
|
||||
|
||||
@ -354,8 +354,8 @@ export function MapUtil(map) {
|
||||
_that._self[layer] = [];
|
||||
|
||||
// d带标题的撒点
|
||||
let T = layer == 'rx' ? 'rxTitle' :'Title'
|
||||
let flagT = layer+T;
|
||||
let T = layer == 'rx' ? 'rxTitle' : 'Title'
|
||||
let flagT = layer + T;
|
||||
if (!_that._self[flagT]) return false;
|
||||
for (let i = 0; i < _that._self[flagT].length; i++) {
|
||||
const el = _that._self[flagT][i];
|
||||
@ -376,9 +376,9 @@ export function MapUtil(map) {
|
||||
_that.idsBox[layer].splice(index, 1);
|
||||
if (_that._self[layer][index]) _that._self[layer][index].destroy()
|
||||
_that._self[layer].splice(index, 1)
|
||||
if(layer == 'rx'){
|
||||
let flagT = layer +'rxTitle';
|
||||
if(_that._self[flagT][index]) _that._self[flagT][index].destroy()
|
||||
if (layer == 'rx') {
|
||||
let flagT = layer + 'rxTitle';
|
||||
if (_that._self[flagT][index]) _that._self[flagT][index].destroy()
|
||||
_that._self[flagT].splice(index, 1)
|
||||
_that.removeGpsZbOverlayById(id) //删除图标
|
||||
}
|
||||
@ -417,12 +417,12 @@ export function MapUtil(map) {
|
||||
* (point 点, line 线, circle 圆, polygon 多边形, rectangle 矩形) ,
|
||||
* geoJson:根据geojson回显图
|
||||
*/
|
||||
MapUtil.prototype.plot = (res,resFun) => {
|
||||
let {flag ,color,linecolor, type ,coords} = res
|
||||
if(!_that._self[flag]) _that._self[flag] = [];
|
||||
if(res.isclear) _that.removePlot(flag); //移除绘制工具
|
||||
if(res.isclear && (res.type == 'polygon' || res.type == 'line')) _that.removeEara(flag); //移除回显的面和线条
|
||||
switch(type){
|
||||
MapUtil.prototype.plot = (res, resFun) => {
|
||||
let { flag, color, linecolor, type, coords } = res
|
||||
if (!_that._self[flag]) _that._self[flag] = [];
|
||||
if (res.isclear) _that.removePlot(flag); //移除绘制工具
|
||||
if (res.isclear && (res.type == 'polygon' || res.type == 'line')) _that.removeEara(flag); //移除回显的面和线条
|
||||
switch (type) {
|
||||
case 'point':
|
||||
_that._CustomDraw.point((val) => { _that.handlePlot(val, type, flag, resFun) })
|
||||
break;
|
||||
@ -486,7 +486,7 @@ export function MapUtil(map) {
|
||||
})
|
||||
}
|
||||
/**
|
||||
* 移除绘制面
|
||||
* 移除绘制面
|
||||
* @param {*} flag 唯一标识
|
||||
*/
|
||||
MapUtil.prototype.removeEara = (flag) => {
|
||||
@ -499,11 +499,11 @@ export function MapUtil(map) {
|
||||
* (solid 实线, dash 虚线, FlowColor 彩虹线, RoadLine 流线
|
||||
*/
|
||||
MapUtil.prototype.createLine = (res) => {
|
||||
let { type , coords , isclear ,flag ,color,width } = res;
|
||||
if(!coords) return false; // coords 是数组对象,可以同时撒多条数据
|
||||
if(!_that._self[flag]) _that._self[flag] = [] ;
|
||||
if(isclear) _that.removeElement(flag); //移除回显的线条
|
||||
let data = coords.map((item,index)=>{
|
||||
let { type, coords, isclear, flag, color, width } = res;
|
||||
if (!coords) return false; // coords 是数组对象,可以同时撒多条数据
|
||||
if (!_that._self[flag]) _that._self[flag] = [];
|
||||
if (isclear) _that.removeElement(flag); //移除回显的线条
|
||||
let data = coords.map((item, index) => {
|
||||
return {
|
||||
position: item.coords[0], //二维数组
|
||||
text: '',
|
||||
@ -670,22 +670,22 @@ export function MapUtil(map) {
|
||||
}
|
||||
|
||||
|
||||
/**geojson 创建边界
|
||||
* let data = {
|
||||
* type: "FeatureCollection",
|
||||
* features: [
|
||||
* {
|
||||
geometry: {
|
||||
type: "Polygon",
|
||||
coordinates: [it.coordinates]
|
||||
},
|
||||
properties: {
|
||||
},
|
||||
type: "Feature",
|
||||
}
|
||||
* ]
|
||||
};
|
||||
*/
|
||||
/**geojson 创建边界
|
||||
* let data = {
|
||||
* type: "FeatureCollection",
|
||||
* features: [
|
||||
* {
|
||||
geometry: {
|
||||
type: "Polygon",
|
||||
coordinates: [it.coordinates]
|
||||
},
|
||||
properties: {
|
||||
},
|
||||
type: "Feature",
|
||||
}
|
||||
* ]
|
||||
};
|
||||
*/
|
||||
MapUtil.prototype.createBoundarys = (res) => {
|
||||
let { data } = res
|
||||
if (!data) return false;
|
||||
@ -713,8 +713,13 @@ export function MapUtil(map) {
|
||||
MapUtil.prototype.openInfoDetail = (flag, data) => {
|
||||
switch (flag) {
|
||||
case 'home_yj_map':
|
||||
console.log(data);
|
||||
emitter.emit("showHomeYJ", data);
|
||||
break;
|
||||
case 'home_yj_detail':
|
||||
console.log(data);
|
||||
emitter.emit("showHomeWarning", data);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user