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[]; titleIcons: TagRenderingConfig[];
icon?: TagRenderingConfig; icon: TagRenderingConfig;
iconSize?: TagRenderingConfig; iconSize: TagRenderingConfig;
color?: TagRenderingConfig; color: TagRenderingConfig;
width?: TagRenderingConfig; width: TagRenderingConfig;
wayHandling: number; wayHandling: number;

View file

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

View file

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

View file

@ -25,6 +25,6 @@
"startZoom": 16, "startZoom": 16,
"widenFactor": 0.05, "widenFactor": 0.05,
"socialImage": "./assets/themes/cyclofix/logo.svg", "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": [] "roamingRenderings": []
} }