Dear All,
I was trying to test the map-app-ios with few customization from my side using AGSGeometryEngine Class to speech the direction text, after my integration i was trying to text the app how it was behaving when i am driving. Here with i am attaching 2 screenshot which i found at the time of testing the app, necessary help would be appreciate for the way forward to achieve my goal.
Also here i am attaching few code snippet how i was trying to achieve the text to speech recogniser.
// Tracking the current/updated new location from locatidHandler
mapView.locationDisplay.locatidHandler = { [weak self] location in
// Have a new function and passing the new location to it.
self?.callFunctionAndPlayWith(newLocation: location)
}
// Function Implementation
func callFunctionAndPlayWith(newLocation: AGSLocation){
// check the Location Point is there or not
guard newLocation.position != nil else {
print("Unable to found the new location position")
return
}
// get the geodeticBufferGeometry from newLocation.position
let geodeticBufferGeometryOfCurrentLocation = self.geodeticBufferGeometry(maneuverGeometry: newLocation.position!)
// Get the route result from Mode
switch self.mode {
case .routeResult(let route):
// Enumerate the array to get the actual index data which intersect the geodeticGeometryValue
route.directionManeuvers.enumerated().forEach { (index, value) in
// Skipping the first Index as its my start location (for testing)
if(index != 0){
// Intersected Index Found from directionManeuvers Array
let isUserIntersectsToPlannedRoute = AGSGeometryEngine.geometry(geodeticBufferGeometryOfCurrentLocation, intersects: value.geometry!)
// Check if if intersected then good to go
if(isUserIntersectsToPlannedRoute == true) {
// Check if we already speech then no need to speech again the same direction text
// Else speech as its a newly intersected point to speech
if(self.currentDirectionManeuver?.directionText != value.directionText){
let newInstance = DirectionsDisplayViewController()
newInstance.textToSpeech(directionText: value.directionText)
self.currentDirectionManeuver = value
}
}
}
}
default:
print("Mode is default")
}
}
func geodeticBufferGeometry(maneuverGeometry geometry:AGSGeometry) -> AGSPolygon {
// Capturing 40 Meters Distance for the geodeticBufferGeometry to check the intersect to speech the new route.
return AGSGeometryEngine.geodeticBufferGeometry(geometry, distance: 40, distanceUnit: AGSLinearUnit.meters(), maxDeviation: 1, curveType: AGSGeodeticCurveType.shapePreserving)!
}
The above changes i have done to test the app.
But When Driving Navigation Arrow Going Beyond Map Actual Route or Road. please have a look on the below attached screenshot.
Would be great and helpful if you can suggest some trick how to test the app with Real Time Driving and Navigation.
