Replace MapProvider.getTilesUrl with LiveAtlasMapDefinition baseUrl option

This commit is contained in:
James Lyne 2022-02-23 22:32:59 +00:00
parent 1c5351313f
commit 40ee948d91
8 changed files with 3 additions and 23 deletions

1
src/index.d.ts vendored
View File

@ -192,7 +192,6 @@ interface LiveAtlasMapProvider {
logout(): void;
register(formData: FormData): void;
getTilesUrl(): string;
getMarkerIconUrl(icon: string): string;
}

View File

@ -44,7 +44,7 @@ export class DynmapTileLayer extends LiveAtlasTileLayer {
super('', options);
this._mapSettings = options.mapSettings;
this._baseUrl = this._store.state.currentMapProvider!.getTilesUrl();
this._baseUrl = options.mapSettings.baseUrl;
this._namedTiles = Object.seal(new Map());
this._pendingUpdates = computed(() => !!this._store.state.pendingTileUpdates.length);

View File

@ -18,13 +18,11 @@
*/
import {LiveAtlasTileLayer, LiveAtlasTileLayerOptions} from "@/leaflet/tileLayer/LiveAtlasTileLayer";
import {Store, useStore} from "@/store";
import {Coords, Util} from "leaflet";
// noinspection JSUnusedGlobalSymbols
export class OverviewerTileLayer extends LiveAtlasTileLayer {
private readonly _baseUrl: string;
private readonly _store: Store = useStore();
constructor(options: LiveAtlasTileLayerOptions) {
super('', options);
@ -34,7 +32,7 @@ export class OverviewerTileLayer extends LiveAtlasTileLayer {
Util.setOptions(this, options);
this._mapSettings = options.mapSettings;
this._baseUrl = this._store.state.currentMapProvider!.getTilesUrl();
this._baseUrl = options.mapSettings.baseUrl;
}
getTileUrl(coords: Coords): string {

View File

@ -15,16 +15,12 @@
*/
import {LiveAtlasTileLayer, LiveAtlasTileLayerOptions} from "@/leaflet/tileLayer/LiveAtlasTileLayer";
import {useStore} from "@/store";
import {Util} from "leaflet";
// noinspection JSUnusedGlobalSymbols
export class Pl3xmapTileLayer extends LiveAtlasTileLayer {
constructor(options: LiveAtlasTileLayerOptions) {
const worldName = options.mapSettings.world.name,
baseUrl = useStore().state.currentMapProvider!.getTilesUrl();
super(`${baseUrl}${worldName}/{z}/{x}_{y}.png`, options);
super(`${options.mapSettings.baseUrl}${options.mapSettings.world.name}/{z}/{x}_{y}.png`, options);
options.zoomReverse = false;

View File

@ -311,10 +311,6 @@ export default class DynmapMapProvider extends MapProvider {
}
}
getTilesUrl(): string {
return this.config.tiles;
}
getMarkerIconUrl(icon: string): string {
return `${this.config.markers}_markers_/${icon}.png`;
}

View File

@ -33,7 +33,6 @@ export default abstract class MapProvider implements LiveAtlasMapProvider {
abstract loadServerConfiguration(): Promise<void>;
abstract createTileLayer(options: LiveAtlasTileLayerOptions): LiveAtlasTileLayer;
abstract getTilesUrl(): string;
abstract getMarkerIconUrl(icon: string): string;
async populateWorld(world: LiveAtlasWorldDefinition): Promise<void> {}

View File

@ -307,10 +307,6 @@ export default class OverviewerMapProvider extends MapProvider {
return new OverviewerTileLayer(options);
}
getTilesUrl(): string {
return this.config;
}
getMarkerIconUrl(icon: string): string {
return this.config + icon;
}

View File

@ -600,10 +600,6 @@ export default class Pl3xmapMapProvider extends MapProvider {
}
}
getTilesUrl(): string {
return `${this.config}tiles/`;
}
getMarkerIconUrl(icon: string): string {
return `${this.config}images/icon/registered/${icon}.png`;
}