From 0633bdcf8d16f85f06f2930c2a5dfce8b362f00c Mon Sep 17 00:00:00 2001 From: xuechunyuan <17853500702@163.com> Date: Thu, 12 Jan 2023 13:55:40 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9C=B0=E5=9B=BE=E4=B8=BB=E9=A2=98=E6=A0=B7?= =?UTF-8?q?=E5=BC=8F=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.vue | 3 +++ src/views/components/pathMap.vue | 42 +++++++++++++++++++++++++++++--- 2 files changed, 41 insertions(+), 4 deletions(-) diff --git a/src/App.vue b/src/App.vue index 23890be..68e9f6b 100644 --- a/src/App.vue +++ b/src/App.vue @@ -21,4 +21,7 @@ .el-message__icon,.el-message__content{ font-size: 16px !important; } +.BMap_cpyCtrl,.anchorBL{ + opacity: 0 !important; +} diff --git a/src/views/components/pathMap.vue b/src/views/components/pathMap.vue index a7feae8..de52796 100644 --- a/src/views/components/pathMap.vue +++ b/src/views/components/pathMap.vue @@ -47,14 +47,48 @@ export default { var point = new BMapGL.Point(118.880278, 35.649947); this.baiduMap.centerAndZoom(point, 11); this.baiduMap.enableScrollWheelZoom(true); + this.baiduMap.setMapStyleV2({ + styleId: 'ec6ebc8ad35bcfbd56a424a29f325360'//'ef4f05652d24d0f23332710fbacad245'// + }); + // this.baiduMap.setMapType(BMAP_SATELLITE_MAP); var bdary = new BMapGL.Boundary(); bdary.get("日照市莒县", rs => { - var pointArray = []; var count = rs.boundaries.length; + // var EN_JW = "180, 90;";//东北角 + // var NW_JW = "-180, 90;";//西北角 + // var WS_JW = "-180, -90;";//西南角 + // var SE_JW = "180, -90;";//东南角 + // //添加环形遮罩层 + // var ply1 = new BMapGL.Polygon(rs.boundaries[0] + SE_JW + SE_JW + WS_JW + NW_JW + EN_JW + SE_JW, { + // strokeColor: "none", + // fillColor: "#0e94eb", + // fillOpacity: 0.5, + // strokeOpacity: 0.5 + // }); //建立多边形覆盖物 + // this.baiduMap.addOverlay(ply1); for (var i = 0; i < count; i++) { - var ply = new BMapGL.Polygon(rs.boundaries[i], { strokeWeight: 2, strokeColor: "#0e94eb", fillColor: '', fillOpacity: 0, }); //建立多边形覆盖物 - this.baiduMap.addOverlay(ply); //添加覆盖物 - pointArray = pointArray.concat(ply.getPath()); + var xyArr = rs.boundaries[i].split(';'); + var ptArr = []; + for (var j = 0; j < xyArr.length; j++) { + var tmp = xyArr[j].split(','); + var pt = new BMapGL.Point(tmp[0], tmp[1]); + ptArr.push(pt); + } + // var mapmask = new BMapGL.MapMask(ptArr, { + // isBuildingMask: true, + // isPoiMask: true, + // isMapMask: true, + // showRegion: 'inside', + // }); + // this.baiduMap.addOverlay(mapmask); + var border = new BMapGL.Polyline(ptArr, { + strokeColor: '#0e94eb', + strokeWeight: 3, + strokeOpacity: 1 + }); + this.baiduMap.addOverlay(border); + // var ply = new BMapGL.Polygon(rs.boundaries[i], { strokeWeight: 2, strokeColor: "#0e94eb", fillColor: '', fillOpacity: 0, }); //建立多边形覆盖物 + // this.baiduMap.addOverlay(ply); //添加覆盖物 } }) this.carList.map((item, index) => {