custom map tile server supports annotation layer

This commit is contained in:
MaysWind
2024-07-21 20:39:10 +08:00
parent aae23c285e
commit 0f8de8d699
7 changed files with 52 additions and 24 deletions
+7 -3
View File
@@ -1,7 +1,9 @@
import mapConstants from '@/consts/map.js';
import {
isMapDataFetchProxyEnabled,
getCustomMapTileServerUrl,
getCustomMapTileLayerUrl,
getCustomMapAnnotationLayerUrl,
isCustomMapAnnotationLayerDataFetchProxyEnabled,
getCustomMapMinZoomLevel,
getCustomMapMaxZoomLevel,
getCustomMapDefaultZoomLevel,
@@ -77,7 +79,7 @@ export function createLeafletMapInstance(mapHolder, mapContainer, options) {
});
tileLayer.addTo(leafletInstance);
if (mapTileSource.annotationUrlFormat) {
if (mapTileSource.annotationUrlFormat || (mapHolder.mapProvider === 'custom' && isCustomMapAnnotationLayerDataFetchProxyEnabled())) {
if (isMapDataFetchProxyEnabled()) {
mapTileSource.annotationUrlFormat = services.generateMapProxyAnnotationImageUrl(mapHolder.mapProvider, options.language);
mapTileSource.annotationUrlSubDomains = '';
@@ -160,8 +162,10 @@ export function removeLeafletMapCenterMaker(mapHolder) {
function createCustomMapSource() {
return {
tileUrlFormat: getCustomMapTileServerUrl(),
tileUrlFormat: getCustomMapTileLayerUrl(),
tileUrlSubDomains: '',
annotationUrlFormat: getCustomMapAnnotationLayerUrl(),
annotationUrlSubDomains: '',
minZoom: getCustomMapMinZoomLevel(),
maxZoom: getCustomMapMaxZoomLevel(),
defaultZoomLevel: getCustomMapDefaultZoomLevel()
+9 -1
View File
@@ -53,10 +53,18 @@ export function isMapDataFetchProxyEnabled() {
return getServerSetting('mp') === '1';
}
export function getCustomMapTileServerUrl() {
export function getCustomMapTileLayerUrl() {
return getServerDecodedSetting('cmsu');
}
export function getCustomMapAnnotationLayerUrl() {
return getServerDecodedSetting('cmau');
}
export function isCustomMapAnnotationLayerDataFetchProxyEnabled() {
return getServerSetting('cmap') === '1';
}
export function getCustomMapMinZoomLevel() {
const zoomLevelSettings = (getServerSetting('cmzl') || '').split('-');
return (zoomLevelSettings && zoomLevelSettings[0]) ? parseInt(zoomLevelSettings[0]) : 1;