Skip to content

Commit

Permalink
move names.push_back(name) line down
Browse files Browse the repository at this point in the history
  • Loading branch information
gerdie committed Jul 19, 2021
1 parent 5cdd368 commit bf2afee
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 1 addition & 2 deletions src/vtcomposite.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,14 +178,13 @@ struct CompositeWorker : Napi::AsyncWorker
std::uint32_t const version = layer.version();
if (std::find(std::begin(names), std::end(names), name) == std::end(names))
{
names.push_back(name);

// should we keep this layer?
// if include_layers is empty, keep all layers
// if include_layers is not empty, keep layer if we can find its name in the vector
std::string sname(name);
if (include_layers.empty() || std::find(std::begin(include_layers), std::end(include_layers), sname) != std::end(include_layers))
{
names.push_back(name);
std::uint32_t extent = layer.extent();
if (zoom_factor == 1)
{
Expand Down
2 changes: 1 addition & 1 deletion test/vtcomposite.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ test('[composite] success: drop layers if "layers" array is in tiles object', fu
composite(tiles, zxy, {}, (err, vtBuffer) => {
assert.notOk(err);
assert.deepEqual(Object.keys(vtinfo(vtBuffer).layers), ['building', 'poi_label'], 'expected layers');
assert.notEqual(vtBuffer.length, bufferSF.length, 'buffer is not of the same sie');
assert.notEqual(vtBuffer.length, bufferSF.length, 'buffer is not of the same size');
assert.end();
});
});
Expand Down

0 comments on commit bf2afee

Please sign in to comment.