+ function refresh() {
+ realtimeResult.refresh()
+ }
+
+ function fillNearbyStations(lat, lon) {
+ nearbyStations = itip.get_nearby_stations(lat, lon)
+ }
+
+ function showNearby() {
+ console.log("show nearby")
+
+ var stations = nearbyStations
+ stationSelectorModel.clear()
+ for (var idx in stations) {
+ stationSelectorModel.append({'name': stations[idx]})
+ }
+
+ stationSelector.open()
+ }
+
+ PositionSource {
+ id: positionSource
+ updateInterval: 10000
+
+ active: true
+
+ onPositionChanged: {
+ fillNearbyStations(positionSource.position.coordinate.latitude, positionSource.position.coordinate.longitude)
+ }
+ }
+
+ SelectionDialog {
+ id: stationSelector
+ titleText: 'Select nearby station'
+
+ model: ListModel {
+ id: stationSelectorModel
+ }
+
+ onAccepted: {
+ realtimeResult.isStation = true
+ realtimeResult.gstation = stationSelectorModel.get(selectedIndex).name
+ realtimeResult.gline = ''
+ realtimeResult.sourceUrl = ''
+ gline.text = ''
+ gstation.text = stationSelectorModel.get(selectedIndex).name
+ console.log('station to get: ' + realtimeResult.gstation)