| | |
| | | //openlayer 创建点位 |
| | | window.pointArr = []; |
| | | export function createPointMarker(position, obj) { |
| | | let positions = ol.proj.fromLonLat(position); |
| | | let startFeature = new ol.Feature({ |
| | | geometry: new ol.geom.Point(position), |
| | | geometry: new ol.geom.Point(positions), |
| | | |
| | | }); |
| | | startFeature.setProperties({ |
| | | desc: obj, |
| | |
| | | //openlayer 地图点击事件 |
| | | export function setClick(state) { |
| | | function handleClick(e) { |
| | | let coordinate = ol.proj.toLonLat(e.coordinate) |
| | | // console.log(coordinate, '地图点击') |
| | | store.setLayerPanelShow(false); |
| | | // 土地管理 |
| | | if (store.tdglInfo.flag) { |
| | |
| | | // "http://10.10.4.115:8022/geowinmap_xncs/ds?r=0.9158559377752831&serviceproviderid=map.vectorserviceprovider&serviceid=queryfeature&featcls=225%25E8%258C%2583%25E5%259B%25B4%25E5%2588%2586%25E5%258C%25BA%25E8%25A7%2584%25E5%2588%2592.geojson&lng=" + |
| | | window.gisBaseUrl + "BEApi/cs/geowinmap_xncs/ds?r=0.9158559377752831&serviceproviderid=map.vectorserviceprovider&serviceid=queryfeature&featcls=225%25E8%258C%2583%25E5%259B%25B4%25E5%2588%2586%25E5%258C%25BA%25E8%25A7%2584%25E5%2588%2592.geojson&lng=" + |
| | | // window.gisBaseUrl + "cs/geowinmap_xncs/ds?&lng=" + |
| | | e.coordinate[0] + |
| | | coordinate[0] + |
| | | "&lat=" + |
| | | e.coordinate[1] + |
| | | coordinate[1] + |
| | | "&geom=true&requesttype=json" |
| | | ).then(response => { |
| | | let center = { lon: 0, lat: 0 }; |
| | |
| | | window.tdglLine = null; |
| | | } |
| | | var format = new ol.format.WKT(); // 创建一个 WKT 解析器 |
| | | var feature = format.readFeature(response.data.geometry); // 解析 WKT 并生成要素对象 |
| | | var feature = format.readFeature(response.data.geometry, { |
| | | dataProjection: 'EPSG:4326', |
| | | featureProjection: 'EPSG:3857' |
| | | }); // 解析 WKT 并生成要素对象 |
| | | |
| | | // 创建一个要素图层 |
| | | window.tdglLine = new ol.layer.Vector({ |
| | |
| | | |
| | | window.mapapi.forEachFeatureAtPixel(e.pixel, function (feature) { |
| | | console.log(feature.getProperties(), 'aaa'); |
| | | |
| | | |
| | | //搜索的点位 |
| | | if (window.pointArr.length > 0) { |
| | | let obj = feature.getProperties().desc |
| | | objdata = { |
| | | POITYPE: "POINT", |
| | | name: obj.name, |
| | | address: obj.address, |
| | | if (obj) { |
| | | objdata = { |
| | | POITYPE: "POINT", |
| | | name: obj.name, |
| | | address: obj.address, |
| | | } |
| | | } |
| | | } else { |
| | | let properties = feature.getProperties().features[0].values_; |
| | | for (const propertyNames in properties) { |
| | | if (propertyNames.indexOf("监控名") !== -1) { |
| | | // objdata = { |
| | | // POITYPE: "SPJK", |
| | | // name: properties["JK名称"]._value, |
| | | // type: properties["JK类型"]._value, |
| | | // function: properties["功能"]._value, |
| | | // area: properties["所在区"]._value, |
| | | // number: properties["JK编号"]._value, |
| | | // code: properties["JK内码"]._value, |
| | | // lon: lon, |
| | | // lat: lat, |
| | | // } |
| | | Message({ |
| | | message: '连接状态查询中', |
| | | const infoM = Message({ |
| | | message: '该点位视频监控加载中,请稍后', |
| | | type: 'info', |
| | | offset: 60, |
| | | offset: 75, |
| | | center: true, |
| | | duration: 1000, |
| | | duration: 0, |
| | | }); |
| | | layerOpen(properties["JK名称"], { |
| | | width: "100%", |
| | | height: "40%", |
| | | // offset: [offsetTop + "px", "380px"], |
| | | url: "../../static/video/video.html?code=" + properties["JK内码"], |
| | | fn: { |
| | | success: (layero, index) => { |
| | | SmartEarthPopupData.layerContainer = layero; |
| | | }, |
| | | end: () => { |
| | | axios |
| | | .get( |
| | | // 请求在线状态 |
| | | window.gisBaseUrl + "BEApi/getCameraDetails?cameraIndexCode=" + |
| | | properties["JK内码"] |
| | | , { |
| | | timeout: 6000 |
| | | }) |
| | | .then(res => { |
| | | if (res.data.data.status == 1) { |
| | | infoM.close(); |
| | | Message({ |
| | | message: '视频监控在线中', |
| | | type: 'success', |
| | | offset: 75, |
| | | center: true, |
| | | duration: 2000, |
| | | }); |
| | | layerOpen(properties["JK名称"], { |
| | | width: "100%", |
| | | height: "40%", |
| | | // offset: [offsetTop + "px", "380px"], |
| | | url: "../../static/video/video.html?code=" + properties["JK内码"], |
| | | fn: { |
| | | success: (layero, index) => { |
| | | SmartEarthPopupData.layerContainer = layero; |
| | | }, |
| | | end: () => { |
| | | |
| | | }, |
| | | cancel: () => { |
| | | }, |
| | | cancel: () => { |
| | | |
| | | }, |
| | | }, |
| | | }); |
| | | }, |
| | | }, |
| | | }); |
| | | } else { |
| | | infoM.close(); |
| | | Message({ |
| | | message: '该视频监控离线中', |
| | | type: 'error', |
| | | offset: 75, |
| | | center: true, |
| | | duration: 2000, |
| | | }); |
| | | return |
| | | } |
| | | }) |
| | | .catch(err => { |
| | | infoM.close(); |
| | | Message({ |
| | | message: '该视频监控请求超时', |
| | | type: 'error', |
| | | offset: 75, |
| | | center: true, |
| | | duration: 2000, |
| | | }); |
| | | return |
| | | }) |
| | | return |
| | | } else if (propertyNames.indexOf("部件名称") !== -1) { |
| | | objdata = { |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | store.setTdglShow(false); |
| | | store.setTdlgInfo({}); |
| | | store.setdwShow(true); |
| | |
| | | |
| | | export function flyToPoint(posisitons) { |
| | | window.mapapi.getView().animate({ |
| | | center: posisitons, |
| | | zoom: 15, |
| | | center: ol.proj.fromLonLat(posisitons), |
| | | projection: "EPSG:3857", |
| | | zoom: 18, |
| | | duration: 1500 |
| | | }) |
| | | } |
| | | |
| | | //监听地图双击事件 |
| | | |
| | | export function touchClick() { |
| | | let dom = document.getElementById('openlayerContainer'); |
| | | dom.addEventListener('touchstart', onTouchStart); |
| | | function onTouchStart(e) { |
| | | let len = e.touches.length; |
| | | if (len === 2) { |
| | | window.mapapi.getView().animate({ |
| | | center: window.mapapi.getView().getCenter(), |
| | | projection: "EPSG:3857", |
| | | zoom: window.mapapi.getView().getZoom() - 1, |
| | | duration: 1000, |
| | | }); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | |