| | |
| | | |
| | | addPlotPolygon (positions, item) { |
| | | const that = this |
| | | |
| | | const center = this.getCenter(positions) |
| | | |
| | | // const divIcon = new global.DC.DivIcon( |
| | | // new global.DC.Position(center[0], center[1], 0), |
| | | // ` |
| | | // <div class="farm-map-icon"> |
| | | // <img src="/img/icon/3858.png" alt=""> |
| | | // // <div>${item.farmName}</div> |
| | | // </div> |
| | | // ` |
| | | // ) |
| | | // divIcon.attrParams = item |
| | | // farmLogoLayer.addOverlay(divIcon) |
| | | |
| | | // divIcon.on(global.DC.MouseEventType.CLICK, (e) => { |
| | | // that.$parent.showDetailPopup(e.overlay.attrParams) |
| | | // }) |
| | | |
| | | if(item.strainUrl !=""){ |
| | | const divIcon = new global.DC.DivIcon( |
| | | new global.DC.Position(center[0], center[1], 0), |
| | | ` |
| | | <div class="farm-map-icon"> |
| | | <img src="${item.strainUrl}" alt=""width="50%" height="50%" text-align="center"> |
| | | </div> |
| | | ` |
| | | ) |
| | | divIcon.attrParams = item |
| | | farmLogoLayer.addOverlay(divIcon) |
| | | divIcon.on(global.DC.MouseEventType.CLICK, (e) => { |
| | | that.$parent.showDetailPopup(e.overlay.attrParams) |
| | | }) |
| | | } |
| | | const polygon = new global.DC.Polygon(positions) |
| | | polygon.attrParams = item |
| | | polygon.setStyle({ |
| | |
| | | that.$parent.plotDetailsPopupShow(e.overlay.attrParams) |
| | | }) |
| | | |
| | | console.log(item, 123) |
| | | |
| | | plotRegionLayer.addOverlay(polygon) |
| | | addPlotLayers.push({ center, name: item.landName }) |
| | | addPlotLayers.push({ center, name: item.landName, id: item.id }) |
| | | }, |
| | | |
| | | setCenter (name) { |
| | |
| | | }) |
| | | }, |
| | | |
| | | setPlotAttr (params) { |
| | | let overLayers = plotRegionLayer.getOverlays() |
| | | |
| | | overLayers.some(item => { |
| | | |
| | | if (item.attrParams.id == params.id) { |
| | | item.attrParams = params |
| | | |
| | | return true |
| | | } |
| | | |
| | | }) |
| | | }, |
| | | |
| | | // 经纬度测算中心位置 |
| | | getCenter (arr) { |
| | | let centerLonLat = [] |