import { Layer, LayerOptions, TileLayer, TileLayerOptions } from '.'; import { TileDataSource } from '../datasources'; import { MBVectorTileDecoder, VectorTileDecoder } from '../vectortiles'; import { ClickType, DefaultLatLonKeys, GenericMapPos, MapPos } from '../core'; import { ClusterElementBuilder } from './cluster'; import { VectorElement } from '../vectorelements'; import { Projection } from '../projections'; import { Geometry } from '../geometry'; import { PointStyleBuilder } from '../vectorelements/point'; import { VectorDataSource } from '../datasources/vector'; export enum VectorTileRenderOrder { HIDDEN, LAYER, LAST } export enum VectorElementDragResult { IGNORE, STOP, MODIFY, DELETE } export interface VectorTileEventData { clickType: ClickType; layer: BaseVectorTileLayer; feature: any; // geojson object featureId: number; featureData: { [k: string]: string }; featureGeometryPosIndex: number; featureLayerName: string; position: GenericMapPos; featurePosition: GenericMapPos; featureGeometry: Geometry | any; } export interface VectorElementEventData { clickType: ClickType; layer: BaseVectorLayer; native: any; // featureId: number; // featureData: { [k: string]: string }; // featureLayerName: string; metaData: { [k: string]: string }; element: VectorElement; position: GenericMapPos; elementPos: GenericMapPos; } export interface VectorElementDragInfo {} export interface VectorTileEventListener { onVectorTileClicked(info: VectorTileEventData): boolean; } export interface VectorElementEventListener { onVectorElementClicked(info: VectorElementEventData): boolean; } export interface VectorEditEventListener { onElementModify(param0: VectorElement, param1: Geometry): void; onElementDeselected(param0: VectorElement): void; onElementSelect(param0: VectorElement): boolean; onSelectDragPointStyle(param0: VectorElement, style: any): PointStyleBuilder; onDragMove(param0: VectorElementDragInfo): VectorElementDragResult; onDragEnd(param0: VectorElementDragInfo): VectorElementDragResult; onDragStart(param0: VectorElementDragInfo): VectorElementDragResult; onElementDelete(param0: VectorElement): void; } export interface VectorLayerOptions extends LayerOptions { dataSource: VectorDataSource; } export interface VectorTileLayerOptions extends TileLayerOptions { dataSource?: TileDataSource; decoder?: VectorTileDecoder; /** * Sets the relative layer blending speed. * Default is 1.0. Use zero or negative values to disable blending. */ layerBlendingSpeed?: number; /** * Sets the relative label blending speed. * Default is 1.0. Use zero or negative values to disable blending. */ labelBlendingSpeed?: number; /** * display order of the labels. Default is VECTOR_TILE_RENDER_ORDER_LAYER */ clickRadius?: number; /** * the vector tile cache capacity in bytes. Tile cache is the primary storage for vector data, * all tiles contained within the cache are stored as uncompressed vertex buffers and can immediately be * drawn to the screen. Setting the cache size too small may cause artifacts, such as disappearing tiles. * The more tiles are visible on the screen, the larger this cache should be. * The default is 10MB, which should be enough for most use cases with preloading enabled. If preloading is * disabled, the cache size should be reduced by the user to conserve memory. */ tileCacheCapacity?: number; /** * display order of the labels. Default is VECTOR_TILE_RENDER_ORDER_LAYER */ labelRenderOrder?: VectorTileRenderOrder; /** * Sets the current display order of the buildings. * Default is VECTOR_TILE_RENDER_ORDER_LAYER. */ buildingRenderOrder?: VectorTileRenderOrder; /** * Sets the renderer layer filter. The filter is given as ECMA regular expression that is applied to qualified layer names. * If non-empty, then only layers that pass the filter are rendered. */ rendererLayerFilter?: string; /** * Sets the click handler layer filter. The filter is given as ECMA regular expression that is applied to qualified layer names. * If non-empty, then only layers that pass the filter are tested when handling clicks. */ clickHandlerLayerFilter?: string; } export interface ClusteredVectorLayerLayerOptions extends VectorTileLayerOptions { dataSource: VectorDataSource; builder: ClusterElementBuilder; minimumClusterDistance?: number; maximumClusterZoom?: number; animatedClusters?: boolean; } export abstract class BaseVectorTileLayer extends TileLayer { /** * Sets the relative layer blending speed. * Default is 1.0. Use zero or negative values to disable blending. */ layerBlendingSpeed: number; /** * Sets the relative label blending speed. * Default is 1.0. Use zero or negative values to disable blending. */ labelBlendingSpeed: number; /** * Sets the click radius of vector tile features. * The click radius is applied as an extra buffer to the vector tile features to make clicking on small features less sensitive. * Units are screen density independent pixels (DP or DIP). *The default value is 4. */ clickRadius: number; /** * display order of the labels. Default is VECTOR_TILE_RENDER_ORDER_LAYER */ labelRenderOrder: VectorTileRenderOrder; /** * Sets the current display order of the buildings. * Default is VECTOR_TILE_RENDER_ORDER_LAYER. */ buildingRenderOrder: VectorTileRenderOrder; /** * the vector tile cache capacity in bytes. Tile cache is the primary storage for vector data, * all tiles contained within the cache are stored as uncompressed vertex buffers and can immediately be * drawn to the screen. Setting the cache size too small may cause artifacts, such as disappearing tiles. * The more tiles are visible on the screen, the larger this cache should be. * The default is 10MB, which should be enough for most use cases with preloading enabled. If preloading is * disabled, the cache size should be reduced by the user to conserve memory. */ tileCacheCapacity: number; /** * Sets the renderer layer filter. The filter is given as ECMA regular expression that is applied to qualified layer names. * If non-empty, then only layers that pass the filter are rendered. */ rendererLayerFilter: string; /** * Sets the click handler layer filter. The filter is given as ECMA regular expression that is applied to qualified layer names. * If non-empty, then only layers that pass the filter are tested when handling clicks. */ clickHandlerLayerFilter: string; setLabelRenderOrder(order: VectorTileRenderOrder): void; setBuildingRenderOrder(order: VectorTileRenderOrder); setVectorTileEventListener(listener: VectorTileEventListener, projection?: Projection, nativeClass?: any): void; getTileDecoder(): MBVectorTileDecoder; } export abstract class BaseVectorLayer extends Layer { setVectorElementEventListener(listener: VectorElementEventListener, projection?: Projection, nativeClass?: any): void; } export class VectorLayer extends BaseVectorLayer {} export class EditableVectorLayer extends VectorLayer {} export class VectorTileLayer extends BaseVectorTileLayer {} export class ClusteredVectorLayer extends BaseVectorLayer { minimumClusterDistance?: number; maximumClusterZoom?: number; animatedClusters?: boolean; expandCluster(element: VectorElement, px: number); }