import { Object as Object$1, Map } from 'ol'; import { EChartsCoreOption, ECharts } from 'echarts'; import { ProjectionLike } from 'ol/proj'; /** * @module ol/events/Event */ /** * @classdesc * Stripped down implementation of the W3C DOM Level 2 Event interface. * See https://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-interface. * * This implementation only provides `type` and `target` properties, and * `stopPropagation` and `preventDefault` methods. It is meant as base class * for higher level events defined in the library, and works with * {@link module:ol/events/Target~Target}. */ declare class BaseEvent { /** * @param {string} type Type. */ constructor(type: string); /** * @type {boolean} */ propagationStopped: boolean; /** * @type {boolean} */ defaultPrevented: boolean; /** * The event type. * @type {string} * @api */ type: string; /** * The event target. * @type {Object} * @api */ target: any; /** * Prevent default. This means that no emulated `click`, `singleclick` or `doubleclick` events * will be fired. * @api */ preventDefault(): void; /** * Stop event propagation. * @api */ stopPropagation(): void; } /** * bind function array * @param fns * @param context */ declare function bindAll(fns: string[] | number[], context: any): void; /** * remove node * @param node */ declare function removeNode(node: HTMLElement): HTMLElement | null; /** * Clone option data without dropping callback functions. * * ECharts options commonly contain formatter/renderItem callbacks, so JSON and * structuredClone are not suitable. Plain objects, arrays, Map/Set and binary * data are copied; other class instances are intentionally kept by reference. */ declare function clone(value: T, seen?: WeakMap): T; type Position = number[]; type PolygonCoordinates = Position[][]; type MultiPolygonCoordinates = PolygonCoordinates[]; interface EncodedGeometry { type?: string; coordinates?: unknown; encodeOffsets?: unknown; } interface EncodedGeoJSON { type?: string; UTF8Encoding?: boolean; UTF8Scale?: number; crs?: Record; features: Array<{ type?: string; geometry?: EncodedGeometry | null; properties?: Record | null; [key: string]: unknown; }>; [key: string]: unknown; } interface DecodedFeatureCollection { type: 'FeatureCollection'; crs: Record; features: Array<{ type: 'Feature'; properties: Record; geometry: { type: 'Polygon' | 'MultiPolygon'; coordinates: PolygonCoordinates | MultiPolygonCoordinates; }; }>; } /** * Decode ECharts-encoded GeoJSON without mutating the caller's data. * Polygon holes and MultiPolygon boundaries are preserved. */ declare function formatGeoJSON(json: EncodedGeoJSON): DecodedFeatureCollection; /** * An array of numbers representing an `xy`, `xyz` or `xyzm` coordinate. * Example: `[16, 48]`. */ type Coordinate = Array; /** Nullable helper */ type Nullable = T | null; /** Optional / possibly undefined helper */ type NoDef = T | undefined; /** Chart series types that need geographic → pixel conversion via `coordinates` */ type ConvertChartType = 'pie' | 'line' | 'bar'; /** * Layer runtime options. * Controls projection, overlay placement, redraw strategy and event polyfill. */ interface EChartsLayerOptions { /** Data source projection, default `EPSG:4326` */ source?: ProjectionLike; /** Target projection; defaults to the map view projection */ destination?: ProjectionLike; /** Call `echarts.clear()` before each redraw (costly) */ forcedRerender?: boolean; /** * Redraw on every map frame via `prerender` (keeps sync, more paints). * Option name kept for backward compatibility; OpenLayers 6+ uses `prerender` * instead of the removed `precompose` event. */ forcedPrecomposeRerender?: boolean; /** Hide chart while zooming */ hideOnZooming?: boolean; /** Hide chart while panning */ hideOnMoving?: boolean; /** Hide chart while rotating */ hideOnRotating?: boolean; /** * Suppress pie labels and label lines while their geographic anchor is * outside the map viewport. Prevents extremely long offscreen guide lines. * @default true */ hideOffscreenLabels?: boolean; /** * Series types converted by geographic `coordinates` field * instead of the registered OpenLayers coordinate system. */ convertTypes?: Array; /** Insert container as the first child of the overlay root */ insertFirst?: boolean; /** Use `ol-overlaycontainer-stopevent` instead of `ol-overlaycontainer` */ stopEvent?: boolean; /** * Proxy pointer events from the map to zrender. * Auto-enabled for OpenLayers <= 6.1.1; usually unnecessary on OL 7+. */ polyfillEvents?: boolean; [key: string]: unknown; } /** ECharts option accepted by the layer (standard option + optional series.coordinates) */ type ChartOptions = EChartsCoreOption & { series?: ChartSeriesOption | ChartSeriesOption[]; }; /** Series option extended with map `coordinates` used by pie/bar/line converters */ type ChartSeriesOption = Record & { type?: string; coordinates?: Coordinate | number[]; coordinateSystem?: string; animation?: boolean; center?: number[] | string[]; radius?: number | string | Array; label?: Record; labelLine?: Record; xAxisIndex?: number; yAxisIndex?: number; data?: unknown; }; /** Incremental append payload for `appendData` */ interface IncrementalDataItem { data: unknown[] | ArrayLike; seriesIndex: number; } /** Internal incremental cache entry */ interface IncrementalCacheItem extends IncrementalDataItem { index: number; } /** Coordinate system instance used by chart converters */ interface CoordinateSystemInstance { dataToPoint(data: number[]): number[]; pointToData?(pixel: number[]): number[]; containPoint?(point: number[]): boolean; getViewRect?(): { x: number; y: number; width: number; height: number; }; prepareCustoms?(): unknown; } /** Layer events dispatched through ol/Object */ type EChartsLayerEventType = 'load' | 'redraw' | 'change:size' | 'zoomstart' | 'zoomend' | 'change:rotation' | 'movestart' | 'moveend' | 'change:center'; interface EChartsLayerEvent { type: EChartsLayerEventType | string; source: unknown; value?: unknown; } declare class EChartsLayer extends Object$1 { static formatGeoJSON: typeof formatGeoJSON; static bind: (func: Function, context: any, ...args: any[]) => Function; static merge: (a: any, b: any) => any; static uuid: () => string; static bindAll: typeof bindAll; static arrayAdd: (array: any[], item: any) => any[]; static removeNode: typeof removeNode; static isObject: (value: any) => boolean; static clone: typeof clone; /** Default layer options (immutable snapshot) */ static defaultOptions: Readonly; private _chartOptions; private _isRegistered; private _incremental; private _coordinateSystem; private coordinateSystemId; private readonly _options; private _initEvent; private prevVisibleState; /** User-facing visibility; temporary hideOn* must not override this */ private _userVisible; /** True between map movestart and moveend */ private _isInteracting; private _interactionZoom; private _interactionRotation; private _isZooming; private _isRotating; $chart: Nullable; $container: NoDef; _map: NoDef; constructor(chartOptions?: NoDef>, options?: NoDef>, map?: NoDef); /** * append layer to map * @param map * @param forceIgnore skip `instanceof Map` check (for wrapped map objects) */ appendTo(map: Map, forceIgnore?: boolean): void; /** * get ol map */ getMap(): NoDef; /** * get echarts instance */ getECharts(): Nullable; /** * get layer options */ getOptions(): EChartsLayerOptions; /** * set map * @param map * @param forceIgnore skip `instanceof Map` check */ setMap(map: Map, forceIgnore?: boolean): void; /** * get echarts options */ getChartOptions(): NoDef>; /** * set echarts options and redraw * @param options */ setChartOptions(options?: ChartOptions): this; /** * append incremental series data * @param data * @param save keep in internal cache for redraw */ appendData(data: IncrementalDataItem, save?: boolean | undefined | null): this; /** * clear layer */ clear(keep?: boolean): void; /** * remove layer and release chart / DOM / listeners */ remove(): void; /** * show layer */ show(): void; private innerShow; /** * hide layer */ hide(): void; private innerHide; /** * check layer is visible */ isVisible(): boolean; /** * show loading bar */ showLoading(): void; /** * hide loading bar */ hideLoading(): void; /** * set zindex * @param zIndex */ setZIndex(zIndex: string | number): void; /** * get zindex */ getZIndex(): string | undefined; /** * set visible * from: https://github.com/sakitam-fdd/ol3Echarts/blob/3929ad72f562661ba3511d4d9e360dee5ac793c2/ * packages/ol-echarts/src/index.js * author: https://github.com/ChenGuanglin0924 * @param visible */ setVisible(visible: boolean): void; /** * render */ render(): void; /** * redraw echarts layer */ redraw(): void; /** * update container size * @param size */ updateViewSize(size?: Array): void; /** * handle map view resize */ private onResize; private onZoomStart; /** * handle zoom end events */ private onZoomEnd; /** Track resolution changes independently from MapBrowserEvent frame state. */ private onResolutionChange; /** * handle rotate start (from movestart when rotation is changing) */ private onDragRotateStart; /** * handle rotate / rotation property changes */ private onDragRotateEnd; /** * handle move start events */ private onMoveStart; /** * handle move end events */ private onMoveEnd; /** * on mouse click * @param event */ private onClick; /** * on mouse down * @param event */ private mouseDown; /** * mouse up * @param event */ private mouseUp; /** * mousemove 事件需要分两种情况处理: * 1. ol-overlaycontainer-stopevent 有高度, 则 propagation path 是 ol-viewport -> ol-overlaycontainer-stopevent. * 此时 ol-overlaycontainer 无法获得事件, 只能 mock 处理 * 2. ol-overlaycontainer-stopevent 没有高度, 则 propagation path 是 ol-viewport -> ol-overlaycontainer. 无需 mock * @param event */ private mouseMove; /** * handle center change */ private onCenterChange; /** * handle map change */ private handleMapChanged; /** * create container */ private createLayerContainer; /** * register events * @private */ private bindEvent; /** * un register events * @private */ private unBindEvent; /** * clear chart and redraw * @private */ private clearAndRedraw; /** * register map coordinate system and stamp series * @private */ private registerMap; /** * Convert series that use geographic `coordinates` (pie / bar / line grids) */ private convertData; /** * register coordinateSystem * @param options */ private getCoordinateSystem; /** * dispatch event * @param event */ dispatchEvent(event: object | BaseEvent | string): boolean | undefined; set(key: string, value: any, optSilent?: boolean): void; get(key: string): any; } export { EChartsLayer as default }; export type { ChartOptions, ChartSeriesOption, ConvertChartType, CoordinateSystemInstance, EChartsLayerEvent, EChartsLayerEventType, EChartsLayerOptions, IncrementalCacheItem, IncrementalDataItem, NoDef, Nullable };