gisviewer-vue3-arcgis
Version:
在应用中引入私服的包, 项目根目录下 新建文件 .npmrc 在 .npmrc 中对包源进行配置:
66 lines (65 loc) • 1.79 kB
TypeScript
import type { default as OlMap } from 'ol/Map';
import { ICluster, IClusterLocation } from '../../../types';
export interface IPixelClusterOptions {
/** 聚合半径(像素),默认 120 */
clusterRadius?: number;
/** 最小聚合点数,默认 2 */
minClusterPoints?: number;
/** 最大聚合符号大小,默认 40 */
maxClusterSymbolSize?: number;
/** 最小聚合符号大小,默认 20 */
minClusterSymbolSize?: number;
}
/**
* 像素聚合计算器
* 基于屏幕像素距离进行点聚合
*/
export declare class PixelClusterCalculator {
private map;
private options;
private clusteredLocations;
constructor(map: OlMap, options?: IPixelClusterOptions);
/**
* 计算聚合结果
* @param locations 原始点位数组
* @returns 聚合结果
*/
calculate(locations: IClusterLocation[]): ICluster[];
/**
* 计算聚合符号大小
* @param clusters 聚合结果
* @returns 带有符号大小信息的聚合结果
*/
calculateSymbolSizes(clusters: ICluster[]): (ICluster & {
symbolSize?: number;
})[];
/**
* 更新配置
*/
updateOptions(options: Partial<IPixelClusterOptions>): void;
/**
* 获取当前配置
*/
getOptions(): Required<IPixelClusterOptions>;
/**
* 将地理坐标转换为屏幕坐标
*/
private locationToScreen;
/**
* 基于像素距离的聚合算法
*/
private doPixelCluster;
/**
* 获取指定点的邻近点
*/
private getNeighbors;
/**
* 计算两点之间的屏幕距离
*/
private getDistance;
/**
* 根据聚合结果创建聚合对象
*/
private createClusters;
}
export default PixelClusterCalculator;