mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-06-05 20:02:05 +08:00
Add ClusterProperties to Cluster
This commit is contained in:
6
types/supercluster/index.d.ts
vendored
6
types/supercluster/index.d.ts
vendored
@@ -80,14 +80,16 @@ declare namespace supercluster {
|
||||
cluster_id?: number;
|
||||
point_count?: number;
|
||||
point_count_abbreviated?: number;
|
||||
sum?: number;
|
||||
[key: string]: any;
|
||||
}
|
||||
interface Cluster extends Point {
|
||||
properties: any;
|
||||
properties: ClusterProperties;
|
||||
}
|
||||
interface TileFeature {
|
||||
type: 1;
|
||||
geometry: Array<[number, number]>;
|
||||
tags: any;
|
||||
tags: ClusterProperties;
|
||||
}
|
||||
interface Tile {
|
||||
features: TileFeatures;
|
||||
|
||||
@@ -1,19 +1,17 @@
|
||||
import * as supercluster from 'supercluster';
|
||||
import {Point, Points, Cluster, ClusterProperties} from 'supercluster';
|
||||
import {Point} from 'supercluster';
|
||||
|
||||
const point1: Cluster = {
|
||||
const point1: Point = {
|
||||
type: 'Feature',
|
||||
properties: {
|
||||
foo: 'fesf'
|
||||
},
|
||||
geometry: { type: 'Point', coordinates: [0, 0] }
|
||||
properties: {},
|
||||
geometry: { type: 'Point', coordinates: [10, 20] }
|
||||
};
|
||||
const point2: Point = {
|
||||
type: 'Feature',
|
||||
properties: {},
|
||||
geometry: { type: 'Point', coordinates: [0, 0] }
|
||||
geometry: { type: 'Point', coordinates: [20, 30] }
|
||||
};
|
||||
const points: Points = [point1, point2];
|
||||
const points = [point1, point2];
|
||||
|
||||
const index = supercluster({
|
||||
radius: 40,
|
||||
@@ -22,7 +20,8 @@ const index = supercluster({
|
||||
log: true
|
||||
});
|
||||
index.load(points);
|
||||
index.getClusters([-180, -85, 180, 85], 2);
|
||||
const clusters = index.getClusters([-180, -85, 180, 85], 2);
|
||||
clusters[0].properties.cluster_id;
|
||||
index.getTile(0, 0, 0);
|
||||
index.getChildren(0, 0);
|
||||
index.getLeaves(0, 0, 10, 5);
|
||||
|
||||
Reference in New Issue
Block a user