示例#1
0
 def isOnBikeLane(self, location, sensitivity=10):
     start_to_point = GoogleDirectionsServiceBroker.getDistance(self.start, location)
     point_to_end = GoogleDirectionsServiceBroker.getDistance(location, self.end)
     distance_sum = start_to_point + point_to_end
     if(start_to_point == -1 | point_to_end == -1 | self.distance == -1):
         raise ValueError
     if(distance_sum < (self.distance + sensitivity) and
         distance_sum > (self.distance - sensitivity)):
             return True
     return False
示例#2
0
 def __init__(self, laneType, start, end, street):
     self.laneType = laneType
     self.start = start
     self.end = end
     self.street = street
     self.distance = GoogleDirectionsServiceBroker.getDistance(self.start, self.end)