Esempio n. 1
0
 def distance_km(self, bus_stop: BusStop = None, user_loc: UserLoc = None):
     if not bus_stop and not user_loc:
         return QUICK_FIX_DIST
     (lat, lon) = (bus_stop.LAT_,
                   bus_stop.LON_) if bus_stop else (user_loc.lat,
                                                    user_loc.lon)
     return distance_km(lat, lon, self.last_lat_, self.last_lon_)
Esempio n. 2
0
 def distance_km(self,
                 bus_stop: BusStop = None,
                 position: Union[UserLoc, NamedTuple] = None):
     (lat, lon) = (bus_stop.LAT_,
                   bus_stop.LON_) if bus_stop else (position.lat,
                                                    position.lon)
     if lat is None or lon is None:
         return QUICK_FIX_DIST
     return distance_km(lat, lon, self.lat, self.lon)
Esempio n. 3
0
 def distance_km(self, bus_stop):
     return distance_km(self.LAT_, self.LON_, bus_stop.LAT_, bus_stop.LON_)
Esempio n. 4
0
 def distance_km(self, bus_stop: BusStop = None, user_loc: UserLoc = None):
     (lat, lon) = (bus_stop.LAT_,
                   bus_stop.LON_) if bus_stop else (user_loc.lat,
                                                    user_loc.lon)
     return distance_km(lat, lon, self.last_lat_, self.last_lon_)