Merge tag 'ios-v3.6.2' into master
# Conflicts: # cmake/core-files.cmake # include/mbgl/renderer/renderer_backend.hpp # platform/android/CHANGELOG.md # platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/AnnotationManager.java # platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/IconManager.java # platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMap.java # platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Projection.java # platform/android/dependencies.gradle # platform/darwin/src/MGLStyle.mm # platform/ios/CHANGELOG.md # platform/ios/app/Info.plist # platform/ios/app/MBXViewController.m # platform/ios/ios.xcodeproj/project.pbxproj # platform/macos/CHANGELOG.md # src/mbgl/gl/attribute.cpp # src/mbgl/gl/attribute.hpp # src/mbgl/gl/context.hpp # src/mbgl/gl/types.hpp # src/mbgl/gl/value.cpp # src/mbgl/gl/value.hpp # src/mbgl/map/backend_scope.cpp # src/mbgl/programs/attributes.hpp # src/mbgl/programs/program.hpp # src/mbgl/programs/segment.cpp # src/mbgl/programs/segment.hpp # src/mbgl/programs/symbol_program.hpp # src/mbgl/programs/uniforms.hpp # src/mbgl/renderer/buckets/symbol_bucket.hpp # src/mbgl/renderer/painter.cpp # src/mbgl/renderer/painter.hpp # src/mbgl/renderer/painter_background.cpp # src/mbgl/renderer/painter_circle.cpp # src/mbgl/renderer/painter_clipping.cpp # src/mbgl/renderer/painter_debug.cpp # src/mbgl/renderer/painter_fill.cpp # src/mbgl/renderer/painter_fill_extrusion.cpp # src/mbgl/renderer/painter_line.cpp # src/mbgl/renderer/painter_raster.cpp # src/mbgl/renderer/painter_symbol.cpp # src/mbgl/shaders/line.cpp # src/mbgl/shaders/line_pattern.cpp # test/renderer/backend_scope.test.cpp
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
GROUP=com.mapbox.mapboxsdk
|
||||
VERSION_NAME=5.2.0-SNAPSHOT
|
||||
VERSION_NAME=5.1.3-SNAPSHOT
|
||||
|
||||
POM_DESCRIPTION=Mapbox GL Android SDK
|
||||
POM_URL=https://github.com/mapbox/mapbox-gl-native
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="mapbox_compassContentDescription">Boussole. Activer pour rétablir l\'orientation de la carte vers le nord.</string>
|
||||
<string name="mapbox_attributionsIconContentDescription">Icone d\'attribution. Activer pour montrer le dialogue d\'attribution.</string>
|
||||
<string name="mapbox_myLocationViewContentDescription">Vue de géolocalisation. Ceci affiche votre localisation sur la carte.</string>
|
||||
<string name="mapbox_mapActionDescription">Affichage d\'une carte créée avec Mapbox. Faites la glisser en traînant deux doigts. Zoomez ou dézoomez en écartant ou rapprochant deux doigts.</string>
|
||||
<string name="mapbox_attributionsDialogTitle">SDK Mapbox pour Android</string>
|
||||
<string name="mapbox_attributionTelemetryTitle">Faire de meilleures cartes Mapbox</string>
|
||||
<string name="mapbox_attributionTelemetryMessage">Vous aidez à améliorer les cartes OpenStreetMap et Mapbox en contribuant des données d\'utilisation anonymes.</string>
|
||||
<string name="mapbox_attributionTelemetryPositive">D\'accord</string>
|
||||
<string name="mapbox_attributionTelemetryNegative">Pas d\'accord</string>
|
||||
<string name="mapbox_attributionTelemetryNeutral">Plus d\'informations</string>
|
||||
<string name="mapbox_offline_error_region_definition_invalid">Le cadre OfflineRegionDefinition pour définir la région de navigation ne tient pas dans les limites du monde : %s</string>
|
||||
|
||||
</resources>
|
||||
@@ -1,3 +1,3 @@
|
||||
fabric-identifier=com.mapbox.mapboxsdk.mapbox-android-sdk
|
||||
fabric-version=5.1.0
|
||||
fabric-version=5.1.2
|
||||
fabric-build-type=binary
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M19,5v14H5V5h14m0,-2H5c-1.1,0 -2,0.9 -2,2v14c0,1.1 0.9,2 2,2h14c1.1,0 2,-0.9 2,-2V5c0,-1.1 -0.9,-2 -2,-2z"/>
|
||||
</vector>
|
||||
@@ -81,8 +81,10 @@ Linear ring | `MGLPolygon.coordinates`, `MGLPolygon.interiorPolygons`
|
||||
A `Feature` object in GeoJSON corresponds to an instance of an `MGLShape`
|
||||
subclass conforming to the `MGLFeature` protocol. There is a distinct
|
||||
`MGLFeature`-conforming class for each type of geometry that a GeoJSON feature
|
||||
can contain. This allows features to be used as shapes where convenient. For
|
||||
example, some features can be added to a map view as annotations.
|
||||
can contain. This allows features to be used as raw shapes where convenient. For
|
||||
example, some features can be added to a map view as annotations. Note that
|
||||
identifiers and attributes will not be available for feature querying when a
|
||||
feature is used as an annotation.
|
||||
|
||||
In contrast to the GeoJSON standard, it is possible for `MGLShape` subclasses
|
||||
other than `MGLPointAnnotation` to straddle the antimeridian.
|
||||
|
||||
291
platform/darwin/resources/fr.lproj/Foundation.strings
Normal file
291
platform/darwin/resources/fr.lproj/Foundation.strings
Normal file
@@ -0,0 +1,291 @@
|
||||
/* Clock position format, long: {hours} o’clock */
|
||||
"CLOCK_FMT_LONG" = "%@ heures";
|
||||
|
||||
/* Clock position format, medium: {hours} o’clock */
|
||||
"CLOCK_FMT_MEDIUM" = "%@ heures";
|
||||
|
||||
/* Clock position format, short: {hours}:00 */
|
||||
"CLOCK_FMT_SHORT" = "%@h 00";
|
||||
|
||||
/* East, long */
|
||||
"COMPASS_E_LONG" = "est";
|
||||
|
||||
/* East, short */
|
||||
"COMPASS_E_SHORT" = "E";
|
||||
|
||||
/* East by north, long */
|
||||
"COMPASS_EbN_LONG" = "est par nord";
|
||||
|
||||
/* East by north, short */
|
||||
"COMPASS_EbN_SHORT" = "EpN";
|
||||
|
||||
/* East by south, long */
|
||||
"COMPASS_EbS_LONG" = "est par sud";
|
||||
|
||||
/* East by south, short */
|
||||
"COMPASS_EbS_SHORT" = "EpS";
|
||||
|
||||
/* East-northeast, long */
|
||||
"COMPASS_ENE_LONG" = "est-nord-est";
|
||||
|
||||
/* East-northeast, short */
|
||||
"COMPASS_ENE_SHORT" = "ENE";
|
||||
|
||||
/* East-southeast, long */
|
||||
"COMPASS_ESE_LONG" = "est-sud-est";
|
||||
|
||||
/* East-southeast, short */
|
||||
"COMPASS_ESE_SHORT" = "ESE";
|
||||
|
||||
/* North, long */
|
||||
"COMPASS_N_LONG" = "nord";
|
||||
|
||||
/* North, short */
|
||||
"COMPASS_N_SHORT" = "N";
|
||||
|
||||
/* North by east, long */
|
||||
"COMPASS_NbE_LONG" = "nord par est";
|
||||
|
||||
/* North by east, short */
|
||||
"COMPASS_NbE_SHORT" = "NpE";
|
||||
|
||||
/* North by west, long */
|
||||
"COMPASS_NbW_LONG" = "nord par ouest";
|
||||
|
||||
/* North by west, short */
|
||||
"COMPASS_NbW_SHORT" = "NpO";
|
||||
|
||||
/* Northeast, long */
|
||||
"COMPASS_NE_LONG" = "nord-est";
|
||||
|
||||
/* Northeast, short */
|
||||
"COMPASS_NE_SHORT" = "NE";
|
||||
|
||||
/* Northeast by east, long */
|
||||
"COMPASS_NEbE_LONG" = "nord-est par est";
|
||||
|
||||
/* Northeast by east, short */
|
||||
"COMPASS_NEbE_SHORT" = "NEpE";
|
||||
|
||||
/* Northeast by north, long */
|
||||
"COMPASS_NEbN_LONG" = "nord-est par nord";
|
||||
|
||||
/* Northeast by north, short */
|
||||
"COMPASS_NEbN_SHORT" = "NEpN";
|
||||
|
||||
/* North-northeast, long */
|
||||
"COMPASS_NNE_LONG" = "nord-nord-est";
|
||||
|
||||
/* North-northeast, short */
|
||||
"COMPASS_NNE_SHORT" = "NNE";
|
||||
|
||||
/* North-northwest, long */
|
||||
"COMPASS_NNW_LONG" = "nord-nord-ouest";
|
||||
|
||||
/* North-northwest, short */
|
||||
"COMPASS_NNW_SHORT" = "NNO";
|
||||
|
||||
/* Northwest, long */
|
||||
"COMPASS_NW_LONG" = "nord-ouest";
|
||||
|
||||
/* Northwest, short */
|
||||
"COMPASS_NW_SHORT" = "NO";
|
||||
|
||||
/* Northwest by north, long */
|
||||
"COMPASS_NWbN_LONG" = "nord-ouest par nord";
|
||||
|
||||
/* Northwest by north, short */
|
||||
"COMPASS_NWbN_SHORT" = "NOpN";
|
||||
|
||||
/* Northwest by west, long */
|
||||
"COMPASS_NWbW_LONG" = "nord-ouest par ouest";
|
||||
|
||||
/* Northwest by west, short */
|
||||
"COMPASS_NWbW_SHORT" = "NOpO";
|
||||
|
||||
/* South, long */
|
||||
"COMPASS_S_LONG" = "sud";
|
||||
|
||||
/* South, short */
|
||||
"COMPASS_S_SHORT" = "S";
|
||||
|
||||
/* South by east, long */
|
||||
"COMPASS_SbE_LONG" = "sud par est";
|
||||
|
||||
/* South by east, short */
|
||||
"COMPASS_SbE_SHORT" = "SpE";
|
||||
|
||||
/* South by west, long */
|
||||
"COMPASS_SbW_LONG" = "sud par ouest";
|
||||
|
||||
/* South by west, short */
|
||||
"COMPASS_SbW_SHORT" = "SpO";
|
||||
|
||||
/* Southeast, long */
|
||||
"COMPASS_SE_LONG" = "sud-est";
|
||||
|
||||
/* Southeast, short */
|
||||
"COMPASS_SE_SHORT" = "SE";
|
||||
|
||||
/* Southeast by east, long */
|
||||
"COMPASS_SEbE_LONG" = "sud-est par est";
|
||||
|
||||
/* Southeast by east, short */
|
||||
"COMPASS_SEbE_SHORT" = "SEpE";
|
||||
|
||||
/* Southeast by south, long */
|
||||
"COMPASS_SEbS_LONG" = "sud-est par sud";
|
||||
|
||||
/* Southeast by south, short */
|
||||
"COMPASS_SEbS_SHORT" = "SEpS";
|
||||
|
||||
/* South-southeast, long */
|
||||
"COMPASS_SSE_LONG" = "sud-sud-est";
|
||||
|
||||
/* South-southeast, short */
|
||||
"COMPASS_SSE_SHORT" = "SSE";
|
||||
|
||||
/* South-southwest, long */
|
||||
"COMPASS_SSW_LONG" = "sud-sud-ouest";
|
||||
|
||||
/* South-southwest, short */
|
||||
"COMPASS_SSW_SHORT" = "SSO";
|
||||
|
||||
/* Southwest, long */
|
||||
"COMPASS_SW_LONG" = "sud-ouest";
|
||||
|
||||
/* Southwest, short */
|
||||
"COMPASS_SW_SHORT" = "SO";
|
||||
|
||||
/* Southwest by south, long */
|
||||
"COMPASS_SWbS_LONG" = "sud-ouest par sud";
|
||||
|
||||
/* Southwest by south, short */
|
||||
"COMPASS_SWbS_SHORT" = "SOpS";
|
||||
|
||||
/* Southwest by west, long */
|
||||
"COMPASS_SWbW_LONG" = "sud-ouest par ouest";
|
||||
|
||||
/* Southwest by west, short */
|
||||
"COMPASS_SWbW_SHORT" = "SOpO";
|
||||
|
||||
/* West, long */
|
||||
"COMPASS_W_LONG" = "ouest";
|
||||
|
||||
/* West, short */
|
||||
"COMPASS_W_SHORT" = "O";
|
||||
|
||||
/* West by north, long */
|
||||
"COMPASS_WbN_LONG" = "ouest par nord";
|
||||
|
||||
/* West by north, short */
|
||||
"COMPASS_WbN_SHORT" = "OpN";
|
||||
|
||||
/* West by south, long */
|
||||
"COMPASS_WbS_LONG" = "ouest par sud";
|
||||
|
||||
/* West by south, short */
|
||||
"COMPASS_WbS_SHORT" = "OpS";
|
||||
|
||||
/* West-northwest, long */
|
||||
"COMPASS_WNW_LONG" = "ouest-nord-ouest";
|
||||
|
||||
/* West-northwest, short */
|
||||
"COMPASS_WNW_SHORT" = "ONO";
|
||||
|
||||
/* West-southwest, long */
|
||||
"COMPASS_WSW_LONG" = "ouest-sud-ouest";
|
||||
|
||||
/* West-southwest, short */
|
||||
"COMPASS_WSW_SHORT" = "OSO";
|
||||
|
||||
/* Degrees format, long */
|
||||
"COORD_DEG_LONG" = "%d degré(s)";
|
||||
|
||||
/* Degrees format, medium: {degrees} */
|
||||
"COORD_DEG_MEDIUM" = "%d°";
|
||||
|
||||
/* Degrees format, short: {degrees} */
|
||||
"COORD_DEG_SHORT" = "%d°";
|
||||
|
||||
/* Coordinate format, long: {degrees}{minutes} */
|
||||
"COORD_DM_LONG" = "%1$@ et %2$@";
|
||||
|
||||
/* Coordinate format, medium: {degrees}{minutes} */
|
||||
"COORD_DM_MEDIUM" = "%1$@%2$@";
|
||||
|
||||
/* Coordinate format, short: {degrees}{minutes} */
|
||||
"COORD_DM_SHORT" = "%1$@%2$@";
|
||||
|
||||
/* Coordinate format, long: {degrees}{minutes}{seconds} */
|
||||
"COORD_DMS_LONG" = "%1$@, %2$@ et %3$@";
|
||||
|
||||
/* Coordinate format, medium: {degrees}{minutes}{seconds} */
|
||||
"COORD_DMS_MEDIUM" = "%1$@%2$@%3$@";
|
||||
|
||||
/* Coordinate format, short: {degrees}{minutes}{seconds} */
|
||||
"COORD_DMS_SHORT" = "%1$@%2$@%3$@";
|
||||
|
||||
/* East longitude format, long: {longitude} */
|
||||
"COORD_E_LONG" = "%@ est";
|
||||
|
||||
/* East longitude format, medium: {longitude} */
|
||||
"COORD_E_MEDIUM" = "%@ est";
|
||||
|
||||
/* East longitude format, short: {longitude} */
|
||||
"COORD_E_SHORT" = "%@E";
|
||||
|
||||
/* Coordinate pair format, long: {latitude}, {longitude} */
|
||||
"COORD_FMT_LONG" = "%1$@, %2$@";
|
||||
|
||||
/* Coordinate pair format, medium: {latitude}, {longitude} */
|
||||
"COORD_FMT_MEDIUM" = "%1$@, %2$@";
|
||||
|
||||
/* Coordinate pair format, short: {latitude}, {longitude} */
|
||||
"COORD_FMT_SHORT" = "%1$@, %2$@";
|
||||
|
||||
/* Minutes format, long */
|
||||
"COORD_MIN_LONG" = "%d minute(s)";
|
||||
|
||||
/* Minutes format, medium: {minutes} */
|
||||
"COORD_MIN_MEDIUM" = "%d′";
|
||||
|
||||
/* Minutes format, short: {minutes} */
|
||||
"COORD_MIN_SHORT" = "%d′";
|
||||
|
||||
/* North latitude format, long: {latitude} */
|
||||
"COORD_N_LONG" = "%@ nord";
|
||||
|
||||
/* North latitude format, medium: {latitude} */
|
||||
"COORD_N_MEDIUM" = "%@ nord";
|
||||
|
||||
/* North latitude format, short: {latitude} */
|
||||
"COORD_N_SHORT" = "%@N";
|
||||
|
||||
/* South latitude format, long: {latitude} */
|
||||
"COORD_S_LONG" = "%@ sud";
|
||||
|
||||
/* South latitude format, medium: {latitude} */
|
||||
"COORD_S_MEDIUM" = "%@ sud";
|
||||
|
||||
/* South latitude format, short: {latitude} */
|
||||
"COORD_S_SHORT" = "%@S";
|
||||
|
||||
/* Seconds format, long */
|
||||
"COORD_SEC_LONG" = "%d seconde(s)";
|
||||
|
||||
/* Seconds format, medium: {seconds} */
|
||||
"COORD_SEC_MEDIUM" = "%d″";
|
||||
|
||||
/* Seconds format, short: {seconds} */
|
||||
"COORD_SEC_SHORT" = "%d″";
|
||||
|
||||
/* West longitude format, long: {longitude} */
|
||||
"COORD_W_LONG" = "%@ ouest";
|
||||
|
||||
/* West longitude format, medium: {longitude} */
|
||||
"COORD_W_MEDIUM" = "%@ ouest";
|
||||
|
||||
/* West longitude format, short: {longitude} */
|
||||
"COORD_W_SHORT" = "%@O";
|
||||
|
||||
@@ -18,15 +18,23 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
You can add custom data to display on the map by creating feature objects and
|
||||
adding them to an `MGLShapeSource` using the
|
||||
`-[MGLShapeSource initWithIdentifier:shape:options:]` method or
|
||||
`MGLShapeSource.shape` property. Similarly, you can add `MGLPointFeature`,
|
||||
`MGLPolylineFeature`, and `MGLPolygonFeature` objects to the map as annotations
|
||||
using `-[MGLMapView addAnnotations:]` and related methods.
|
||||
`MGLShapeSource.shape` property.
|
||||
|
||||
In addition to adding data to the map, you can also extract data from the map:
|
||||
`-[MGLMapView visibleFeaturesAtPoint:]` and related methods return feature
|
||||
objects that correspond to features in the source. This enables you to inspect
|
||||
the properties of features in vector tiles loaded by `MGLVectorSource` objects.
|
||||
You also reuse these feature objects as overlay annotations.
|
||||
|
||||
While it is possible to add `MGLFeature`-conforming objects to the map as
|
||||
annotations using `-[MGLMapView addAnnotations:]` and related methods, doing so
|
||||
has trade-offs:
|
||||
|
||||
- Features added as annotations will not have `identifier` or `attributes`
|
||||
properties when used with feature querying.
|
||||
|
||||
- Features added as annotations become interactive. Taps and selection can be
|
||||
handled in `-[MGLMapViewDelegate mapView:didSelectAnnotation:]`.
|
||||
*/
|
||||
@protocol MGLFeature <MGLAnnotation>
|
||||
|
||||
|
||||
@@ -42,6 +42,15 @@ MGL_DEFINE_FEATURE_IS_EQUAL();
|
||||
return mbglFeature({[self geometryObject]}, identifier, self.attributes);
|
||||
}
|
||||
|
||||
- (NSString *)description
|
||||
{
|
||||
return [NSString stringWithFormat:@"<%@: %p; identifier = %@, coordinate = %f, %f, attributes = %@>",
|
||||
NSStringFromClass([self class]), (void *)self,
|
||||
self.identifier ? [NSString stringWithFormat:@"\"%@\"", self.identifier] : self.identifier,
|
||||
self.coordinate.latitude, self.coordinate.longitude,
|
||||
self.attributes.count ? self.attributes : @"none"];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@interface MGLPolylineFeature ()
|
||||
@@ -68,6 +77,16 @@ MGL_DEFINE_FEATURE_IS_EQUAL();
|
||||
return mbglFeature({[self geometryObject]}, identifier, self.attributes);
|
||||
}
|
||||
|
||||
- (NSString *)description
|
||||
{
|
||||
return [NSString stringWithFormat:@"<%@: %p; identifier = %@, count = %lu, bounds = %@, attributes = %@>",
|
||||
NSStringFromClass([self class]), (void *)self,
|
||||
self.identifier ? [NSString stringWithFormat:@"\"%@\"", self.identifier] : self.identifier,
|
||||
(unsigned long)[self pointCount],
|
||||
MGLStringFromCoordinateBounds(self.overlayBounds),
|
||||
self.attributes.count ? self.attributes : @"none"];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@interface MGLPolygonFeature ()
|
||||
@@ -94,6 +113,16 @@ MGL_DEFINE_FEATURE_IS_EQUAL();
|
||||
return mbglFeature({[self geometryObject]}, identifier, self.attributes);
|
||||
}
|
||||
|
||||
- (NSString *)description
|
||||
{
|
||||
return [NSString stringWithFormat:@"<%@: %p; identifier = %@, count = %lu, bounds = %@, attributes = %@>",
|
||||
NSStringFromClass([self class]), (void *)self,
|
||||
self.identifier ? [NSString stringWithFormat:@"\"%@\"", self.identifier] : self.identifier,
|
||||
(unsigned long)[self pointCount],
|
||||
MGLStringFromCoordinateBounds(self.overlayBounds),
|
||||
self.attributes.count ? self.attributes : @"none"];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@interface MGLPointCollectionFeature ()
|
||||
@@ -146,6 +175,16 @@ MGL_DEFINE_FEATURE_IS_EQUAL();
|
||||
return mbglFeature({[self geometryObject]}, identifier, self.attributes);
|
||||
}
|
||||
|
||||
- (NSString *)description
|
||||
{
|
||||
return [NSString stringWithFormat:@"<%@: %p; identifier = %@, count = %lu, bounds = %@, attributes = %@>",
|
||||
NSStringFromClass([self class]), (void *)self,
|
||||
self.identifier ? [NSString stringWithFormat:@"\"%@\"", self.identifier] : self.identifier,
|
||||
(unsigned long)self.polylines.count,
|
||||
MGLStringFromCoordinateBounds(self.overlayBounds),
|
||||
self.attributes.count ? self.attributes : @"none"];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@interface MGLMultiPolygonFeature ()
|
||||
@@ -172,6 +211,16 @@ MGL_DEFINE_FEATURE_IS_EQUAL();
|
||||
return mbglFeature({[self geometryObject]}, identifier, self.attributes);
|
||||
}
|
||||
|
||||
- (NSString *)description
|
||||
{
|
||||
return [NSString stringWithFormat:@"<%@: %p; identifier = %@, count = %lu, bounds = %@, attributes = %@>",
|
||||
NSStringFromClass([self class]), (void *)self,
|
||||
self.identifier ? [NSString stringWithFormat:@"\"%@\"", self.identifier] : self.identifier,
|
||||
(unsigned long)self.polygons.count,
|
||||
MGLStringFromCoordinateBounds(self.overlayBounds),
|
||||
self.attributes.count ? self.attributes : @"none"];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@interface MGLShapeCollectionFeature ()
|
||||
|
||||
@@ -200,4 +200,14 @@
|
||||
@"coordinates": coordinates};
|
||||
}
|
||||
|
||||
- (NSString *)description
|
||||
{
|
||||
return [NSString stringWithFormat:@"<%@: %p; title = %@, subtitle: = %@, count = %lu; bounds = %@>",
|
||||
NSStringFromClass([self class]), (void *)self,
|
||||
self.title ? [NSString stringWithFormat:@"\"%@\"", self.title] : self.title,
|
||||
self.subtitle ? [NSString stringWithFormat:@"\"%@\"", self.subtitle] : self.subtitle,
|
||||
(unsigned long)self.polygons.count,
|
||||
MGLStringFromCoordinateBounds(self.overlayBounds)];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -33,8 +33,18 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
`MGLPolygon` object. To group multiple polylines together in one shape, use an
|
||||
`MGLMultiPolyline` or `MGLShapeCollection` object.
|
||||
|
||||
To make the polyline straddle the antimeridian, specify some longitudes less
|
||||
than −180 degrees or greater than 180 degrees.
|
||||
To make the polyline go across the antimeridian or international date line,
|
||||
specify some longitudes less than −180 degrees or greater than 180 degrees.
|
||||
For example, a polyline that stretches from Tokyo to San Francisco would have
|
||||
coordinates of (35.68476, -220.24257) and (37.78428, -122.41310).
|
||||
|
||||
```swift
|
||||
let coordinates = [
|
||||
CLLocationCoordinate2D(latitude: 35.68476, longitude: -220.24257),
|
||||
CLLocationCoordinate2D(latitude: 37.78428, longitude: -122.41310)
|
||||
]
|
||||
let polyline = MGLPolyline(coordinates: coordinates, count: UInt(coordinates.count))
|
||||
```
|
||||
|
||||
A polyline is known as a
|
||||
<a href="https://tools.ietf.org/html/rfc7946#section-3.1.4">LineString</a>
|
||||
|
||||
@@ -201,4 +201,14 @@
|
||||
@"coordinates": coordinates};
|
||||
}
|
||||
|
||||
- (NSString *)description
|
||||
{
|
||||
return [NSString stringWithFormat:@"<%@: %p; title = %@, subtitle: = %@, count = %lu; bounds = %@>",
|
||||
NSStringFromClass([self class]), (void *)self,
|
||||
self.title ? [NSString stringWithFormat:@"\"%@\"", self.title] : self.title,
|
||||
self.subtitle ? [NSString stringWithFormat:@"\"%@\"", self.subtitle] : self.subtitle,
|
||||
(unsigned long)self.polylines.count,
|
||||
MGLStringFromCoordinateBounds(self.overlayBounds)];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -98,8 +98,8 @@ const MGLShapeSourceOption MGLShapeSourceOptionSimplificationTolerance = @"MGLSh
|
||||
}
|
||||
|
||||
std::vector<mbgl::Feature> features;
|
||||
if (self.style) {
|
||||
features = self.style.mapView.renderer->querySourceFeatures(self.rawSource->getID(), { {}, optionalFilter });
|
||||
if (self.mapView) {
|
||||
features = self.mapView.renderer->querySourceFeatures(self.rawSource->getID(), { {}, optionalFilter });
|
||||
}
|
||||
return MGLFeaturesFromMBGLFeatures(features);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
#import "MGLSource_Private.h"
|
||||
#import "MGLStyle_Private.h"
|
||||
#import "MGLMapView_Private.h"
|
||||
|
||||
#include <mbgl/style/style.hpp>
|
||||
#include <mbgl/map/map.hpp>
|
||||
#include <mbgl/style/source.hpp>
|
||||
|
||||
@interface MGLSource ()
|
||||
@@ -10,7 +12,7 @@
|
||||
// special internal source types like mbgl::AnnotationSource.
|
||||
@property (nonatomic, readonly) mbgl::style::Source *rawSource;
|
||||
|
||||
@property (nonatomic, readonly, weak) MGLStyle *style;
|
||||
@property (nonatomic, readonly, weak) MGLMapView *mapView;
|
||||
|
||||
@end
|
||||
|
||||
@@ -27,37 +29,38 @@
|
||||
return self;
|
||||
}
|
||||
|
||||
- (instancetype)initWithRawSource:(mbgl::style::Source *)rawSource {
|
||||
- (instancetype)initWithRawSource:(mbgl::style::Source *)rawSource mapView:(MGLMapView *)mapView {
|
||||
NSString *identifier = @(rawSource->getID().c_str());
|
||||
if (self = [self initWithIdentifier:identifier]) {
|
||||
_rawSource = rawSource;
|
||||
_rawSource->peer = SourceWrapper { self };
|
||||
_mapView = mapView;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (instancetype)initWithPendingSource:(std::unique_ptr<mbgl::style::Source>)pendingSource {
|
||||
if (self = [self initWithRawSource:pendingSource.get()]) {
|
||||
if (self = [self initWithRawSource:pendingSource.get() mapView:nil]) {
|
||||
_pendingSource = std::move(pendingSource);
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)addToStyle:(MGLStyle *)style {
|
||||
- (void)addToMapView:(MGLMapView *)mapView {
|
||||
if (_pendingSource == nullptr) {
|
||||
[NSException raise:@"MGLRedundantSourceException"
|
||||
format:@"This instance %@ was already added to %@. Adding the same source instance " \
|
||||
"to the style more than once is invalid.", self, style];
|
||||
"to the style more than once is invalid.", self, mapView.style];
|
||||
}
|
||||
|
||||
_style = style;
|
||||
style.rawStyle->addSource(std::move(_pendingSource));
|
||||
|
||||
_mapView = mapView;
|
||||
_mapView.style.rawStyle->addSource(std::move(_pendingSource));
|
||||
}
|
||||
|
||||
- (void)removeFromStyle:(MGLStyle *)style {
|
||||
if (self.rawSource == style.rawStyle->getSource(self.identifier.UTF8String)) {
|
||||
_pendingSource = style.rawStyle->removeSource(self.identifier.UTF8String);
|
||||
_style = nil;
|
||||
- (void)removeFromMapView:(MGLMapView *)mapView {
|
||||
if (self.rawSource == mapView.style.rawStyle->getSource(self.identifier.UTF8String)) {
|
||||
_pendingSource = mapView.style.rawStyle->removeSource(self.identifier.UTF8String);
|
||||
_mapView = nil;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ struct SourceWrapper {
|
||||
__weak MGLSource *source;
|
||||
};
|
||||
|
||||
@class MGLStyle;
|
||||
@class MGLMapView;
|
||||
|
||||
@interface MGLSource (Private)
|
||||
|
||||
@@ -26,7 +26,7 @@ struct SourceWrapper {
|
||||
Initializes and returns a source with a raw pointer to the backing store,
|
||||
associated with a style.
|
||||
*/
|
||||
- (instancetype)initWithRawSource:(mbgl::style::Source *)rawSource;
|
||||
- (instancetype)initWithRawSource:(mbgl::style::Source *)rawSource mapView:(nullable MGLMapView *)mapView;
|
||||
|
||||
/**
|
||||
Initializes and returns a source with an owning pointer to the backing store,
|
||||
@@ -44,33 +44,30 @@ struct SourceWrapper {
|
||||
@property (nonatomic, readonly) mbgl::style::Source *rawSource;
|
||||
|
||||
/**
|
||||
The style which currently contains the source.
|
||||
|
||||
If the source is not currently part of a style, this property is
|
||||
The map view whose style currently contains the source.
|
||||
If the source is not currently part of any map view’s style, this property is
|
||||
set to `nil`.
|
||||
*/
|
||||
@property (nonatomic, readonly, weak) MGLStyle *style;
|
||||
@property (nonatomic, readonly, weak) MGLMapView *mapView;
|
||||
|
||||
/**
|
||||
Adds the mbgl source that this object represents to the style.
|
||||
|
||||
Adds the mbgl source that this object represents to the mbgl map.
|
||||
Once a mbgl source is added, ownership of the object is transferred to the
|
||||
`mbgl::Style` and this object no longer has an active unique_ptr reference to the
|
||||
`mbgl::Map` and this object no longer has an active unique_ptr reference to the
|
||||
`mbgl::Source`. If this object's mbgl source is in that state, the mbgl source
|
||||
can still be changed but the changes will not be visible until the `MGLSource`
|
||||
is added back to the style via `-[MGLStyle addSource:]` and styled with a
|
||||
is added back to the map via `-[MGLStyle addSource:]` and styled with a
|
||||
`MGLLayer`.
|
||||
*/
|
||||
- (void)addToStyle:(MGLStyle *)style;
|
||||
- (void)addToMapView:(MGLMapView *)mapView;
|
||||
|
||||
/**
|
||||
Removes the mbgl source that this object represents from the style.
|
||||
|
||||
Removes the mbgl source that this object represents from the mbgl map.
|
||||
When a mbgl source is removed, ownership of the object is transferred back
|
||||
to the `MGLSource` instance and the unique_ptr reference is valid again. It is
|
||||
safe to add the source back to the style after it is removed.
|
||||
*/
|
||||
- (void)removeFromStyle:(MGLStyle *)style;
|
||||
- (void)removeFromMapView:(MGLMapView *)mapView;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@@ -557,6 +557,21 @@ MGL_EXPORT
|
||||
*/
|
||||
@property (nonatomic, strong) MGLLight *light;
|
||||
|
||||
#pragma mark Localizing Map Content
|
||||
|
||||
/**
|
||||
A Boolean value that determines whether the style attempts to localize labels in
|
||||
the style into the system’s preferred language.
|
||||
|
||||
When this property is enabled, the style automatically modifies the text property
|
||||
of any symbol style layer whose source is the
|
||||
<a href="https://www.mapbox.com/vector-tiles/mapbox-streets-v7/#overview">Mapbox
|
||||
Streets source</a>. On iOS, the user can set the system’s preferred language in
|
||||
Settings, General Settings, Language & Region. On macOS, the user can set the
|
||||
system’s preferred language in the Language & Region pane of System Preferences.
|
||||
*/
|
||||
@property (nonatomic) BOOL localizesLabels;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
#import "MGLLight_Private.h"
|
||||
#import "MGLTileSource_Private.h"
|
||||
#import "MGLVectorSource.h"
|
||||
#import "MGLVectorSource+MGLAdditions.h"
|
||||
#import "MGLRasterSource.h"
|
||||
#import "MGLShapeSource.h"
|
||||
#import "MGLImageSource.h"
|
||||
@@ -49,12 +50,35 @@
|
||||
#import "NSImage+MGLAdditions.h"
|
||||
#endif
|
||||
|
||||
/**
|
||||
Model class for localization changes.
|
||||
*/
|
||||
@interface MGLTextLanguage: NSObject
|
||||
@property (strong, nonatomic) NSString *originalTextField;
|
||||
@property (strong, nonatomic) NSString *updatedTextField;
|
||||
|
||||
- (instancetype)initWithTextLanguage:(NSString *)originalTextField updatedTextField:(NSString *)updatedTextField;
|
||||
|
||||
@end
|
||||
|
||||
@implementation MGLTextLanguage
|
||||
- (instancetype)initWithTextLanguage:(NSString *)originalTextField updatedTextField:(NSString *)updatedTextField
|
||||
{
|
||||
if (self = [super init]) {
|
||||
_originalTextField = originalTextField;
|
||||
_updatedTextField = updatedTextField;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
@end
|
||||
|
||||
@interface MGLStyle()
|
||||
|
||||
@property (nonatomic, readonly, weak) MGLMapView *mapView;
|
||||
@property (nonatomic, readonly) mbgl::style::Style *rawStyle;
|
||||
@property (readonly, copy, nullable) NSURL *URL;
|
||||
@property (nonatomic, readwrite, strong) NS_MUTABLE_DICTIONARY_OF(NSString *, MGLOpenGLStyleLayer *) *openGLLayers;
|
||||
@property (nonatomic) NS_MUTABLE_DICTIONARY_OF(NSString *, NS_DICTIONARY_OF(NSObject *, MGLTextLanguage *) *) *localizedLayersByIdentifier;
|
||||
|
||||
@end
|
||||
|
||||
@@ -119,6 +143,7 @@ static NSURL *MGLStyleURL_emerald;
|
||||
_mapView = mapView;
|
||||
_rawStyle = rawStyle;
|
||||
_openGLLayers = [NSMutableDictionary dictionary];
|
||||
_localizedLayersByIdentifier = [NSMutableDictionary dictionary];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
@@ -164,6 +189,7 @@ static NSURL *MGLStyleURL_emerald;
|
||||
- (MGLSource *)sourceWithIdentifier:(NSString *)identifier
|
||||
{
|
||||
auto rawSource = self.rawStyle->getSource(identifier.UTF8String);
|
||||
|
||||
return rawSource ? [self sourceFromMBGLSource:rawSource] : nil;
|
||||
}
|
||||
|
||||
@@ -175,15 +201,15 @@ static NSURL *MGLStyleURL_emerald;
|
||||
// TODO: Fill in options specific to the respective source classes
|
||||
// https://github.com/mapbox/mapbox-gl-native/issues/6584
|
||||
if (auto vectorSource = rawSource->as<mbgl::style::VectorSource>()) {
|
||||
return [[MGLVectorSource alloc] initWithRawSource:vectorSource];
|
||||
return [[MGLVectorSource alloc] initWithRawSource:vectorSource mapView:self.mapView];
|
||||
} else if (auto geoJSONSource = rawSource->as<mbgl::style::GeoJSONSource>()) {
|
||||
return [[MGLShapeSource alloc] initWithRawSource:geoJSONSource];
|
||||
return [[MGLShapeSource alloc] initWithRawSource:geoJSONSource mapView:self.mapView];
|
||||
} else if (auto rasterSource = rawSource->as<mbgl::style::RasterSource>()) {
|
||||
return [[MGLRasterSource alloc] initWithRawSource:rasterSource];
|
||||
return [[MGLRasterSource alloc] initWithRawSource:rasterSource mapView:self.mapView];
|
||||
} else if (auto imageSource = rawSource->as<mbgl::style::ImageSource>()) {
|
||||
return [[MGLImageSource alloc] initWithRawSource:imageSource];
|
||||
return [[MGLImageSource alloc] initWithRawSource:imageSource mapView:self.mapView];
|
||||
} else {
|
||||
return [[MGLSource alloc] initWithRawSource:rawSource];
|
||||
return [[MGLSource alloc] initWithRawSource:rawSource mapView:self.mapView];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -197,7 +223,7 @@ static NSURL *MGLStyleURL_emerald;
|
||||
}
|
||||
|
||||
try {
|
||||
[source addToStyle:self];
|
||||
[source addToMapView:self.mapView];
|
||||
} catch (std::runtime_error & err) {
|
||||
[NSException raise:@"MGLRedundantSourceIdentifierException" format:@"%s", err.what()];
|
||||
}
|
||||
@@ -211,7 +237,7 @@ static NSURL *MGLStyleURL_emerald;
|
||||
@"Make sure the source was created as a member of a concrete subclass of MGLSource.",
|
||||
source];
|
||||
}
|
||||
[source removeFromStyle:self];
|
||||
[source removeFromMapView:self.mapView];
|
||||
}
|
||||
|
||||
- (nullable NS_ARRAY_OF(MGLAttributionInfo *) *)attributionInfosWithFontSize:(CGFloat)fontSize linkColor:(nullable MGLColor *)linkColor {
|
||||
@@ -585,4 +611,115 @@ static NSURL *MGLStyleURL_emerald;
|
||||
self.URL ? [NSString stringWithFormat:@"\"%@\"", self.URL] : self.URL];
|
||||
}
|
||||
|
||||
#pragma mark Style language preferences
|
||||
|
||||
- (void)setLocalizesLabels:(BOOL)localizesLabels
|
||||
{
|
||||
if (_localizesLabels != localizesLabels) {
|
||||
_localizesLabels = localizesLabels;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
if (_localizesLabels) {
|
||||
NSString *preferredLanguage = [MGLVectorSource preferredMapboxStreetsLanguage];
|
||||
NSMutableDictionary *localizedKeysByKeyBySourceIdentifier = [NSMutableDictionary dictionary];
|
||||
for (MGLSymbolStyleLayer *layer in self.layers) {
|
||||
if (![layer isKindOfClass:[MGLSymbolStyleLayer class]]) {
|
||||
continue;
|
||||
}
|
||||
|
||||
MGLVectorSource *source = (MGLVectorSource *)[self sourceWithIdentifier:layer.sourceIdentifier];
|
||||
if (![source isKindOfClass:[MGLVectorSource class]] || !source.mapboxStreets) {
|
||||
continue;
|
||||
}
|
||||
|
||||
NSDictionary *localizedKeysByKey = localizedKeysByKeyBySourceIdentifier[layer.sourceIdentifier];
|
||||
if (!localizedKeysByKey) {
|
||||
localizedKeysByKey = localizedKeysByKeyBySourceIdentifier[layer.sourceIdentifier] = [source localizedKeysByKeyForPreferredLanguage:preferredLanguage];
|
||||
}
|
||||
|
||||
NSString *(^stringByLocalizingString)(NSString *) = ^ NSString * (NSString *string) {
|
||||
NSMutableString *localizedString = string.mutableCopy;
|
||||
[localizedKeysByKey enumerateKeysAndObjectsUsingBlock:^(NSString * _Nonnull key, NSString * _Nonnull localizedKey, BOOL * _Nonnull stop) {
|
||||
NSAssert([key isKindOfClass:[NSString class]], @"key is not a string");
|
||||
NSAssert([localizedKey isKindOfClass:[NSString class]], @"localizedKey is not a string");
|
||||
[localizedString replaceOccurrencesOfString:[NSString stringWithFormat:@"{%@}", key]
|
||||
withString:[NSString stringWithFormat:@"{%@}", localizedKey]
|
||||
options:0
|
||||
range:NSMakeRange(0, localizedString.length)];
|
||||
}];
|
||||
return localizedString;
|
||||
};
|
||||
|
||||
if ([layer.text isKindOfClass:[MGLConstantStyleValue class]]) {
|
||||
NSString *textField = [(MGLConstantStyleValue<NSString *> *)layer.text rawValue];
|
||||
NSString *localizingString = stringByLocalizingString(textField);
|
||||
if (![textField isEqualToString:localizingString]) {
|
||||
MGLTextLanguage *textLanguage = [[MGLTextLanguage alloc] initWithTextLanguage:textField
|
||||
updatedTextField:localizingString];
|
||||
[self.localizedLayersByIdentifier setObject:@{ textField : textLanguage } forKey:layer.identifier];
|
||||
layer.text = [MGLStyleValue<NSString *> valueWithRawValue:localizingString];
|
||||
}
|
||||
}
|
||||
else if ([layer.text isKindOfClass:[MGLCameraStyleFunction class]]) {
|
||||
MGLCameraStyleFunction *function = (MGLCameraStyleFunction<NSString *> *)layer.text;
|
||||
NSMutableDictionary *stops = function.stops.mutableCopy;
|
||||
NSMutableDictionary *cameraStops = [NSMutableDictionary dictionary];
|
||||
[stops enumerateKeysAndObjectsUsingBlock:^(NSNumber *zoomLevel, MGLConstantStyleValue<NSString *> *stop, BOOL *done) {
|
||||
NSString *textField = stop.rawValue;
|
||||
NSString *localizingString = stringByLocalizingString(textField);
|
||||
if (![textField isEqualToString:localizingString]) {
|
||||
MGLTextLanguage *textLanguage = [[MGLTextLanguage alloc] initWithTextLanguage:textField
|
||||
updatedTextField:localizingString];
|
||||
[cameraStops setObject:textLanguage forKey:zoomLevel];
|
||||
stops[zoomLevel] = [MGLStyleValue<NSString *> valueWithRawValue:localizingString];
|
||||
}
|
||||
|
||||
}];
|
||||
if (cameraStops.count > 0) {
|
||||
[self.localizedLayersByIdentifier setObject:cameraStops forKey:layer.identifier];
|
||||
}
|
||||
function.stops = stops;
|
||||
layer.text = function;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
[self.localizedLayersByIdentifier enumerateKeysAndObjectsUsingBlock:^(NSString *identifier, NSDictionary<NSObject *, MGLTextLanguage *> *textFields, BOOL *done) {
|
||||
MGLSymbolStyleLayer *layer = (MGLSymbolStyleLayer *)[self.mapView.style layerWithIdentifier:identifier];
|
||||
|
||||
if ([layer.text isKindOfClass:[MGLConstantStyleValue class]]) {
|
||||
NSString *textField = [(MGLConstantStyleValue<NSString *> *)layer.text rawValue];
|
||||
[textFields enumerateKeysAndObjectsUsingBlock:^(NSObject *originalLanguage, MGLTextLanguage *textLanguage, BOOL *done) {
|
||||
if ([textLanguage.updatedTextField isEqualToString:textField]) {
|
||||
layer.text = [MGLStyleValue<NSString *> valueWithRawValue:textLanguage.originalTextField];
|
||||
}
|
||||
}];
|
||||
|
||||
}
|
||||
else if ([layer.text isKindOfClass:[MGLCameraStyleFunction class]]) {
|
||||
MGLCameraStyleFunction *function = (MGLCameraStyleFunction<NSString *> *)layer.text;
|
||||
NSMutableDictionary *stops = function.stops.mutableCopy;
|
||||
[textFields enumerateKeysAndObjectsUsingBlock:^(NSObject *zoomKey, MGLTextLanguage *textLanguage, BOOL *done) {
|
||||
if ([zoomKey isKindOfClass:[NSNumber class]]) {
|
||||
NSNumber *zoomLevel = (NSNumber*)zoomKey;
|
||||
MGLConstantStyleValue<NSString *> *stop = [stops objectForKey:zoomLevel];
|
||||
NSString *textField = stop.rawValue;
|
||||
if ([textLanguage.updatedTextField isEqualToString:textField]) {
|
||||
stops[zoomLevel] = [MGLStyleValue<NSString *> valueWithRawValue:textLanguage.originalTextField];
|
||||
}
|
||||
}
|
||||
}];
|
||||
|
||||
function.stops = stops;
|
||||
layer.text = function;
|
||||
}
|
||||
|
||||
}];
|
||||
|
||||
self.localizedLayersByIdentifier = [NSMutableDictionary dictionary];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface MGLVectorSource (MBXAdditions)
|
||||
@interface MGLVectorSource (MGLAdditions)
|
||||
|
||||
+ (NSString *)preferredMapboxStreetsLanguage;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#import "MGLVectorSource+MBXAdditions.h"
|
||||
#import "MGLVectorSource+MGLAdditions.h"
|
||||
|
||||
@implementation MGLVectorSource (MBXAdditions)
|
||||
@implementation MGLVectorSource (MGLAdditions)
|
||||
|
||||
+ (NS_SET_OF(NSString *) *)mapboxStreetsLanguages {
|
||||
// https://www.mapbox.com/vector-tiles/mapbox-streets-v7/#overview
|
||||
@@ -64,8 +64,8 @@
|
||||
}
|
||||
|
||||
std::vector<mbgl::Feature> features;
|
||||
if (self.style) {
|
||||
features = self.style.mapView.renderer->querySourceFeatures(self.rawSource->getID(), { optionalSourceLayerIDs, optionalFilter });
|
||||
if (self.mapView) {
|
||||
features = self.mapView.renderer->querySourceFeatures(self.rawSource->getID(), { optionalSourceLayerIDs, optionalFilter });
|
||||
}
|
||||
return MGLFeaturesFromMBGLFeatures(features);
|
||||
}
|
||||
|
||||
@@ -103,6 +103,18 @@ class MGLDocumentationExampleTests: XCTestCase, MGLMapViewDelegate {
|
||||
|
||||
XCTAssertNotNil(mapView.style?.source(withIdentifier: "pois"))
|
||||
}
|
||||
|
||||
func testMGLPolyline() {
|
||||
//#-example-code
|
||||
let coordinates = [
|
||||
CLLocationCoordinate2D(latitude: 35.68476, longitude: -220.24257),
|
||||
CLLocationCoordinate2D(latitude: 37.78428, longitude: -122.41310)
|
||||
]
|
||||
let polyline = MGLPolyline(coordinates: coordinates, count: UInt(coordinates.count))
|
||||
//#-end-example-code
|
||||
|
||||
XCTAssertNotNil(polyline)
|
||||
}
|
||||
|
||||
func testMGLImageSource() {
|
||||
//#-example-code
|
||||
|
||||
@@ -14,7 +14,22 @@ Mapbox welcomes participation and contributions from everyone. Please read [CONT
|
||||
|
||||
* Increased the default maximum zoom level from 20 to 22. ([#9835](https://github.com/mapbox/mapbox-gl-native/pull/9835))
|
||||
|
||||
## 3.6.0
|
||||
## 3.6.2
|
||||
|
||||
* Added an `MGLStyle.localizesLabels` property, off by default, that localizes any Mapbox Streets–sourced symbol layer into the user’s preferred language. ([#9582](https://github.com/mapbox/mapbox-gl-native/pull/9582))
|
||||
* Added an additional camera method to MGLMapView that accepts an edge padding parameter. ([#9651](https://github.com/mapbox/mapbox-gl-native/pull/9651))
|
||||
* Fixed an issue with the scaling of the user location annotation’s horizontal accuracy indicator. ([#9721](https://github.com/mapbox/mapbox-gl-native/pull/9721))
|
||||
* Fixed an issue that caused `-[MGLShapeSource featuresMatchingPredicate:]` and `-[MGLVectorSource featuresInSourceLayersWithIdentifiers:predicate:]` to always return an empty array. ([#9784](https://github.com/mapbox/mapbox-gl-native/pull/9784))
|
||||
|
||||
## 3.6.1 - July 28, 2017
|
||||
|
||||
* Reduced the size of the dynamic framework by optimizing symbol visibility. ([#7604](https://github.com/mapbox/mapbox-gl-native/pull/7604))
|
||||
* Fixed an issue where the attribution button would have its custom tint color reset when the map view received a tint color change notification, such as when an alert controller was presented. ([#9598](https://github.com/mapbox/mapbox-gl-native/pull/9598))
|
||||
* Improved the behavior of zoom gestures when the map reaches the minimum zoom limit. ([#9626](https://github.com/mapbox/mapbox-gl-native/pull/9626))
|
||||
* Fixed an issue where tilt gesture was triggered with two fingers aligned vertically and panning down. ([#9571](https://github.com/mapbox/mapbox-gl-native/pull/9571))
|
||||
* Bitcode symbol maps (.bcsymbolmap files) are now included with the dynamic framework. ([#9613](https://github.com/mapbox/mapbox-gl-native/pull/9613))
|
||||
|
||||
## 3.6.0 - June 29, 2017
|
||||
|
||||
### Packaging
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
Pod::Spec.new do |m|
|
||||
|
||||
version = '3.6.0-alpha.1'
|
||||
version = '3.6.2'
|
||||
|
||||
m.name = 'Mapbox-iOS-SDK-nightly-dynamic'
|
||||
m.version = "#{version}-nightly"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
Pod::Spec.new do |m|
|
||||
|
||||
version = '3.6.0'
|
||||
version = '3.6.2'
|
||||
|
||||
m.name = 'Mapbox-iOS-SDK-symbols'
|
||||
m.version = "#{version}-symbols"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
Pod::Spec.new do |m|
|
||||
|
||||
version = '3.6.0'
|
||||
version = '3.6.2'
|
||||
|
||||
m.name = 'Mapbox-iOS-SDK'
|
||||
m.version = version
|
||||
|
||||
@@ -2,24 +2,11 @@
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "settings.png",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "settings@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
"filename" : "settings.pdf"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
},
|
||||
"properties" : {
|
||||
"template-rendering-intent" : "template"
|
||||
}
|
||||
}
|
||||
BIN
platform/ios/app/Assets.xcassets/settings.imageset/settings.pdf
vendored
Normal file
BIN
platform/ios/app/Assets.xcassets/settings.imageset/settings.pdf
vendored
Normal file
Binary file not shown.
Binary file not shown.
|
Before Width: | Height: | Size: 528 B |
Binary file not shown.
|
Before Width: | Height: | Size: 1.1 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 18 KiB |
@@ -51,5 +51,16 @@
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
<key>UIApplicationShortcutItems</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>UIApplicationShortcutItemTitle</key>
|
||||
<string>Settings</string>
|
||||
<key>UIApplicationShortcutItemType</key>
|
||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER).settings</string>
|
||||
<key>UIApplicationShortcutItemIconFile</key>
|
||||
<string>settings</string>
|
||||
</dict>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
||||
|
||||
@@ -1,8 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="10116" systemVersion="15E65" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" initialViewController="01J-lp-oVM">
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="12121" systemVersion="16G29" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
|
||||
<device id="retina4_7" orientation="portrait">
|
||||
<adaptation id="fullscreen"/>
|
||||
</device>
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12089"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
<!--View Controller-->
|
||||
@@ -14,9 +18,9 @@
|
||||
<viewControllerLayoutGuide type="bottom" id="xb3-aO-Qok"/>
|
||||
</layoutGuides>
|
||||
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
|
||||
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
|
||||
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
</view>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
|
||||
@@ -26,4 +26,22 @@ NSString * const MBXMapboxAccessTokenDefaultsKey = @"MBXMapboxAccessToken";
|
||||
return YES;
|
||||
}
|
||||
|
||||
#pragma mark - Quick actions
|
||||
|
||||
- (void)application:(UIApplication *)application performActionForShortcutItem:(UIApplicationShortcutItem *)shortcutItem completionHandler:(void (^)(BOOL))completionHandler {
|
||||
completionHandler([self handleShortcut:shortcutItem]);
|
||||
}
|
||||
|
||||
- (BOOL)handleShortcut:(UIApplicationShortcutItem *)shortcut {
|
||||
if ([[shortcut.type componentsSeparatedByString:@"."].lastObject isEqual:@"settings"]) {
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];
|
||||
});
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
return NO;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -34,7 +34,6 @@ typedef NS_ENUM(NSInteger, MBXSettingsCoreRenderingRows) {
|
||||
MBXSettingsCoreRenderingTimestamps,
|
||||
MBXSettingsCoreRenderingCollisionBoxes,
|
||||
MBXSettingsCoreRenderingOverdrawVisualization,
|
||||
MBXSettingsCoreRenderingToggleTwoMaps,
|
||||
};
|
||||
|
||||
typedef NS_ENUM(NSInteger, MBXSettingsAnnotationsRows) {
|
||||
@@ -48,6 +47,7 @@ typedef NS_ENUM(NSInteger, MBXSettingsAnnotationsRows) {
|
||||
MBXSettingsAnnotationsTestShapes,
|
||||
MBXSettingsAnnotationsCustomCallout,
|
||||
MBXSettingsAnnotationsQueryAnnotations,
|
||||
MBXSettingsAnnotationsCustomUserDot,
|
||||
MBXSettingsAnnotationsRemoveAnnotations,
|
||||
};
|
||||
|
||||
@@ -73,7 +73,6 @@ typedef NS_ENUM(NSInteger, MBXSettingsRuntimeStylingRows) {
|
||||
MBXSettingsRuntimeStylingVectorSource,
|
||||
MBXSettingsRuntimeStylingRasterSource,
|
||||
MBXSettingsRuntimeStylingImageSource,
|
||||
MBXSettingsRuntimeStylingCountryLabels,
|
||||
MBXSettingsRuntimeStylingRouteLine,
|
||||
MBXSettingsRuntimeStylingDDSPolygon,
|
||||
};
|
||||
@@ -81,9 +80,10 @@ typedef NS_ENUM(NSInteger, MBXSettingsRuntimeStylingRows) {
|
||||
typedef NS_ENUM(NSInteger, MBXSettingsMiscellaneousRows) {
|
||||
MBXSettingsMiscellaneousShowReuseQueueStats = 0,
|
||||
MBXSettingsMiscellaneousWorldTour,
|
||||
MBXSettingsMiscellaneousCustomUserDot,
|
||||
MBXSettingsMiscellaneousShowZoomLevel,
|
||||
MBXSettingsMiscellaneousScrollView,
|
||||
MBXSettingsMiscellaneousToggleTwoMaps,
|
||||
MBXSettingsMiscellaneousCountryLabels,
|
||||
MBXSettingsMiscellaneousPrintLogFile,
|
||||
MBXSettingsMiscellaneousDeleteLogFile,
|
||||
};
|
||||
@@ -305,8 +305,6 @@ typedef NS_ENUM(NSInteger, MBXSettingsMiscellaneousRows) {
|
||||
(debugMask & MGLMapDebugCollisionBoxesMask ? @"Hide" :@"Show")],
|
||||
[NSString stringWithFormat:@"%@ Overdraw Visualization",
|
||||
(debugMask & MGLMapDebugOverdrawVisualizationMask ? @"Hide" :@"Show")],
|
||||
[NSString stringWithFormat:@"%@ Second Map",
|
||||
([self.view viewWithTag:2] == nil ? @"Show" : @"Hide")],
|
||||
]];
|
||||
break;
|
||||
case MBXSettingsAnnotations:
|
||||
@@ -321,6 +319,7 @@ typedef NS_ENUM(NSInteger, MBXSettingsMiscellaneousRows) {
|
||||
@"Add Test Shapes",
|
||||
@"Add Point With Custom Callout",
|
||||
@"Query Annotations",
|
||||
[NSString stringWithFormat:@"%@ Custom User Dot", (_customUserLocationAnnnotationEnabled ? @"Disable" : @"Enable")],
|
||||
@"Remove Annotations",
|
||||
]];
|
||||
break;
|
||||
@@ -347,7 +346,6 @@ typedef NS_ENUM(NSInteger, MBXSettingsMiscellaneousRows) {
|
||||
@"Style Vector Source",
|
||||
@"Style Raster Source",
|
||||
@"Style Image Source",
|
||||
[NSString stringWithFormat:@"Label Countries in %@", (_usingLocaleBasedCountryLabels ? @"Local Language" : [[NSLocale currentLocale] displayNameForKey:NSLocaleIdentifier value:[self bestLanguageForUser]])],
|
||||
@"Add Route Line",
|
||||
@"Dynamically Style Polygon",
|
||||
]];
|
||||
@@ -356,9 +354,10 @@ typedef NS_ENUM(NSInteger, MBXSettingsMiscellaneousRows) {
|
||||
[settingsTitles addObjectsFromArray:@[
|
||||
[NSString stringWithFormat:@"%@ Reuse Queue Stats", (_reuseQueueStatsEnabled ? @"Hide" :@"Show")],
|
||||
@"Start World Tour",
|
||||
[NSString stringWithFormat:@"%@ Custom User Dot", (_customUserLocationAnnnotationEnabled ? @"Disable" : @"Enable")],
|
||||
[NSString stringWithFormat:@"%@ Zoom Level", (_showZoomLevelEnabled ? @"Hide" :@"Show")],
|
||||
@"Embedded Map View",
|
||||
[NSString stringWithFormat:@"%@ Second Map", ([self.view viewWithTag:2] == nil ? @"Show" : @"Hide")],
|
||||
[NSString stringWithFormat:@"Show Labels in %@", (_usingLocaleBasedCountryLabels ? @"Default Language" : [[NSLocale currentLocale] displayNameForKey:NSLocaleIdentifier value:[self bestLanguageForUser]])],
|
||||
]];
|
||||
|
||||
if (self.debugLoggingEnabled)
|
||||
@@ -403,81 +402,6 @@ typedef NS_ENUM(NSInteger, MBXSettingsMiscellaneousRows) {
|
||||
case MBXSettingsCoreRenderingOverdrawVisualization:
|
||||
self.mapView.debugMask ^= MGLMapDebugOverdrawVisualizationMask;
|
||||
break;
|
||||
case MBXSettingsCoreRenderingToggleTwoMaps:
|
||||
if ([self.view viewWithTag:2] == nil) {
|
||||
MGLMapView *secondMapView = [[MGLMapView alloc] initWithFrame:
|
||||
CGRectMake(0, self.view.bounds.size.height / 2,
|
||||
self.view.bounds.size.width, self.view.bounds.size.height / 2)];
|
||||
secondMapView.translatesAutoresizingMaskIntoConstraints = false;
|
||||
secondMapView.tag = 2;
|
||||
for (NSLayoutConstraint *constraint in self.view.constraints)
|
||||
{
|
||||
if ((constraint.firstItem == self.mapView && constraint.firstAttribute == NSLayoutAttributeBottom) ||
|
||||
(constraint.secondItem == self.mapView && constraint.secondAttribute == NSLayoutAttributeBottom))
|
||||
{
|
||||
[self.view removeConstraint:constraint];
|
||||
break;
|
||||
}
|
||||
}
|
||||
[self.view addSubview:secondMapView];
|
||||
[self.view addConstraints:@[
|
||||
[NSLayoutConstraint constraintWithItem:self.mapView
|
||||
attribute:NSLayoutAttributeBottom
|
||||
relatedBy:NSLayoutRelationEqual
|
||||
toItem:self.view
|
||||
attribute:NSLayoutAttributeCenterY
|
||||
multiplier:1
|
||||
constant:0],
|
||||
[NSLayoutConstraint constraintWithItem:secondMapView
|
||||
attribute:NSLayoutAttributeCenterX
|
||||
relatedBy:NSLayoutRelationEqual
|
||||
toItem:self.view
|
||||
attribute:NSLayoutAttributeCenterX
|
||||
multiplier:1
|
||||
constant:0],
|
||||
[NSLayoutConstraint constraintWithItem:secondMapView
|
||||
attribute:NSLayoutAttributeWidth
|
||||
relatedBy:NSLayoutRelationEqual
|
||||
toItem:self.view
|
||||
attribute:NSLayoutAttributeWidth
|
||||
multiplier:1
|
||||
constant:0],
|
||||
[NSLayoutConstraint constraintWithItem:secondMapView
|
||||
attribute:NSLayoutAttributeTop
|
||||
relatedBy:NSLayoutRelationEqual
|
||||
toItem:self.view
|
||||
attribute:NSLayoutAttributeCenterY
|
||||
multiplier:1
|
||||
constant:0],
|
||||
[NSLayoutConstraint constraintWithItem:secondMapView
|
||||
attribute:NSLayoutAttributeBottom
|
||||
relatedBy:NSLayoutRelationEqual
|
||||
toItem:self.bottomLayoutGuide
|
||||
attribute:NSLayoutAttributeTop
|
||||
multiplier:1
|
||||
constant:0],
|
||||
]];
|
||||
} else {
|
||||
NSMutableArray *constraintsToRemove = [NSMutableArray array];
|
||||
MGLMapView *secondMapView = (MGLMapView *)[self.view viewWithTag:2];
|
||||
for (NSLayoutConstraint *constraint in self.view.constraints)
|
||||
{
|
||||
if (constraint.firstItem == secondMapView || constraint.secondItem == secondMapView)
|
||||
{
|
||||
[constraintsToRemove addObject:constraint];
|
||||
}
|
||||
}
|
||||
[self.view removeConstraints:constraintsToRemove];
|
||||
[secondMapView removeFromSuperview];
|
||||
[self.view addConstraint:[NSLayoutConstraint constraintWithItem:self.mapView
|
||||
attribute:NSLayoutAttributeBottom
|
||||
relatedBy:NSLayoutRelationEqual
|
||||
toItem:self.bottomLayoutGuide
|
||||
attribute:NSLayoutAttributeTop
|
||||
multiplier:1
|
||||
constant:0]];
|
||||
}
|
||||
break;
|
||||
default:
|
||||
NSAssert(NO, @"All core rendering setting rows should be implemented");
|
||||
break;
|
||||
@@ -515,6 +439,9 @@ typedef NS_ENUM(NSInteger, MBXSettingsMiscellaneousRows) {
|
||||
break;
|
||||
case MBXSettingsAnnotationsQueryAnnotations:
|
||||
[self testQueryPointAnnotations];
|
||||
case MBXSettingsAnnotationsCustomUserDot:
|
||||
break;
|
||||
[self toggleCustomUserDot];
|
||||
break;
|
||||
case MBXSettingsAnnotationsRemoveAnnotations:
|
||||
[self.mapView removeAnnotations:self.mapView.annotations];
|
||||
@@ -590,9 +517,6 @@ typedef NS_ENUM(NSInteger, MBXSettingsMiscellaneousRows) {
|
||||
case MBXSettingsRuntimeStylingImageSource:
|
||||
[self styleImageSource];
|
||||
break;
|
||||
case MBXSettingsRuntimeStylingCountryLabels:
|
||||
[self styleCountryLabelsLanguage];
|
||||
break;
|
||||
case MBXSettingsRuntimeStylingRouteLine:
|
||||
[self styleRouteLine];
|
||||
break;
|
||||
@@ -607,12 +531,12 @@ typedef NS_ENUM(NSInteger, MBXSettingsMiscellaneousRows) {
|
||||
case MBXSettingsMiscellaneous:
|
||||
switch (indexPath.row)
|
||||
{
|
||||
case MBXSettingsMiscellaneousCountryLabels:
|
||||
[self styleCountryLabelsLanguage];
|
||||
break;
|
||||
case MBXSettingsMiscellaneousWorldTour:
|
||||
[self startWorldTour];
|
||||
break;
|
||||
case MBXSettingsMiscellaneousCustomUserDot:
|
||||
[self toggleCustomUserDot];
|
||||
break;
|
||||
case MBXSettingsMiscellaneousPrintLogFile:
|
||||
[self printTelemetryLogFile];
|
||||
break;
|
||||
@@ -640,6 +564,81 @@ typedef NS_ENUM(NSInteger, MBXSettingsMiscellaneousRows) {
|
||||
[self.navigationController pushViewController:embeddedMapViewController animated:YES];
|
||||
break;
|
||||
}
|
||||
case MBXSettingsMiscellaneousToggleTwoMaps:
|
||||
if ([self.view viewWithTag:2] == nil) {
|
||||
MGLMapView *secondMapView = [[MGLMapView alloc] initWithFrame:
|
||||
CGRectMake(0, self.view.bounds.size.height / 2,
|
||||
self.view.bounds.size.width, self.view.bounds.size.height / 2)];
|
||||
secondMapView.translatesAutoresizingMaskIntoConstraints = false;
|
||||
secondMapView.tag = 2;
|
||||
for (NSLayoutConstraint *constraint in self.view.constraints)
|
||||
{
|
||||
if ((constraint.firstItem == self.mapView && constraint.firstAttribute == NSLayoutAttributeBottom) ||
|
||||
(constraint.secondItem == self.mapView && constraint.secondAttribute == NSLayoutAttributeBottom))
|
||||
{
|
||||
[self.view removeConstraint:constraint];
|
||||
break;
|
||||
}
|
||||
}
|
||||
[self.view addSubview:secondMapView];
|
||||
[self.view addConstraints:@[
|
||||
[NSLayoutConstraint constraintWithItem:self.mapView
|
||||
attribute:NSLayoutAttributeBottom
|
||||
relatedBy:NSLayoutRelationEqual
|
||||
toItem:self.view
|
||||
attribute:NSLayoutAttributeCenterY
|
||||
multiplier:1
|
||||
constant:0],
|
||||
[NSLayoutConstraint constraintWithItem:secondMapView
|
||||
attribute:NSLayoutAttributeCenterX
|
||||
relatedBy:NSLayoutRelationEqual
|
||||
toItem:self.view
|
||||
attribute:NSLayoutAttributeCenterX
|
||||
multiplier:1
|
||||
constant:0],
|
||||
[NSLayoutConstraint constraintWithItem:secondMapView
|
||||
attribute:NSLayoutAttributeWidth
|
||||
relatedBy:NSLayoutRelationEqual
|
||||
toItem:self.view
|
||||
attribute:NSLayoutAttributeWidth
|
||||
multiplier:1
|
||||
constant:0],
|
||||
[NSLayoutConstraint constraintWithItem:secondMapView
|
||||
attribute:NSLayoutAttributeTop
|
||||
relatedBy:NSLayoutRelationEqual
|
||||
toItem:self.view
|
||||
attribute:NSLayoutAttributeCenterY
|
||||
multiplier:1
|
||||
constant:0],
|
||||
[NSLayoutConstraint constraintWithItem:secondMapView
|
||||
attribute:NSLayoutAttributeBottom
|
||||
relatedBy:NSLayoutRelationEqual
|
||||
toItem:self.bottomLayoutGuide
|
||||
attribute:NSLayoutAttributeTop
|
||||
multiplier:1
|
||||
constant:0],
|
||||
]];
|
||||
} else {
|
||||
NSMutableArray *constraintsToRemove = [NSMutableArray array];
|
||||
MGLMapView *secondMapView = (MGLMapView *)[self.view viewWithTag:2];
|
||||
for (NSLayoutConstraint *constraint in self.view.constraints)
|
||||
{
|
||||
if (constraint.firstItem == secondMapView || constraint.secondItem == secondMapView)
|
||||
{
|
||||
[constraintsToRemove addObject:constraint];
|
||||
}
|
||||
}
|
||||
[self.view removeConstraints:constraintsToRemove];
|
||||
[secondMapView removeFromSuperview];
|
||||
[self.view addConstraint:[NSLayoutConstraint constraintWithItem:self.mapView
|
||||
attribute:NSLayoutAttributeBottom
|
||||
relatedBy:NSLayoutRelationEqual
|
||||
toItem:self.bottomLayoutGuide
|
||||
attribute:NSLayoutAttributeTop
|
||||
multiplier:1
|
||||
constant:0]];
|
||||
}
|
||||
break;
|
||||
default:
|
||||
NSAssert(NO, @"All miscellaneous setting rows should be implemented");
|
||||
break;
|
||||
@@ -1303,8 +1302,8 @@ typedef NS_ENUM(NSInteger, MBXSettingsMiscellaneousRows) {
|
||||
|
||||
- (void)styleRasterSource
|
||||
{
|
||||
NSArray *tileURLTemplates = @[@"https://stamen-tiles.a.ssl.fastly.net/terrain-background/{z}/{x}/{y}.jpg"];
|
||||
MGLRasterSource *rasterSource = [[MGLRasterSource alloc] initWithIdentifier:@"style-raster-source-id" tileURLTemplates:tileURLTemplates options:@{
|
||||
NSString *tileURL = [NSString stringWithFormat:@"https://stamen-tiles.a.ssl.fastly.net/terrain-background/{z}/{x}/{y}%@.jpg", UIScreen.mainScreen.nativeScale > 1 ? @"@2x" : @""];
|
||||
MGLRasterSource *rasterSource = [[MGLRasterSource alloc] initWithIdentifier:@"style-raster-source-id" tileURLTemplates:@[tileURL] options:@{
|
||||
MGLTileSourceOptionTileSize: @256,
|
||||
}];
|
||||
[self.mapView.style addSource:rasterSource];
|
||||
@@ -1348,12 +1347,8 @@ typedef NS_ENUM(NSInteger, MBXSettingsMiscellaneousRows) {
|
||||
|
||||
-(void)styleCountryLabelsLanguage
|
||||
{
|
||||
NSArray<NSString *> *labelLayers = @[
|
||||
@"country-label-lg",
|
||||
@"country-label-md",
|
||||
@"country-label-sm",
|
||||
];
|
||||
[self styleLabelLanguageForLayersNamed:labelLayers];
|
||||
_usingLocaleBasedCountryLabels = !_usingLocaleBasedCountryLabels;
|
||||
self.mapView.style.localizesLabels = _usingLocaleBasedCountryLabels;
|
||||
}
|
||||
|
||||
- (void)styleRouteLine
|
||||
@@ -1436,39 +1431,6 @@ typedef NS_ENUM(NSInteger, MBXSettingsMiscellaneousRows) {
|
||||
[self.mapView.style addLayer:fillStyleLayer];
|
||||
}
|
||||
|
||||
- (void)styleLabelLanguageForLayersNamed:(NSArray<NSString *> *)layers
|
||||
{
|
||||
_usingLocaleBasedCountryLabels = !_usingLocaleBasedCountryLabels;
|
||||
NSString *bestLanguageForUser = [NSString stringWithFormat:@"{name_%@}", [self bestLanguageForUser]];
|
||||
NSString *language = _usingLocaleBasedCountryLabels ? bestLanguageForUser : @"{name}";
|
||||
|
||||
for (NSString *layerName in layers) {
|
||||
MGLSymbolStyleLayer *layer = (MGLSymbolStyleLayer *)[self.mapView.style layerWithIdentifier:layerName];
|
||||
|
||||
if ([layer isKindOfClass:[MGLSymbolStyleLayer class]]) {
|
||||
if ([layer.text isKindOfClass:[MGLConstantStyleValue class]]) {
|
||||
MGLConstantStyleValue *label = (MGLConstantStyleValue<NSString *> *)layer.text;
|
||||
if ([label.rawValue hasPrefix:@"{name"]) {
|
||||
layer.text = [MGLStyleValue valueWithRawValue:language];
|
||||
}
|
||||
}
|
||||
else if ([layer.text isKindOfClass:[MGLCameraStyleFunction class]]) {
|
||||
MGLCameraStyleFunction *function = (MGLCameraStyleFunction<NSString *> *)layer.text;
|
||||
NSMutableDictionary *stops = function.stops.mutableCopy;
|
||||
[stops enumerateKeysAndObjectsUsingBlock:^(NSNumber *zoomLevel, MGLConstantStyleValue<NSString *> *stop, BOOL *done) {
|
||||
if ([stop.rawValue hasPrefix:@"{name"]) {
|
||||
stops[zoomLevel] = [MGLStyleValue<NSString *> valueWithRawValue:language];
|
||||
}
|
||||
}];
|
||||
function.stops = stops;
|
||||
layer.text = function;
|
||||
}
|
||||
} else {
|
||||
NSLog(@"%@ is not a symbol style layer", layerName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (NSString *)bestLanguageForUser
|
||||
{
|
||||
// https://www.mapbox.com/vector-tiles/mapbox-streets-v7/#overview
|
||||
@@ -1686,7 +1648,7 @@ typedef NS_ENUM(NSInteger, MBXSettingsMiscellaneousRows) {
|
||||
[sender setAccessibilityValue:nextAccessibilityValue];
|
||||
}
|
||||
|
||||
#pragma mark - Map Delegate
|
||||
#pragma mark - MGLMapViewDelegate
|
||||
|
||||
- (MGLAnnotationView *)mapView:(MGLMapView *)mapView viewForAnnotation:(id<MGLAnnotation>)annotation
|
||||
{
|
||||
|
||||
@@ -6,4 +6,4 @@ The Mapbox iOS SDK is an open-source framework for embedding interactive map vie
|
||||
|
||||
For setup information, check out the [Mapbox iOS SDK homepage](https://www.mapbox.com/ios-sdk/). For detailed usage instructions, read “[First steps with the Mapbox iOS SDK](https://www.mapbox.com/help/first-steps-ios-sdk/)” and consult the [online examples](https://www.mapbox.com/ios-sdk/examples/). A [full changelog](https://github.com/mapbox/mapbox-gl-native/blob/master/platform/ios/CHANGELOG.md) is also available.
|
||||
|
||||
If you have any questions, please [contact our support team](https://www.mapbox.com/contact/). We welcome your [bug reports and feature requests](https://github.com/mapbox/mapbox-gl-native/issues/).
|
||||
If you have any questions, please see [our help page](https://www.mapbox.com/help/). We welcome your [bug reports, feature requests, and contributions](https://github.com/mapbox/mapbox-gl-native/issues/).
|
||||
|
||||
@@ -96,4 +96,4 @@ class ViewController: UIViewController {
|
||||
|
||||
Full API documentation is included in this package, within the `documentation` folder. For more details, read “[First steps with the Mapbox iOS SDK](https://www.mapbox.com/help/first-steps-ios-sdk/)” and consult the [online examples](https://www.mapbox.com/ios-sdk/examples/).
|
||||
|
||||
If you have any questions, please [contact our support team](https://www.mapbox.com/contact/). We welcome your [bug reports and feature requests](https://github.com/mapbox/mapbox-gl-native/issues/).
|
||||
If you have any questions, please see [our help page](https://www.mapbox.com/help/). We welcome your [bug reports, feature requests, and contributions](https://github.com/mapbox/mapbox-gl-native/issues/).
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
"TELEMETRY_GROUP_TITLE" = "Adatvédelmi beállítások";
|
||||
"TELEMETRY_SWITCH_TITLE" = "Mapbox Telemetria";
|
||||
"TELEMETRY_GROUP_FOOTER" = "Ez a beállítás megengedi az alkalmazásnak, hogy névtelen helyzeti és használati adatokat osszon meg a Mapbox-szal.";
|
||||
@@ -22,6 +22,10 @@
|
||||
1F7454971ECD450D00021D39 /* MGLLight_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 1F7454941ECD450D00021D39 /* MGLLight_Private.h */; };
|
||||
1F7454A91ED08AB400021D39 /* MGLLightTest.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1F7454A61ED08AB400021D39 /* MGLLightTest.mm */; };
|
||||
1F95931D1E6DE2E900D5B294 /* MGLNSDateAdditionsTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1F95931C1E6DE2E900D5B294 /* MGLNSDateAdditionsTests.mm */; };
|
||||
1FB7DAAF1F2A4DBD00410606 /* MGLVectorSource+MGLAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 1FDD9D6D1F26936400252B09 /* MGLVectorSource+MGLAdditions.h */; };
|
||||
1FB7DAB01F2A4DC200410606 /* MGLVectorSource+MGLAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 1FDD9D6D1F26936400252B09 /* MGLVectorSource+MGLAdditions.h */; };
|
||||
1FB7DAB11F2A4DC800410606 /* MGLVectorSource+MGLAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = 1FDD9D6E1F26936400252B09 /* MGLVectorSource+MGLAdditions.m */; };
|
||||
1FB7DAB21F2A4DC900410606 /* MGLVectorSource+MGLAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = 1FDD9D6E1F26936400252B09 /* MGLVectorSource+MGLAdditions.m */; };
|
||||
30E578171DAA85520050F07E /* UIImage+MGLAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 30E578111DAA7D690050F07E /* UIImage+MGLAdditions.h */; };
|
||||
30E578181DAA85520050F07E /* UIImage+MGLAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 30E578111DAA7D690050F07E /* UIImage+MGLAdditions.h */; };
|
||||
30E578191DAA855E0050F07E /* UIImage+MGLAdditions.mm in Sources */ = {isa = PBXBuildFile; fileRef = 30E578121DAA7D690050F07E /* UIImage+MGLAdditions.mm */; };
|
||||
@@ -237,7 +241,6 @@
|
||||
DA1DC9971CB6E046006E619F /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = DA1DC9961CB6E046006E619F /* main.m */; };
|
||||
DA1DC9991CB6E054006E619F /* MBXAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = DA1DC9981CB6E054006E619F /* MBXAppDelegate.m */; };
|
||||
DA1DC99B1CB6E064006E619F /* MBXViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = DA1DC99A1CB6E064006E619F /* MBXViewController.m */; };
|
||||
DA1DC99D1CB6E076006E619F /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = DA1DC99C1CB6E076006E619F /* Default-568h@2x.png */; };
|
||||
DA1DC99F1CB6E088006E619F /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = DA1DC99E1CB6E088006E619F /* Assets.xcassets */; };
|
||||
DA1F8F3D1EBD287B00367E42 /* MGLDocumentationGuideTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA1F8F3C1EBD287B00367E42 /* MGLDocumentationGuideTests.swift */; };
|
||||
DA2207BF1DC0805F0002F84D /* MGLStyleValueTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA2207BE1DC0805F0002F84D /* MGLStyleValueTests.swift */; };
|
||||
@@ -558,6 +561,8 @@
|
||||
1F7454941ECD450D00021D39 /* MGLLight_Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLLight_Private.h; sourceTree = "<group>"; };
|
||||
1F7454A61ED08AB400021D39 /* MGLLightTest.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = MGLLightTest.mm; path = ../../darwin/test/MGLLightTest.mm; sourceTree = "<group>"; };
|
||||
1F95931C1E6DE2E900D5B294 /* MGLNSDateAdditionsTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = MGLNSDateAdditionsTests.mm; path = ../../darwin/test/MGLNSDateAdditionsTests.mm; sourceTree = "<group>"; };
|
||||
1FDD9D6D1F26936400252B09 /* MGLVectorSource+MGLAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "MGLVectorSource+MGLAdditions.h"; sourceTree = "<group>"; };
|
||||
1FDD9D6E1F26936400252B09 /* MGLVectorSource+MGLAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "MGLVectorSource+MGLAdditions.m"; sourceTree = "<group>"; };
|
||||
20DABE861DF78148007AC5FF /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/Foundation.strings"; sourceTree = "<group>"; };
|
||||
20DABE881DF78148007AC5FF /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/Localizable.strings"; sourceTree = "<group>"; };
|
||||
20DABE8A1DF78149007AC5FF /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/Root.strings"; sourceTree = "<group>"; };
|
||||
@@ -724,7 +729,6 @@
|
||||
DA1DC9961CB6E046006E619F /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
|
||||
DA1DC9981CB6E054006E619F /* MBXAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MBXAppDelegate.m; sourceTree = "<group>"; };
|
||||
DA1DC99A1CB6E064006E619F /* MBXViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MBXViewController.m; sourceTree = "<group>"; };
|
||||
DA1DC99C1CB6E076006E619F /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x.png"; sourceTree = "<group>"; };
|
||||
DA1DC99E1CB6E088006E619F /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
|
||||
DA1F8F3C1EBD287B00367E42 /* MGLDocumentationGuideTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = MGLDocumentationGuideTests.swift; path = ../../darwin/test/MGLDocumentationGuideTests.swift; sourceTree = "<group>"; };
|
||||
DA2207BE1DC0805F0002F84D /* MGLStyleValueTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = MGLStyleValueTests.swift; path = ../../darwin/test/MGLStyleValueTests.swift; sourceTree = "<group>"; };
|
||||
@@ -915,6 +919,7 @@
|
||||
DABCABBF1CB80717000A7C39 /* locations.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = locations.cpp; sourceTree = "<group>"; };
|
||||
DABCABC01CB80717000A7C39 /* locations.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = locations.hpp; sourceTree = "<group>"; };
|
||||
DAC49C621CD07D74009E1AA3 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = en; path = en.lproj/Localizable.stringsdict; sourceTree = "<group>"; };
|
||||
DACCD9C81F1F473700BB09A1 /* hu */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = hu; path = hu.lproj/Root.strings; sourceTree = "<group>"; };
|
||||
DAD165691CF41981001FF4B9 /* MGLFeature.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLFeature.h; sourceTree = "<group>"; };
|
||||
DAD1656A1CF41981001FF4B9 /* MGLFeature_Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLFeature_Private.h; sourceTree = "<group>"; };
|
||||
DAD1656B1CF41981001FF4B9 /* MGLFeature.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MGLFeature.mm; sourceTree = "<group>"; };
|
||||
@@ -1164,6 +1169,20 @@
|
||||
name = Sources;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
9604FC341F313A5E003EEA02 /* Fixtures */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
353BAEF51D646370009A8DA9 /* amsterdam.geojson */,
|
||||
DA1DC96C1CB6C6CE006E619F /* points.geojson */,
|
||||
DA1DC96D1CB6C6CE006E619F /* polyline.geojson */,
|
||||
DA1DC96F1CB6C6CE006E619F /* threestates.geojson */,
|
||||
DD4823721D94AE6C00EB71B7 /* fill_filter_style.json */,
|
||||
DD4823731D94AE6C00EB71B7 /* line_filter_style.json */,
|
||||
DD4823741D94AE6C00EB71B7 /* numeric_filter_style.json */,
|
||||
);
|
||||
name = Fixtures;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
DA1DC9411CB6C1C2006E619F = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
@@ -1212,16 +1231,9 @@
|
||||
DA821D051CCC6D59007508D4 /* Main.storyboard */,
|
||||
DA821D041CCC6D59007508D4 /* LaunchScreen.storyboard */,
|
||||
DA1DC99E1CB6E088006E619F /* Assets.xcassets */,
|
||||
DA1DC96C1CB6C6CE006E619F /* points.geojson */,
|
||||
DA1DC96D1CB6C6CE006E619F /* polyline.geojson */,
|
||||
DA1DC96F1CB6C6CE006E619F /* threestates.geojson */,
|
||||
353BAEF51D646370009A8DA9 /* amsterdam.geojson */,
|
||||
DD4823721D94AE6C00EB71B7 /* fill_filter_style.json */,
|
||||
DD4823731D94AE6C00EB71B7 /* line_filter_style.json */,
|
||||
DD4823741D94AE6C00EB71B7 /* numeric_filter_style.json */,
|
||||
DA1DC95E1CB6C1C2006E619F /* Info.plist */,
|
||||
DA1DC99C1CB6E076006E619F /* Default-568h@2x.png */,
|
||||
96E027251E57C76E004B8E66 /* Localizable.strings */,
|
||||
9604FC341F313A5E003EEA02 /* Fixtures */,
|
||||
DA1DC94D1CB6C1C2006E619F /* Supporting Files */,
|
||||
);
|
||||
name = "Demo App";
|
||||
@@ -1554,6 +1566,8 @@
|
||||
DAD165831CF4CFED001FF4B9 /* Categories */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
1FDD9D6D1F26936400252B09 /* MGLVectorSource+MGLAdditions.h */,
|
||||
1FDD9D6E1F26936400252B09 /* MGLVectorSource+MGLAdditions.m */,
|
||||
7E016D821D9E890300A29A21 /* MGLPolygon+MGLAdditions.h */,
|
||||
7E016D831D9E890300A29A21 /* MGLPolygon+MGLAdditions.m */,
|
||||
7E016D7C1D9E86BE00A29A21 /* MGLPolyline+MGLAdditions.h */,
|
||||
@@ -1659,6 +1673,7 @@
|
||||
350098DC1D484E60004B2AF0 /* NSValue+MGLStyleAttributeAdditions.h in Headers */,
|
||||
DA8848231CBAFA6200AB86E3 /* MGLOfflineStorage_Private.h in Headers */,
|
||||
404326891D5B9B27007111BD /* MGLAnnotationContainerView_Private.h in Headers */,
|
||||
1FB7DAAF1F2A4DBD00410606 /* MGLVectorSource+MGLAdditions.h in Headers */,
|
||||
DA88483B1CBAFB8500AB86E3 /* MGLCalloutView.h in Headers */,
|
||||
35E0CFE61D3E501500188327 /* MGLStyle_Private.h in Headers */,
|
||||
3510FFF01D6D9D8C00F413B2 /* NSExpression+MGLAdditions.h in Headers */,
|
||||
@@ -1840,6 +1855,7 @@
|
||||
35136D4D1D4277FC00C20EFD /* MGLSource.h in Headers */,
|
||||
DA35A2BC1CCA9A6900E826B2 /* MGLClockDirectionFormatter.h in Headers */,
|
||||
35D13AC41D3D19DD00AFB4E0 /* MGLFillStyleLayer.h in Headers */,
|
||||
1FB7DAB01F2A4DC200410606 /* MGLVectorSource+MGLAdditions.h in Headers */,
|
||||
DABFB86E1CBE9A0F00D62B32 /* MGLCalloutView.h in Headers */,
|
||||
1F7454971ECD450D00021D39 /* MGLLight_Private.h in Headers */,
|
||||
DABFB8601CBE99E500D62B32 /* MGLMapCamera.h in Headers */,
|
||||
@@ -2066,7 +2082,6 @@
|
||||
353BAEF61D646370009A8DA9 /* amsterdam.geojson in Resources */,
|
||||
DA1DC9711CB6C6CE006E619F /* polyline.geojson in Resources */,
|
||||
DD4823761D94AE6C00EB71B7 /* line_filter_style.json in Resources */,
|
||||
DA1DC99D1CB6E076006E619F /* Default-568h@2x.png in Resources */,
|
||||
DA821D071CCC6D59007508D4 /* Main.storyboard in Resources */,
|
||||
DA1DC9731CB6C6CE006E619F /* threestates.geojson in Resources */,
|
||||
DA821D061CCC6D59007508D4 /* LaunchScreen.storyboard in Resources */,
|
||||
@@ -2218,6 +2233,7 @@
|
||||
9620BB3A1E69FE1700705A1D /* MGLSDKUpdateChecker.mm in Sources */,
|
||||
354B83981D2E873E005D9406 /* MGLUserLocationAnnotationView.m in Sources */,
|
||||
DA88485D1CBAFB9800AB86E3 /* MGLFaux3DUserLocationAnnotationView.m in Sources */,
|
||||
1FB7DAB11F2A4DC800410606 /* MGLVectorSource+MGLAdditions.m in Sources */,
|
||||
DAD165701CF41981001FF4B9 /* MGLFeature.mm in Sources */,
|
||||
30E578191DAA855E0050F07E /* UIImage+MGLAdditions.mm in Sources */,
|
||||
40EDA1C11CFE0E0500D9EA68 /* MGLAnnotationContainerView.m in Sources */,
|
||||
@@ -2301,6 +2317,7 @@
|
||||
9620BB3B1E69FE1700705A1D /* MGLSDKUpdateChecker.mm in Sources */,
|
||||
DAA4E4221CBB730400178DFB /* MGLPointAnnotation.mm in Sources */,
|
||||
DAED38661D62D0FC00D7640F /* NSURL+MGLAdditions.m in Sources */,
|
||||
1FB7DAB21F2A4DC900410606 /* MGLVectorSource+MGLAdditions.m in Sources */,
|
||||
DAD165711CF41981001FF4B9 /* MGLFeature.mm in Sources */,
|
||||
30E5781A1DAA855E0050F07E /* UIImage+MGLAdditions.mm in Sources */,
|
||||
40EDA1C21CFE0E0500D9EA68 /* MGLAnnotationContainerView.m in Sources */,
|
||||
@@ -2464,6 +2481,7 @@
|
||||
DA618B1E1E688A3700CB7F44 /* ca */,
|
||||
DA618B2C1E68933600CB7F44 /* fi */,
|
||||
DAE8CCAE1E6E8C76009B5CB0 /* nl */,
|
||||
DACCD9C81F1F473700BB09A1 /* hu */,
|
||||
);
|
||||
name = Root.strings;
|
||||
sourceTree = "<group>";
|
||||
|
||||
@@ -10,6 +10,9 @@
|
||||
/* No comment provided by engineer. */
|
||||
"CANCEL" = "Annuler";
|
||||
|
||||
/* Accessibility hint for closing the selected annotation’s callout view and returning to the map */
|
||||
"CLOSE_CALLOUT_A11Y_HINT" = "Retour à la carte";
|
||||
|
||||
/* Accessibility hint */
|
||||
"COMPASS_A11Y_HINT" = "Tourne la carte vers le nord";
|
||||
|
||||
@@ -31,6 +34,12 @@
|
||||
/* Accessibility label */
|
||||
"INFO_A11Y_LABEL" = "À propos de cette carte";
|
||||
|
||||
/* User-friendly error description */
|
||||
"LOAD_MAP_FAILED_DESC" = "La carte n’a pas pu être chargée car une erreur inconnue est survenue.";
|
||||
|
||||
/* User-friendly error description */
|
||||
"LOAD_STYLE_FAILED_DESC" = "La carte n’a pas pu être chargée car le style ne peut pas être chargé.";
|
||||
|
||||
/* Accessibility label */
|
||||
"LOGO_A11Y_LABEL" = "Mapbox";
|
||||
|
||||
@@ -40,9 +49,18 @@
|
||||
/* Map accessibility value */
|
||||
"MAP_A11Y_VALUE" = "Zoom %1$dx\n%2$ld annotation(s) visible(s)";
|
||||
|
||||
/* User-friendly error description */
|
||||
"PARSE_STYLE_FAILED_DESC" = "La carte n’a pas pu être chargée car le style est corrompu.";
|
||||
|
||||
/* Action sheet title */
|
||||
"SDK_NAME" = "Mapbox iOS SDK";
|
||||
|
||||
/* Developer-only SDK update notification; {latest version, in format x.x.x} */
|
||||
"SDK_UPDATE_AVAILABLE" = "La version %@ du SDK Mapbox pour iOS est maintenant disponible :";
|
||||
|
||||
/* User-friendly error description */
|
||||
"STYLE_NOT_FOUND_DESC" = "La carte n’a pas pu être chargée car le style n’a pas été trouvé ou est incompatible.";
|
||||
|
||||
/* Telemetry prompt message */
|
||||
"TELEMETRY_DISABLED_MSG" = "Vous pouvez contribuer à OpenStreetMap et Mapbox en partageant des données d’utilisation anonymes.";
|
||||
|
||||
|
||||
@@ -21,33 +21,17 @@ elif [[ ${FORMAT} == "dynamic" ]]; then
|
||||
BUILD_STATIC=false
|
||||
fi
|
||||
|
||||
SELF_CONTAINED=${SELF_CONTAINED:-}
|
||||
STATIC_BUNDLE_DIR=
|
||||
if [[ ${SELF_CONTAINED} ]]; then
|
||||
STATIC_BUNDLE_DIR="${OUTPUT}/static/${NAME}.framework"
|
||||
else
|
||||
STATIC_BUNDLE_DIR="${OUTPUT}/static"
|
||||
fi
|
||||
|
||||
STATIC_SETTINGS_DIR=
|
||||
if [[ ${SELF_CONTAINED} ]]; then
|
||||
STATIC_SETTINGS_DIR="${OUTPUT}/static/${NAME}.framework"
|
||||
else
|
||||
STATIC_SETTINGS_DIR="${OUTPUT}"
|
||||
fi
|
||||
|
||||
SDK=iphonesimulator
|
||||
if [[ ${BUILD_FOR_DEVICE} == true ]]; then
|
||||
SDK=iphoneos
|
||||
fi
|
||||
IOS_SDK_VERSION=`xcrun --sdk ${SDK} --show-sdk-version`
|
||||
|
||||
echo "Configuring ${FORMAT:-dynamic and static} ${BUILDTYPE} framework for ${SDK}; symbols: ${SYMBOLS}; self-contained static framework: ${SELF_CONTAINED:-NO}"
|
||||
|
||||
function step { >&2 echo -e "\033[1m\033[36m* $@\033[0m"; }
|
||||
function finish { >&2 echo -en "\033[0m"; }
|
||||
trap finish EXIT
|
||||
|
||||
step "Configuring ${FORMAT:-dynamic and static} ${BUILDTYPE} framework for ${SDK}; symbols: ${SYMBOLS}"
|
||||
|
||||
rm -rf ${OUTPUT}
|
||||
if [[ ${BUILD_STATIC} == true ]]; then
|
||||
@@ -69,7 +53,7 @@ PROJ_VERSION=$(git rev-list --count HEAD)
|
||||
SEM_VERSION=$( git describe --tags --match=ios-v*.*.* --abbrev=0 | sed 's/^ios-v//' )
|
||||
SHORT_VERSION=${SEM_VERSION%-*}
|
||||
|
||||
step "Building targets (build ${PROJ_VERSION}, version ${SEM_VERSION})…"
|
||||
step "Building targets (build ${PROJ_VERSION}, version ${SEM_VERSION})"
|
||||
|
||||
SCHEME='dynamic'
|
||||
if [[ ${BUILD_DYNAMIC} == true && ${BUILD_STATIC} == true ]]; then
|
||||
@@ -78,6 +62,7 @@ elif [[ ${BUILD_STATIC} == true ]]; then
|
||||
SCHEME='static'
|
||||
fi
|
||||
|
||||
step "Building for iOS Simulator using scheme ${SCHEME}"
|
||||
xcodebuild \
|
||||
CURRENT_PROJECT_VERSION=${PROJ_VERSION} \
|
||||
CURRENT_SHORT_VERSION=${SHORT_VERSION} \
|
||||
@@ -92,6 +77,7 @@ xcodebuild \
|
||||
-jobs ${JOBS} | xcpretty
|
||||
|
||||
if [[ ${BUILD_FOR_DEVICE} == true ]]; then
|
||||
step "Building for iOS devices using scheme ${SCHEME}"
|
||||
xcodebuild \
|
||||
CURRENT_PROJECT_VERSION=${PROJ_VERSION} \
|
||||
CURRENT_SHORT_VERSION=${SHORT_VERSION} \
|
||||
@@ -119,7 +105,7 @@ if [[ ${BUILD_FOR_DEVICE} == true ]]; then
|
||||
${LIBS[@]/#/${PRODUCTS}/${BUILDTYPE}-iphonesimulator/lib} \
|
||||
`cmake -LA -N ${DERIVED_DATA} | grep MASON_PACKAGE_icu_LIBRARIES | cut -d= -f2`
|
||||
|
||||
cp -rv ${PRODUCTS}/${BUILDTYPE}-iphoneos/${NAME}.bundle ${STATIC_BUNDLE_DIR}
|
||||
cp -rv ${PRODUCTS}/${BUILDTYPE}-iphoneos/${NAME}.bundle ${OUTPUT}/static
|
||||
fi
|
||||
|
||||
if [[ ${BUILD_DYNAMIC} == true ]]; then
|
||||
@@ -149,7 +135,7 @@ if [[ ${BUILD_FOR_DEVICE} == true ]]; then
|
||||
-create -output ${OUTPUT}/dynamic/${NAME}.framework/${NAME} | echo
|
||||
fi
|
||||
|
||||
cp -rv ${PRODUCTS}/${BUILDTYPE}-iphoneos/Settings.bundle ${STATIC_SETTINGS_DIR}
|
||||
cp -rv ${PRODUCTS}/${BUILDTYPE}-iphoneos/Settings.bundle ${OUTPUT}
|
||||
else
|
||||
if [[ ${BUILD_STATIC} == true ]]; then
|
||||
step "Assembling static library for iOS Simulator…"
|
||||
@@ -159,7 +145,7 @@ else
|
||||
${LIBS[@]/#/${PRODUCTS}/${BUILDTYPE}-iphonesimulator/lib} \
|
||||
`cmake -LA -N ${DERIVED_DATA} | grep MASON_PACKAGE_icu_LIBRARIES | cut -d= -f2`
|
||||
|
||||
cp -rv ${PRODUCTS}/${BUILDTYPE}-iphonesimulator/${NAME}.bundle ${STATIC_BUNDLE_DIR}
|
||||
cp -rv ${PRODUCTS}/${BUILDTYPE}-iphonesimulator/${NAME}.bundle ${OUTPUT}/static
|
||||
fi
|
||||
|
||||
if [[ ${BUILD_DYNAMIC} == true ]]; then
|
||||
@@ -174,7 +160,7 @@ else
|
||||
fi
|
||||
fi
|
||||
|
||||
cp -rv ${PRODUCTS}/${BUILDTYPE}-iphonesimulator/Settings.bundle ${STATIC_SETTINGS_DIR}
|
||||
cp -rv ${PRODUCTS}/${BUILDTYPE}-iphonesimulator/Settings.bundle ${OUTPUT}
|
||||
fi
|
||||
|
||||
if [[ ${SYMBOLS} = NO ]]; then
|
||||
@@ -244,13 +230,17 @@ if [[ ${BUILD_STATIC} == true ]]; then
|
||||
fi
|
||||
|
||||
step "Copying library resources…"
|
||||
cp -pv LICENSE.md ${STATIC_SETTINGS_DIR}
|
||||
cp -pv LICENSE.md ${OUTPUT}
|
||||
if [[ ${BUILD_STATIC} == true ]]; then
|
||||
cp -pv "${STATIC_BUNDLE_DIR}/${NAME}.bundle/Info.plist" "${OUTPUT}/static/${NAME}.framework/Info.plist"
|
||||
cp -pv "${OUTPUT}/static/${NAME}.bundle/Info.plist" "${OUTPUT}/static/${NAME}.framework/Info.plist"
|
||||
plutil -replace CFBundlePackageType -string FMWK "${OUTPUT}/static/${NAME}.framework/Info.plist"
|
||||
mkdir "${OUTPUT}/static/${NAME}.framework/Modules"
|
||||
cp -pv platform/ios/framework/modulemap "${OUTPUT}/static/${NAME}.framework/Modules/module.modulemap"
|
||||
fi
|
||||
if [[ ${BUILD_DYNAMIC} == true && ${BUILD_FOR_DEVICE} == true ]]; then
|
||||
step "Copying bitcode symbol maps…"
|
||||
find "${PRODUCTS}/${BUILDTYPE}-iphoneos" -name '*.bcsymbolmap' -type f -exec cp -pv {} "${OUTPUT}/dynamic/" \;
|
||||
fi
|
||||
sed -n -e '/^## /,$p' platform/ios/CHANGELOG.md > "${OUTPUT}/CHANGELOG.md"
|
||||
|
||||
rm -rf /tmp/mbgl
|
||||
|
||||
@@ -460,11 +460,8 @@ const CGFloat MGLUserLocationAnnotationArrowSize = MGLUserLocationAnnotationPuck
|
||||
|
||||
- (CGFloat)calculateAccuracyRingSize
|
||||
{
|
||||
CGFloat latitudeRadians = MGLRadiansFromDegrees(self.userLocation.coordinate.latitude);
|
||||
CGFloat metersPerPoint = [self.mapView metersPerPointAtLatitude:self.userLocation.coordinate.latitude];
|
||||
CGFloat pixelRadius = self.userLocation.location.horizontalAccuracy / cos(latitudeRadians) / metersPerPoint;
|
||||
|
||||
return pixelRadius * 2.0;
|
||||
// diameter in screen points
|
||||
return self.userLocation.location.horizontalAccuracy / [self.mapView metersPerPointAtLatitude:self.userLocation.coordinate.latitude] * 2.0;
|
||||
}
|
||||
|
||||
- (UIImage *)headingIndicatorTintedGradientImage
|
||||
|
||||
@@ -777,6 +777,23 @@ MGL_EXPORT IB_DESIGNABLE
|
||||
*/
|
||||
- (void)setCamera:(MGLMapCamera *)camera withDuration:(NSTimeInterval)duration animationTimingFunction:(nullable CAMediaTimingFunction *)function completionHandler:(nullable void (^)(void))completion;
|
||||
|
||||
/**
|
||||
Moves the viewpoint to a different location with respect to the map with an
|
||||
optional transition duration and timing function.
|
||||
|
||||
@param camera The new viewpoint.
|
||||
@param duration The amount of time, measured in seconds, that the transition
|
||||
animation should take. Specify `0` to jump to the new viewpoint
|
||||
instantaneously.
|
||||
@param function A timing function used for the animation. Set this parameter to
|
||||
`nil` for a transition that matches most system animations. If the duration
|
||||
is `0`, this parameter is ignored.
|
||||
@param edgePadding The minimum padding (in screen points) that would be visible
|
||||
around the returned camera object if it were set as the receiver’s camera.
|
||||
@param completion The block to execute after the animation finishes.
|
||||
*/
|
||||
- (void)setCamera:(MGLMapCamera *)camera withDuration:(NSTimeInterval)duration animationTimingFunction:(nullable CAMediaTimingFunction *)function edgePadding:(UIEdgeInsets)edgePadding completionHandler:(nullable void (^)(void))completion;
|
||||
|
||||
/**
|
||||
Moves the viewpoint to a different location using a transition animation that
|
||||
evokes powered flight and a default duration based on the length of the flight
|
||||
|
||||
@@ -1116,8 +1116,10 @@ public:
|
||||
|
||||
- (void)updateTintColorForView:(UIView *)view
|
||||
{
|
||||
// stop at recursing container & annotation views (#8522)
|
||||
if ([view isEqual:self.annotationContainerView]) return;
|
||||
// Don't update:
|
||||
// - annotation views
|
||||
// - attribution button (handled automatically)
|
||||
if ([view isEqual:self.annotationContainerView] || [view isEqual:self.attributionButton]) return;
|
||||
|
||||
if ([view respondsToSelector:@selector(setTintColor:)]) view.tintColor = self.tintColor;
|
||||
|
||||
@@ -1250,8 +1252,6 @@ public:
|
||||
{
|
||||
if ( ! self.isZoomEnabled) return;
|
||||
|
||||
if (_mbglMap->getZoom() <= _mbglMap->getMinZoom() && pinch.scale < 1) return;
|
||||
|
||||
_mbglMap->cancelTransitions();
|
||||
|
||||
CGPoint centerPoint = [self anchorPointForGesture:pinch];
|
||||
@@ -1267,17 +1267,17 @@ public:
|
||||
}
|
||||
else if (pinch.state == UIGestureRecognizerStateChanged)
|
||||
{
|
||||
// Zoom limiting happens at the core level.
|
||||
CGFloat newScale = self.scale * pinch.scale;
|
||||
double zoom = log2(newScale);
|
||||
if (zoom < _mbglMap->getMinZoom()) return;
|
||||
|
||||
double newZoom = log2(newScale);
|
||||
|
||||
// Calculates the final camera zoom, has no effect within current map camera.
|
||||
MGLMapCamera *toCamera = [self cameraByZoomingToZoomLevel:zoom aroundAnchorPoint:centerPoint];
|
||||
MGLMapCamera *toCamera = [self cameraByZoomingToZoomLevel:newZoom aroundAnchorPoint:centerPoint];
|
||||
|
||||
if (![self.delegate respondsToSelector:@selector(mapView:shouldChangeFromCamera:toCamera:)] ||
|
||||
[self.delegate mapView:self shouldChangeFromCamera:oldCamera toCamera:toCamera])
|
||||
{
|
||||
_mbglMap->setZoom(zoom, mbgl::ScreenCoordinate { centerPoint.x, centerPoint.y });
|
||||
_mbglMap->setZoom(newZoom, mbgl::ScreenCoordinate { centerPoint.x, centerPoint.y });
|
||||
// The gesture recognizer only reports the gesture’s current center
|
||||
// point, so use the previous center point to anchor the transition.
|
||||
// If the number of touches has changed, the remembered center point is
|
||||
@@ -1625,9 +1625,9 @@ public:
|
||||
{
|
||||
CGFloat distance = [quickZoom locationInView:quickZoom.view].y - self.quickZoomStart;
|
||||
|
||||
CGFloat newZoom = log2f(self.scale) + (distance / 75);
|
||||
CGFloat newZoom = MAX(log2f(self.scale) + (distance / 75), _mbglMap->getMinZoom());
|
||||
|
||||
if (newZoom < _mbglMap->getMinZoom()) return;
|
||||
if (_mbglMap->getZoom() == newZoom) return;
|
||||
|
||||
CGPoint centerPoint = [self anchorPointForGesture:quickZoom];
|
||||
|
||||
@@ -1760,39 +1760,6 @@ public:
|
||||
return [gesture locationInView:gesture.view];
|
||||
}
|
||||
|
||||
- (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer
|
||||
{
|
||||
if ([gestureRecognizer isKindOfClass:[UIPanGestureRecognizer class]])
|
||||
{
|
||||
UIPanGestureRecognizer *panGesture = (UIPanGestureRecognizer *)gestureRecognizer;
|
||||
|
||||
if (panGesture.minimumNumberOfTouches == 2)
|
||||
{
|
||||
CGPoint velocity = [panGesture velocityInView:panGesture.view];
|
||||
double gestureAngle = MGLDegreesFromRadians(atan(velocity.y / velocity.x));
|
||||
double horizontalToleranceDegrees = 20.0;
|
||||
|
||||
// cancel if gesture angle is not 90º±20º (more or less vertical)
|
||||
if ( ! (fabs((fabs(gestureAngle) - 90.0)) < horizontalToleranceDegrees))
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (gestureRecognizer == _singleTapGestureRecognizer)
|
||||
{
|
||||
// Gesture will be recognized if it could deselect an annotation
|
||||
if(!self.selectedAnnotation)
|
||||
{
|
||||
id<MGLAnnotation>annotation = [self annotationForGestureRecognizer:(UITapGestureRecognizer*)gestureRecognizer persistingResults:NO];
|
||||
if(!annotation) {
|
||||
return NO;
|
||||
}
|
||||
}
|
||||
}
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (void)handleCalloutAccessoryTapGesture:(UITapGestureRecognizer *)tap
|
||||
{
|
||||
if ([self.delegate respondsToSelector:@selector(mapView:annotation:calloutAccessoryControlTapped:)])
|
||||
@@ -1836,12 +1803,60 @@ public:
|
||||
UIAccessibilityPostNotification(UIAccessibilityLayoutChangedNotification, calloutView);
|
||||
}
|
||||
|
||||
- (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer
|
||||
{
|
||||
if ([gestureRecognizer isKindOfClass:[UIPanGestureRecognizer class]])
|
||||
{
|
||||
UIPanGestureRecognizer *panGesture = (UIPanGestureRecognizer *)gestureRecognizer;
|
||||
|
||||
if (panGesture.minimumNumberOfTouches == 2)
|
||||
{
|
||||
CGPoint west = [panGesture locationOfTouch:0 inView:panGesture.view];
|
||||
CGPoint east = [panGesture locationOfTouch:1 inView:panGesture.view];
|
||||
|
||||
if (west.x > east.x) {
|
||||
CGPoint swap = west;
|
||||
west = east;
|
||||
east = swap;
|
||||
}
|
||||
|
||||
CLLocationDegrees horizontalToleranceDegrees = 60.0;
|
||||
if ([self angleBetweenPoints:west east:east] > horizontalToleranceDegrees) {
|
||||
return NO;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
else if (gestureRecognizer == _singleTapGestureRecognizer)
|
||||
{
|
||||
// Gesture will be recognized if it could deselect an annotation
|
||||
if(!self.selectedAnnotation)
|
||||
{
|
||||
id<MGLAnnotation>annotation = [self annotationForGestureRecognizer:(UITapGestureRecognizer*)gestureRecognizer persistingResults:NO];
|
||||
if(!annotation) {
|
||||
return NO;
|
||||
}
|
||||
}
|
||||
}
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer
|
||||
{
|
||||
NSArray *validSimultaneousGestures = @[ self.pan, self.pinch, self.rotate ];
|
||||
|
||||
return ([validSimultaneousGestures containsObject:gestureRecognizer] && [validSimultaneousGestures containsObject:otherGestureRecognizer]);
|
||||
}
|
||||
|
||||
- (CLLocationDegrees)angleBetweenPoints:(CGPoint)west east:(CGPoint)east
|
||||
{
|
||||
CGFloat slope = (west.y - east.y) / (west.x - east.x);
|
||||
|
||||
CGFloat angle = atan(fabs(slope));
|
||||
CLLocationDegrees degrees = MGLDegreesFromRadians(angle);
|
||||
|
||||
return degrees;
|
||||
}
|
||||
|
||||
- (void)trackGestureEvent:(NSString *)gestureID forRecognizer:(UIGestureRecognizer *)recognizer
|
||||
{
|
||||
@@ -2743,6 +2758,10 @@ public:
|
||||
|
||||
- (void)setCamera:(MGLMapCamera *)camera withDuration:(NSTimeInterval)duration animationTimingFunction:(nullable CAMediaTimingFunction *)function completionHandler:(nullable void (^)(void))completion
|
||||
{
|
||||
[self setCamera:camera withDuration:duration animationTimingFunction:function edgePadding:self.contentInset completionHandler:completion];
|
||||
}
|
||||
|
||||
- (void)setCamera:(MGLMapCamera *)camera withDuration:(NSTimeInterval)duration animationTimingFunction:(nullable CAMediaTimingFunction *)function edgePadding:(UIEdgeInsets)edgePadding completionHandler:(nullable void (^)(void))completion {
|
||||
mbgl::AnimationOptions animationOptions;
|
||||
if (duration > 0)
|
||||
{
|
||||
@@ -2771,7 +2790,7 @@ public:
|
||||
|
||||
[self willChangeValueForKey:@"camera"];
|
||||
_mbglMap->cancelTransitions();
|
||||
mbgl::CameraOptions cameraOptions = [self cameraOptionsObjectForAnimatingToCamera:camera edgePadding:self.contentInset];
|
||||
mbgl::CameraOptions cameraOptions = [self cameraOptionsObjectForAnimatingToCamera:camera edgePadding:edgePadding];
|
||||
_mbglMap->easeTo(cameraOptions, animationOptions);
|
||||
[self didChangeValueForKey:@"camera"];
|
||||
}
|
||||
|
||||
@@ -12,6 +12,13 @@
|
||||
|
||||
* Increased the default maximum zoom level from 20 to 22. ([#9835](https://github.com/mapbox/mapbox-gl-native/pull/9835))
|
||||
|
||||
## 0.5.1
|
||||
|
||||
This version of the Mapbox macOS SDK corresponds to version 3.6.2 of the Mapbox iOS SDK.
|
||||
|
||||
* Added an `MGLStyle.localizesLabels` property, off by default, that localizes any Mapbox Streets–sourced symbol layer into the user’s preferred language. ([#9582](https://github.com/mapbox/mapbox-gl-native/pull/9582))
|
||||
* Fixed an issue that caused `-[MGLShapeSource featuresMatchingPredicate:]` and `-[MGLVectorSource featuresInSourceLayersWithIdentifiers:predicate:]` to always return an empty array. ([#9784](https://github.com/mapbox/mapbox-gl-native/pull/9784))
|
||||
|
||||
## 0.5.0
|
||||
|
||||
This version of the Mapbox macOS SDK corresponds to version 3.6.0 of the Mapbox iOS SDK.
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#import "DroppedPinAnnotation.h"
|
||||
|
||||
#import "MGLStyle+MBXAdditions.h"
|
||||
#import "MGLVectorSource+MBXAdditions.h"
|
||||
#import "MGLVectorSource+MGLAdditions.h"
|
||||
|
||||
#import <Mapbox/Mapbox.h>
|
||||
|
||||
@@ -344,52 +344,7 @@ NS_ARRAY_OF(id <MGLAnnotation>) *MBXFlattenedShapes(NS_ARRAY_OF(id <MGLAnnotatio
|
||||
}
|
||||
|
||||
- (void)updateLabels {
|
||||
MGLStyle *style = self.mapView.style;
|
||||
NSString *preferredLanguage = _isLocalizingLabels ? [MGLVectorSource preferredMapboxStreetsLanguage] : nil;
|
||||
NSMutableDictionary *localizedKeysByKeyBySourceIdentifier = [NSMutableDictionary dictionary];
|
||||
for (MGLSymbolStyleLayer *layer in style.layers) {
|
||||
if (![layer isKindOfClass:[MGLSymbolStyleLayer class]]) {
|
||||
continue;
|
||||
}
|
||||
|
||||
MGLVectorSource *source = (MGLVectorSource *)[style sourceWithIdentifier:layer.sourceIdentifier];
|
||||
if (![source isKindOfClass:[MGLVectorSource class]] || !source.mapboxStreets) {
|
||||
continue;
|
||||
}
|
||||
|
||||
NSDictionary *localizedKeysByKey = localizedKeysByKeyBySourceIdentifier[layer.sourceIdentifier];
|
||||
if (!localizedKeysByKey) {
|
||||
localizedKeysByKey = localizedKeysByKeyBySourceIdentifier[layer.sourceIdentifier] = [source localizedKeysByKeyForPreferredLanguage:preferredLanguage];
|
||||
}
|
||||
|
||||
NSString *(^stringByLocalizingString)(NSString *) = ^ NSString * (NSString *string) {
|
||||
NSMutableString *localizedString = string.mutableCopy;
|
||||
[localizedKeysByKey enumerateKeysAndObjectsUsingBlock:^(NSString * _Nonnull key, NSString * _Nonnull localizedKey, BOOL * _Nonnull stop) {
|
||||
NSAssert([key isKindOfClass:[NSString class]], @"key is not a string");
|
||||
NSAssert([localizedKey isKindOfClass:[NSString class]], @"localizedKey is not a string");
|
||||
[localizedString replaceOccurrencesOfString:[NSString stringWithFormat:@"{%@}", key]
|
||||
withString:[NSString stringWithFormat:@"{%@}", localizedKey]
|
||||
options:0
|
||||
range:NSMakeRange(0, localizedString.length)];
|
||||
}];
|
||||
return localizedString;
|
||||
};
|
||||
|
||||
if ([layer.text isKindOfClass:[MGLConstantStyleValue class]]) {
|
||||
NSString *textField = [(MGLConstantStyleValue<NSString *> *)layer.text rawValue];
|
||||
layer.text = [MGLStyleValue<NSString *> valueWithRawValue:stringByLocalizingString(textField)];
|
||||
}
|
||||
else if ([layer.text isKindOfClass:[MGLCameraStyleFunction class]]) {
|
||||
MGLCameraStyleFunction *function = (MGLCameraStyleFunction<NSString *> *)layer.text;
|
||||
NSMutableDictionary *stops = function.stops.mutableCopy;
|
||||
[stops enumerateKeysAndObjectsUsingBlock:^(NSNumber *zoomLevel, MGLConstantStyleValue<NSString *> *stop, BOOL *done) {
|
||||
NSString *textField = stop.rawValue;
|
||||
stops[zoomLevel] = [MGLStyleValue<NSString *> valueWithRawValue:stringByLocalizingString(textField)];
|
||||
}];
|
||||
function.stops = stops;
|
||||
layer.text = function;
|
||||
}
|
||||
}
|
||||
self.mapView.style.localizesLabels = _isLocalizingLabels;
|
||||
}
|
||||
|
||||
- (void)applyPendingState {
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
1F7454A51ECFB00300021D39 /* MGLLight.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1F7454A21ECFB00300021D39 /* MGLLight.mm */; };
|
||||
1F7454AB1ED1DDBD00021D39 /* MGLLightTest.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1F7454AA1ED1DDBD00021D39 /* MGLLightTest.mm */; };
|
||||
1F95931B1E6DE2B600D5B294 /* MGLNSDateAdditionsTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1F95931A1E6DE2B600D5B294 /* MGLNSDateAdditionsTests.mm */; };
|
||||
1FCDF1421F2A4F3600A46694 /* MGLVectorSource+MGLAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 1FCDF1401F2A4F3600A46694 /* MGLVectorSource+MGLAdditions.h */; };
|
||||
1FCDF1431F2A4F3600A46694 /* MGLVectorSource+MGLAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = 1FCDF1411F2A4F3600A46694 /* MGLVectorSource+MGLAdditions.m */; };
|
||||
30E5781B1DAA857E0050F07E /* NSImage+MGLAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 30E578141DAA7D920050F07E /* NSImage+MGLAdditions.h */; };
|
||||
3508EC641D749D39009B0EE4 /* NSExpression+MGLAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 3508EC621D749D39009B0EE4 /* NSExpression+MGLAdditions.h */; };
|
||||
3508EC651D749D39009B0EE4 /* NSExpression+MGLAdditions.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3508EC631D749D39009B0EE4 /* NSExpression+MGLAdditions.mm */; };
|
||||
@@ -237,7 +239,6 @@
|
||||
DAEDC4371D606291000224FF /* MGLAttributionButtonTests.m in Sources */ = {isa = PBXBuildFile; fileRef = DAEDC4361D606291000224FF /* MGLAttributionButtonTests.m */; };
|
||||
DAF0D80E1DFE0E5D00B28378 /* MGLPointCollection_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = DAF0D80D1DFE0E5D00B28378 /* MGLPointCollection_Private.h */; };
|
||||
DAF0D8161DFE6B1800B28378 /* MGLAttributionInfo_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = DAF0D8151DFE6B1800B28378 /* MGLAttributionInfo_Private.h */; };
|
||||
DAF0D81C1DFF567C00B28378 /* MGLVectorSource+MBXAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = DAF0D81B1DFF567C00B28378 /* MGLVectorSource+MBXAdditions.m */; };
|
||||
DD0902B21DB1AC6400C5BDCE /* MGLNetworkConfiguration.m in Sources */ = {isa = PBXBuildFile; fileRef = DD0902AF1DB1AC6400C5BDCE /* MGLNetworkConfiguration.m */; };
|
||||
DD0902B31DB1AC6400C5BDCE /* MGLNetworkConfiguration.h in Headers */ = {isa = PBXBuildFile; fileRef = DD0902B01DB1AC6400C5BDCE /* MGLNetworkConfiguration.h */; };
|
||||
DD58A4C91D822C6700E1F038 /* MGLExpressionTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = DD58A4C71D822C6200E1F038 /* MGLExpressionTests.mm */; };
|
||||
@@ -284,6 +285,8 @@
|
||||
1F7454A21ECFB00300021D39 /* MGLLight.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MGLLight.mm; sourceTree = "<group>"; };
|
||||
1F7454AA1ED1DDBD00021D39 /* MGLLightTest.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MGLLightTest.mm; sourceTree = "<group>"; };
|
||||
1F95931A1E6DE2B600D5B294 /* MGLNSDateAdditionsTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = MGLNSDateAdditionsTests.mm; path = ../../darwin/test/MGLNSDateAdditionsTests.mm; sourceTree = "<group>"; };
|
||||
1FCDF1401F2A4F3600A46694 /* MGLVectorSource+MGLAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "MGLVectorSource+MGLAdditions.h"; sourceTree = "<group>"; };
|
||||
1FCDF1411F2A4F3600A46694 /* MGLVectorSource+MGLAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "MGLVectorSource+MGLAdditions.m"; sourceTree = "<group>"; };
|
||||
30E578141DAA7D920050F07E /* NSImage+MGLAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "NSImage+MGLAdditions.h"; path = "src/NSImage+MGLAdditions.h"; sourceTree = SOURCE_ROOT; };
|
||||
3508EC621D749D39009B0EE4 /* NSExpression+MGLAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSExpression+MGLAdditions.h"; sourceTree = "<group>"; };
|
||||
3508EC631D749D39009B0EE4 /* NSExpression+MGLAdditions.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "NSExpression+MGLAdditions.mm"; sourceTree = "<group>"; };
|
||||
@@ -483,6 +486,7 @@
|
||||
DACC22121CF3D3E200D220D9 /* MGLFeature.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLFeature.h; sourceTree = "<group>"; };
|
||||
DACC22131CF3D3E200D220D9 /* MGLFeature.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MGLFeature.mm; sourceTree = "<group>"; };
|
||||
DACC22171CF3D4F700D220D9 /* MGLFeature_Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLFeature_Private.h; sourceTree = "<group>"; };
|
||||
DACCD9C71F1F443B00BB09A1 /* fr */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = fr; path = fr.lproj/Foundation.strings; sourceTree = "<group>"; };
|
||||
DAD165721CF4CD7A001FF4B9 /* MGLShapeCollection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLShapeCollection.h; sourceTree = "<group>"; };
|
||||
DAD165731CF4CD7A001FF4B9 /* MGLShapeCollection.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MGLShapeCollection.mm; sourceTree = "<group>"; };
|
||||
DAE6C2E11CC304F900DB3429 /* Credits.rtf */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.rtf; path = Credits.rtf; sourceTree = "<group>"; };
|
||||
@@ -575,8 +579,6 @@
|
||||
DAEDC4361D606291000224FF /* MGLAttributionButtonTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MGLAttributionButtonTests.m; sourceTree = "<group>"; };
|
||||
DAF0D80D1DFE0E5D00B28378 /* MGLPointCollection_Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLPointCollection_Private.h; sourceTree = "<group>"; };
|
||||
DAF0D8151DFE6B1800B28378 /* MGLAttributionInfo_Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLAttributionInfo_Private.h; sourceTree = "<group>"; };
|
||||
DAF0D81A1DFF567C00B28378 /* MGLVectorSource+MBXAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "MGLVectorSource+MBXAdditions.h"; sourceTree = "<group>"; };
|
||||
DAF0D81B1DFF567C00B28378 /* MGLVectorSource+MBXAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "MGLVectorSource+MBXAdditions.m"; sourceTree = "<group>"; };
|
||||
DAFBD0D51E3FA969000CD6BF /* zh-Hant */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hant"; path = "zh-Hant.lproj/Localizable.strings"; sourceTree = "<group>"; };
|
||||
DAFBD0D61E3FA983000CD6BF /* zh-Hant */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hant"; path = "zh-Hant.lproj/Foundation.strings"; sourceTree = "<group>"; };
|
||||
DD0902AF1DB1AC6400C5BDCE /* MGLNetworkConfiguration.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MGLNetworkConfiguration.m; sourceTree = "<group>"; };
|
||||
@@ -749,8 +751,6 @@
|
||||
DA839E9E1CC2E3400062CAFB /* MapDocument.xib */,
|
||||
DACB0C371E18DFFD005DDBEA /* MGLStyle+MBXAdditions.h */,
|
||||
DACB0C381E18DFFD005DDBEA /* MGLStyle+MBXAdditions.m */,
|
||||
DAF0D81A1DFF567C00B28378 /* MGLVectorSource+MBXAdditions.h */,
|
||||
DAF0D81B1DFF567C00B28378 /* MGLVectorSource+MBXAdditions.m */,
|
||||
DAE6C2E91CC3050F00DB3429 /* OfflinePackNameValueTransformer.h */,
|
||||
DAE6C2EA1CC3050F00DB3429 /* OfflinePackNameValueTransformer.m */,
|
||||
DAA48EFB1D6A4731006A7E36 /* StyleLayerIconTransformer.h */,
|
||||
@@ -930,6 +930,8 @@
|
||||
DAD1657F1CF4CF50001FF4B9 /* Categories */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
1FCDF1401F2A4F3600A46694 /* MGLVectorSource+MGLAdditions.h */,
|
||||
1FCDF1411F2A4F3600A46694 /* MGLVectorSource+MGLAdditions.m */,
|
||||
408AA8601DAEED3300022900 /* MGLPolygon+MGLAdditions.h */,
|
||||
408AA85C1DAEED3300022900 /* MGLPolygon+MGLAdditions.m */,
|
||||
408AA8611DAEED3300022900 /* MGLPolyline+MGLAdditions.h */,
|
||||
@@ -1166,6 +1168,7 @@
|
||||
DAE6C3601CC31E0400DB3429 /* MGLOfflineRegion.h in Headers */,
|
||||
DAE6C3681CC31E0400DB3429 /* MGLTilePyramidOfflineRegion.h in Headers */,
|
||||
DA35A2CF1CCAAED300E826B2 /* NSValue+MGLAdditions.h in Headers */,
|
||||
1FCDF1421F2A4F3600A46694 /* MGLVectorSource+MGLAdditions.h in Headers */,
|
||||
DAE6C3A61CC31E9400DB3429 /* MGLMapViewDelegate.h in Headers */,
|
||||
DAE6C38B1CC31E2A00DB3429 /* MGLOfflinePack_Private.h in Headers */,
|
||||
558DE7A61E56161C00C7916D /* MGLFoundation_Private.h in Headers */,
|
||||
@@ -1391,7 +1394,6 @@
|
||||
DACB0C391E18DFFD005DDBEA /* MGLStyle+MBXAdditions.m in Sources */,
|
||||
DA839E9A1CC2E3400062CAFB /* main.m in Sources */,
|
||||
DA839E971CC2E3400062CAFB /* AppDelegate.m in Sources */,
|
||||
DAF0D81C1DFF567C00B28378 /* MGLVectorSource+MBXAdditions.m in Sources */,
|
||||
DAE6C2F01CC3050F00DB3429 /* OfflinePackNameValueTransformer.m in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
@@ -1408,6 +1410,7 @@
|
||||
40B77E461DB11BCD003DA2FE /* NSArray+MGLAdditions.mm in Sources */,
|
||||
DAE6C38C1CC31E2A00DB3429 /* MGLOfflinePack.mm in Sources */,
|
||||
35D65C5B1D65AD5500722C23 /* NSDate+MGLAdditions.mm in Sources */,
|
||||
1FCDF1431F2A4F3600A46694 /* MGLVectorSource+MGLAdditions.m in Sources */,
|
||||
DD0902B21DB1AC6400C5BDCE /* MGLNetworkConfiguration.m in Sources */,
|
||||
1F7454A51ECFB00300021D39 /* MGLLight.mm in Sources */,
|
||||
DAE6C3B11CC31EF300DB3429 /* MGLAnnotationImage.m in Sources */,
|
||||
@@ -1614,6 +1617,7 @@
|
||||
DA618B171E68876C00CB7F44 /* ca */,
|
||||
DA618B231E6891ED00CB7F44 /* lt */,
|
||||
DAE9E0F21EB7BF39001E8E8B /* es */,
|
||||
DACCD9C71F1F443B00BB09A1 /* fr */,
|
||||
);
|
||||
name = Foundation.strings;
|
||||
sourceTree = "<group>";
|
||||
|
||||
@@ -1,6 +1,18 @@
|
||||
/* Accessibility title */
|
||||
/* User-friendly error description */
|
||||
"LOAD_MAP_FAILED_DESC" = "La carte n’a pas pu être chargée car une erreur inconnue est survenue.";
|
||||
|
||||
/* User-friendly error description */
|
||||
"LOAD_STYLE_FAILED_DESC" = "La carte n’a pas pu être chargée car le style ne peut pas être chargé.";
|
||||
|
||||
/* Accessibility title */
|
||||
"MAP_A11Y_TITLE" = "Mapbox";
|
||||
|
||||
/* User-friendly error description */
|
||||
"PARSE_STYLE_FAILED_DESC" = "La carte n’a pas pu être chargée car le style est corrompu.";
|
||||
|
||||
/* User-friendly error description */
|
||||
"STYLE_NOT_FOUND_DESC" = "La carte n’a pas pu être chargée car le style n’a pas été trouvé ou est incompatible.";
|
||||
|
||||
/* Label of Zoom In button */
|
||||
"ZOOM_IN_LABEL" = "+";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user