2020-09-09 20:06:53 +08:00
|
|
|
import { bBoxToBounds } from '@antv/l7-utils';
|
2019-10-08 19:20:12 +08:00
|
|
|
import Source from '../src/source';
|
2019-12-04 19:00:43 +08:00
|
|
|
import Point from './data/point';
|
2019-10-08 19:20:12 +08:00
|
|
|
import Polygon from './data/polygon';
|
|
|
|
|
|
|
|
describe('source constructor', () => {
|
|
|
|
it('source.constructor', () => {
|
|
|
|
const source = new Source(Polygon);
|
|
|
|
expect(source.extent).toEqual([
|
|
|
|
114.24373626708983,
|
|
|
|
30.55560910664438,
|
|
|
|
114.32424545288086,
|
|
|
|
30.60807236997211,
|
|
|
|
]);
|
|
|
|
});
|
2019-12-04 19:00:43 +08:00
|
|
|
it('source.cluster', () => {
|
|
|
|
const source = new Source(Point, {
|
|
|
|
cluster: true,
|
|
|
|
clusterOptions: {
|
|
|
|
method: 'sum',
|
|
|
|
field: 'mag',
|
|
|
|
},
|
|
|
|
});
|
2020-09-07 16:50:56 +08:00
|
|
|
source.updateClusterData(bBoxToBounds(source.extent), 2);
|
2019-12-04 19:00:43 +08:00
|
|
|
});
|
2019-10-08 19:20:12 +08:00
|
|
|
});
|