/** * This file is part of the NocoBase (R) project. * Copyright (c) 2020-2024 NocoBase Co., Ltd. * Authors: NocoBase Team. * * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License. * For more information, please refer to: https://www.nocobase.com/agreement. */ /// import React from 'react'; import { MapEditorType } from '../../../../shared/types'; export type OverlayOptions = google.maps.PolygonOptions & google.maps.MarkerOptions & google.maps.PolylineOptions; type GoogleMapsOverlay = google.maps.Marker | google.maps.Polygon | google.maps.Polyline | google.maps.Circle; export type GoogleMapsDrawingMode = 'marker' | 'polygon' | 'polyline' | 'circle' | null; type GoogleMapsOverlayCompleteEvent = { type: Exclude; overlay: GoogleMapsOverlay; }; type OverlayCompleteListener = (event: GoogleMapsOverlayCompleteEvent) => void; export declare const getDrawingMode: (type: MapEditorType) => "polygon" | "circle" | "marker" | "polyline"; export declare class GoogleMapsDrawingManager { private readonly listeners; private readonly mapListeners; private readonly options; private drawingMode; private draftOverlay; private draftPath; private circleCenter; private lastClickPosition; constructor(options: OverlayOptions & { drawingMode?: GoogleMapsDrawingMode; map?: google.maps.Map; }); addListener(eventName: 'overlaycomplete', listener: OverlayCompleteListener): { remove: () => void; }; setDrawingMode(mode: GoogleMapsDrawingMode): void; handleClick(event: google.maps.MapMouseEvent): void; handleOverlayClick(event: google.maps.MapMouseEvent, fallbackPosition?: google.maps.LatLng | null): void; handleDoubleClick(): void; unbindAll(): void; completeDrawing(): void; private bindMapEvents; private clearMapEvents; private resetDraft; private handlePositionClick; private shouldSkipDuplicateClick; private handlePathClick; private handleCircleClick; private updatePreview; private updatePath; private updateCircle; private completePathOverlay; private completeCircleOverlay; private emitComplete; } export interface GoogleMapsCompProps { value?: any; onChange?: (value: number[]) => void; disabled?: boolean; mapType: string; /** * only ReadPretty */ readonly: string; zoom: number; type: MapEditorType; style?: React.CSSProperties; overlayCommonOptions?: OverlayOptions; block?: boolean; height?: number; } export interface GoogleMapForwardedRefProps { setOverlay: (t: MapEditorType, v: any, o?: OverlayOptions) => google.maps.MVCObject; getOverlay: (t: MapEditorType, v: any, o?: OverlayOptions) => google.maps.MVCObject; setFitView: (overlays: google.maps.MVCObject[]) => void; createDraw: (onlyCreate?: boolean, additionalOptions?: OverlayOptions) => GoogleMapsDrawingManager; map: google.maps.Map; overlay: google.maps.MVCObject; drawingManager: GoogleMapsDrawingManager; errMessage?: string; } export declare const GoogleMapsCom: React.ForwardRefExoticComponent>; export {};