def locationTest(self, _text): '''This is an example of a speech rule which triggers when the user says "Create map location ". This example demonstrates how create and display a specific map location to the Siri user. * _text -- The text spoken by the user ''' # Create the two web search buttons to display to the user locations = [ ("Apple HQ", ObjectFactory.location(street="1 Infinite Loop", city="Cupertino", stateCode="CA", countryCode="US", postalCode="95014")), ("Orlando", ObjectFactory.location(city="Olando", stateCode="FL", countryCode="US")), ] mapItem = ObjectFactory.mapItem(locations) # Create a view to display the utterance and the buttons self.makeView([mapItem]) self.completeRequest()
def directionsTest(self, _text): '''Test creating directions between two locations. Note: Currently directions only work between two locations that are given the latitude and longitude coordinates. ''' appleHq = ObjectFactory.location(latitude=37.331414, longitude=-122.030566) appleHq = DataObjects.create(DataObjects.MapItem, label="Apple HQ", location=appleHq) googleHq = ObjectFactory.location(street="1600 Amphitheatre Parkway", city="Mountain View", stateCode="CA", countryCode="US", postalCode="94043", latitude=37.422131, longitude=-122.083911) googleHq = DataObjects.create(DataObjects.MapItem, label="Google HQ", location=googleHq) # Note: Showing directions completes the request self.showDrivingDirections(appleHq, googleHq)
def directionsTest(self, _text): '''Test creating directions between two locations. Note: Currently directions only work between two locations that are given the latitude and longitude coordinates. ''' appleHq = ObjectFactory.location(latitude=37.331414, longitude=-122.030566) appleHq = DataObjects.create(DataObjects.MapItem, label="Apple HQ", location=appleHq) googleHq = ObjectFactory.location(street="1600 Amphitheatre Parkway", city="Mountain View", stateCode="CA", countryCode="US", postalCode="94043", latitude=37.422131, longitude=-122.083911) googleHq = DataObjects.create(DataObjects.MapItem, label="Google HQ", location=googleHq) # Note: Showing directions completes the request self.showDrivingDirections(appleHq, googleHq)