Commit 8a3f2a3e authored by jianqian's avatar jianqian

地图 关闭在点击问题,坐标被覆盖问题

parent 7189e082
......@@ -19,7 +19,8 @@ import { Vector as VectorLayer } from "ol/layer";
import { Vector as VectorSource,Raster as RasterSource, Stamen } from 'ol/source';
import Point from "ol/geom/Point";
import Overlay from 'ol/Overlay';
import Select from 'ol/interaction/Select'
import Select from 'ol/interaction/Select';
import Pointer from "ol/interaction/Pointer";
import Draw from 'ol/interaction/Draw';
import GeoJSON from 'ol/format/GeoJSON';
import Snap from 'ol/interaction/Snap';
......@@ -100,9 +101,9 @@ export default class Mutil {
className: "mapTypeC",
source: new XYZ({
//url: "https://t{0-7}.tianditu.gov.cn/DataServer?T=cva_w&x={x}&y={y}&l={z}&tk=c8df739f047ce17cfe41b63cbeae6997",
//url: " http://wprd0{1-4}.is.autonavi.com/appmaptile?x={x}&y={y}&z={z}&lang=zh_cn&size=1&scl=1&style=7",
url: " http://webst0{1-4}.is.autonavi.com/appmaptile?style=7&x={x}&y={y}&z={z}",
//url: " http://map.geoq.cn/ArcGIS/rest/services/ChinaOnlineStreetPurplishBlue/MapServer/tile/{z}/{y}/{x}",
url: "http://wprd0{1-4}.is.autonavi.com/appmaptile?x={x}&y={y}&z={z}&lang=zh_cn&size=1&scl=1&style=7",
//url: "http://wprd0{1-4}.is.autonavi.com/appmaptile?x={x}&y={y}&z={z}&lang=zh_cn&size=1&scl=1&style=7",
}),
visible: false,
name: "天地图标注(不含路网)",
......@@ -281,14 +282,47 @@ export default class Mutil {
that.MAP.addOverlay(overlay);
//点击X隐藏企业气泡
document.getElementById(`pop-close${id}`).onclick = function () {
//overlay.setPosition(114.514793, 38.042225)
//console.log("=="+`${id}`)
var box =document.getElementById("popup"+`${id}`)
box.parentNode.removeChild(box);
//console.log(document.getElementById("popup"+`${id}`))
//overlay.setPosition(undefined)
//that.Mutil.closeAllOverlays();
var box =document.getElementById("popup"+`${id}`);
that.boxdiv =`${id}`;
box.style.display="none";
//box.parentNode.removeChild(box);
}
}
mapSelectBind(callbcak) {//地图绑定选中feature事件
let _this = this;
let selectPointerClick = new Pointer({
handleDownEvent: function(ev){
let pixel = ev.pixel;
let feature = _this.MAP.forEachFeatureAtPixel(
pixel,
function (feature) {
return feature;
}
);
if (feature) {
var box =document.getElementById("popup"+_this.boxdiv);
// console.log(feature.ol_uid)
// console.log(_this.oluid)
if(_this.oluid==undefined){
_this.oluid=feature.ol_uid
}else if (box!=null&&feature.ol_uid==_this.oluid){
box.style.display="";
_this.oluid=feature.ol_uid
}else {
_this.oluid=feature.ol_uid
}
} else {
//callback({ flag: false }); //do something
//console.log("22")
}
}
});
_this.MAP.addInteraction(selectPointerClick);
let se = new Select({
style: null,
hitTolerance: 0,
......@@ -441,11 +475,10 @@ export default class Mutil {
color: '#08d527',
width: 4,
}),
font: '24px Calibri,sans-serif',
fill: new Fill({
color: 'rgba(21, 220, 229, 0.1)'
//color: 'rgba(21, 220, 229, 0.1)'
})
fill: new Fill({
color: 'rgba(21, 220, 229, 0.1)'
//color: 'rgba(21, 220, 229, 0.1)'
})
}),
text: new Text({ //文本样式
font: '12px Calibri,sans-serif',
......
......@@ -269,7 +269,6 @@
}
getMaterialWindow(id: string) {
let that = this;
console.log('----------------------'+id);
(window as any).checkDetail = function (param: string) {
that.$router.push({
path: "/EnDetail",
......
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