UNPKG

rlayers

Version:

React Components for OpenLayers

95 lines 3.76 kB
import React from 'react'; import { VectorTile as LayerVectorTile } from 'ol/layer'; import { RContextType } from '../context'; import { default as RLayerRaster, RLayerRasterProps } from './RLayerRaster'; import { RFeatureUIEvent } from '../RFeature'; import { RStyleLike } from '../style/RStyle'; import type * as MBTiles from 'ol-mbtiles'; import BaseEvent from 'ol/events/Event'; /** * @propsfor RLayerVectorTile */ export interface RLayerVectorMBTilesProps extends RLayerRasterProps { /** An URL for a remote MBTiles file */ url: string; /** * Use multiple SQLite workers, refer to the ol-mbtiles for more information * @default 4 */ workers?: number; /** * Use a specific HTTP backend, refer to the ol-mbtiles for more information * @default 'sync' */ backend?: 'sync' | 'shared'; /** * Cache size in KBytes to use for SQLite * @default 4096 */ sqlCacheSize?: number; /** * Maximum SQLite page size in bytes, reduce to 1024 if you have optimized your files * @default 4096 */ maxSqlPageSize?: number; /** * Optional list of layers to be retrieved * @default all */ layers?: string[]; /** * Style to be used for rendering the features * You can use a dynamic style, but the property value must stay the same * ie switching from a static OpenLayers style to a RefObject is not supported */ style?: RStyleLike; /** * Width of the frame around the viewport that shall be rendered too * so that the symbols, whose center is outside of the viewport, * but are partially inside, can be rendered * * this property currently does not support dynamic updates */ renderBuffer?: number; /** onClick handler for loaded features */ onClick?: (this: RLayerVectorMBTiles, e: RFeatureUIEvent) => boolean | void; /** onPointerMove handler for loaded features */ onPointerMove?: (this: RLayerVectorMBTiles, e: RFeatureUIEvent) => boolean | void; /** onPointerEnter handler for loaded features */ onPointerEnter?: (this: RLayerVectorMBTiles, e: RFeatureUIEvent) => boolean | void; /** onPointerLeave handler for loaded features */ onPointerLeave?: (this: RLayerVectorMBTiles, e: RFeatureUIEvent) => boolean | void; /** Called after each metadata change to signal that the metadata has been loaded */ onMetadataReady?: (this: RLayerVectorMBTiles, md: MBTiles.MBTilesVectorOptions & MBTiles.SQLOptions) => void; /** Called by OpenLayers when the layer is ready to start rendering */ onSourceReady?: (this: RLayerVectorMBTiles, e: BaseEvent) => void; } /** * A layer from a remote MBTiles vector source * * WARNING: Using this module requires manually installing `ol-mbtiles` * * `npm install ol-mbtiles` * * Be sure to read its own documentation for tips on how to improve * its performance (COOP/COEP, WASM compression, preloading...) * * It does not provide a vector layer context for JSX-declared `RFeature`s * and it is not compatible with RLayerVector * * Requires an `RMap` context */ export default class RLayerVectorMBTiles extends RLayerRaster<RLayerVectorMBTilesProps> { addon: Promise<typeof MBTiles>; metadata: Promise<MBTiles.MBTilesVectorOptions & MBTiles.SQLOptions>; ol: LayerVectorTile; source: MBTiles.MBTilesVectorSource; private abort; constructor(props: Readonly<RLayerVectorMBTilesProps>, context?: React.Context<RContextType>); protected createSource(): void; protected destroySource(): void; componentWillUnmount(): void; protected refresh(prevProps?: RLayerVectorMBTilesProps): void; render(): JSX.Element; } //# sourceMappingURL=RLayerVectorMBTiles.d.ts.map