rlayers
Version:
React Components for OpenLayers
52 lines • 2 kB
TypeScript
import React, { PropsWithChildren } from 'react';
import { Layer } from 'ol/layer';
import { Source } from 'ol/source';
import LayerRenderer from 'ol/renderer/Layer';
import BaseEvent from 'ol/events/Event';
import { ProjectionLike } from 'ol/proj';
import { RContextType } from '../context';
import { RlayersBase } from '../REvent';
/**
* @propsfor RLayerProps
*/
export interface RLayerProps extends PropsWithChildren<unknown> {
/** State of the layer */
visible?: boolean;
/** Opacity when blending */
opacity?: number;
/** zIndex */
zIndex?: number;
/** Minimum resolution below which the layer is not rendered */
minResolution?: number;
/** Maximum resolution above which the layer is not rendered */
maxResolution?: number;
/** Minimum zoom level below which the layer is not rendered */
minZoom?: number;
/** Maximum zoom level which the layer is not rendered */
maxZoom?: number;
/** Custom attributions string */
attributions?: string;
/** Initial tile cache size */
cacheSize?: number | undefined;
/** Wrap features around the antimeridian */
wrapX?: boolean | undefined;
/** A set of properties that can be accessed later by .get()/.getProperties() */
properties?: Record<string, unknown>;
/** The layer will be reprojected if its projection is different than the map */
projection?: ProjectionLike;
/** Called on every change */
onChange?: (this: RLayer<RLayerProps>, e: BaseEvent) => void;
}
/**
* Abstract base class for all layers, not meant to be used directly
*/
export default class RLayer<P extends RLayerProps> extends RlayersBase<P, Record<string, never>> {
ol: Layer<Source, LayerRenderer<any>>;
source: Source;
constructor(props: Readonly<P>, context?: React.Context<RContextType>);
protected refresh(prevProps?: P): void;
componentDidMount(): void;
componentWillUnmount(): void;
render(): JSX.Element;
}
//# sourceMappingURL=RLayer.d.ts.map