diff --git a/proxy/js/features.mjs b/proxy/js/features.mjs index 1bec0a70..197ca88d 100644 --- a/proxy/js/features.mjs +++ b/proxy/js/features.mjs @@ -105,28 +105,68 @@ const railwayLineFeatures = { // TODO formatting / lookup table of values properties: { // TODO replace railway with `state` - railway: 'Railway', - usage: 'Usage', - service: 'Service', - highspeed: 'Highspeed', - preferred_direction: 'Preferred direction', - tunnel: 'Tunnel', - bridge: 'Bridge', - ref: 'Reference', - track_ref: 'Track', - speed_label: 'Speed', - train_protection: 'Train protection', - electrification_state: 'Electrification', + railway: { + name: 'Railway', + }, + usage: { + name: 'Usage', + }, + service: { + name: 'Service', + }, + highspeed: { + name: 'Highspeed', + }, + preferred_direction: { + name: 'Preferred direction', + }, + tunnel: { + name: 'Tunnel', + }, + bridge: { + name: 'Bridge', + }, + ref: { + name: 'Reference', + }, + track_ref: { + name: 'Track', + }, + speed_label: { + name: 'Speed', + }, + train_protection: { + name: 'Train protection', + }, + electrification_state: { + name: 'Electrification', + }, // TODO format with 2 digits and Hz - frequency: 'Frequency', + frequency: { + name: 'Frequency', + }, // TODO format with V - voltage: 'Voltage', - future_frequency: 'Future frequency', - future_voltage: 'Future voltage', - gauge_label: 'Gauge', - loading_gauge: 'Loading gauge', - track_class: 'Track class', - reporting_marks: 'Reporting marks', + voltage: { + name: 'Voltage', + }, + future_frequency: { + name: 'Future frequency', + }, + future_voltage: { + name: 'Future voltage', + }, + gauge_label: { + name: 'Gauge', + }, + loading_gauge: { + name: 'Loading gauge', + }, + track_class: { + name: 'Track class', + }, + reporting_marks: { + name: 'Reporting marks', + }, // TODO import operator }, }; @@ -139,14 +179,16 @@ const stationFeatures = { stations.features.map(feature => [feature.feature, {name: feature.description}]) ), properties: { - station: 'Type', - label: 'Reference', + station: { + name: 'Type', + }, + label: { + name: 'Reference', + }, // TODO Add UIC ref }, } -// TODO add properties for use in labels -// TODO add name / label property of feature // TODO move examples here // TODO add icon const features = { @@ -193,7 +235,9 @@ const features = { }, }, properties: { - pos: 'Position', + pos: { + name: 'Position', + }, }, }, 'openrailwaymap_standard-standard_railway_switch_ref': { @@ -207,7 +251,9 @@ const features = { } }, properties: { - railway_local_operated: 'Operated locally', + railway_local_operated: { + name: 'Operated locally', + }, }, }, 'openrailwaymap_speed-speed_railway_signals': { @@ -223,10 +269,18 @@ const features = { 'openrailwaymap_signals-signals_railway_signals': { features: generateSignalFeatures(signals_railway_signals.features), properties: { - direction_both: 'both directions', - ref: 'Reference', - type: 'Type', - deactivated: 'Deactivated', + direction_both: { + name: 'both directions,' + }, + ref: { + name: 'Reference', + }, + type: { + name: 'Type', + }, + deactivated: { + name: 'Deactivated', + }, }, }, 'openrailwaymap_signals-signals_signal_boxes': { @@ -243,15 +297,23 @@ const features = { } }, properties: { - ref: 'Reference', + ref: { + name: 'Reference', + }, }, }, 'openrailwaymap_electrification-electrification_signals': { features: generateSignalFeatures(electrification_signals.features), properties: { - direction_both: 'both directions', - ref: 'Reference', - type: 'Type', + direction_both: { + name: 'both directions', + }, + ref: { + name: 'Reference', + }, + type: { + name: 'Type', + }, // TODO add deactivated // TODO add voltage // TODO add frequency diff --git a/proxy/js/ui.js b/proxy/js/ui.js index 5ad0010b..cc91ed34 100644 --- a/proxy/js/ui.js +++ b/proxy/js/ui.js @@ -704,7 +704,7 @@ function popupContent(feature) { const osmType = featureType === 'point' ? 'node' : 'way'; const propertyValues = Object.entries(featureCatalog.properties || {}) - .map(([property, description]) => properties[property] ? `${description}${properties[property] === true ? '' : `: ${properties[property]}`}` : '') + .map(([property, {name}]) => properties[property] ? `${name}${properties[property] === true ? '' : `: ${properties[property]}`}` : '') .filter(it => it) .join('')