Closed krnekhelesh closed 9 years ago
This info is available in miscInfo
of each entry.
But if i remember correctly only on a search by gps
For HAFAS, at least, it takes this info from XML reply. And HAFAS returns distance to station only when you search by coordinates.
@smurfy @leppa Thanks for the help..it seems that in ubuntu touch, we don't use the miscinfo
variable in the listview delegates and thereby were missing that information. This should be a relatively easy fix.
Earlier I was scouring the internet on how to calculate the distance between 2 gps coordinates instead of simply looking at the fahrplan backend :P
I use this in my Javascript project: :D
function (lat1, lon1, lat2, lon2) {
var radlat1 = Math.PI * lat1/180,
radlat2 = Math.PI * lat2/180,
theta = lon1-lon2,
radtheta = Math.PI * theta/180,
dist = Math.sin(radlat1) * Math.sin(radlat2) + Math.cos(radlat1) * Math.cos(radlat2) * Math.cos(radtheta);
dist = Math.acos(dist);
dist = dist * 180/Math.PI;
dist = dist * 60 * 1.1515;
dist = dist * 1.609344;
dist = dist * 1000; //to meter
return dist
};
However, this means that we need to request GPS coordinates from the phone for every search (not only for search by location). This might impose some delay (while waiting for GPS fix). Also, some users might not like that their location is requested every time they do search.
@leppa well I can just add miscinfo
to the listview delegates and hide it when it has nothing to show since I am presuming that the fahrplan backend only fills it with proper info when the search is done by location. I am yet to implement and test this, but the UI change shouldn't cause GPS coordinates request on every search since all is handled in the backend plugin?
@leppa @krnekhelesh i also think the distance is most important with search by gps coordinates, not for normal searches.
:+1: I agree
@krnekhelesh, yes, just display miscInfo
if it's not empty. Beware that it might also contain some other info. For example, in 9292ov.nl it contains station type and in my yet to be submitted change I added a distance, so it's two lines (if distance is available).
@leppa Do you mind splitting that info (distance and station type) into two variable instead? That will give UI devs freedom to display that information without overloading the listview delegates. For instance, I could use say stationtype
to display a train or a bus icon to help recognize it faster rather than displaying it as a text. And then display distance
in the right side of the listview like fahrplan already does in other platforms.
Well, it definitely makes sense to make information more granular. It just needs to be done.
For example, all cancellation warnings, announcements and comments, together with HTML formatting to distinguish each of them, go into one info
property of JourneyDetailResultItem
. And this already brings some issues, like exposed HTML formatting in calendar entries. The issue is to make it granular enough, but not to overload items with hundreds of properties.
I noticed while looking at the fahrplan's blackberry screenshots that it shows the distance in meters to each station listed in the stationselect page. I think this is brilliant! Let's get that over to ubuntu touch as well.