maplibre-gl-indoor
Version:
A MapLibre plugin to visualize multi-level buildings
137 lines (131 loc) • 4.27 kB
TypeScript
// Generated by dts-bundle-generator v9.5.1
import { BBox, FeatureCollection, Geometry } from 'geojson';
import { ExpressionSpecification, IControl, LayerSpecification, Listener, Map as Map$1 } from 'maplibre-gl';
export declare class IndoorMap {
beforeLayerId?: string;
bounds: BBox;
defaultLevel: number;
geojson: FeatureCollection<Geometry>;
layers: Array<LayerSpecification>;
layersToHide: Array<string>;
levelsRange: LevelsRange;
showFeaturesWithEmptyLevel: boolean;
constructor(bounds: BBox, geojson: FeatureCollection<Geometry>, layers: Array<LayerSpecification>, levelsRange: LevelsRange, layersToHide: Array<string>, defaultLevel: number, showFeaturesWithEmptyLevel: boolean, beforeLayerId?: string);
static fromGeojson(geojson: FeatureCollection<Geometry>, options?: IndoorMapOptions): IndoorMap;
}
export type SavedFilter = {
filter: ExpressionSpecification;
layerId: string;
};
/**
* Manage indoor levels
* @param {Map} map the Maplibre map
*/
export declare class IndoorLayer {
_indoorMaps: Array<IndoorMap>;
_level: Level | null;
_map: Map$1;
_mapLoadedPromise: Promise<void>;
_previousSelectedLevel: Level | null;
_previousSelectedMap: IndoorMap | null;
_savedFilters: Array<SavedFilter>;
_selectedMap: IndoorMap | null;
_updateMapPromise: Promise<void>;
constructor(map: Map$1);
_addLayerForFiltering(layer: LayerSpecification, beforeLayerId?: string): void;
_closestMap(): IndoorMap | null;
_removeLayerForFiltering(layerId: string): void;
/**
* ***********************
* Handle level change
* ***********************
*/
_updateFiltering(): void;
_updateSelectedMap(indoorMap: IndoorMap | null): void;
_updateSelectedMapIfNeeded(): Promise<void>;
addLayerForFiltering(layer: LayerSpecification, beforeLayerId?: string): void;
addMap(map: IndoorMap): Promise<void>;
/**
* **************
* Handle maps
* **************
*/
getLevel(): Level | null;
getSelectedMap(): IndoorMap | null;
removeLayerForFiltering(layerId: string): void;
removeMap(map: IndoorMap): Promise<void>;
setLevel(level: Level | null, fireEvent?: boolean): void;
}
export type IndoorMapEvent = "indoor.level.changed" | "indoor.map.loaded" | "indoor.map.unloaded";
export type IndoorMapOptions = {
beforeLayerId?: string;
defaultLevel?: number;
layers?: Array<LayerSpecification>;
layersToHide?: Array<string>;
showFeaturesWithEmptyLevel?: boolean;
};
export type Level = number;
export type LevelsRange = {
max: Level;
min: Level;
};
export type MapGLWithIndoor = MaplibreMapWithIndoor;
export type MaplibreMapWithIndoor = Map$1 & {
indoor: IndoorLayer;
off(type: IndoorMapEvent, listener: Listener): Map$1;
on(type: IndoorMapEvent, listener: Listener): Map$1;
};
export function addIndoorTo(map: Map$1): MapGLWithIndoor;
/**
* Creates a indoor control with floors buttons
* @implements {IControl}
*/
export declare class IndoorControl implements IControl {
_container?: HTMLElement;
_indoor?: IndoorLayer;
_indoorMap: IndoorMap | null;
_levelsButtons: Array<HTMLElement>;
_map?: MapGLWithIndoor;
_selectedButton: HTMLElement | null;
constructor();
_createLevelButton(container: HTMLElement, level: Level): HTMLButtonElement;
_onContextMenu(e: Event): void;
_onLevelChanged: ({ level }: {
level: Level | null;
}) => void;
_onMapLoaded: ({ indoorMap }: {
indoorMap: IndoorMap;
}) => void;
_onMapUnLoaded: () => void;
_setSelected(level: Level | null): void;
_updateNavigationBar(): void;
onAdd(map: Map$1 | MapGLWithIndoor): HTMLDivElement;
onRemove(): void;
}
export type RemoteMap = {
indoorMap?: IndoorMap;
name: string;
url: string;
};
export declare class MapServerHandler {
downloadedBounds: BBox | null;
indoorMapOptions?: IndoorMapOptions;
loadMapsPromise: Promise<void>;
map: MapGLWithIndoor;
remoteMapsDownloaded: RemoteMap[];
serverUrl: string;
private constructor();
static manage(server: string, map: Map$1, indoorMapOptions?: IndoorMapOptions): MapServerHandler;
private addCustomMap;
private loadMapsIfNecessary;
private loadMapsInBounds;
private removeCustomMap;
}
declare const _default: {
DefaultLayers: import("maplibre-gl").LayerSpecification[];
defaultLayers: import("maplibre-gl").LayerSpecification[];
};
export {
_default as DefaultStyle,
};
export {};