mirror of https://gitee.com/antv-l7/antv-l7
chore: source private 2 protected
This commit is contained in:
parent
62f028b96e
commit
817d58fadd
|
@ -48,7 +48,7 @@ export default class Source extends EventEmitter implements ISource {
|
|||
public getSourceCfg() {
|
||||
return this.cfg;
|
||||
}
|
||||
public parser: IParserCfg | ITileParserCFG = { type: 'geojson' } ;
|
||||
public parser: IParserCfg | ITileParserCFG = { type: 'geojson' };
|
||||
public transforms: ITransform[] = [];
|
||||
public cluster: boolean = false;
|
||||
public clusterOptions: Partial<IClusterOptions> = {
|
||||
|
@ -62,18 +62,18 @@ export default class Source extends EventEmitter implements ISource {
|
|||
// 瓦片数据管理器
|
||||
public tileset: TilesetManager | undefined;
|
||||
// 是否有效范围
|
||||
private invalidExtent: boolean = false;
|
||||
protected invalidExtent: boolean = false;
|
||||
|
||||
private dataArrayChanged: boolean = false;
|
||||
protected dataArrayChanged: boolean = false;
|
||||
|
||||
// 原始数据
|
||||
private originData: any;
|
||||
private rawData: any;
|
||||
private cfg: Partial<ISourceCFG> = {
|
||||
protected originData: any;
|
||||
protected rawData: any;
|
||||
protected cfg: Partial<ISourceCFG> = {
|
||||
autoRender: true
|
||||
};
|
||||
|
||||
private clusterIndex: Supercluster;
|
||||
protected clusterIndex: Supercluster;
|
||||
|
||||
constructor(data: any | ISource, cfg?: ISourceCFG) {
|
||||
super();
|
||||
|
@ -81,9 +81,9 @@ export default class Source extends EventEmitter implements ISource {
|
|||
this.originData = data;
|
||||
this.initCfg(cfg);
|
||||
|
||||
this.init().then(()=>{
|
||||
this.init().then(() => {
|
||||
this.inited = true;
|
||||
this.emit('update',{
|
||||
this.emit('update', {
|
||||
type: 'inited'
|
||||
})
|
||||
});
|
||||
|
@ -142,7 +142,7 @@ export default class Source extends EventEmitter implements ISource {
|
|||
}
|
||||
|
||||
public getFeatureById(id: number): unknown {
|
||||
|
||||
|
||||
const { type = 'geojson', geometry } = this.parser as IParserCfg;
|
||||
if (type === 'geojson' && !this.cluster) {
|
||||
const feature =
|
||||
|
@ -151,7 +151,7 @@ export default class Source extends EventEmitter implements ISource {
|
|||
: 'null';
|
||||
const newFeature = cloneDeep(feature);
|
||||
|
||||
|
||||
|
||||
if (
|
||||
newFeature?.properties &&
|
||||
(this.transforms.length !== 0 || this.dataArrayChanged)
|
||||
|
@ -186,7 +186,7 @@ export default class Source extends EventEmitter implements ISource {
|
|||
},
|
||||
);
|
||||
this.dataArrayChanged = true;
|
||||
this.emit('update',{
|
||||
this.emit('update', {
|
||||
type: 'update'
|
||||
});
|
||||
}
|
||||
|
@ -202,9 +202,9 @@ export default class Source extends EventEmitter implements ISource {
|
|||
this.originData = data;
|
||||
this.dataArrayChanged = false;
|
||||
this.initCfg(options);
|
||||
|
||||
this.init().then(()=>{
|
||||
this.emit('update',{
|
||||
|
||||
this.init().then(() => {
|
||||
this.emit('update', {
|
||||
type: 'update'
|
||||
})
|
||||
});
|
||||
|
@ -220,7 +220,7 @@ export default class Source extends EventEmitter implements ISource {
|
|||
this.tileset?.destroy();
|
||||
}
|
||||
|
||||
private async processData() {
|
||||
protected async processData() {
|
||||
return await new Promise((resolve, reject) => {
|
||||
try {
|
||||
this.excuteParser();
|
||||
|
@ -233,7 +233,7 @@ export default class Source extends EventEmitter implements ISource {
|
|||
});
|
||||
}
|
||||
|
||||
private initCfg(option?: ISourceCFG) {
|
||||
protected initCfg(option?: ISourceCFG) {
|
||||
this.cfg = mergeWith(this.cfg, option, mergeCustomizer);
|
||||
const cfg = this.cfg;
|
||||
if (cfg) {
|
||||
|
@ -254,7 +254,7 @@ export default class Source extends EventEmitter implements ISource {
|
|||
}
|
||||
}
|
||||
|
||||
private async init() {
|
||||
protected async init() {
|
||||
this.inited = false;
|
||||
await this.processData();
|
||||
this.inited = true;
|
||||
|
@ -263,7 +263,7 @@ export default class Source extends EventEmitter implements ISource {
|
|||
/**
|
||||
* 数据解析
|
||||
*/
|
||||
private excuteParser(): void {
|
||||
protected excuteParser(): void {
|
||||
// 耗时计算测试
|
||||
// let t = new Date().getTime();
|
||||
// let c = 0
|
||||
|
@ -289,7 +289,7 @@ export default class Source extends EventEmitter implements ISource {
|
|||
this.extent[0] === this.extent[2] || this.extent[1] === this.extent[3];
|
||||
}
|
||||
|
||||
private setCenter(bbox: BBox) {
|
||||
protected setCenter(bbox: BBox) {
|
||||
this.center = [(bbox[0] + bbox[2]) / 2, (bbox[1] + bbox[3]) / 2];
|
||||
if (isNaN(this.center[0]) || isNaN(this.center[1])) {
|
||||
// this.center = [NaN, NaN] // Infinity - Infinity = NaN
|
||||
|
@ -301,7 +301,7 @@ export default class Source extends EventEmitter implements ISource {
|
|||
/**
|
||||
* 瓦片数据管理器
|
||||
*/
|
||||
private initTileset() {
|
||||
protected initTileset() {
|
||||
const { tilesetOptions } = this.data;
|
||||
if (!tilesetOptions) {
|
||||
return;
|
||||
|
@ -321,7 +321,7 @@ export default class Source extends EventEmitter implements ISource {
|
|||
/**
|
||||
* 数据统计
|
||||
*/
|
||||
private executeTrans() {
|
||||
protected executeTrans() {
|
||||
const trans = this.transforms;
|
||||
trans.forEach((tran: ITransform) => {
|
||||
const { type } = tran;
|
||||
|
@ -334,7 +334,7 @@ export default class Source extends EventEmitter implements ISource {
|
|||
/**
|
||||
* 数据聚合
|
||||
*/
|
||||
private initCluster() {
|
||||
protected initCluster() {
|
||||
if (!this.cluster) {
|
||||
return;
|
||||
}
|
||||
|
@ -343,7 +343,7 @@ export default class Source extends EventEmitter implements ISource {
|
|||
this.clusterIndex = cluster(this.data, clusterOptions);
|
||||
}
|
||||
|
||||
private caculClusterExtent(bufferRatio: number): any {
|
||||
protected caculClusterExtent(bufferRatio: number): any {
|
||||
let newBounds = [
|
||||
[-Infinity, -Infinity],
|
||||
[Infinity, Infinity],
|
||||
|
|
Loading…
Reference in New Issue