rlayers
Version:
React Components for OpenLayers
92 lines • 3.82 kB
TypeScript
import React, { JSX } from 'react';
import { VectorTile as LayerVectorTile } from 'ol/layer';
import { VectorTile as SourceVectorTile } from 'ol/source';
import type { Options } from 'ol/source/VectorTile';
import FeatureFormat from 'ol/format/Feature';
import { FeatureLike } from 'ol/Feature';
import RenderFeature from 'ol/render/Feature';
import { RContextType } from '../context';
import { default as RLayer, RLayerProps } from './RLayer';
import { RFeatureUIEvent } from '../RFeature';
import { OLEvent } from '../REvent';
import { RStyleLike } from '../style/RStyle';
/**
* @propsfor RLayerVectorTile
*/
export interface RLayerVectorTileProps<F extends FeatureLike = RenderFeature> extends RLayerProps {
/** URL for the tiles, normal {x}{y}{z} convention applies */
url: 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;
/**
* Vector tile format
*
* this property currently does not support dynamic updates
*/
format: FeatureFormat<F>;
/**
* 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;
extent?: Options<F>['extent'];
overlaps?: Options<F>['overlaps'];
state?: Options<F>['state'];
tileClass?: Options<F>['tileClass'];
tileSize?: Options<F>['tileSize'];
tileGrid?: Options<F>['tileGrid'];
tileLoadFunction?: Options<F>['tileLoadFunction'];
tileUrlFunction?: Options<F>['tileUrlFunction'];
transition?: Options<F>['transition'];
zDirection?: Options<F>['zDirection'];
/** onClick handler for loaded features */
onClick?: (this: RLayerVectorTile<F>, e: RFeatureUIEvent<F>) => boolean | void;
/** onPointerMove handler for loaded features */
onPointerMove?: (this: RLayerVectorTile<F>, e: RFeatureUIEvent<F>) => boolean | void;
/** onPointerEnter handler for loaded features */
onPointerEnter?: (this: RLayerVectorTile<F>, e: RFeatureUIEvent<F>) => boolean | void;
/** onPointerLeave handler for loaded features */
onPointerLeave?: (this: RLayerVectorTile<F>, e: RFeatureUIEvent<F>) => boolean | void;
}
/**
* A vector tile layer
*
* Supports loading of features from vector tile servers.
*
* Only the handlers can be dynamically modified.
*
* Requires an `RMap` context.
*
* It does not provide a vector layer context for JSX-declared `RFeature`s
* and it is not compatible with RLayerVector.
*
* Since 3.0, RLayerVectorTile uses OpenLayers light-weight RenderFeatures by default.
*
* @example
* <RLayerVectorTile url={url} format={new MVT()} />
*
* If you need advanced feature functions, you can switch to using full blown OpenLayers features
* by using a `format` parser that returns Features and, if using TSX, specifying the right
* generic argument.
*
* @example
* <RLayerVectorTile<Feature> url={url} format={new MVT({featureClass: Feature})} />
*/
export default class RLayerVectorTile<F extends FeatureLike = RenderFeature> extends RLayer<RLayerVectorTileProps<F>> {
ol: LayerVectorTile<SourceVectorTile<F>, F>;
source: SourceVectorTile<F>;
static contextType: React.Context<RContextType>;
constructor(props: Readonly<RLayerVectorTileProps<F>>);
protected incrementHandlers(ev: OLEvent): void;
protected decrementHandlers(ev: OLEvent): void;
protected refresh(prevProps?: RLayerVectorTileProps<F>): void;
render(): JSX.Element;
}
//# sourceMappingURL=RLayerVectorTile.d.ts.map