From b475f4c282a8cd97f1cf04c1d2ae5cb4e99c9dce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Minh=20Nguye=CC=82=CC=83n?= Date: Mon, 11 Sep 2017 01:34:08 -0700 Subject: [ios] Announce direction of divided roads Announce the direction of a divided road based on the direction of its first polyline. --- platform/ios/src/MGLMapAccessibilityElement.m | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/platform/ios/src/MGLMapAccessibilityElement.m b/platform/ios/src/MGLMapAccessibilityElement.m index e220030399..aa1912c4b6 100644 --- a/platform/ios/src/MGLMapAccessibilityElement.m +++ b/platform/ios/src/MGLMapAccessibilityElement.m @@ -143,16 +143,20 @@ CLLocationDirection MGLDirectionBetweenCoordinates(CLLocationCoordinate2D firstC } // Announce whether the road is a divided road. - if ([feature isKindOfClass:[MGLShapeCollectionFeature class]]) { + MGLPolyline *polyline; + if ([feature isKindOfClass:[MGLMultiPolylineFeature class]]) { [facts addObject:NSLocalizedStringWithDefaultValue(@"ROAD_DIVIDED_A11Y_VALUE", nil, nil, @"Divided road", @"Accessibility value indicating that a road is a divided road (dual carriageway)")]; - feature = [(MGLShapeCollectionFeature *)feature shapes].firstObject; + polyline = [(MGLMultiPolylineFeature *)feature polylines].firstObject; } // Announce the road’s general direction. if ([feature isKindOfClass:[MGLPolylineFeature class]]) { - NSUInteger pointCount = [(MGLPolylineFeature *)feature pointCount]; + polyline = (MGLPolylineFeature *)feature; + } + if (polyline) { + NSUInteger pointCount = polyline.pointCount; if (pointCount) { - CLLocationCoordinate2D *coordinates = [(MGLPolyline *)feature coordinates]; + CLLocationCoordinate2D *coordinates = polyline.coordinates; CLLocationDirection startDirection = MGLDirectionBetweenCoordinates(coordinates[pointCount - 1], coordinates[0]); CLLocationDirection endDirection = MGLDirectionBetweenCoordinates(coordinates[0], coordinates[pointCount - 1]); -- cgit v1.2.1