Skip to content

Commit

Permalink
to reset
Browse files Browse the repository at this point in the history
  • Loading branch information
ftoromanoff committed Nov 26, 2024
1 parent 62c95af commit 589fd85
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/Core/Style.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ function replaceWhitePxl(imgd, color, id) {
const newColor = new Color(color);
const colorToChange = new Color('white');
for (let i = 0, n = pix.length; i < n; i += 4) {
const d = deltaE(pix.slice(i, i + 3), colorToChange) / 100;
const d = deltaE(Array.prototype.slice.call(pix, i, i + 3), colorToChange) / 100;
pix[i] = (pix[i] * d + newColor.r * 255 * (1 - d));
pix[i + 1] = (pix[i + 1] * d + newColor.g * 255 * (1 - d));
pix[i + 2] = (pix[i + 2] * d + newColor.b * 255 * (1 - d));
Expand Down
38 changes: 23 additions & 15 deletions src/Parser/VectorTileParser.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,20 +175,28 @@ function readPBF(file, options) {
feature.order = layer.layerOrder;
});

let _feature;
// let _feature;
// for (const layer of layers) {
// if (!_feature) {
// _feature = _collection.requestFeatureById(layer.id, vtFeature.type - 1);
// _feature.id = layer.id;
// _feature.order = layer.order;
// _feature.style = options.in.styles[_feature.id];
// vtFeatureToFeatureGeometry(vtFeature, _feature);
// } else if (!_collection.features.find(f => f.id === layer.id)) {
// _feature = _collection.newFeatureByReference(_feature);
// _feature.id = layer.id;
// _feature.order = layer.order;
// _feature.style = options.in.styles[_feature.id];
// }
// }

for (const layer of layers) {
if (!_feature) {
_feature = _collection.requestFeatureById(layer.id, vtFeature.type - 1);
_feature.id = layer.id;
_feature.order = layer.order;
_feature.style = options.in.styles[_feature.id];
vtFeatureToFeatureGeometry(vtFeature, _feature);
} else if (!_collection.features.find(f => f.id === layer.id)) {
_feature = _collection.newFeatureByReference(_feature);
_feature.id = layer.id;
_feature.order = layer.order;
_feature.style = options.in.styles[_feature.id];
}
const _feature = _collection.requestFeatureById(layer.id, vtFeature.type - 1);
_feature.id = layer.id;
_feature.order = layer.order;
_feature.style = options.in.styles[_feature.id];
vtFeatureToFeatureGeometry(vtFeature, _feature);
}
}
});
Expand All @@ -209,10 +217,10 @@ function readPBF(file, options) {

// console.log(collection.features);
// console.log(collection.features.map(f => f.type));
// console.log(_collection.features);
// console.log('zoom', z, _collection.features);
// console.log(_collection.features.map(f => f.type));

return Promise.resolve(collection);
return Promise.resolve(_collection);
}

/**
Expand Down
1 change: 1 addition & 0 deletions src/Source/VectorTilesSource.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ class VectorTilesSource extends TMSSource {
order,
layerOrder,
filterExpression: featureFilter(layer.filter, layer.type),
style: layer,
});
}
});
Expand Down

0 comments on commit 589fd85

Please sign in to comment.