Skip to content

Commit

Permalink
Make bucketLayerIDs an array
Browse files Browse the repository at this point in the history
  • Loading branch information
jfirebaugh committed Jul 3, 2017
1 parent 9ed259e commit 83fb52d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
6 changes: 3 additions & 3 deletions src/data/feature_index.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class FeatureIndex {
grid: Grid;
featureIndexArray: FeatureIndexArray;
rawTileData: any;
bucketLayerIDs: { [string]: Array<string> };
bucketLayerIDs: Array<Array<string>>;
paintPropertyStatistics: PaintPropertyStatistics;
coord: TileCoord;
overscaling: number;
Expand Down Expand Up @@ -295,8 +295,8 @@ class FeatureIndex {
}

hasLayer(id: string) {
for (const index in this.bucketLayerIDs) {
for (const layerID of this.bucketLayerIDs[index]) {
for (const layerIDs of this.bucketLayerIDs) {
for (const layerID of layerIDs) {
if (id === layerID) return true;
}
}
Expand Down
9 changes: 3 additions & 6 deletions src/source/worker_tile.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,9 @@ class WorkerTile {
const sourceLayerCoder = new DictionaryCoder(Object.keys(data.layers).sort());

const featureIndex = new FeatureIndex(this.coord, this.overscaling);
featureIndex.bucketLayerIDs = {}; // Should this be an array?
featureIndex.bucketLayerIDs = [];

const buckets = {};
let bucketIndex = 0;

const options = {
featureIndex: featureIndex,
Expand Down Expand Up @@ -115,17 +114,15 @@ class WorkerTile {
}

const bucket = buckets[layer.id] = layer.createBucket({
index: bucketIndex,
index: featureIndex.bucketLayerIDs.length,
layers: family,
zoom: this.zoom,
overscaling: this.overscaling,
collisionBoxArray: this.collisionBoxArray
});

bucket.populate(features, options);
featureIndex.bucketLayerIDs[String(bucketIndex)] = family.map((l) => l.id);

bucketIndex++;
featureIndex.bucketLayerIDs.push(family.map((l) => l.id));
}
}

Expand Down

0 comments on commit 83fb52d

Please sign in to comment.