@tplc/business
Version:
41 lines (40 loc) • 868 B
TypeScript
import type { LightMapConfig, LocationRecord } from './types'
/**
* 使用 Haversine 公式计算两个经纬度坐标之间的距离
* @param lat1 起点纬度
* @param lng1 起点经度
* @param lat2 终点纬度
* @param lng2 终点经度
* @returns 距离(单位:米)
*/
export declare const getDistanceByLoc: (
lat1?: number,
lng1?: number,
lat2?: number,
lng2?: number,
) => number
/**
* 计算位置点相对于地图的百分比位置
*/
export declare const getPosition: (
item: LocationRecord,
mapConfig: LightMapConfig,
) => {
left: number
bottom: number
}
/**
* 获取点的完整样式
*/
export declare const getDotStyle: (
item: LocationRecord,
mapConfig: LightMapConfig,
) => {
left: string
bottom: string
width: string
height: string
backgroundColor: string
marginLeft: string
marginBottom: string
}