| | |
| | | // 根据获取数据 画出 内容 |
| | | DrawTheSolidWasteContent (data) { |
| | | // 图标样式扩展 |
| | | var SolidWasteIcon = this.SolidWasteIcon() |
| | | const SolidWasteIcon = this.SolidWasteIcon() |
| | | |
| | | // //加载数据前如果存在图层组 那么清除掉 |
| | | if (this.SolidWasteLayerGroup) { |
| | |
| | | // if (positionX != null && positionY != null) { |
| | | // 用于 判断 => 判断是否展示脉冲效果 => temp(临时) |
| | | const determineValueOne = data[i].LongDayWarning |
| | | var determineValueTwo = data[i].StorageQty |
| | | const determineValueTwo = data[i].StorageQty |
| | | const positionArea = [positionX, positionY] |
| | | |
| | | // 图标展示 |
| | | var iconUrl = this.SolidWasteIconUrl(determineValueOne, determineValueTwo, positionArea) |
| | | var Icon = new SolidWasteIcon({ iconUrl: iconUrl }) |
| | | // var url = Icon.options.iconUrl |
| | | const iconUrl = this.SolidWasteIconUrl(determineValueOne, determineValueTwo, positionArea) |
| | | const Icon = new SolidWasteIcon({ iconUrl: iconUrl }) |
| | | // let url = Icon.options.iconUrl |
| | | |
| | | const marker = this.L.marker([positionX, positionY], { icon: Icon }) |
| | | |
| | |
| | | |
| | | // 根据类型返回图片加载url |
| | | SolidWasteIconUrl (determineValueOne, determineValueTwo, position) { |
| | | var EffectOfChange |
| | | let EffectOfChange |
| | | if (determineValueOne === 1 || determineValueTwo === 1) { |
| | | EffectOfChange = defaultImg |
| | | this.EffectOfPulse(position, this.solidWasteMarkersLabels, this.SolidWasteLayerGroup) |
| | |
| | | // 脉冲效果设置实现 |
| | | EffectOfPulse (position, markers, layerGroup) { |
| | | // // 区分直接执行 和判断执行的不同区别 |
| | | var differentColor = '' |
| | | let differentColor = '' |
| | | if (markers) { |
| | | differentColor = '#ff0000' |
| | | } else { |
| | | differentColor = '#98FB98' |
| | | } |
| | | // 坐标数据:报警传进来的是数组 / 点击传进来的是object |
| | | var FinalPosition = position instanceof Array ? { |
| | | const FinalPosition = position instanceof Array ? { |
| | | lat: position[0], |
| | | lng: position[1] |
| | | } : position |
| | | // 插件 效果实现 |
| | | var pulsingIcon = this.L.icon.pulse({ |
| | | const pulsingIcon = this.L.icon.pulse({ |
| | | iconSize: [20, 20], |
| | | color: differentColor, |
| | | fillColor: '' |
| | |
| | | // markers.push(this.L.marker(FinalPosition, { icon: pulsingIcon })) |
| | | // this.L.layerGroup(markers).addLayer(layerGroup) |
| | | } else { |
| | | var picGroupMarker = new this.L.FeatureGroup() |
| | | const picGroupMarker = new this.L.FeatureGroup() |
| | | this.L.marker(FinalPosition, { icon: pulsingIcon }).addTo(picGroupMarker) |
| | | this.pulseHeighLightMarker = picGroupMarker.addTo(this.SolidWasteLayerGroup) |
| | | this.PulseCountSetting() |
| | |
| | | |
| | | // 对图标脉冲 进行set设置 // 高亮图层 |
| | | PulseCountSetting () { |
| | | var HeightLightTime = 5 |
| | | var PulseNumber = 5 |
| | | const HeightLightTime = 5 |
| | | let PulseNumber = 5 |
| | | const pulseinterver = setInterval(() => { |
| | | if (PulseNumber > 0) { |
| | | PulseNumber-- |