Fixes to wayhandling

This commit is contained in:
Pieter Vander Vennet 2020-10-27 14:46:40 +01:00
parent 032bf89017
commit 813e96f8df
4 changed files with 17 additions and 16 deletions

View file

@ -21,10 +21,10 @@ export default class LayerConfig {
titleIcons: TagRenderingConfig[];
icon?: TagRenderingConfig;
iconSize?: TagRenderingConfig;
color?: TagRenderingConfig;
width?: TagRenderingConfig;
icon: TagRenderingConfig;
iconSize: TagRenderingConfig;
color: TagRenderingConfig;
width: TagRenderingConfig;
wayHandling: number;

View file

@ -140,21 +140,24 @@ export class FilteredLayer {
const selfFeatures = [];
for (let feature of geojson.features) {
// feature.properties contains all the properties
const tags = TagUtils.proprtiesToKV(feature.properties);
const centerPoint = GeoOperations.centerpoint(feature);
if (!this.filters.matches(tags)) {
leftoverFeatures.push(feature);
continue;
}
if (feature.geometry.type !== "Point") {
const centerPoint = GeoOperations.centerpoint(feature);
if (this._wayHandling === LayerConfig.WAYHANDLING_CENTER_AND_WAY) {
selfFeatures.push(centerPoint);
} else if (this._wayHandling === LayerConfig.WAYHANDLING_CENTER_ONLY) {
feature = centerPoint;
}
}
if (this.filters.matches(tags)) {
selfFeatures.push(feature);
} else {
leftoverFeatures.push(feature);
}
selfFeatures.push(feature);
}

View file

@ -16,10 +16,8 @@ export class LayerSelection extends UIElement {
for (const layer of State.state.filteredLayers.data) {
let iconUrl = "./asets/checkbox.svg";
let iconUrlBlank = "";
if (layer.layerDef.icon && layer.layerDef.icon !== "") {
iconUrl = layer.layerDef.icon as string;
iconUrlBlank = layer.layerDef.icon as string;
if (layer.layerDef.icon ) {
iconUrl = layer.layerDef.icon.GetRenderValue({id:"node/-1"}).txt;
}
const icon = new FixedUiElement(`<img style="height:2em;max-width: 2em;" src="${iconUrl}">`);

View file

@ -25,6 +25,6 @@
"startZoom": 16,
"widenFactor": 0.05,
"socialImage": "./assets/themes/cyclofix/logo.svg",
"layers": ["bike_cafes", "bike_shops", "bike_repair_station", "drinking_water", "bike_themed_object"],
"layers": ["bike_cafes", "bike_shops", "bike_repair_station", "drinking_water", "bike_themed_object","bike_parking"],
"roamingRenderings": []
}