地图聚合字体样式

This commit is contained in:
unknown 2022-10-14 10:34:17 +08:00
parent 3d69aa5922
commit ae046a6f82
1 changed files with 842 additions and 839 deletions

View File

@ -21,6 +21,7 @@ const restoreIconObj = {
} }
const progress = document.getElementById('progress') const progress = document.getElementById('progress')
const progressBar = document.getElementById('progress-bar') const progressBar = document.getElementById('progress-bar')
function updateProgressBar(processed, total, elapsed, layersArray) { function updateProgressBar(processed, total, elapsed, layersArray) {
if (elapsed > 1000) { if (elapsed > 1000) {
// if it takes more than a second to load, display the progress bar: // if it takes more than a second to load, display the progress bar:
@ -64,6 +65,14 @@ function createMarkerClusterLayer(layerClassName) {
} else { } else {
// 使 // 使
markerClusterLayer = L.markerClusterGroup({ markerClusterLayer = L.markerClusterGroup({
iconCreateFunction(cluster) {
const markers = cluster.getAllChildMarkers()
let n = 0
for (let i = 0; i < markers.length; i++) {
n += markers[i].number
}
return L.divIcon({ html: markers.length, className: "topic-marker-cluster-video" })
},
// PolylineOptions spider // PolylineOptions spider
spiderfyOnMaxZoom: true, spiderfyOnMaxZoom: true,
// //
@ -111,8 +120,7 @@ function chunkData(data, doChunk, chunkCompleted) {
* @param layerGroup * @param layerGroup
* @return {*|void} layer对象可以直接用map的removeLayer删除 * @return {*|void} layer对象可以直接用map的removeLayer删除
*/ */
function addPointOnMap( function addPointOnMap({
{
feature, feature,
iconSize = [48, 48], iconSize = [48, 48],
iconUrl = 'poi.png', iconUrl = 'poi.png',
@ -134,8 +142,7 @@ function addPointOnMap(
// div // div
if (isCustomIcon) { if (isCustomIcon) {
iconHtml = iconHtml || createDefaultDivIcon() iconHtml = iconHtml || createDefaultDivIcon()
icon = createDefaultFeatureStyle( icon = createDefaultFeatureStyle({ img: iconUrl, iconSize: iconSize },
{ img: iconUrl, iconSize: iconSize },
iconHtml, iconHtml,
iconClassName iconClassName
) )
@ -171,12 +178,12 @@ function addPointOnMap(
}) })
} }
return isOpenPopup return isOpenPopup ?
? marker marker
.addTo(mapObj.map) .addTo(mapObj.map)
.bindPopup(elementHtml, { className: popupClassName }) .bindPopup(elementHtml, { className: popupClassName })
.openPopup() .openPopup() :
: marker.addTo(mapObj.map) marker.addTo(mapObj.map)
} }
/** /**
@ -196,9 +203,9 @@ function createPromiseByQueryService(idArray = [], layerConfigInfo, type = '') {
authorityFilter = 'SMID > 0' authorityFilter = 'SMID > 0'
} else if (idArray.length <= 1000) { } else if (idArray.length <= 1000) {
const authorityFilter1 = "'" + idArray.join("','") + "'" const authorityFilter1 = "'" + idArray.join("','") + "'"
authorityFilter = type authorityFilter = type ?
? `CAMERA_INDEX_CODE in (${authorityFilter1})` `CAMERA_INDEX_CODE in (${authorityFilter1})` :
: `UUID in (${authorityFilter1})` `UUID in (${authorityFilter1})`
} else { } else {
// UUID1000 // UUID1000
const count = Math.floor(idArray.length / 1000) // const count = Math.floor(idArray.length / 1000) //
@ -209,9 +216,9 @@ function createPromiseByQueryService(idArray = [], layerConfigInfo, type = '') {
const authorityFilterString = "'" + indexCodeSplice.join("','") + "'" const authorityFilterString = "'" + indexCodeSplice.join("','") + "'"
const authorityFilterSplice = `CAMERA_INDEX_CODE in (${authorityFilterString})` const authorityFilterSplice = `CAMERA_INDEX_CODE in (${authorityFilterString})`
authorityFilter = authorityFilter =
i === 0 i === 0 ?
? authorityFilterSplice authorityFilterSplice :
: `${authorityFilter} or ${authorityFilterSplice}` `${authorityFilter} or ${authorityFilterSplice}`
} }
} else { } else {
for (let i = 0; i <= count; i++) { for (let i = 0; i <= count; i++) {
@ -219,9 +226,9 @@ function createPromiseByQueryService(idArray = [], layerConfigInfo, type = '') {
const authorityFilterString = "'" + indexCodeSplice.join("','") + "'" const authorityFilterString = "'" + indexCodeSplice.join("','") + "'"
const authorityFilterSplice = `UUID in (${authorityFilterString})` const authorityFilterSplice = `UUID in (${authorityFilterString})`
authorityFilter = authorityFilter =
i === 0 i === 0 ?
? authorityFilterSplice authorityFilterSplice :
: `${authorityFilter} or ${authorityFilterSplice}` `${authorityFilter} or ${authorityFilterSplice}`
} }
} }
} }
@ -271,9 +278,8 @@ function addResourceOnMapNew(
// //
let layers = null let layers = null
// //
layers = layerConfig.cluster.flag layers = layerConfig.cluster.flag ?
? createMarkerClusterLayer(layerConfig.cluster.clusterName) createMarkerClusterLayer(layerConfig.cluster.clusterName) : []
: []
// promise // promise
return new Promise((resolve) => { return new Promise((resolve) => {
@ -347,8 +353,7 @@ function addResourceOnMapNew(
* @return {*} * @return {*}
* @private * @private
*/ */
function addResourceOnMap( function addResourceOnMap({
{
features, features,
layerName, layerName,
layerConfigInfo, layerConfigInfo,
@ -658,8 +663,7 @@ function addResourceOnMapWithoutSuperMap(
feature.traveladdress + feature.traveladdress +
'(' + '(' +
feature.count + feature.count +
'次)</span></p>', '次)</span></p>', {
{
permanent: true, permanent: true,
} }
) )
@ -795,8 +799,7 @@ function addPointsToMap(
* @return {*} * @return {*}
* @private * @private
*/ */
function addResourceOnMapWithoutSuper( function addResourceOnMapWithoutSuper({
{
features, features,
layerName, layerName,
layerConfigInfo, layerConfigInfo,