UNPKG

@fleet-frontend/mower-maps

Version:

a mower maps in google maps

223 lines 7.23 kB
import React from 'react'; import { PathData } from './path'; import { MapData, UnstructMapData } from './map'; import { RobotStatus } from '../config'; import { RealTimeLocationType, RealTimePartitionType, RealTimeProcessType, RealTimeStatusType } from './realTime'; import { Point, UnitsType } from './utils'; import { DataType } from '@/processor/unified'; import { ClickEventType, EditMapInfo, ElementRecordParams, MobileEditMode } from '@/context/mapEdit'; import { DoodleItem } from '../render/svgEditMap/components/AddEntry/components/DoodleModal'; export interface DragState { x?: number; y?: number; rotation?: number; isDragging?: boolean; isRotating?: boolean; } export interface DragCallbacks { onDragStart?: (state: DragState) => void; onDragMove?: (state: DragState) => void; onDragEnd?: (state: DragState) => void; } export interface BaseConfig { lineWidth?: number; lineColor?: string; fillColor?: string; opacity?: number; } export interface BoundaryStyle extends BaseConfig { mowingLineColor?: string; } export interface ObstacleStyle extends BaseConfig { } export interface VisionOffStyle extends BaseConfig { } export interface DoodleStyle extends BaseConfig { } export interface AntennaStyle extends BaseConfig { radius?: number; } export interface ChargingPileStyle extends BaseConfig { radius?: number; } export interface ChannelStyle extends BaseConfig { bottomLineWidth?: number; bottomLineColor?: string; bottomLineOpacity?: number; } /** * 元素样式类型定义 */ export interface PathStyle extends BaseConfig { edgeLineColor?: string; transLineColor?: string; mowingLineColor?: string; mowedLineColor?: string; } export interface MapConfig { [DataType.BOUNDARY]?: BoundaryStyle; [DataType.VISION_OFF]?: VisionOffStyle; [DataType.OBSTACLE]?: ObstacleStyle; [DataType.CHARGING_PILE]?: ChargingPileStyle; [DataType.DOODLE]?: DoodleStyle; [DataType.PATH]?: PathStyle; [DataType.CHANNEL]?: ChannelStyle; [DataType.ANTENNA]?: AntennaStyle; } export interface RendererPathConfig { lineWidth?: number; showEdgePaths?: boolean; showTransPaths?: boolean; showMowingPaths?: boolean; edgePathColor?: string; transPathColor?: string; mowingPathColor?: string; edgePathOpacity?: number; transPathOpacity?: number; mowingPathOpacity?: number; } export interface AntennaConfig { id: number; location_x: number; location_y: number; pn: string; status: number; timestamp: string; type: number; valid: number; version: string; } export interface MowerPositionConfig { postureTheta: number; postureX: number; postureY: number; lastPostureTheta?: number; lastPostureX?: number; lastPostureY?: number; vehicleState?: RobotStatus; } export interface MowerPartitionInfo { partitionIds: number[]; time: number; } export type RealTimeData = RealTimeLocationType | RealTimeProcessType | RealTimePartitionType | RealTimeStatusType; export declare enum PlatformType { WEB = "web", H5 = "h5" } export declare enum CheckObstaclePointErrorType { OBSTACLE_INTERSECT = "obstacle_intersect", DOODLE_INTERSECT = "doodle_intersect", DOODLE_DISTANCE_TOO_CLOSE = "doodle_distance_too_close", BOUNDARY_NOT_IN_BOUNDARY = "boundary_not_in_boundary", POINT_IN_OBSTACLE = "point_in_obstacle", MAP_NOT_EXIST = "map_not_exist", GET_POINT_FAILED = "get_point_failed", COMMON_ERROR = "common_error" } export declare enum CheckDoodleErrorType { NO_DOODLE_SELECTED = "no_doodle_selected", NO_MOVABLE_POINTS = "no_movable_points", DOODLE_NOT_IN_BOUNDARY = "doodle_not_in_boundary", DOODLE_DISTANCE_TOO_CLOSE = "doodle_distance_too_close", DOODLE_INTERSECT = "doodle_intersect", DOODLE_DISTANCE_TOO_CLOSE_TO_OTHER_ELEMENT = "doodle_distance_too_close_to_other_element" } export interface MowerIconConfig { mapImgUrl: string; mapDisabledUrl: string; mapNoPositionUrl: string; } export interface MowerMapRendererProps { sn?: string; /** * 当前使用的平台:web/h5 * @default PlatformType.WEB */ platform?: PlatformType; mowerIconConfig?: MowerIconConfig; edger?: boolean; unitType?: UnitsType; language?: string; onlyRead?: boolean; mapConfig?: MapConfig; modelType: string; mapRef?: google.maps.Map; mapJson?: MapData; pathJson?: PathData; realTimeData?: RealTimeData[]; antennaConfig?: AntennaConfig[]; onMapLoad?: (elementCount: number) => void; onPathLoad?: (elementCount: number) => void; onZoomChange?: (zoomLevel: number) => void; onError?: (error: string) => void; className?: string; style?: React.CSSProperties; googleMapInstance?: any; dragMap?: boolean; canRotateMap?: boolean; editMap?: boolean; dragCallbacks?: DragCallbacks; defaultTransform?: { x?: number; y?: number; rotation?: number; }; debug?: boolean; doodleList?: DoodleItem[]; unStructMapData?: UnstructMapData; disabledObstacles?: boolean; onHandleEnterRecord?: (params: ElementRecordParams) => Promise<void>; onHandleCompleteRecord?: () => Promise<void>; onHandleStopRecord?: () => Promise<void>; onHandleDeleteElement?: (params: ElementRecordParams) => Promise<void>; onSaveBoundaryData?: () => Promise<void>; onSaveMap?: () => Promise<void>; onEditInfoMapChange?: (editMapInfo: EditMapInfo) => void; onUpdateBoundary?: (params: ElementRecordParams) => Promise<void>; heightOptions?: number[]; globalHeight?: number; onHandleEvent?: (type: ClickEventType, data: any) => void; onSelectElement?: (type: DataType) => void; } export interface MowerMapRendererRef { setZoom?: (zoom: number) => void; getZoom?: () => number; resetView?: () => void; clear?: () => void; getSvgElement?: () => SVGSVGElement | null; fitToView?: () => void; getOverlay?: () => any; toggleOverlay?: (visible: boolean) => void; setEditMode?: (enabled: boolean) => void; getEditMode?: () => boolean; getCurrentDragState?: () => DragState | null; getElementCount?: () => number; getPathCount?: () => number; isGoogleMapsReady?: () => boolean; resetToDefaultTransform?: () => void; updateEditMapInfo?: (editMapInfo: EditMapInfo) => void; resetEditMapInfo?: () => void; getEditMapInfo?: () => EditMapInfo; addCreateObstaclePoint?: () => { isValid?: boolean; reason?: string; code?: CheckObstaclePointErrorType; }; undoCreateObstaclePoint?: () => void; getCreateObstaclePoints?: () => Point[]; getCreateObstaclePointCount?: () => number; addVisionOffPoint?: () => void; enterVisionOffEditMode?: (mode: MobileEditMode) => void; addHistory?: (history: any) => void; redo?: () => void; undo?: () => void; clearHistory?: () => void; addDoodle?: (doodle: DoodleItem) => void; checkDoodle?: () => { isValid: boolean; reason?: string; code?: CheckDoodleErrorType; }; } //# sourceMappingURL=renderer.d.ts.map