mirror of https://gitee.com/antv-l7/antv-l7
parent
2274154481
commit
4d401bb45a
|
@ -14,7 +14,6 @@ import {
|
||||||
import {
|
import {
|
||||||
bBoxToBounds,
|
bBoxToBounds,
|
||||||
extent,
|
extent,
|
||||||
lnglatDistance,
|
|
||||||
padBounds,
|
padBounds,
|
||||||
} from '@antv/l7-utils';
|
} from '@antv/l7-utils';
|
||||||
import {
|
import {
|
||||||
|
@ -59,8 +58,8 @@ export default class Source extends EventEmitter {
|
||||||
zoom: -99,
|
zoom: -99,
|
||||||
method: 'count',
|
method: 'count',
|
||||||
};
|
};
|
||||||
// 数据范围框的对角线长度
|
// 是否有效范围
|
||||||
private extentDiagonalLength: number;
|
private invalidExtent: boolean = false;
|
||||||
|
|
||||||
// 原始数据
|
// 原始数据
|
||||||
private originData: any;
|
private originData: any;
|
||||||
|
@ -180,7 +179,9 @@ export default class Source extends EventEmitter {
|
||||||
[-Infinity, -Infinity],
|
[-Infinity, -Infinity],
|
||||||
[Infinity, Infinity],
|
[Infinity, Infinity],
|
||||||
];
|
];
|
||||||
if (this.extentDiagonalLength > 0) {
|
|
||||||
|
if (!this.invalidExtent) {
|
||||||
|
|
||||||
newBounds = padBounds(bBoxToBounds(this.extent), bufferRatio);
|
newBounds = padBounds(bBoxToBounds(this.extent), bufferRatio);
|
||||||
}
|
}
|
||||||
return newBounds[0].concat(newBounds[1]);
|
return newBounds[0].concat(newBounds[1]);
|
||||||
|
@ -213,10 +214,8 @@ export default class Source extends EventEmitter {
|
||||||
this.data = sourceParser(this.originData, parser);
|
this.data = sourceParser(this.originData, parser);
|
||||||
// 计算范围
|
// 计算范围
|
||||||
this.extent = extent(this.data.dataArray);
|
this.extent = extent(this.data.dataArray);
|
||||||
this.extentDiagonalLength = lnglatDistance(
|
this.invalidExtent = this.extent[0]===this.extent[2] || this.extent[1]===this.extent[3]
|
||||||
[this.extent[0], this.extent[1]],
|
|
||||||
[this.extent[2], this.extent[3]],
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 数据统计
|
* 数据统计
|
||||||
|
|
Loading…
Reference in New Issue