Skip to content

Commit

Permalink
Eliminate Bucket#sourceLayerIndex
Browse files Browse the repository at this point in the history
  • Loading branch information
jfirebaugh committed Oct 25, 2016
1 parent cd72f38 commit db828d2
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
3 changes: 1 addition & 2 deletions js/data/bucket.js
Expand Up @@ -34,7 +34,6 @@ class Bucket {
this.childLayers = options.childLayers;

this.index = options.index;
this.sourceLayerIndex = options.sourceLayerIndex;
this.featureIndex = options.featureIndex;
this.programConfigurations = util.mapObject(this.programInterfaces, (programInterface) => {
const result = {};
Expand Down Expand Up @@ -67,7 +66,7 @@ class Bucket {
for (const feature of features) {
if (this.layer.filter(feature)) {
this.addFeature(feature);
this.featureIndex.insert(feature, feature.index, this.sourceLayerIndex, this.index);
this.featureIndex.insert(feature, this.index);
}
}

Expand Down
3 changes: 2 additions & 1 deletion js/data/bucket/symbol_bucket.js
Expand Up @@ -179,6 +179,7 @@ class SymbolBucket extends Bucket {
text,
icon,
index: this.features.length,
sourceLayerIndex: feature.sourceLayerIndex,
geometry: loadGeometry(feature),
properties: feature.properties
});
Expand Down Expand Up @@ -378,7 +379,7 @@ class SymbolBucket extends Bucket {
// the buffers for both tiles and clipped to tile boundaries at draw time.
const addToBuffers = inside || mayOverlap;
this.addSymbolInstance(anchor, line, shapedText, shapedIcon, this.layer,
addToBuffers, this.symbolInstancesArray.length, this.collisionBoxArray, feature.index, this.sourceLayerIndex, this.index,
addToBuffers, this.symbolInstancesArray.length, this.collisionBoxArray, feature.index, feature.sourceLayerIndex, this.index,
textBoxScale, textPadding, textAlongLine,
iconBoxScale, iconPadding, iconAlongLine, {zoom: this.zoom}, feature.properties);
}
Expand Down
4 changes: 2 additions & 2 deletions js/data/feature_index.js
Expand Up @@ -50,9 +50,9 @@ class FeatureIndex {
this.setCollisionTile(collisionTile);
}

insert(feature, featureIndex, sourceLayerIndex, bucketIndex) {
insert(feature, bucketIndex) {
const key = this.featureIndexArray.length;
this.featureIndexArray.emplaceBack(featureIndex, sourceLayerIndex, bucketIndex);
this.featureIndexArray.emplaceBack(feature.index, feature.sourceLayerIndex, bucketIndex);
const geometry = loadGeometry(feature);

for (let r = 0; r < geometry.length; r++) {
Expand Down
3 changes: 2 additions & 1 deletion js/source/worker_tile.js
Expand Up @@ -63,10 +63,12 @@ class WorkerTile {
);
}

const sourceLayerIndex = sourceLayerCoder.encode(sourceLayerId);
const features = [];
for (let i = 0; i < sourceLayer.length; i++) {
const feature = sourceLayer.feature(i);
feature.index = i;
feature.sourceLayerIndex = sourceLayerIndex;
features.push(feature);
}

Expand All @@ -89,7 +91,6 @@ class WorkerTile {
collisionBoxArray: this.collisionBoxArray,
symbolQuadsArray: this.symbolQuadsArray,
symbolInstancesArray: this.symbolInstancesArray,
sourceLayerIndex: sourceLayerCoder.encode(sourceLayerId),
featureIndex: featureIndex
});

Expand Down

0 comments on commit db828d2

Please sign in to comment.