diff options
author | Minh Nguyễn <mxn@1ec5.org> | 2017-09-11 01:34:08 -0700 |
---|---|---|
committer | Minh Nguyễn <mxn@1ec5.org> | 2017-11-02 15:19:54 -0700 |
commit | b475f4c282a8cd97f1cf04c1d2ae5cb4e99c9dce (patch) | |
tree | 439a806bb4321c27d8c784f621f95ffbbc3bcab2 | |
parent | 04ba3e2de2f983629e84d5b2a05c942166eefb33 (diff) | |
download | qtlocation-mapboxgl-b475f4c282a8cd97f1cf04c1d2ae5cb4e99c9dce.tar.gz |
[ios] Announce direction of divided roads
Announce the direction of a divided road based on the direction of its first polyline.
-rw-r--r-- | platform/ios/src/MGLMapAccessibilityElement.m | 12 |
1 files 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]); |