def __init__(self, steps=[], start=map.Place(), end=map.Place(), distance={}, duration={}): self.steps = steps self.start = start self.end = end self.distance = distance self.duration = duration
def __init__(self, htmlInstructions='', start=map.Place(), end=map.Place(), distance={}, duration={}, maneuver=''): self.htmlInstructions = htmlInstructions self.start = start self.end = end self.distance = distance self.duration = duration self.maneuver = maneuver
def fromJSON(cls, jsonObject): start = map.Place(jsonObject['start_location']['lat'], jsonObject['start_location']['lng']) end = map.Place(jsonObject['end_location']['lat'], jsonObject['end_location']['lng']) distance = jsonObject['distance'] duration = jsonObject['duration'] steps = [] for step in jsonObject['steps']: steps.append(Step.fromJSON(step)) inst = cls(steps, start, end, distance, duration) return inst
def fromJSON(cls, jsonObject): htmlInstructions = jsonObject['html_instructions'] start = map.Place(jsonObject['start_location']['lat'], jsonObject['start_location']['lng']) end = map.Place(jsonObject['end_location']['lat'], jsonObject['end_location']['lng']) distance = jsonObject['distance'] duration = jsonObject['duration'] maneuver = 'None' if jsonObject.get('maneuver'): maneuver = jsonObject['maneuver'] inst = cls(htmlInstructions, start, end, distance, duration, maneuver) return inst
def __init__(self, start=map.Place(), end=map.Place(), legs=[]): self.start = start self.end = end self.legs = legs self.currentStep = 0