|
|
@ -365,101 +365,101 @@ export class GisLabelingComponent implements OnInit { |
|
|
|
data: item |
|
|
|
data: item |
|
|
|
}) |
|
|
|
}) |
|
|
|
}) |
|
|
|
}) |
|
|
|
this.map.plugin(["AMap.MarkerClusterer"], () => { |
|
|
|
|
|
|
|
var gridSize = 60 |
|
|
|
var gridSize = 60 |
|
|
|
var count = unitMarkerArrcluster.length; |
|
|
|
var count = unitMarkerArrcluster.length; |
|
|
|
|
|
|
|
|
|
|
|
let render = MapFactory.RenderClusterMarkerInstance(); |
|
|
|
let render = MapFactory.RenderClusterMarkerInstance(); |
|
|
|
render.contentRender = (contextCount) => { |
|
|
|
render.contentRender = (contextCount) => { |
|
|
|
var factor = Math.pow(contextCount / count, 1 / 18); |
|
|
|
var factor = Math.pow(contextCount / count, 1 / 18); |
|
|
|
var div = document.createElement('div'); |
|
|
|
var div = document.createElement('div'); |
|
|
|
var Hue = 180 - factor * 180; |
|
|
|
var Hue = 180 - factor * 180; |
|
|
|
var bgColor = 'hsla(' + Hue + ',100%,40%,0.7)'; |
|
|
|
var bgColor = 'hsla(' + Hue + ',100%,40%,0.7)'; |
|
|
|
var fontColor = 'hsla(' + Hue + ',100%,90%,1)'; |
|
|
|
var fontColor = 'hsla(' + Hue + ',100%,90%,1)'; |
|
|
|
var borderColor = 'hsla(' + Hue + ',100%,40%,1)'; |
|
|
|
var borderColor = 'hsla(' + Hue + ',100%,40%,1)'; |
|
|
|
var shadowColor = 'hsla(' + Hue + ',100%,90%,1)'; |
|
|
|
var shadowColor = 'hsla(' + Hue + ',100%,90%,1)'; |
|
|
|
div.style.backgroundColor = bgColor; |
|
|
|
div.style.backgroundColor = bgColor; |
|
|
|
var size = Math.round(30 + Math.pow(contextCount / count, 1 / 5) * 20); |
|
|
|
var size = Math.round(30 + Math.pow(contextCount / count, 1 / 5) * 20); |
|
|
|
div.style.width = div.style.height = size + 'px'; |
|
|
|
div.style.width = div.style.height = size + 'px'; |
|
|
|
div.style.border = 'solid 1px ' + borderColor; |
|
|
|
div.style.border = 'solid 1px ' + borderColor; |
|
|
|
div.style.borderRadius = size / 2 + 'px'; |
|
|
|
div.style.borderRadius = size / 2 + 'px'; |
|
|
|
div.style.boxShadow = '0 0 5px ' + shadowColor; |
|
|
|
div.style.boxShadow = '0 0 5px ' + shadowColor; |
|
|
|
div.innerHTML = contextCount; |
|
|
|
div.innerHTML = contextCount; |
|
|
|
div.style.lineHeight = size + 'px'; |
|
|
|
div.style.lineHeight = size + 'px'; |
|
|
|
div.style.color = fontColor; |
|
|
|
div.style.color = fontColor; |
|
|
|
div.style.fontSize = '14px'; |
|
|
|
div.style.fontSize = '14px'; |
|
|
|
div.style.textAlign = 'center'; |
|
|
|
div.style.textAlign = 'center'; |
|
|
|
return div; |
|
|
|
return div; |
|
|
|
}; |
|
|
|
}; |
|
|
|
render.pixelRender = (contextCount) => { |
|
|
|
render.pixelRender = (contextCount) => { |
|
|
|
var size = Math.round(30 + Math.pow(contextCount / count, 1 / 5) * 20); |
|
|
|
var size = Math.round(30 + Math.pow(contextCount / count, 1 / 5) * 20); |
|
|
|
return MapFactory.PixelInstance(-size / 2, -size / 2); |
|
|
|
return MapFactory.PixelInstance(-size / 2, -size / 2); |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
render.contentNonRender = (src) => { |
|
|
|
render.contentNonRender = (src) => { |
|
|
|
return `<img class='clusterImgCollection' src="${src}" alt="">`; |
|
|
|
return `<img class='clusterImgCollection' src="${src}" alt="">`; |
|
|
|
}; |
|
|
|
}; |
|
|
|
render.pixelNonRender = () => { |
|
|
|
render.pixelNonRender = () => { |
|
|
|
return MapFactory.PixelInstance(-15, -15); |
|
|
|
return MapFactory.PixelInstance(-15, -15); |
|
|
|
} |
|
|
|
} |
|
|
|
this.unitCluster = MapFactory.MarkerClusterInstance(this.map, unitMarkerArrcluster, { |
|
|
|
this.unitCluster = MapFactory.MarkerClusterInstance(this.map, unitMarkerArrcluster, { |
|
|
|
gridSize: gridSize, // 设置网格像素大小
|
|
|
|
gridSize: gridSize, // 设置网格像素大小
|
|
|
|
render: render //自定义聚合点样式, 自定义非聚合点样式
|
|
|
|
render: render //自定义聚合点样式, 自定义非聚合点样式
|
|
|
|
}); |
|
|
|
|
|
|
|
this.unitCluster.on('click', (e) => { |
|
|
|
|
|
|
|
if (e.clusterData.length == 1) { |
|
|
|
|
|
|
|
let item = e.clusterData[0].data |
|
|
|
|
|
|
|
let markerContent = |
|
|
|
|
|
|
|
`<div style="font-size: 14px" id="gispopupbox">
|
|
|
|
|
|
|
|
<div style="color: #0080FF;"><span style="margin-left:8px">${item.name}</span><label style="font-size: 12px; color: #999; margin-left: 10px">${item.address}</label> </div> |
|
|
|
|
|
|
|
<div style="display: flex; margin-top: 10px;margin-left:8px"> |
|
|
|
|
|
|
|
<div style="width:240px; overflow: hidden;">单位性质: <label style="margin-left: 10px;font-size: 12px;">${item.buildingTypes.length ? item.buildingTypes[0].name : "暂无数据"}</label></div> |
|
|
|
|
|
|
|
<div style="flex: 1; margin-left: 25px;">消防负责人: <label style="margin-left: 10px;font-size: 12px;">${item.contacts || "暂无数据"}</label></div> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
<div style="display: flex; margin-top: 10px;margin-left:8px""> |
|
|
|
|
|
|
|
<div style="width:240px; overflow: hidden;">防火级别: <label style="margin-left: 10px;font-size: 12px;">二级</label></div> |
|
|
|
|
|
|
|
<div style="flex: 1; margin-left: 25px;">消防管理人: <label style="margin-left: 10px;font-size: 12px;">${item.contacts || "暂无数据"}</label></div> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
<div style="display: flex; margin-top: 10px;margin-left:8px""> |
|
|
|
|
|
|
|
<div style="width:240px; overflow: hidden;">防火管辖: <label style="margin-left: 10px;font-size: 12px;">${item.organizationName || "暂无数据"}</label></div> |
|
|
|
|
|
|
|
<div style="flex: 1; margin-left: 25px;">防火监督员: <label style="margin-left: 10px;font-size: 12px;">李四15022215122</label></div> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
<div style="display: flex; margin-top: 10px;margin-left:8px""> |
|
|
|
|
|
|
|
<div style="width:240px; overflow: hidden;">责任队站: <label style="margin-left: 10px;font-size: 12px;">安博消防救援站</label></div> |
|
|
|
|
|
|
|
<div style="flex: 1; margin-left: 25px;">总建筑面积: <label style="margin-left: 10px;font-size: 12px;">500平方米</label></div> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
<div style="display: flex; margin-top: 10px;margin-left:8px""> |
|
|
|
|
|
|
|
<div style="width:240px; overflow: hidden;">建筑信息分类: <label style="margin-left: 10px;font-size: 12px;">建筑群</label></div> |
|
|
|
|
|
|
|
<div style="flex: 1; margin-left: 25px;">总占地面积: <label style="margin-left: 10px;font-size: 12px;">600平方米</label></div> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
<div style="display: flex; margin-top: 10px;margin-left:8px""> |
|
|
|
|
|
|
|
<div style="width:240px; overflow: hidden;">值班电话: <label style="margin-left: 10px;font-size: 12px;">${item.phone || "暂无数据"}</label></div> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
<div style="display: flex; align-items: center; justify-content: center; margin-top: 10px;"> |
|
|
|
|
|
|
|
<div class="btn" id="baseInformation"><img src="../../../assets/images/basicinfoicon.png" alt="">基本信息</div> |
|
|
|
|
|
|
|
<div class="btn" id="route"><img src="../../../assets/images/navicon.png" alt="">导航</div> |
|
|
|
|
|
|
|
<div class="btn" id="fullViewNavigation"><img src="../../../assets/images/panoramaicon.png" alt="">全景漫游</div> |
|
|
|
|
|
|
|
<div class="btn" id="threeeScene"><img src="../../../assets/images/3dicon.png" alt="">三维场景</div> |
|
|
|
|
|
|
|
<div class="btn" id="seePlan"><img src="../../../assets/images/planicon.png" alt="">查看预案</div>
|
|
|
|
|
|
|
|
<div class="btn" id="share"><img src="../../../assets/images/shareicon.png" alt="">分享</div> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
</div>` |
|
|
|
|
|
|
|
// 创建一个自定义内容的 infowindow 实例
|
|
|
|
|
|
|
|
this.infoWindow = MapFactory.InfoWindowInstance({ |
|
|
|
|
|
|
|
position: [item.location.x, item.location.y], |
|
|
|
|
|
|
|
offset: MapFactory.PixelInstance(0, -30), |
|
|
|
|
|
|
|
content: markerContent, |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
this.infoWindow.open(this.map); |
|
|
|
|
|
|
|
this.renderer2.listen(this.elementRef.nativeElement.querySelector('#baseInformation'), 'click', (event) => { this.baseInformation(item) })//基本信息点击事件
|
|
|
|
|
|
|
|
this.renderer2.listen(this.elementRef.nativeElement.querySelector('#route'), 'click', (event) => { this.route(item) })//导航点击事件
|
|
|
|
|
|
|
|
this.renderer2.listen(this.elementRef.nativeElement.querySelector('#fullViewNavigation'), 'click', (event) => { this.fullViewNavigation(item) })//全景漫游点击事件
|
|
|
|
|
|
|
|
this.renderer2.listen(this.elementRef.nativeElement.querySelector('#threeeScene'), 'click', (event) => { this.threeeScene(item) })//三维场景点击事件
|
|
|
|
|
|
|
|
this.renderer2.listen(this.elementRef.nativeElement.querySelector('#seePlan'), 'click', (event) => { this.seePlan(item) })//查看预案点击事件
|
|
|
|
|
|
|
|
this.renderer2.listen(this.elementRef.nativeElement.querySelector('#share'), 'click', (event) => { this.share(item) })//分享点击事件
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
this.unitCluster.on('click', (e) => { |
|
|
|
|
|
|
|
if (e.clusterData.length == 1) { |
|
|
|
|
|
|
|
let item = e.clusterData[0].data |
|
|
|
|
|
|
|
let markerContent = |
|
|
|
|
|
|
|
`<div style="font-size: 14px" id="gispopupbox">
|
|
|
|
|
|
|
|
<div style="color: #0080FF;"><span style="margin-left:8px">${item.name}</span><label style="font-size: 12px; color: #999; margin-left: 10px">${item.address}</label> </div> |
|
|
|
|
|
|
|
<div style="display: flex; margin-top: 10px;margin-left:8px"> |
|
|
|
|
|
|
|
<div style="width:240px; overflow: hidden;">单位性质: <label style="margin-left: 10px;font-size: 12px;">${item.buildingTypes.length ? item.buildingTypes[0].name : "暂无数据"}</label></div> |
|
|
|
|
|
|
|
<div style="flex: 1; margin-left: 25px;">消防负责人: <label style="margin-left: 10px;font-size: 12px;">${item.contacts || "暂无数据"}</label></div> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
<div style="display: flex; margin-top: 10px;margin-left:8px""> |
|
|
|
|
|
|
|
<div style="width:240px; overflow: hidden;">防火级别: <label style="margin-left: 10px;font-size: 12px;">二级</label></div> |
|
|
|
|
|
|
|
<div style="flex: 1; margin-left: 25px;">消防管理人: <label style="margin-left: 10px;font-size: 12px;">${item.contacts || "暂无数据"}</label></div> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
<div style="display: flex; margin-top: 10px;margin-left:8px""> |
|
|
|
|
|
|
|
<div style="width:240px; overflow: hidden;">防火管辖: <label style="margin-left: 10px;font-size: 12px;">${item.organizationName || "暂无数据"}</label></div> |
|
|
|
|
|
|
|
<div style="flex: 1; margin-left: 25px;">防火监督员: <label style="margin-left: 10px;font-size: 12px;">李四15022215122</label></div> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
<div style="display: flex; margin-top: 10px;margin-left:8px""> |
|
|
|
|
|
|
|
<div style="width:240px; overflow: hidden;">责任队站: <label style="margin-left: 10px;font-size: 12px;">安博消防救援站</label></div> |
|
|
|
|
|
|
|
<div style="flex: 1; margin-left: 25px;">总建筑面积: <label style="margin-left: 10px;font-size: 12px;">500平方米</label></div> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
<div style="display: flex; margin-top: 10px;margin-left:8px""> |
|
|
|
|
|
|
|
<div style="width:240px; overflow: hidden;">建筑信息分类: <label style="margin-left: 10px;font-size: 12px;">建筑群</label></div> |
|
|
|
|
|
|
|
<div style="flex: 1; margin-left: 25px;">总占地面积: <label style="margin-left: 10px;font-size: 12px;">600平方米</label></div> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
<div style="display: flex; margin-top: 10px;margin-left:8px""> |
|
|
|
|
|
|
|
<div style="width:240px; overflow: hidden;">值班电话: <label style="margin-left: 10px;font-size: 12px;">${item.phone || "暂无数据"}</label></div> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
<div style="display: flex; align-items: center; justify-content: center; margin-top: 10px;"> |
|
|
|
|
|
|
|
<div class="btn" id="baseInformation"><img src="../../../assets/images/basicinfoicon.png" alt="">基本信息</div> |
|
|
|
|
|
|
|
<div class="btn" id="route"><img src="../../../assets/images/navicon.png" alt="">导航</div> |
|
|
|
|
|
|
|
<div class="btn" id="fullViewNavigation"><img src="../../../assets/images/panoramaicon.png" alt="">全景漫游</div> |
|
|
|
|
|
|
|
<div class="btn" id="threeeScene"><img src="../../../assets/images/3dicon.png" alt="">三维场景</div> |
|
|
|
|
|
|
|
<div class="btn" id="seePlan"><img src="../../../assets/images/planicon.png" alt="">查看预案</div>
|
|
|
|
|
|
|
|
<div class="btn" id="share"><img src="../../../assets/images/shareicon.png" alt="">分享</div> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
</div>` |
|
|
|
|
|
|
|
// 创建一个自定义内容的 infowindow 实例
|
|
|
|
|
|
|
|
this.infoWindow = MapFactory.InfoWindowInstance({ |
|
|
|
|
|
|
|
position: [item.location.x, item.location.y], |
|
|
|
|
|
|
|
offset: MapFactory.PixelInstance(0, -30), |
|
|
|
|
|
|
|
content: markerContent, |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
this.infoWindow.open(this.map); |
|
|
|
|
|
|
|
this.renderer2.listen(this.elementRef.nativeElement.querySelector('#baseInformation'), 'click', (event) => { this.baseInformation(item) })//基本信息点击事件
|
|
|
|
|
|
|
|
this.renderer2.listen(this.elementRef.nativeElement.querySelector('#route'), 'click', (event) => { this.route(item) })//导航点击事件
|
|
|
|
|
|
|
|
this.renderer2.listen(this.elementRef.nativeElement.querySelector('#fullViewNavigation'), 'click', (event) => { this.fullViewNavigation(item) })//全景漫游点击事件
|
|
|
|
|
|
|
|
this.renderer2.listen(this.elementRef.nativeElement.querySelector('#threeeScene'), 'click', (event) => { this.threeeScene(item) })//三维场景点击事件
|
|
|
|
|
|
|
|
this.renderer2.listen(this.elementRef.nativeElement.querySelector('#seePlan'), 'click', (event) => { this.seePlan(item) })//查看预案点击事件
|
|
|
|
|
|
|
|
this.renderer2.listen(this.elementRef.nativeElement.querySelector('#share'), 'click', (event) => { this.share(item) })//分享点击事件
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
//取消显示单位
|
|
|
|
//取消显示单位
|
|
|
@ -541,48 +541,48 @@ export class GisLabelingComponent implements OnInit { |
|
|
|
data: item |
|
|
|
data: item |
|
|
|
}) : null |
|
|
|
}) : null |
|
|
|
}) |
|
|
|
}) |
|
|
|
this.map.plugin(["AMap.MarkerClusterer"], () => { |
|
|
|
|
|
|
|
var gridSize = 60 |
|
|
|
var gridSize = 60 |
|
|
|
var count = fireForceMarkerArrcluster.length; |
|
|
|
var count = fireForceMarkerArrcluster.length; |
|
|
|
|
|
|
|
|
|
|
|
let render = MapFactory.RenderClusterMarkerInstance(); |
|
|
|
let render = MapFactory.RenderClusterMarkerInstance(); |
|
|
|
render.contentRender = (contextCount) => { |
|
|
|
render.contentRender = (contextCount) => { |
|
|
|
var factor = Math.pow(contextCount / count, 1 / 18); |
|
|
|
var factor = Math.pow(contextCount / count, 1 / 18); |
|
|
|
var div = document.createElement('div'); |
|
|
|
var div = document.createElement('div'); |
|
|
|
var Hue = 180 - factor * 180; |
|
|
|
var Hue = 180 - factor * 180; |
|
|
|
var bgColor = 'hsla(' + Hue + ',100%,40%,0.7)'; |
|
|
|
var bgColor = 'hsla(' + Hue + ',100%,40%,0.7)'; |
|
|
|
var fontColor = 'hsla(' + Hue + ',100%,90%,1)'; |
|
|
|
var fontColor = 'hsla(' + Hue + ',100%,90%,1)'; |
|
|
|
var borderColor = 'hsla(' + Hue + ',100%,40%,1)'; |
|
|
|
var borderColor = 'hsla(' + Hue + ',100%,40%,1)'; |
|
|
|
var shadowColor = 'hsla(' + Hue + ',100%,90%,1)'; |
|
|
|
var shadowColor = 'hsla(' + Hue + ',100%,90%,1)'; |
|
|
|
div.style.backgroundColor = bgColor; |
|
|
|
div.style.backgroundColor = bgColor; |
|
|
|
var size = Math.round(30 + Math.pow(contextCount / count, 1 / 5) * 20); |
|
|
|
var size = Math.round(30 + Math.pow(contextCount / count, 1 / 5) * 20); |
|
|
|
div.style.width = div.style.height = size + 'px'; |
|
|
|
div.style.width = div.style.height = size + 'px'; |
|
|
|
div.style.border = 'solid 1px ' + borderColor; |
|
|
|
div.style.border = 'solid 1px ' + borderColor; |
|
|
|
div.style.borderRadius = size / 2 + 'px'; |
|
|
|
div.style.borderRadius = size / 2 + 'px'; |
|
|
|
div.style.boxShadow = '0 0 5px ' + shadowColor; |
|
|
|
div.style.boxShadow = '0 0 5px ' + shadowColor; |
|
|
|
div.innerHTML = contextCount; |
|
|
|
div.innerHTML = contextCount; |
|
|
|
div.style.lineHeight = size + 'px'; |
|
|
|
div.style.lineHeight = size + 'px'; |
|
|
|
div.style.color = fontColor; |
|
|
|
div.style.color = fontColor; |
|
|
|
div.style.fontSize = '14px'; |
|
|
|
div.style.fontSize = '14px'; |
|
|
|
div.style.textAlign = 'center'; |
|
|
|
div.style.textAlign = 'center'; |
|
|
|
return div; |
|
|
|
return div; |
|
|
|
}; |
|
|
|
}; |
|
|
|
render.pixelRender = (contextCount) => { |
|
|
|
render.pixelRender = (contextCount) => { |
|
|
|
var size = Math.round(30 + Math.pow(contextCount / count, 1 / 5) * 20); |
|
|
|
var size = Math.round(30 + Math.pow(contextCount / count, 1 / 5) * 20); |
|
|
|
return MapFactory.PixelInstance(-size / 2, -size / 2); |
|
|
|
return MapFactory.PixelInstance(-size / 2, -size / 2); |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
render.contentNonRender = (src) => { |
|
|
|
render.contentNonRender = (src) => { |
|
|
|
return `<img class='clusterImgCollection' src="${src}" alt="">`; |
|
|
|
return `<img class='clusterImgCollection' src="${src}" alt="">`; |
|
|
|
}; |
|
|
|
}; |
|
|
|
render.pixelNonRender = () => { |
|
|
|
render.pixelNonRender = () => { |
|
|
|
return MapFactory.PixelInstance(-15, -15); |
|
|
|
return MapFactory.PixelInstance(-15, -15); |
|
|
|
} |
|
|
|
} |
|
|
|
this.fireForceCluster = MapFactory.MarkerClusterInstance(this.map, fireForceMarkerArrcluster, { |
|
|
|
this.fireForceCluster = MapFactory.MarkerClusterInstance(this.map, fireForceMarkerArrcluster, { |
|
|
|
gridSize: gridSize, // 设置网格像素大小
|
|
|
|
gridSize: gridSize, // 设置网格像素大小
|
|
|
|
render: render //自定义聚合点样式, 自定义非聚合点样式
|
|
|
|
render: render //自定义聚合点样式, 自定义非聚合点样式
|
|
|
|
}); |
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
//取消消防力量
|
|
|
|
//取消消防力量
|
|
|
|
resetFireForce() { |
|
|
|
resetFireForce() { |
|
|
@ -689,49 +689,49 @@ export class GisLabelingComponent implements OnInit { |
|
|
|
} |
|
|
|
} |
|
|
|
// 用于点集合的数组
|
|
|
|
// 用于点集合的数组
|
|
|
|
}) |
|
|
|
}) |
|
|
|
this.map.plugin(["AMap.MarkerClusterer"], () => { |
|
|
|
|
|
|
|
var gridSize = 60 |
|
|
|
|
|
|
|
var count = linkageForcesMarkerArrcluster.length; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let render = MapFactory.RenderClusterMarkerInstance(); |
|
|
|
|
|
|
|
render.contentRender = (contextCount) => { |
|
|
|
|
|
|
|
var factor = Math.pow(contextCount / count, 1 / 18); |
|
|
|
|
|
|
|
var div = document.createElement('div'); |
|
|
|
|
|
|
|
var Hue = 180 - factor * 180; |
|
|
|
|
|
|
|
var bgColor = 'hsla(' + Hue + ',100%,40%,0.7)'; |
|
|
|
|
|
|
|
var fontColor = 'hsla(' + Hue + ',100%,90%,1)'; |
|
|
|
|
|
|
|
var borderColor = 'hsla(' + Hue + ',100%,40%,1)'; |
|
|
|
|
|
|
|
var shadowColor = 'hsla(' + Hue + ',100%,90%,1)'; |
|
|
|
|
|
|
|
div.style.backgroundColor = bgColor; |
|
|
|
|
|
|
|
var size = Math.round(30 + Math.pow(contextCount / count, 1 / 5) * 20); |
|
|
|
|
|
|
|
div.style.width = div.style.height = size + 'px'; |
|
|
|
|
|
|
|
div.style.border = 'solid 1px ' + borderColor; |
|
|
|
|
|
|
|
div.style.borderRadius = size / 2 + 'px'; |
|
|
|
|
|
|
|
div.style.boxShadow = '0 0 5px ' + shadowColor; |
|
|
|
|
|
|
|
div.innerHTML = contextCount; |
|
|
|
|
|
|
|
div.style.lineHeight = size + 'px'; |
|
|
|
|
|
|
|
div.style.color = fontColor; |
|
|
|
|
|
|
|
div.style.fontSize = '14px'; |
|
|
|
|
|
|
|
div.style.textAlign = 'center'; |
|
|
|
|
|
|
|
return div; |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
render.pixelRender = (contextCount) => { |
|
|
|
|
|
|
|
var size = Math.round(30 + Math.pow(contextCount / count, 1 / 5) * 20); |
|
|
|
|
|
|
|
return MapFactory.PixelInstance(-size / 2, -size / 2); |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
render.contentNonRender = (src) => { |
|
|
|
|
|
|
|
return `<img class='clusterImgCollection' src="${src}" alt="">`; |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
render.pixelNonRender = () => { |
|
|
|
|
|
|
|
return MapFactory.PixelInstance(-15, -15); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.linkageForcesCluster = MapFactory.MarkerClusterInstance(this.map, linkageForcesMarkerArrcluster, { |
|
|
|
var gridSize = 60 |
|
|
|
gridSize: gridSize, // 设置网格像素大小
|
|
|
|
var count = linkageForcesMarkerArrcluster.length; |
|
|
|
render: render //自定义聚合点样式, 自定义非聚合点样式
|
|
|
|
|
|
|
|
}); |
|
|
|
let render = MapFactory.RenderClusterMarkerInstance(); |
|
|
|
|
|
|
|
render.contentRender = (contextCount) => { |
|
|
|
|
|
|
|
var factor = Math.pow(contextCount / count, 1 / 18); |
|
|
|
|
|
|
|
var div = document.createElement('div'); |
|
|
|
|
|
|
|
var Hue = 180 - factor * 180; |
|
|
|
|
|
|
|
var bgColor = 'hsla(' + Hue + ',100%,40%,0.7)'; |
|
|
|
|
|
|
|
var fontColor = 'hsla(' + Hue + ',100%,90%,1)'; |
|
|
|
|
|
|
|
var borderColor = 'hsla(' + Hue + ',100%,40%,1)'; |
|
|
|
|
|
|
|
var shadowColor = 'hsla(' + Hue + ',100%,90%,1)'; |
|
|
|
|
|
|
|
div.style.backgroundColor = bgColor; |
|
|
|
|
|
|
|
var size = Math.round(30 + Math.pow(contextCount / count, 1 / 5) * 20); |
|
|
|
|
|
|
|
div.style.width = div.style.height = size + 'px'; |
|
|
|
|
|
|
|
div.style.border = 'solid 1px ' + borderColor; |
|
|
|
|
|
|
|
div.style.borderRadius = size / 2 + 'px'; |
|
|
|
|
|
|
|
div.style.boxShadow = '0 0 5px ' + shadowColor; |
|
|
|
|
|
|
|
div.innerHTML = contextCount; |
|
|
|
|
|
|
|
div.style.lineHeight = size + 'px'; |
|
|
|
|
|
|
|
div.style.color = fontColor; |
|
|
|
|
|
|
|
div.style.fontSize = '14px'; |
|
|
|
|
|
|
|
div.style.textAlign = 'center'; |
|
|
|
|
|
|
|
return div; |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
render.pixelRender = (contextCount) => { |
|
|
|
|
|
|
|
var size = Math.round(30 + Math.pow(contextCount / count, 1 / 5) * 20); |
|
|
|
|
|
|
|
return MapFactory.PixelInstance(-size / 2, -size / 2); |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
render.contentNonRender = (src) => { |
|
|
|
|
|
|
|
return `<img class='clusterImgCollection' src="${src}" alt="">`; |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
render.pixelNonRender = () => { |
|
|
|
|
|
|
|
return MapFactory.PixelInstance(-15, -15); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.linkageForcesCluster = MapFactory.MarkerClusterInstance(this.map, linkageForcesMarkerArrcluster, { |
|
|
|
|
|
|
|
gridSize: gridSize, // 设置网格像素大小
|
|
|
|
|
|
|
|
render: render //自定义聚合点样式, 自定义非聚合点样式
|
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
//取消联动力量
|
|
|
|
//取消联动力量
|
|
|
|
resetLinkageForces() { |
|
|
|
resetLinkageForces() { |
|
|
@ -835,89 +835,88 @@ export class GisLabelingComponent implements OnInit { |
|
|
|
data: item |
|
|
|
data: item |
|
|
|
}) |
|
|
|
}) |
|
|
|
}) |
|
|
|
}) |
|
|
|
this.map.plugin(["AMap.MarkerClusterer"], () => { |
|
|
|
|
|
|
|
var gridSize = 60 |
|
|
|
|
|
|
|
var count = waterMarkerArrcluster.length; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let render = MapFactory.RenderClusterMarkerInstance(); |
|
|
|
|
|
|
|
render.contentRender = (contextCount) => { |
|
|
|
|
|
|
|
var factor = Math.pow(contextCount / count, 1 / 18); |
|
|
|
|
|
|
|
var div = document.createElement('div'); |
|
|
|
|
|
|
|
var Hue = 180 - factor * 180; |
|
|
|
|
|
|
|
var bgColor = 'hsla(' + Hue + ',100%,40%,0.7)'; |
|
|
|
|
|
|
|
var fontColor = 'hsla(' + Hue + ',100%,90%,1)'; |
|
|
|
|
|
|
|
var borderColor = 'hsla(' + Hue + ',100%,40%,1)'; |
|
|
|
|
|
|
|
var shadowColor = 'hsla(' + Hue + ',100%,90%,1)'; |
|
|
|
|
|
|
|
div.style.backgroundColor = bgColor; |
|
|
|
|
|
|
|
var size = Math.round(30 + Math.pow(contextCount / count, 1 / 5) * 20); |
|
|
|
|
|
|
|
div.style.width = div.style.height = size + 'px'; |
|
|
|
|
|
|
|
div.style.border = 'solid 1px ' + borderColor; |
|
|
|
|
|
|
|
div.style.borderRadius = size / 2 + 'px'; |
|
|
|
|
|
|
|
div.style.boxShadow = '0 0 5px ' + shadowColor; |
|
|
|
|
|
|
|
div.innerHTML = contextCount; |
|
|
|
|
|
|
|
div.style.lineHeight = size + 'px'; |
|
|
|
|
|
|
|
div.style.color = fontColor; |
|
|
|
|
|
|
|
div.style.fontSize = '14px'; |
|
|
|
|
|
|
|
div.style.textAlign = 'center'; |
|
|
|
|
|
|
|
return div; |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
render.pixelRender = (contextCount) => { |
|
|
|
|
|
|
|
var size = Math.round(30 + Math.pow(contextCount / count, 1 / 5) * 20); |
|
|
|
|
|
|
|
return MapFactory.PixelInstance(-size / 2, -size / 2); |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
render.contentNonRender = (src) => { |
|
|
|
|
|
|
|
return `<img class='clusterImgCollection' src="${src}" alt="">`; |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
render.pixelNonRender = () => { |
|
|
|
|
|
|
|
return MapFactory.PixelInstance(-15, -15); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// var _renderClusterMarker = function (context) {
|
|
|
|
var gridSize = 60 |
|
|
|
// var factor = Math.pow(context.count / count, 1 / 18);
|
|
|
|
var count = waterMarkerArrcluster.length; |
|
|
|
// var div = document.createElement('div');
|
|
|
|
|
|
|
|
// var Hue = 180 - factor * 180;
|
|
|
|
let render = MapFactory.RenderClusterMarkerInstance(); |
|
|
|
// var bgColor = 'hsla(' + Hue + ',100%,40%,0.7)';
|
|
|
|
render.contentRender = (contextCount) => { |
|
|
|
// var fontColor = 'hsla(' + Hue + ',100%,90%,1)';
|
|
|
|
var factor = Math.pow(contextCount / count, 1 / 18); |
|
|
|
// var borderColor = 'hsla(' + Hue + ',100%,40%,1)';
|
|
|
|
var div = document.createElement('div'); |
|
|
|
// var shadowColor = 'hsla(' + Hue + ',100%,90%,1)';
|
|
|
|
var Hue = 180 - factor * 180; |
|
|
|
// div.style.backgroundColor = bgColor;
|
|
|
|
var bgColor = 'hsla(' + Hue + ',100%,40%,0.7)'; |
|
|
|
// var size = Math.round(30 + Math.pow(context.count / count, 1 / 5) * 20);
|
|
|
|
var fontColor = 'hsla(' + Hue + ',100%,90%,1)'; |
|
|
|
// div.style.width = div.style.height = size + 'px';
|
|
|
|
var borderColor = 'hsla(' + Hue + ',100%,40%,1)'; |
|
|
|
// div.style.border = 'solid 1px ' + borderColor;
|
|
|
|
var shadowColor = 'hsla(' + Hue + ',100%,90%,1)'; |
|
|
|
// div.style.borderRadius = size / 2 + 'px';
|
|
|
|
div.style.backgroundColor = bgColor; |
|
|
|
// div.style.boxShadow = '0 0 5px ' + shadowColor;
|
|
|
|
var size = Math.round(30 + Math.pow(contextCount / count, 1 / 5) * 20); |
|
|
|
// div.innerHTML = context.count;
|
|
|
|
div.style.width = div.style.height = size + 'px'; |
|
|
|
// div.style.lineHeight = size + 'px';
|
|
|
|
div.style.border = 'solid 1px ' + borderColor; |
|
|
|
// div.style.color = fontColor;
|
|
|
|
div.style.borderRadius = size / 2 + 'px'; |
|
|
|
// div.style.fontSize = '14px';
|
|
|
|
div.style.boxShadow = '0 0 5px ' + shadowColor; |
|
|
|
// div.style.textAlign = 'center';
|
|
|
|
div.innerHTML = contextCount; |
|
|
|
// context.marker.setOffset(MapFactory.PixelInstance(-size / 2, -size / 2));
|
|
|
|
div.style.lineHeight = size + 'px'; |
|
|
|
// context.marker.setContent(div)
|
|
|
|
div.style.color = fontColor; |
|
|
|
// };
|
|
|
|
div.style.fontSize = '14px'; |
|
|
|
// var _renderMarker = (context) => {
|
|
|
|
div.style.textAlign = 'center'; |
|
|
|
// var content = `<img class='clusterImgCollection' src="${context.data[0].image}" alt="">`;
|
|
|
|
return div; |
|
|
|
// var offset = MapFactory.PixelInstance(-15, -15);
|
|
|
|
}; |
|
|
|
// context.marker.setContent(content)
|
|
|
|
render.pixelRender = (contextCount) => { |
|
|
|
// context.marker.setOffset(offset)
|
|
|
|
var size = Math.round(30 + Math.pow(contextCount / count, 1 / 5) * 20); |
|
|
|
// }
|
|
|
|
return MapFactory.PixelInstance(-size / 2, -size / 2); |
|
|
|
this.waterCluster = MapFactory.MarkerClusterInstance(this.map, waterMarkerArrcluster, { |
|
|
|
}; |
|
|
|
gridSize: gridSize, // 设置网格像素大小
|
|
|
|
|
|
|
|
render: render //自定义聚合点样式, 自定义非聚合点样式
|
|
|
|
render.contentNonRender = (src) => { |
|
|
|
}); |
|
|
|
return `<img class='clusterImgCollection' src="${src}" alt="">`; |
|
|
|
|
|
|
|
}; |
|
|
|
// this.waterCluster = new AMap.MarkerCluster(this.map, waterMarkerArrcluster, {
|
|
|
|
render.pixelNonRender = () => { |
|
|
|
// gridSize: gridSize, // 设置网格像素大小
|
|
|
|
return MapFactory.PixelInstance(-15, -15); |
|
|
|
// renderClusterMarker: _renderClusterMarker, // 自定义聚合点样式
|
|
|
|
} |
|
|
|
// renderMarker: _renderMarker, // 自定义非聚合点样式
|
|
|
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
this.waterCluster.on('click', (e) => { |
|
|
|
|
|
|
|
if (e.clusterData.length == 1) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
// var _renderClusterMarker = function (context) {
|
|
|
|
}) |
|
|
|
// var factor = Math.pow(context.count / count, 1 / 18);
|
|
|
|
|
|
|
|
// var div = document.createElement('div');
|
|
|
|
|
|
|
|
// var Hue = 180 - factor * 180;
|
|
|
|
|
|
|
|
// var bgColor = 'hsla(' + Hue + ',100%,40%,0.7)';
|
|
|
|
|
|
|
|
// var fontColor = 'hsla(' + Hue + ',100%,90%,1)';
|
|
|
|
|
|
|
|
// var borderColor = 'hsla(' + Hue + ',100%,40%,1)';
|
|
|
|
|
|
|
|
// var shadowColor = 'hsla(' + Hue + ',100%,90%,1)';
|
|
|
|
|
|
|
|
// div.style.backgroundColor = bgColor;
|
|
|
|
|
|
|
|
// var size = Math.round(30 + Math.pow(context.count / count, 1 / 5) * 20);
|
|
|
|
|
|
|
|
// div.style.width = div.style.height = size + 'px';
|
|
|
|
|
|
|
|
// div.style.border = 'solid 1px ' + borderColor;
|
|
|
|
|
|
|
|
// div.style.borderRadius = size / 2 + 'px';
|
|
|
|
|
|
|
|
// div.style.boxShadow = '0 0 5px ' + shadowColor;
|
|
|
|
|
|
|
|
// div.innerHTML = context.count;
|
|
|
|
|
|
|
|
// div.style.lineHeight = size + 'px';
|
|
|
|
|
|
|
|
// div.style.color = fontColor;
|
|
|
|
|
|
|
|
// div.style.fontSize = '14px';
|
|
|
|
|
|
|
|
// div.style.textAlign = 'center';
|
|
|
|
|
|
|
|
// context.marker.setOffset(MapFactory.PixelInstance(-size / 2, -size / 2));
|
|
|
|
|
|
|
|
// context.marker.setContent(div)
|
|
|
|
|
|
|
|
// };
|
|
|
|
|
|
|
|
// var _renderMarker = (context) => {
|
|
|
|
|
|
|
|
// var content = `<img class='clusterImgCollection' src="${context.data[0].image}" alt="">`;
|
|
|
|
|
|
|
|
// var offset = MapFactory.PixelInstance(-15, -15);
|
|
|
|
|
|
|
|
// context.marker.setContent(content)
|
|
|
|
|
|
|
|
// context.marker.setOffset(offset)
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
this.waterCluster = MapFactory.MarkerClusterInstance(this.map, waterMarkerArrcluster, { |
|
|
|
|
|
|
|
gridSize: gridSize, // 设置网格像素大小
|
|
|
|
|
|
|
|
render: render //自定义聚合点样式, 自定义非聚合点样式
|
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// this.waterCluster = new AMap.MarkerCluster(this.map, waterMarkerArrcluster, {
|
|
|
|
|
|
|
|
// gridSize: gridSize, // 设置网格像素大小
|
|
|
|
|
|
|
|
// renderClusterMarker: _renderClusterMarker, // 自定义聚合点样式
|
|
|
|
|
|
|
|
// renderMarker: _renderMarker, // 自定义非聚合点样式
|
|
|
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
this.waterCluster.on('click', (e) => { |
|
|
|
|
|
|
|
if (e.clusterData.length == 1) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
//取消显示水源
|
|
|
|
//取消显示水源
|
|
|
|
resetWater() { |
|
|
|
resetWater() { |
|
|
@ -1053,9 +1052,7 @@ export class GisLabelingComponent implements OnInit { |
|
|
|
}) |
|
|
|
}) |
|
|
|
that.map = MapFactory.MapInstance('map', { layers: [layer] }); |
|
|
|
that.map = MapFactory.MapInstance('map', { layers: [layer] }); |
|
|
|
that.map.setCity('上海市'); |
|
|
|
that.map.setCity('上海市'); |
|
|
|
that.map.plugin(["AMap.RangingTool", "AMap.MouseTool"], function () { |
|
|
|
that.mouseTool = MapFactory.MouseToolInstance(that.map); |
|
|
|
that.mouseTool = MapFactory.MouseToolInstance(that.map); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -1087,17 +1084,7 @@ export class GisLabelingComponent implements OnInit { |
|
|
|
|
|
|
|
|
|
|
|
//清空距离测量
|
|
|
|
//清空距离测量
|
|
|
|
clearDistance() { |
|
|
|
clearDistance() { |
|
|
|
this.distanceList.forEach(item => { |
|
|
|
|
|
|
|
if (item.className == 'AMap.Marker') { |
|
|
|
|
|
|
|
let parent = item.dom.parentNode |
|
|
|
|
|
|
|
let children = item.dom.nextElementSibling |
|
|
|
|
|
|
|
parent && children ? parent.removeChild(item.dom.nextElementSibling) : null |
|
|
|
|
|
|
|
this.map.remove(item) |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
this.map.remove(item) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
this.distanceList = [] //清空数组
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//清空面积测量
|
|
|
|
//清空面积测量
|
|
|
@ -1348,33 +1335,31 @@ export class GisLabelingComponent implements OnInit { |
|
|
|
this.timeout = window.setTimeout(() => { |
|
|
|
this.timeout = window.setTimeout(() => { |
|
|
|
|
|
|
|
|
|
|
|
that.map.getCity(function (info) { //获取当前 city
|
|
|
|
that.map.getCity(function (info) { //获取当前 city
|
|
|
|
that.map.plugin(['AMap.AutoComplete'], () => { |
|
|
|
var autoOptions = { city: info.city } |
|
|
|
var autoOptions = { city: info.city } |
|
|
|
let keywords |
|
|
|
let keywords |
|
|
|
e == 0 ? keywords = that.routeStart : keywords = that.routeEnd |
|
|
|
e == 0 ? keywords = that.routeStart : keywords = that.routeEnd |
|
|
|
var autoComplete = MapFactory.AutocompleteInstance(autoOptions); |
|
|
|
var autoComplete = MapFactory.AutocompleteInstance(autoOptions); |
|
|
|
autoComplete.search(keywords, function (status, result) { |
|
|
|
autoComplete.search(keywords, function (status, result) { |
|
|
|
if (result && result.tips && result.tips.length) { //搜索到数据时
|
|
|
|
if (result && result.tips && result.tips.length) { //搜索到数据时
|
|
|
|
that._ngZone.run(() => { |
|
|
|
that._ngZone.run(() => { |
|
|
|
if (e == 0) {//起点
|
|
|
|
if (e == 0) {//起点
|
|
|
|
that.routeStartList = result.tips |
|
|
|
that.routeStartList = result.tips |
|
|
|
if (result.tips.length != 0) { |
|
|
|
if (result.tips.length != 0) { |
|
|
|
for (let index = 0; index < result.tips.length; index++) { |
|
|
|
for (let index = 0; index < result.tips.length; index++) { |
|
|
|
const element = result.tips[index]; |
|
|
|
const element = result.tips[index]; |
|
|
|
if (element.location) { |
|
|
|
if (element.location) { |
|
|
|
that.startCoordinate = MapFactory.LngLatInstance(element.location.lng, element.location.lat) |
|
|
|
that.startCoordinate = MapFactory.LngLatInstance(element.location.lng, element.location.lat) |
|
|
|
return |
|
|
|
return |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} else {//终点
|
|
|
|
|
|
|
|
that.routeEndList = result.tips |
|
|
|
|
|
|
|
that.endCoordinate = MapFactory.LngLatInstance(result.tips[0].location.lng, result.tips[0].location.lat) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
} else {//终点
|
|
|
|
|
|
|
|
that.routeEndList = result.tips |
|
|
|
|
|
|
|
that.endCoordinate = MapFactory.LngLatInstance(result.tips[0].location.lng, result.tips[0].location.lat) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
} //if
|
|
|
|
} //if
|
|
|
|
}) |
|
|
|
|
|
|
|
}) |
|
|
|
}) |
|
|
|
}); //获取当前 city
|
|
|
|
}); //获取当前 city
|
|
|
|
|
|
|
|
|
|
|
|