Skip to content

Commit

Permalink
nest property name
Browse files Browse the repository at this point in the history
  • Loading branch information
hiddewie committed Dec 15, 2024
1 parent bee9db1 commit 80488fa
Show file tree
Hide file tree
Showing 2 changed files with 97 additions and 35 deletions.
130 changes: 96 additions & 34 deletions proxy/js/features.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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
},
};
Expand All @@ -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 = {
Expand Down Expand Up @@ -193,7 +235,9 @@ const features = {
},
},
properties: {
pos: 'Position',
pos: {
name: 'Position',
},
},
},
'openrailwaymap_standard-standard_railway_switch_ref': {
Expand All @@ -207,7 +251,9 @@ const features = {
}
},
properties: {
railway_local_operated: 'Operated locally',
railway_local_operated: {
name: 'Operated locally',
},
},
},
'openrailwaymap_speed-speed_railway_signals': {
Expand All @@ -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': {
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion proxy/js/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -704,7 +704,7 @@ function popupContent(feature) {
const osmType = featureType === 'point' ? 'node' : 'way';

const propertyValues = Object.entries(featureCatalog.properties || {})
.map(([property, description]) => properties[property] ? `<span class="badge rounded-pill text-bg-light">${description}${properties[property] === true ? '' : `: <span class="text-monospace">${properties[property]}`}</span></span>` : '')
.map(([property, {name}]) => properties[property] ? `<span class="badge rounded-pill text-bg-light">${name}${properties[property] === true ? '' : `: <span class="text-monospace">${properties[property]}`}</span></span>` : '')
.filter(it => it)
.join('')

Expand Down

0 comments on commit 80488fa

Please sign in to comment.