@fleet-frontend/mower-maps
Version:
a mower maps in google maps
137 lines • 3.65 kB
TypeScript
import { SvgMapView } from './SvgMapView';
import { BoundaryData, UnitsType } from '../types/utils';
/**
* 边界标签管理器
* 专门处理边界标签的创建、定位和管理
*/
export declare class BoundaryLabelsManager {
private svgView;
private boundaryData;
private container;
private overlayDiv;
private globalClickHandler;
private unitType;
private language;
private onlyRead;
private currentExpandedBoundaryId;
private static readonly Z_INDEX;
private rotation;
constructor(svgView: SvgMapView, boundaryData: BoundaryData[], { unitType, language, onlyRead }: {
unitType: UnitsType;
language: string;
onlyRead: boolean;
});
/**
* 初始化容器
*/
private initializeContainer;
/**
* 设置全局点击监听器
*/
private setupGlobalClickHandler;
/**
* 提升边界标签层级到最高
*/
private elevateLabelZIndex;
/**
* 重置所有边界标签层级
*/
private resetLabelZIndex;
/**
* 设置叠加层div引用(用于坐标转换)
*/
setOverlayDiv(overlayDiv: HTMLElement): void;
/**
* 添加单个边界标签元素
*/
addElement(boundary: BoundaryData): HTMLElement | null;
/**
* 创建孤立子区域图标
*/
private createIsolatedIcon;
/**
* 展开标签
*/
private expandLabel;
/**
* 关闭其他展开的标签
*/
private collapseOtherLabels;
/**
* 添加所有边界标签元素
*/
addAllElements(): void;
/**
* 获取容器元素
*/
getElement(): HTMLElement | null;
/**
* 使用预计算的数据更新边界标签位置(优化版本)
* @param divWidth 叠加层div的宽度
* @param divHeight 叠加层div的高度
* @param viewBox SVG的viewBox信息
*/
updatePositionsWithPrecomputedData(divWidth?: number, divHeight?: number, viewBox?: {
x: number;
y: number;
width: number;
height: number;
}): void;
/**
* 计算边界中心点
*/
private calculateBoundaryCenter;
/**
* 计算多边形重心(地图坐标)
* 使用面积加权的重心算法
*/
private calculatePolygonCentroid;
/**
* 计算多边形重心的具体实现
* 使用面积加权的重心公式
*/
private computePolygonCentroid;
/**
* 回退方法:计算点的平均位置
*/
private calculateAverageCenter;
/**
* 将地图坐标转换为叠加层像素坐标
*/
private convertMapCoordinateToOverlayPixel;
/**
* 使用预计算数据将地图坐标转换为叠加层像素坐标(优化版本)
*/
private convertMapCoordinateToPixelWithPrecomputedData;
updateReadOnlyMode(onlyRead: boolean): void;
/**
* 更新边界数据
*/
updateBoundaryData(boundaryData: BoundaryData[]): void;
/**
* 销毁管理器
*/
destroy(): void;
/**
* 显示/隐藏标签
*/
setVisible(visible: boolean): void;
/**
* 根据ID获取特定边界的标签元素
*/
private getLabelElement;
/**
* 关闭所有展开的标签
*/
collapseAllLabels(): void;
/**
* 设置标签的交互状态
*/
setInteractive(interactive: boolean): void;
/**
* 设置标签旋转角度,使其与地图旋转相反,保持水平状态
* @param rotation 地图的旋转角度(度)
*/
setRotation(rotation: number): void;
}
//# sourceMappingURL=BoundaryLabelsManager.d.ts.map