| | |
| | | MARKER_BLUE: 'img/marker_blue.svg', |
| | | CENTER_PIN: 'img/push_pin.svg', |
| | | DIVIDE_BLUE: 'img/divide_home_blue.svg', |
| | | DIVIDE_RED: 'img/divide_home_red.svg' |
| | | DIVIDE_RED: 'img/divide_home_red.svg', |
| | | MARKER_START: 'img/marker_blue_start.svg', |
| | | MARKER_END: 'img/marker_blue_end.svg' |
| | | }, |
| | | MAP: { |
| | | DEFAULT_ZOOM: 12, |
| | |
| | | window.showAllWaterIntakes = showAllWaterIntakes; |
| | | window.hideAllDivides = hideAllDivides; |
| | | window.showAllDivides = showAllDivides; |
| | | window.showHistoryLocation = showHistoryLocation; |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | // 手机获取到定位后显示定位 |
| | | function locationOverLay(lng, lag) { |
| | | // console.log("function》》》》》locationOverLay"); |
| | | // console.log("function》》》》》locationOverLay"); |
| | | map.centerAndZoom(new T.LngLat(lng, lag), map.getZoom()); |
| | | let icon = new T.Icon({ |
| | | iconUrl: CONFIG.IMAGES.LOCATION, |
| | |
| | | //设置地图中心点 |
| | | function setCenterAndZoom(lng, lat, thiszoom) { |
| | | zoom = thiszoom; |
| | | // console.log("function》》》》》setCenterAndZoom>>>>lng:" + lng + ",lat:" + lat); |
| | | // console.log("function》》》》》setCenterAndZoom>>>>lng:" + lng + ",lat:" + lat); |
| | | map.centerAndZoom(new T.LngLat(lng, lat), zoom); |
| | | } |
| | | |
| | |
| | | }, |
| | | |
| | | addPoint(lng, lat, isNewLine, isShow) { |
| | | // console.log(`Adding point: ${lng}, ${lat}, isNewLine: ${isNewLine}`); // 添加日志 |
| | | // console.log(`Adding point: ${lng}, ${lat}, isNewLine: ${isNewLine}`); // 添加日志 |
| | | |
| | | const point = new T.LngLat(lng, lat); |
| | | |
| | |
| | | }, |
| | | |
| | | showAll() { |
| | | // console.log("showAllpipe" + this.lines.length); |
| | | // console.log("showAllpipe" + this.lines.length); |
| | | this.lines.forEach(line => { |
| | | if (line.overlay) { |
| | | map.addOverLay(line.overlay); |
| | |
| | | }, |
| | | |
| | | hideAll() { |
| | | // console.log("hideAllpipe" + this.lines.length); |
| | | // console.log("hideAllpipe" + this.lines.length); |
| | | this.lines.forEach(line => { |
| | | if (line.overlay) { |
| | | map.removeOverLay(line.overlay); |
| | |
| | | map.addOverLay(item.label); |
| | | }); |
| | | } |
| | | var historyPoint = []; |
| | | //显示历史巡检记录 |
| | | function showHistoryLocation(lng, lat, start, end) { |
| | | // 调用 Android 提供的接口,获取数据 |
| | | console.log("aginShowLocation>>lng:" + lng + ">>>lat:" + lat+">>>start:"+start+">>>end:"+end); |
| | | var newPoint = new T.LngLat(lng, lat); |
| | | historyPoint.push(newPoint); |
| | | if (start === "true" || start === true) { |
| | | map.panTo(newPoint); |
| | | let marker = new T.Marker( |
| | | newPoint, |
| | | { icon: createIcon(CONFIG.IMAGES.MARKER_START, 35) } |
| | | ); |
| | | map.addOverLay(marker); |
| | | } else if (end === "true" || end === true) { |
| | | let marker = new T.Marker( |
| | | newPoint, |
| | | { icon: createIcon(CONFIG.IMAGES.MARKER_END, 35) } |
| | | ); |
| | | map.addOverLay(marker); |
| | | } |
| | | oldLineLayer.setLngLats(historyPoint); |
| | | map.addOverLay(oldLineLayer); |
| | | } |
| | | |
| | | })(); |
| | | } |
| | | |
| | | )(); |