mobility-toolbox-js
Version:
Toolbox for JavaScript applications in the domains of mobility and logistics.
82 lines (81 loc) • 3.21 kB
TypeScript
import MaplibreStyleLayer from './MaplibreStyleLayer';
import type { Map } from 'ol';
import type { MocoAPIOptions } from '../../api/MocoAPI';
import type { MocoDefinitions, MocoNotification } from '../../types';
import type { MaplibreStyleLayerOptions } from './MaplibreStyleLayer';
export declare const MOCO_SOURCE_ID = "moco";
export declare const MOCO_MD_LAYER_FILTER = "moco";
export declare const DEFAULT_GRAPH_MAPPING: {
1: string;
};
export type MocoLayerOptions = {
date?: Date;
loadAll?: boolean;
notifications?: MocoNotification[];
tenant?: string;
url?: string;
} & MaplibreStyleLayerOptions & Pick<MocoAPIOptions, 'apiKey' | 'url'>;
export type MocoNotificationToRender = {
features?: ({} & MocoDefinitions['AffectedLinesFeature'])[];
properties: {
iPublished?: boolean;
isActive?: boolean;
} & MocoDefinitions['FeatureCollectionProperties'];
} & Omit<MocoNotification, 'features' | 'properties'>;
/**
* An OpenLayers layer able to display data from the [geOps MOCO API](https://geops.com/de/solution/disruption-information).
*
* @example
* import { MaplibreLayer, MaplibreStyleLayer } from 'mobility-toolbox-js/ol';
*
* const maplibreLayer = new MaplibreLayer({
* apiKey: 'yourApiKey',
* });
*
* const layer = new MocoLayer({
* apiKey: 'yourApiKey',
* maplibreLayer: maplibreLayer,
* // date: new Date(),
* // loadAll: true,
* // notifications: undefined,
* // tenant: "geopstest",
* // url: 'https://moco.geops.io'
* });
*
* @see <a href="/example/ol-maplibre-style-layer">OpenLayers MaplibreStyle layer example</a>
* @extends {MaplibreStyleLayer}
* @private
*/
declare class MocoLayer extends MaplibreStyleLayer {
#private;
get apiKey(): string;
set apiKey(value: string);
get date(): Date;
set date(value: Date);
get loadAll(): boolean;
set loadAll(value: boolean);
get notifications(): MocoNotification[] | undefined;
set notifications(value: MocoNotification[]);
get tenant(): string | undefined;
set tenant(value: string);
get url(): string | undefined;
set url(value: string);
/**
* Constructor.
*
* @param {Object} options
* @param {string} options.apiKey Access key for [geOps APIs](https://developer.geops.io/). *
* @param {string} [options.date] The date to filter notifications. If not set, the current date is used.
* @param {boolean} [options.loadAll=true] If true, all active and published notifications will be loaded, otherwise only the notifications set in 'notifications' will be displayed.
* @param {MocoNotification[]} [options.notifications] The notifications to display. If not set and loadAll is true, all active and published notifications will be loaded.
* @param {string} [options.tenant] The SSO config to use to get notifications from.
* @param {string} [options.url] The URL of the [geOps MOCO API](https://geops.com/de/solution/disruption-information).
* @public
*/
constructor(options: MocoLayerOptions);
attachToMap(map: Map): void;
detachFromMap(): void;
onLoad(): void;
updateData(): Promise<true | undefined>;
}
export default MocoLayer;