@fleet-frontend/mower-maps
Version:
a mower maps in google maps
110 lines • 2.64 kB
TypeScript
/**
* 基于第三方库的 SVG 解析工具
* 提供类似 Android SvgParserNative.parseSvg 的功能
*/
export interface Point {
x: number;
y: number;
}
export interface SvgParseResult {
elements: number[][][];
points: Point[];
width: number;
height: number;
originalContent: string;
bounds: {
x: number;
y: number;
width: number;
height: number;
};
pathCount: number;
}
export declare class SvgParserNative {
private static cache;
/**
* 解析 SVG 内容,类似 Android 的 SvgParserNative.parseSvg
* @param content SVG 字符串内容
* @param precision 点坐标精度,默认为 1
* @returns 解析结果
*/
static parseSvg(content: string, precision?: number): SvgParseResult;
/**
* 使用浏览器原生 API 解析 SVG(回退方案)
*/
private static parseWithNativeAPI;
/**
* 提取 SVG 尺寸信息(第三方库版本)
*/
private static extractDimensions;
/**
* 提取 SVG 尺寸信息(原生 API 版本)
*/
private static extractNativeDimensions;
/**
* 解析长度值
*/
private static parseLength;
/**
* 提取所有图形元素的点坐标
*/
private static extractAllPoints;
/**
* 将DOM元素转换为数据格式
*/
private static convertDOMElementToData;
/**
* 从 path 元素提取点坐标(使用浏览器原生 API)
*/
private static extractPathPoints;
/**
* 备用路径解析方法(使用第三方库)
*/
private static extractPathPointsFallback;
/**
* 提取椭圆点坐标
*/
private static extractEllipsePoints;
/**
* 提取直线点坐标
*/
private static extractLinePoints;
/**
* 提取多边形/折线点坐标
*/
private static extractPolyPoints;
/**
* 采样二次贝塞尔曲线
*/
private static sampleQuadraticBezier;
/**
* 采样弧线
*/
private static sampleArc;
/**
* 提取原生 API 点坐标
*/
private static extractNativePoints;
/**
* 采样三次贝塞尔曲线
*/
private static sampleCubicBezier;
/**
* 提取矩形点坐标
*/
private static extractRectPoints;
/**
* 提取圆形点坐标
*/
private static extractCirclePoints;
/**
* 清除缓存
*/
static clearCache(): void;
/**
* 获取缓存大小
*/
static getCacheSize(): number;
}
export default SvgParserNative;
//# sourceMappingURL=svgParserNative.d.ts.map