diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2017-01-26 18:52:44 +0100 |
---|---|---|
committer | Konstantin Käfer <mail@kkaefer.com> | 2017-01-27 11:44:16 +0100 |
commit | 62ea1f21858c69f6921c775ba7a3de201f0514d8 (patch) | |
tree | 7a4da88706e8a5513e1e13e993b2acc212cae3b1 | |
parent | a662508ddde4043ece36d8ea9b424368891d892c (diff) | |
download | qtlocation-mapboxgl-62ea1f21858c69f6921c775ba7a3de201f0514d8.tar.gz |
[core] remove trailing whitespace, add trailing newlines, add space after //
421 files changed, 3487 insertions, 3457 deletions
diff --git a/.travis.yml b/.travis.yml index 6e3bc85c9f..6969a7c909 100644 --- a/.travis.yml +++ b/.travis.yml @@ -80,6 +80,7 @@ matrix: script: - git fetch origin master:refs/remotes/origin/master - make check + - make codestyle # EGL - Node - Clang 3.8 - Debug - os: linux @@ -634,6 +634,10 @@ android-javadoc: style-code: node scripts/generate-style-code.js +.PHONY: codestyle +codestyle: + scripts/codestyle.sh + .PHONY: clean clean: -rm -rf ./build \ diff --git a/include/mbgl/storage/default_file_source.hpp b/include/mbgl/storage/default_file_source.hpp index b8f5e1167e..1ff440e4e5 100644 --- a/include/mbgl/storage/default_file_source.hpp +++ b/include/mbgl/storage/default_file_source.hpp @@ -29,7 +29,7 @@ public: bool supportsOptionalRequests() const override { return true; } - + void setAPIBaseURL(const std::string&); std::string getAPIBaseURL() const; diff --git a/include/mbgl/storage/online_file_source.hpp b/include/mbgl/storage/online_file_source.hpp index 9c7feceb47..f432a8886e 100644 --- a/include/mbgl/storage/online_file_source.hpp +++ b/include/mbgl/storage/online_file_source.hpp @@ -12,7 +12,7 @@ public: void setAPIBaseURL(const std::string& t) { apiBaseURL = t; } std::string getAPIBaseURL() const { return apiBaseURL; } - + void setAccessToken(const std::string& t) { accessToken = t; } std::string getAccessToken() const { return accessToken; } diff --git a/include/mbgl/storage/response.hpp b/include/mbgl/storage/response.hpp index 448423c1cb..2460f4340d 100644 --- a/include/mbgl/storage/response.hpp +++ b/include/mbgl/storage/response.hpp @@ -53,7 +53,7 @@ public: // An error message from the request handler, e.g. a server message or a system message // informing the user about the reason for the failure. std::string message; - + optional<Timestamp> retryAfter; public: diff --git a/include/mbgl/util/chrono.hpp b/include/mbgl/util/chrono.hpp index 4adf030331..723cd131e3 100644 --- a/include/mbgl/util/chrono.hpp +++ b/include/mbgl/util/chrono.hpp @@ -29,7 +29,7 @@ std::string rfc1123(Timestamp); std::string iso8601(Timestamp); Timestamp parseTimestamp(const char *); - + Timestamp parseTimestamp(const int32_t timestamp); // C++17 polyfill diff --git a/include/mbgl/util/compression.hpp b/include/mbgl/util/compression.hpp index 5e232187c3..93a3ddb8bc 100644 --- a/include/mbgl/util/compression.hpp +++ b/include/mbgl/util/compression.hpp @@ -4,9 +4,9 @@ namespace mbgl { namespace util { - + std::string compress(const std::string& raw); std::string decompress(const std::string& raw); - + } // namespace util } // namespace mbgl diff --git a/include/mbgl/util/constants.hpp b/include/mbgl/util/constants.hpp index 85e19c2ff0..0f2779e33b 100644 --- a/include/mbgl/util/constants.hpp +++ b/include/mbgl/util/constants.hpp @@ -44,11 +44,11 @@ constexpr Duration DEFAULT_FADE_DURATION = Milliseconds(300); constexpr Seconds CLOCK_SKEW_RETRY_TIMEOUT { 30 }; constexpr UnitBezier DEFAULT_TRANSITION_EASE = { 0, 0, 0.25, 1 }; - + constexpr int DEFAULT_RATE_LIMIT_TIMEOUT = 5; constexpr const char* API_BASE_URL = "https://api.mapbox.com"; - + } // namespace util namespace debug { diff --git a/include/mbgl/util/geo.hpp b/include/mbgl/util/geo.hpp index 9dca10eb84..57a028e467 100644 --- a/include/mbgl/util/geo.hpp +++ b/include/mbgl/util/geo.hpp @@ -187,10 +187,10 @@ enum class NorthOrientation : uint8_t { /// The distance on each side between a rectangle and a rectangle within. class EdgeInsets { public: - double top = 0; ///< Number of pixels inset from the top edge. - double left = 0; ///< Number of pixels inset from the left edge. - double bottom = 0; ///< Number of pixels inset from the bottom edge. - double right = 0; ///< Number of pixels inset from the right edge. + double top = 0; // Number of pixels inset from the top edge. + double left = 0; // Number of pixels inset from the left edge. + double bottom = 0; // Number of pixels inset from the bottom edge. + double right = 0; // Number of pixels inset from the right edge. EdgeInsets() {} diff --git a/platform/android/MapboxGLAndroidSDK/build.gradle b/platform/android/MapboxGLAndroidSDK/build.gradle index ae02f8765c..e4b1afe119 100644 --- a/platform/android/MapboxGLAndroidSDK/build.gradle +++ b/platform/android/MapboxGLAndroidSDK/build.gradle @@ -81,4 +81,4 @@ configurations { apply from: 'gradle-javadoc.gradle' apply from: 'gradle-publish.gradle' -apply from: 'gradle-checkstyle.gradle'
\ No newline at end of file +apply from: 'gradle-checkstyle.gradle' diff --git a/platform/android/MapboxGLAndroidSDK/gradle-checkstyle.gradle b/platform/android/MapboxGLAndroidSDK/gradle-checkstyle.gradle index cdcc7f1e23..bfb8341dbc 100644 --- a/platform/android/MapboxGLAndroidSDK/gradle-checkstyle.gradle +++ b/platform/android/MapboxGLAndroidSDK/gradle-checkstyle.gradle @@ -14,4 +14,4 @@ task checkstyle(type: Checkstyle) { exclude '**/gen/**' classpath = files() ignoreFailures = false -}
\ No newline at end of file +} diff --git a/platform/android/MapboxGLAndroidSDK/gradle-javadoc.gradle b/platform/android/MapboxGLAndroidSDK/gradle-javadoc.gradle index ba7601127c..eeb5e9b4d6 100644 --- a/platform/android/MapboxGLAndroidSDK/gradle-javadoc.gradle +++ b/platform/android/MapboxGLAndroidSDK/gradle-javadoc.gradle @@ -1,6 +1,6 @@ android.libraryVariants.all { variant -> def name = variant.name - //noinspection GroovyAssignabilityCheck + // noinspection GroovyAssignabilityCheck task "javadoc$name"(type: Javadoc) { description = "Generates javadoc for build $name" failOnError = false @@ -18,4 +18,4 @@ android.libraryVariants.all { variant -> options.group("Third Party Libraries", "com.almeros.*") exclude '**/R.java', '**/BuildConfig.java', 'com/almeros/**' } -}
\ No newline at end of file +} diff --git a/platform/android/MapboxGLAndroidSDK/gradle-publish.gradle b/platform/android/MapboxGLAndroidSDK/gradle-publish.gradle index f017434fac..c5037974c0 100644 --- a/platform/android/MapboxGLAndroidSDK/gradle-publish.gradle +++ b/platform/android/MapboxGLAndroidSDK/gradle-publish.gradle @@ -150,4 +150,4 @@ afterEvaluate { project -> archives androidSourcesJar archives androidJavadocsJar } -}
\ No newline at end of file +} diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/Mapbox.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/Mapbox.java index 9d20e968c8..2abdb37041 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/Mapbox.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/Mapbox.java @@ -101,4 +101,4 @@ public final class Mapbox { NetworkInfo activeNetwork = cm.getActiveNetworkInfo(); return (activeNetwork != null && activeNetwork.isConnected()); } -}
\ No newline at end of file +} diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/InfoWindow.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/InfoWindow.java index 4e080d98f6..57e9373a42 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/InfoWindow.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/InfoWindow.java @@ -198,7 +198,7 @@ public class InfoWindow { // Calculate x-offset for update method viewWidthOffset = x - coordinates.x - offsetX; - close(); //if it was already opened + close(); // if it was already opened mapView.addView(view, lp); isVisible = true; } diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/MarkerViewManager.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/MarkerViewManager.java index ad221691b4..710ffc329b 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/MarkerViewManager.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/MarkerViewManager.java @@ -573,7 +573,7 @@ public class MarkerViewManager implements MapView.OnMapChangedListener { if (view != null) { if (marker.getWidth() == 0) { if (view.getMeasuredWidth() == 0) { - //Ensure the marker's view is measured first + // Ensure the marker's view is measured first view.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED); } marker.setWidth(view.getMeasuredWidth()); diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/constants/MyBearingTracking.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/constants/MyBearingTracking.java index cba2fb282c..f53c65d055 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/constants/MyBearingTracking.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/constants/MyBearingTracking.java @@ -38,6 +38,6 @@ public class MyBearingTracking { */ public static final int GPS = 0x00000008; - //public static final int COMBINED = 0x00000012; + // public static final int COMBINED = 0x00000012; } diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/constants/MyLocationTracking.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/constants/MyLocationTracking.java index d1eaac04de..39f653596f 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/constants/MyLocationTracking.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/constants/MyLocationTracking.java @@ -34,4 +34,4 @@ public class MyLocationTracking { */ public static final int TRACKING_FOLLOW = 0x00000004; -}
\ No newline at end of file +} diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/exceptions/InvalidMarkerPositionException.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/exceptions/InvalidMarkerPositionException.java index e5a647841f..bd24379af3 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/exceptions/InvalidMarkerPositionException.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/exceptions/InvalidMarkerPositionException.java @@ -7,4 +7,4 @@ public class InvalidMarkerPositionException extends RuntimeException { + "Missing the required position field. " + "Provide a non null LatLng as position to the Marker."); } -}
\ No newline at end of file +} diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/exceptions/TelemetryServiceNotConfiguredException.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/exceptions/TelemetryServiceNotConfiguredException.java index e2e114fa77..50dddd36e6 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/exceptions/TelemetryServiceNotConfiguredException.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/exceptions/TelemetryServiceNotConfiguredException.java @@ -19,4 +19,4 @@ public class TelemetryServiceNotConfiguredException extends RuntimeException { + "\nFor an example visit http://goo.gl/cET0Jn. For more information visit https://www.mapbox.com/android-sdk/."); } -}
\ No newline at end of file +} diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/geometry/LatLngSpan.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/geometry/LatLngSpan.java index dd7fef4d23..d00ccdb9b8 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/geometry/LatLngSpan.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/geometry/LatLngSpan.java @@ -100,4 +100,4 @@ public class LatLngSpan implements Parcelable { out.writeDouble(mLatitudeSpan); out.writeDouble(mLongitudeSpan); } -}
\ No newline at end of file +} diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/geometry/VisibleRegion.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/geometry/VisibleRegion.java index 45300f248c..c5b8ad3077 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/geometry/VisibleRegion.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/geometry/VisibleRegion.java @@ -127,4 +127,4 @@ public class VisibleRegion implements Parcelable { } }; -}
\ No newline at end of file +} diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/http/HTTPRequest.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/http/HTTPRequest.java index 2c6251638a..9c8cda5544 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/http/HTTPRequest.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/http/HTTPRequest.java @@ -123,7 +123,7 @@ class HTTPRequest implements Callback { body = response.body().bytes(); } catch (IOException ioException) { onFailure(ioException); - //throw ioException; + // throw ioException; return; } finally { response.body().close(); @@ -202,4 +202,4 @@ class HTTPRequest implements Callback { return ""; } } -}
\ No newline at end of file +} diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationServices.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationServices.java index aaf08c8b55..364d925d37 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationServices.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationServices.java @@ -96,7 +96,7 @@ public class LocationServices implements LostApiClient.ConnectionCallbacks, @Override public void onConnected() { - //noinspection MissingPermission + // noinspection MissingPermission Location lastLocation = FusedLocationApi.getLastLocation(locationClient); if (lastLocation != null) { this.lastLocation = lastLocation; @@ -110,7 +110,7 @@ public class LocationServices implements LostApiClient.ConnectionCallbacks, .setFastestInterval(1000) .setSmallestDisplacement(3.0f) .setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY); - //noinspection MissingPermission + // noinspection MissingPermission FusedLocationApi.requestLocationUpdates(locationClient, locationRequest, this); } else { // LocationRequest Tuned for PASSIVE @@ -118,7 +118,7 @@ public class LocationServices implements LostApiClient.ConnectionCallbacks, .setFastestInterval(1000) .setSmallestDisplacement(3.0f) .setPriority(LocationRequest.PRIORITY_NO_POWER); - //noinspection MissingPermission + // noinspection MissingPermission FusedLocationApi.requestLocationUpdates(locationClient, locationRequest, this); } } diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/AnnotationManager.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/AnnotationManager.java index 8b47fb1d51..0c77723354 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/AnnotationManager.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/AnnotationManager.java @@ -194,7 +194,7 @@ class AnnotationManager { if (ids != null) { id = ids[i]; } else { - //unit test + // unit test id++; } m.setId(id); diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapGestureDetector.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapGestureDetector.java index 59ded2b25d..bdd5ae1c1b 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapGestureDetector.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapGestureDetector.java @@ -181,7 +181,7 @@ final class MapGestureDetector { */ boolean onGenericMotionEvent(MotionEvent event) { // Mouse events - //if (event.isFromSource(InputDevice.SOURCE_CLASS_POINTER)) { // this is not available before API 18 + // if (event.isFromSource(InputDevice.SOURCE_CLASS_POINTER)) { // this is not available before API 18 if ((event.getSource() & InputDevice.SOURCE_CLASS_POINTER) == InputDevice.SOURCE_CLASS_POINTER) { // Choose the action switch (event.getActionMasked()) { @@ -653,4 +653,4 @@ final class MapGestureDetector { void setOnScrollListener(MapboxMap.OnScrollListener onScrollListener) { this.onScrollListener = onScrollListener; } -}
\ No newline at end of file +} diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMap.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMap.java index a4248a1fb5..18af6e8f2e 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMap.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMap.java @@ -229,7 +229,7 @@ public final class MapboxMap { @UiThread public <T extends Layer> T getLayerAs(@NonNull String layerId) { try { - //noinspection unchecked + // noinspection unchecked return (T) nativeMapView.getLayer(layerId); } catch (ClassCastException exception) { Timber.e(String.format("Layer: %s is a different type: %s", layerId, exception)); @@ -297,7 +297,7 @@ public final class MapboxMap { @UiThread public <T extends Source> T getSourceAs(@NonNull String sourceId) { try { - //noinspection unchecked + // noinspection unchecked return (T) nativeMapView.getSource(sourceId); } catch (ClassCastException exception) { Timber.e(String.format("Source: %s is a different type: %s", sourceId, exception)); @@ -2032,4 +2032,4 @@ public final class MapboxMap { Transform getTransform() { return transform; } -}
\ No newline at end of file +} diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMapOptions.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMapOptions.java index 518ef47329..9a5e336cf8 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMapOptions.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMapOptions.java @@ -1161,4 +1161,4 @@ public class MapboxMapOptions implements Parcelable { result = 31 * result + (style != null ? style.hashCode() : 0); return result; } -}
\ No newline at end of file +} diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/NativeMapView.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/NativeMapView.java index 0c15480dee..654923ea96 100755 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/NativeMapView.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/NativeMapView.java @@ -843,16 +843,16 @@ final class NativeMapView { if (isDestroyedOn("addImage")) { return; } - //Check/correct config + // Check/correct config if (image.getConfig() != Bitmap.Config.ARGB_8888) { image = image.copy(Bitmap.Config.ARGB_8888, false); } - //Get pixels + // Get pixels ByteBuffer buffer = ByteBuffer.allocate(image.getByteCount()); image.copyPixelsToBuffer(buffer); - //Determine pixel ratio + // Determine pixel ratio float density = image.getDensity() == Bitmap.DENSITY_NONE ? Bitmap.DENSITY_NONE : image.getDensity(); float pixelRatio = density / DisplayMetrics.DENSITY_DEFAULT; diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/SupportMapFragment.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/SupportMapFragment.java index 90d933736b..77fea1a14a 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/SupportMapFragment.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/SupportMapFragment.java @@ -152,4 +152,4 @@ public class SupportMapFragment extends Fragment { public void getMapAsync(@NonNull final OnMapReadyCallback onMapReadyCallback) { this.onMapReadyCallback = onMapReadyCallback; } -}
\ No newline at end of file +} diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/TrackingSettings.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/TrackingSettings.java index 604805bcfd..ce2b437d19 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/TrackingSettings.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/TrackingSettings.java @@ -63,10 +63,10 @@ public final class TrackingSettings { } catch (SecurityException ignore) { // User did not accept location permissions } - //noinspection ResourceType + // noinspection ResourceType setMyLocationTrackingMode(savedInstanceState.getInt( MapboxConstants.STATE_MY_LOCATION_TRACKING_MODE, MyLocationTracking.TRACKING_NONE)); - //noinspection ResourceType + // noinspection ResourceType setMyBearingTrackingMode(savedInstanceState.getInt( MapboxConstants.STATE_MY_BEARING_TRACKING_MODE, MyBearingTracking.NONE)); setDismissLocationTrackingOnGesture(savedInstanceState.getBoolean( diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/net/ConnectivityReceiver.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/net/ConnectivityReceiver.java index 7c37569ae2..ed7370a910 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/net/ConnectivityReceiver.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/net/ConnectivityReceiver.java @@ -27,11 +27,11 @@ public class ConnectivityReceiver extends BroadcastReceiver { */ public static synchronized ConnectivityReceiver instance(Context context) { if (INSTANCE == null) { - //Register new instance + // Register new instance INSTANCE = new ConnectivityReceiver(); context.registerReceiver(INSTANCE, new IntentFilter("android.net.conn.CONNECTIVITY_CHANGE")); - //Add default listeners + // Add default listeners INSTANCE.addListener(new NativeConnectivityListener()); } @@ -51,7 +51,7 @@ public class ConnectivityReceiver extends BroadcastReceiver { boolean connected = isConnected(context); Timber.v("Connected: " + connected); - //Loop over listeners + // Loop over listeners for (ConnectivityListener listener : listeners) { listener.onNetworkStateChanged(connected); } diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/Property.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/Property.java index bb060ddf15..d298b62392 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/Property.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/Property.java @@ -11,7 +11,7 @@ import java.lang.annotation.RetentionPolicy; */ public abstract class Property<T> { - //VISIBILITY: Whether this layer is displayed. + // VISIBILITY: Whether this layer is displayed. /** * The layer is shown. @@ -30,7 +30,7 @@ public abstract class Property<T> { public @interface VISIBILITY { } - //LINE_CAP: The display of line endings. + // LINE_CAP: The display of line endings. /** * A cap with a squared-off end which is drawn to the exact endpoint of the line. @@ -59,7 +59,7 @@ public abstract class Property<T> { public @interface LINE_CAP { } - //LINE_JOIN: The display of lines when joining. + // LINE_JOIN: The display of lines when joining. /** * A join with a squared-off end which is drawn beyond the endpoint of the line at a distance of one-half of the @@ -89,7 +89,7 @@ public abstract class Property<T> { public @interface LINE_JOIN { } - //SYMBOL_PLACEMENT: Label placement relative to its geometry. + // SYMBOL_PLACEMENT: Label placement relative to its geometry. /** * The label is placed at the point where the geometry is located. @@ -111,7 +111,7 @@ public abstract class Property<T> { public @interface SYMBOL_PLACEMENT { } - //ICON_ROTATION_ALIGNMENT: In combination with `symbol-placement`, determines the rotation behavior of icons. + // ICON_ROTATION_ALIGNMENT: In combination with `symbol-placement`, determines the rotation behavior of icons. /** * When {@link SYMBOL_PLACEMENT} is set to {@link Property#SYMBOL_PLACEMENT_POINT}, aligns icons east-west. When @@ -142,7 +142,7 @@ public abstract class Property<T> { public @interface ICON_ROTATION_ALIGNMENT { } - //ICON_TEXT_FIT: Scales the icon to fit around the associated text. + // ICON_TEXT_FIT: Scales the icon to fit around the associated text. /** * The icon is displayed at its intrinsic aspect ratio. @@ -174,7 +174,7 @@ public abstract class Property<T> { public @interface ICON_TEXT_FIT { } - //TEXT_PITCH_ALIGNMENT: Orientation of text when map is pitched. + // TEXT_PITCH_ALIGNMENT: Orientation of text when map is pitched. /** * The text is aligned to the plane of the map. @@ -201,7 +201,7 @@ public abstract class Property<T> { public @interface TEXT_PITCH_ALIGNMENT { } - //TEXT_ROTATION_ALIGNMENT: In combination with `symbol-placement`, determines the rotation behavior of the individual + // TEXT_ROTATION_ALIGNMENT: In combination with `symbol-placement`, determines the rotation behavior of the individual // glyphs forming the text. /** @@ -233,7 +233,7 @@ public abstract class Property<T> { public @interface TEXT_ROTATION_ALIGNMENT { } - //TEXT_JUSTIFY: Text justification options. + // TEXT_JUSTIFY: Text justification options. /** * The text is aligned to the left. @@ -260,7 +260,7 @@ public abstract class Property<T> { public @interface TEXT_JUSTIFY { } - //TEXT_ANCHOR: Part of the text placed closest to the anchor. + // TEXT_ANCHOR: Part of the text placed closest to the anchor. /** * The center of the text is placed closest to the anchor. @@ -317,7 +317,7 @@ public abstract class Property<T> { public @interface TEXT_ANCHOR { } - //TEXT_TRANSFORM: Specifies how to capitalize text, similar to the CSS `text-transform` property. + // TEXT_TRANSFORM: Specifies how to capitalize text, similar to the CSS `text-transform` property. /** * The text is not altered. @@ -344,7 +344,7 @@ public abstract class Property<T> { public @interface TEXT_TRANSFORM { } - //FILL_TRANSLATE_ANCHOR: Controls the translation reference point. + // FILL_TRANSLATE_ANCHOR: Controls the translation reference point. /** * The fill is translated relative to the map. @@ -366,7 +366,7 @@ public abstract class Property<T> { public @interface FILL_TRANSLATE_ANCHOR { } - //LINE_TRANSLATE_ANCHOR: Controls the translation reference point. + // LINE_TRANSLATE_ANCHOR: Controls the translation reference point. /** * The line is translated relative to the map. @@ -388,7 +388,7 @@ public abstract class Property<T> { public @interface LINE_TRANSLATE_ANCHOR { } - //ICON_TRANSLATE_ANCHOR: Controls the translation reference point. + // ICON_TRANSLATE_ANCHOR: Controls the translation reference point. /** * Icons are translated relative to the map. @@ -410,7 +410,7 @@ public abstract class Property<T> { public @interface ICON_TRANSLATE_ANCHOR { } - //TEXT_TRANSLATE_ANCHOR: Controls the translation reference point. + // TEXT_TRANSLATE_ANCHOR: Controls the translation reference point. /** * The text is translated relative to the map. @@ -432,7 +432,7 @@ public abstract class Property<T> { public @interface TEXT_TRANSLATE_ANCHOR { } - //CIRCLE_TRANSLATE_ANCHOR: Controls the translation reference point. + // CIRCLE_TRANSLATE_ANCHOR: Controls the translation reference point. /** * The circle is translated relative to the map. @@ -454,7 +454,7 @@ public abstract class Property<T> { public @interface CIRCLE_TRANSLATE_ANCHOR { } - //CIRCLE_PITCH_SCALE: Controls the scaling behavior of the circle when the map is pitched. + // CIRCLE_PITCH_SCALE: Controls the scaling behavior of the circle when the map is pitched. /** * Circles are scaled according to their apparent distance to the camera. @@ -476,7 +476,7 @@ public abstract class Property<T> { public @interface CIRCLE_PITCH_SCALE { } - //Class definition + // Class definition public final String name; public final T value; diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/PropertyValue.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/PropertyValue.java index c404f07c76..582a0bc74f 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/PropertyValue.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/PropertyValue.java @@ -30,7 +30,7 @@ public class PropertyValue<T> { @Nullable public Function<T> getFunction() { if (isFunction()) { - //noinspection unchecked + // noinspection unchecked return (Function<T>) value; } else { Timber.w("not a function, try value"); @@ -41,7 +41,7 @@ public class PropertyValue<T> { @Nullable public T getValue() { if (isValue()) { - //noinspection unchecked + // noinspection unchecked return (T) value; } else { Timber.w("not a value, try function"); diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/property.java.ejs b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/property.java.ejs index 3ce691775c..eb6a0a6938 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/property.java.ejs +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/property.java.ejs @@ -14,7 +14,7 @@ import java.lang.annotation.RetentionPolicy; */ public abstract class Property<T> { - //VISIBILITY: Whether this layer is displayed. + // VISIBILITY: Whether this layer is displayed. /** * The layer is shown. @@ -33,7 +33,7 @@ public abstract class Property<T> { public @interface VISIBILITY {} <% for (const property of properties) { -%> - //<%- snakeCaseUpper(property.name) %>: <%- property.doc %> + // <%- snakeCaseUpper(property.name) %>: <%- property.doc %> <% for (const value in property.values) { -%> /** @@ -55,7 +55,7 @@ public abstract class Property<T> { <% } -%> - //Class definition + // Class definition public final String name; public final T value; diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/GeoJsonSource.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/GeoJsonSource.java index 0c2ee42ea0..f9875c7242 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/GeoJsonSource.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/GeoJsonSource.java @@ -160,8 +160,8 @@ public class GeoJsonSource extends Source { } protected void setRawJson(String geoJson) { - //Wrap the String in a map as an Object is expected by the - //style conversion template + // Wrap the String in a map as an Object is expected by the + // style conversion template HashMap<String, String> wrapper = new HashMap<>(); wrapper.put("data", geoJson); nativeSetGeoJson(wrapper); diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/telemetry/MapboxEventManager.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/telemetry/MapboxEventManager.java index 4a0ef248b7..89413f26f0 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/telemetry/MapboxEventManager.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/telemetry/MapboxEventManager.java @@ -117,10 +117,10 @@ public class MapboxEventManager { */ public void initialize(@NonNull Context context, @NonNull String accessToken) { - //Timber.i("Telemetry initialize() called..."); + // Timber.i("Telemetry initialize() called..."); if (initialized) { - //Timber.i("Mapbox Telemetry has already been initialized."); + // Timber.i("Mapbox Telemetry has already been initialized."); return; } @@ -143,7 +143,7 @@ public class MapboxEventManager { Context.MODE_PRIVATE); // Determine if Telemetry Should Be Enabled - ///Timber.i("Right before Telemetry set enabled in initialized()"); + /// Timber.i("Right before Telemetry set enabled in initialized()"); setTelemetryEnabled(prefs.getBoolean(MapboxConstants.MAPBOX_SHARED_PREFERENCE_KEY_TELEMETRY_ENABLED, true)); // Load / Create Vendor Id @@ -171,7 +171,7 @@ public class MapboxEventManager { String stagingAccessToken = appInfo.metaData.getString(MapboxConstants.KEY_META_DATA_STAGING_ACCESS_TOKEN); if (TextUtils.isEmpty(stagingURL) || TextUtils.isEmpty(stagingAccessToken)) { - //Timber.d("Looking in SharedPreferences for Staging Credentials"); + // Timber.d("Looking in SharedPreferences for Staging Credentials"); stagingURL = prefs.getString(MapboxConstants.MAPBOX_SHARED_PREFERENCE_KEY_TELEMETRY_STAGING_URL, null); stagingAccessToken = prefs.getString( MapboxConstants.MAPBOX_SHARED_PREFERENCE_KEY_TELEMETRY_STAGING_ACCESS_TOKEN, null); @@ -191,7 +191,7 @@ public class MapboxEventManager { } } catch (Exception exception) { - //Timber.e("Error Trying to load Staging Credentials: ", exception); + // Timber.e("Error Trying to load Staging Credentials: ", exception); } // Register for battery updates @@ -227,7 +227,7 @@ public class MapboxEventManager { } } } catch (Exception exception) { - //Timber.w("Error checking for Telemetry Service Config: ", exception); + // Timber.w("Error checking for Telemetry Service Config: ", exception); } throw new TelemetryServiceNotConfiguredException(); } @@ -246,26 +246,26 @@ public class MapboxEventManager { * @param telemetryEnabled True to start telemetry, false to stop it */ public void setTelemetryEnabled(boolean telemetryEnabled) { - //Timber.i("this.telemetryEnabled = " + this.telemetryEnabled + "; telemetryEnabled = " + telemetryEnabled); + // Timber.i("this.telemetryEnabled = " + this.telemetryEnabled + "; telemetryEnabled = " + telemetryEnabled); if (this.telemetryEnabled == telemetryEnabled) { - //Timber.d("No need to start / stop telemetry as it's already in that state."); + // Timber.d("No need to start / stop telemetry as it's already in that state."); return; } if (telemetryEnabled) { - //Timber.d("Starting Telemetry Up!"); + // Timber.d("Starting Telemetry Up!"); // Start It Up context.startService(new Intent(context, TelemetryService.class)); // Make sure Ambient Mode is started at a minimum if (LocationServices.getLocationServices(context).areLocationPermissionsGranted()) { - //Timber.i("Permissions are good, see if GPS is enabled and if not then setup Ambient."); + // Timber.i("Permissions are good, see if GPS is enabled and if not then setup Ambient."); if (LocationServices.getLocationServices(context).isGpsEnabled()) { LocationServices.getLocationServices(context).toggleGPS(false); } } else { // Start timer that checks for Permissions - //Timber.i("Permissions are not good. Need to do some looping to check on stuff."); + // Timber.i("Permissions are not good. Need to do some looping to check on stuff."); final Handler permsHandler = new Handler(); Runnable runnable = new Runnable() { @@ -275,7 +275,7 @@ public class MapboxEventManager { @Override public void run() { if (LocationServices.getLocationServices(context).areLocationPermissionsGranted()) { - //Timber.i("Permissions finally granted, so starting Ambient if GPS isn't already enabled"); + // Timber.i("Permissions finally granted, so starting Ambient if GPS isn't already enabled"); // Start Ambient if (LocationServices.getLocationServices(context).isGpsEnabled()) { LocationServices.getLocationServices(context).toggleGPS(false); @@ -283,7 +283,7 @@ public class MapboxEventManager { } else { // Restart Handler long nextWaitTime = exponentialBackoffCounter.getNextCount(); - //Timber.i("Permissions not granted yet... let's try again in " + nextWaitTime/1000 + " seconds"); + // Timber.i("Permissions not granted yet... let's try again in " + nextWaitTime/1000 + " seconds"); permsHandler.postDelayed(this, nextWaitTime); } } @@ -295,7 +295,7 @@ public class MapboxEventManager { timer = new Timer(); timer.schedule(new FlushEventsTimerTask(), flushDelayInitialInMillis, flushDelayInMillis); } else { - //Timber.d("Shutting Telemetry Down"); + // Timber.d("Shutting Telemetry Down"); // Shut It Down events.removeAllElements(); context.stopService(new Intent(context, TelemetryService.class)); @@ -322,7 +322,7 @@ public class MapboxEventManager { * NOTE: Permission set to package private to enable only telemetry code to use this. */ void flushEventsQueueImmediately() { - //Timber.i("flushEventsQueueImmediately() called..."); + // Timber.i("flushEventsQueueImmediately() called..."); new FlushTheEventsTask().execute(); } @@ -337,7 +337,7 @@ public class MapboxEventManager { } events.add(event); if (events.size() == FLUSH_EVENTS_CAP) { - //Timber.d("eventsSize == flushCap so send data."); + // Timber.d("eventsSize == flushCap so send data."); flushEventsQueueImmediately(); } } @@ -437,7 +437,7 @@ public class MapboxEventManager { eventWithAttributes.put(MapboxEvent.ATTRIBUTE_CELLULAR_NETWORK_TYPE, getCellularNetworkType()); eventWithAttributes.put(MapboxEvent.ATTRIBUTE_WIFI, getConnectedToWifi()); } else { - //Timber.w("This is not an event type in the Events Data Model."); + // Timber.w("This is not an event type in the Events Data Model."); return; } @@ -459,7 +459,7 @@ public class MapboxEventManager { // Send to Server Immediately flushEventsQueueImmediately(); - //Timber.d("turnstile event pushed."); + // Timber.d("turnstile event pushed."); } /** @@ -485,7 +485,7 @@ public class MapboxEventManager { return hex; } } catch (Exception exception) { - //Timber.w("Error encoding string, will return in original form.", exception); + // Timber.w("Error encoding string, will return in original form.", exception); } return string; } @@ -624,7 +624,7 @@ public class MapboxEventManager { status = true; } } catch (Exception exception) { - //Timber.w("Error getting Wifi Connection Status: ", exception); + // Timber.w("Error getting Wifi Connection Status: ", exception); status = false; } } @@ -642,13 +642,13 @@ public class MapboxEventManager { protected Void doInBackground(Void... voids) { if (events.isEmpty()) { - //Timber.d("No events in the queue to send so returning."); + // Timber.d("No events in the queue to send so returning."); return null; } // Check for NetworkConnectivity if (!Mapbox.isConnected()) { - //Timber.w("Not connected to network, so empty events cache and return without attempting to send events"); + // Timber.w("Not connected to network, so empty events cache and return without attempting to send events"); // Make sure that events don't pile up when Offline // and thus impact available memory over time. events.removeAllElements(); @@ -772,7 +772,7 @@ public class MapboxEventManager { .post(body) .build(); response = client.newCall(request).execute(); - //Timber.d("response code = " + response.code() + " for events " + events.size()); + // Timber.d("response code = " + response.code() + " for events " + events.size()); } catch (Exception exception) { Timber.e("FlushTheEventsTask borked: ", exception); @@ -825,4 +825,4 @@ public class MapboxEventManager { return attempt * BASE_TIME; } } -}
\ No newline at end of file +} diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/utils/ColorUtils.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/utils/ColorUtils.java index d45d647247..2da2472d69 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/utils/ColorUtils.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/utils/ColorUtils.java @@ -119,4 +119,4 @@ public class ColorUtils { throw new ConversionException("Not a valid rgb/rgba value"); } } -}
\ No newline at end of file +} diff --git a/platform/android/MapboxGLAndroidSDK/src/main/res/color/mapbox_material_bg_selector.xml b/platform/android/MapboxGLAndroidSDK/src/main/res/color/mapbox_material_bg_selector.xml index 64d7f46c2d..4c733ed112 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/res/color/mapbox_material_bg_selector.xml +++ b/platform/android/MapboxGLAndroidSDK/src/main/res/color/mapbox_material_bg_selector.xml @@ -2,4 +2,4 @@ <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:color="?attr/colorPrimaryDark" android:state_pressed="true" /> <item android:color="?attr/colorPrimary" /> -</selector>
\ No newline at end of file +</selector> diff --git a/platform/android/MapboxGLAndroidSDK/src/main/res/drawable-v21/mapbox_default_bg_selector.xml b/platform/android/MapboxGLAndroidSDK/src/main/res/drawable-v21/mapbox_default_bg_selector.xml index ef82c18f5d..2fd6815c23 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/res/drawable-v21/mapbox_default_bg_selector.xml +++ b/platform/android/MapboxGLAndroidSDK/src/main/res/drawable-v21/mapbox_default_bg_selector.xml @@ -6,4 +6,4 @@ <solid android:color="@android:color/white" /> </shape> </item> -</ripple>
\ No newline at end of file +</ripple> diff --git a/platform/android/MapboxGLAndroidSDK/src/main/res/drawable/mapbox_default_bg_selector.xml b/platform/android/MapboxGLAndroidSDK/src/main/res/drawable/mapbox_default_bg_selector.xml index 45073bb1f3..3efe48615b 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/res/drawable/mapbox_default_bg_selector.xml +++ b/platform/android/MapboxGLAndroidSDK/src/main/res/drawable/mapbox_default_bg_selector.xml @@ -3,4 +3,4 @@ <item android:drawable="@color/mapbox_gray_light" android:state_pressed="true" /> <item android:drawable="@color/mapbox_gray_light" android:state_focused="true" /> <item android:drawable="@android:color/transparent" /> -</selector>
\ No newline at end of file +</selector> diff --git a/platform/android/MapboxGLAndroidSDK/src/main/res/drawable/mapbox_info_bg_selector.xml b/platform/android/MapboxGLAndroidSDK/src/main/res/drawable/mapbox_info_bg_selector.xml index 3ead19b781..01fc7cc2e8 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/res/drawable/mapbox_info_bg_selector.xml +++ b/platform/android/MapboxGLAndroidSDK/src/main/res/drawable/mapbox_info_bg_selector.xml @@ -2,4 +2,4 @@ <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:drawable="@drawable/mapbox_info_icon_selected" android:state_pressed="true" /> <item android:drawable="@drawable/mapbox_info_icon_default" /> -</selector>
\ No newline at end of file +</selector> diff --git a/platform/android/MapboxGLAndroidSDK/src/main/res/drawable/mapbox_mylocation_bg_shape.xml b/platform/android/MapboxGLAndroidSDK/src/main/res/drawable/mapbox_mylocation_bg_shape.xml index df0687bbd3..21054aabcb 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/res/drawable/mapbox_mylocation_bg_shape.xml +++ b/platform/android/MapboxGLAndroidSDK/src/main/res/drawable/mapbox_mylocation_bg_shape.xml @@ -7,4 +7,4 @@ <size android:width="@dimen/mapbox_my_locationview_outer_circle" android:height="@dimen/mapbox_my_locationview_outer_circle" /> -</shape>
\ No newline at end of file +</shape> diff --git a/platform/android/MapboxGLAndroidSDK/src/main/res/layout/mapbox_mapview_internal.xml b/platform/android/MapboxGLAndroidSDK/src/main/res/layout/mapbox_mapview_internal.xml index c6dcd35a2f..9810e8900b 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/res/layout/mapbox_mapview_internal.xml +++ b/platform/android/MapboxGLAndroidSDK/src/main/res/layout/mapbox_mapview_internal.xml @@ -41,4 +41,4 @@ android:padding="7dp" android:src="@drawable/mapbox_info_bg_selector" /> -</merge>
\ No newline at end of file +</merge> diff --git a/platform/android/MapboxGLAndroidSDK/src/main/res/layout/mapbox_mapview_preview.xml b/platform/android/MapboxGLAndroidSDK/src/main/res/layout/mapbox_mapview_preview.xml index 5517c0cfe6..d87f443586 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/res/layout/mapbox_mapview_preview.xml +++ b/platform/android/MapboxGLAndroidSDK/src/main/res/layout/mapbox_mapview_preview.xml @@ -38,4 +38,4 @@ android:layout_margin="10dp" android:src="@drawable/mapbox_compass_icon" /> -</RelativeLayout>
\ No newline at end of file +</RelativeLayout> diff --git a/platform/android/MapboxGLAndroidSDK/src/main/res/values/styles.xml b/platform/android/MapboxGLAndroidSDK/src/main/res/values/styles.xml index 82d9d1e076..eba1fb3a7d 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/res/values/styles.xml +++ b/platform/android/MapboxGLAndroidSDK/src/main/res/values/styles.xml @@ -3,4 +3,4 @@ <style name="mapbox_AlertDialogStyle" parent="Theme.AppCompat.Light.Dialog.Alert"/> -</resources>
\ No newline at end of file +</resources> diff --git a/platform/android/MapboxGLAndroidSDKTestApp/gradle-checkstyle.gradle b/platform/android/MapboxGLAndroidSDKTestApp/gradle-checkstyle.gradle index cdcc7f1e23..bfb8341dbc 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/gradle-checkstyle.gradle +++ b/platform/android/MapboxGLAndroidSDKTestApp/gradle-checkstyle.gradle @@ -14,4 +14,4 @@ task checkstyle(type: Checkstyle) { exclude '**/gen/**' classpath = files() ignoreFailures = false -}
\ No newline at end of file +} diff --git a/platform/android/MapboxGLAndroidSDKTestApp/gradle-config.gradle b/platform/android/MapboxGLAndroidSDKTestApp/gradle-config.gradle index 21da83c4a0..0eefee7f5c 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/gradle-config.gradle +++ b/platform/android/MapboxGLAndroidSDKTestApp/gradle-config.gradle @@ -19,4 +19,4 @@ task accessToken { gradle.projectsEvaluated { preBuild.dependsOn('accessToken') -}
\ No newline at end of file +} diff --git a/platform/android/MapboxGLAndroidSDKTestApp/gradle-device-farm.gradle b/platform/android/MapboxGLAndroidSDKTestApp/gradle-device-farm.gradle index f455e263c0..5cb5d75bbb 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/gradle-device-farm.gradle +++ b/platform/android/MapboxGLAndroidSDKTestApp/gradle-device-farm.gradle @@ -40,4 +40,4 @@ devicefarm { instrumentation { } -}
\ No newline at end of file +} diff --git a/platform/android/MapboxGLAndroidSDKTestApp/gradle-make.gradle b/platform/android/MapboxGLAndroidSDKTestApp/gradle-make.gradle index 29567df6f0..65d971cc96 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/gradle-make.gradle +++ b/platform/android/MapboxGLAndroidSDKTestApp/gradle-make.gradle @@ -15,4 +15,4 @@ task makeAndroid(type: Exec) { task makeAndroidAll(type: Exec) { workingDir '../../' commandLine 'make', 'apackage' -}
\ No newline at end of file +} diff --git a/platform/android/MapboxGLAndroidSDKTestApp/gradle-spoon.gradle b/platform/android/MapboxGLAndroidSDKTestApp/gradle-spoon.gradle index 1c9afaeb7c..7a5b966443 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/gradle-spoon.gradle +++ b/platform/android/MapboxGLAndroidSDKTestApp/gradle-spoon.gradle @@ -5,4 +5,4 @@ spoon { // for more options see https://github.com/stanfy/spoon-gradle-plugin grantAllPermissions = true debug = true -}
\ No newline at end of file +} diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/CameraInternalApiTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/CameraInternalApiTest.java index 3ca61f7e9d..1b40e265d2 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/CameraInternalApiTest.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/CameraInternalApiTest.java @@ -166,4 +166,4 @@ public class CameraInternalApiTest { MapViewUtils.setLatLng(mapboxMap, new LatLng(1.1, 2.2)); } } -}
\ No newline at end of file +} diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/feature/QueryRenderedFeaturesBoxCountTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/feature/QueryRenderedFeaturesBoxCountTest.java index b4be73be7a..f49296a164 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/feature/QueryRenderedFeaturesBoxCountTest.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/feature/QueryRenderedFeaturesBoxCountTest.java @@ -58,4 +58,4 @@ public class QueryRenderedFeaturesBoxCountTest { Espresso.unregisterIdlingResources(idlingResource); } -}
\ No newline at end of file +} diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/feature/QueryRenderedFeaturesHighlightTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/feature/QueryRenderedFeaturesHighlightTest.java index b8cd46e612..0333aba191 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/feature/QueryRenderedFeaturesHighlightTest.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/feature/QueryRenderedFeaturesHighlightTest.java @@ -78,4 +78,4 @@ public class QueryRenderedFeaturesHighlightTest { }, Press.FINGER); } -}
\ No newline at end of file +} diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/feature/QueryRenderedFeaturesPropertiesTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/feature/QueryRenderedFeaturesPropertiesTest.java index 3b86397603..01eb9c8b44 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/feature/QueryRenderedFeaturesPropertiesTest.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/feature/QueryRenderedFeaturesPropertiesTest.java @@ -75,4 +75,4 @@ public class QueryRenderedFeaturesPropertiesTest { }, Press.FINGER); } -}
\ No newline at end of file +} diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/BackgroundLayerStyleTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/BackgroundLayerStyleTest.java index 68ed5cb05d..d9e006ae42 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/BackgroundLayerStyleTest.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/BackgroundLayerStyleTest.java @@ -61,10 +61,10 @@ public class BackgroundLayerStyleTest extends BaseStyleTest { Timber.i("visibility"); assertNotNull(layer); - //Get initial + // Get initial assertEquals(layer.getVisibility().getValue(), VISIBLE); - //Set + // Set layer.setProperties(visibility(NONE)); assertEquals(layer.getVisibility().getValue(), NONE); } @@ -80,7 +80,7 @@ public class BackgroundLayerStyleTest extends BaseStyleTest { Timber.i("background-color"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(backgroundColor("rgba(0, 0, 0, 1)")); assertEquals((String) layer.getBackgroundColor().getValue(), (String) "rgba(0, 0, 0, 1)"); } @@ -96,7 +96,7 @@ public class BackgroundLayerStyleTest extends BaseStyleTest { Timber.i("background-color"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(backgroundColor(Color.RED)); assertEquals(layer.getBackgroundColorAsInt(), Color.RED); } @@ -112,7 +112,7 @@ public class BackgroundLayerStyleTest extends BaseStyleTest { Timber.i("background-pattern"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(backgroundPattern("pedestrian-polygon")); assertEquals((String) layer.getBackgroundPattern().getValue(), (String) "pedestrian-polygon"); } @@ -128,7 +128,7 @@ public class BackgroundLayerStyleTest extends BaseStyleTest { Timber.i("background-opacity"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(backgroundOpacity(0.3f)); assertEquals((Float) layer.getBackgroundOpacity().getValue(), (Float) 0.3f); } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/BackgroundLayerTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/BackgroundLayerTest.java index ab53ae0487..82d2ecfa39 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/BackgroundLayerTest.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/BackgroundLayerTest.java @@ -61,10 +61,10 @@ public class BackgroundLayerTest extends BaseStyleTest { Timber.i("visibility"); assertNotNull(layer); - //Get initial + // Get initial assertEquals(layer.getVisibility().getValue(), VISIBLE); - //Set + // Set layer.setProperties(visibility(NONE)); assertEquals(layer.getVisibility().getValue(), NONE); } @@ -80,7 +80,7 @@ public class BackgroundLayerTest extends BaseStyleTest { Timber.i("background-color"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(backgroundColor("rgba(0, 0, 0, 1)")); assertEquals((String) layer.getBackgroundColor().getValue(), (String) "rgba(0, 0, 0, 1)"); } @@ -96,7 +96,7 @@ public class BackgroundLayerTest extends BaseStyleTest { Timber.i("background-color"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(backgroundColor(Color.RED)); assertEquals(layer.getBackgroundColorAsInt(), Color.RED); } @@ -112,7 +112,7 @@ public class BackgroundLayerTest extends BaseStyleTest { Timber.i("background-pattern"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(backgroundPattern("pedestrian-polygon")); assertEquals((String) layer.getBackgroundPattern().getValue(), (String) "pedestrian-polygon"); } @@ -128,7 +128,7 @@ public class BackgroundLayerTest extends BaseStyleTest { Timber.i("background-opacity"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(backgroundOpacity(0.3f)); assertEquals((Float) layer.getBackgroundOpacity().getValue(), (Float) 0.3f); } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/CircleLayerStyleTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/CircleLayerStyleTest.java index 58fda51f07..1564597009 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/CircleLayerStyleTest.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/CircleLayerStyleTest.java @@ -67,16 +67,16 @@ public class CircleLayerStyleTest extends BaseStyleTest { layer = new CircleLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("visibility"); assertNotNull(layer); - //Get initial + // Get initial assertEquals(layer.getVisibility().getValue(), VISIBLE); - //Set + // Set layer.setProperties(visibility(NONE)); assertEquals(layer.getVisibility().getValue(), NONE); } @@ -92,13 +92,13 @@ public class CircleLayerStyleTest extends BaseStyleTest { layer = new CircleLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("circle-radius"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(circleRadius(0.3f)); assertEquals((Float) layer.getCircleRadius().getValue(), (Float) 0.3f); } @@ -114,13 +114,13 @@ public class CircleLayerStyleTest extends BaseStyleTest { layer = new CircleLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("circle-color"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(circleColor("rgba(0, 0, 0, 1)")); assertEquals((String) layer.getCircleColor().getValue(), (String) "rgba(0, 0, 0, 1)"); } @@ -136,13 +136,13 @@ public class CircleLayerStyleTest extends BaseStyleTest { layer = new CircleLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("circle-color"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(circleColor(Color.RED)); assertEquals(layer.getCircleColorAsInt(), Color.RED); } @@ -158,13 +158,13 @@ public class CircleLayerStyleTest extends BaseStyleTest { layer = new CircleLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("circle-blur"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(circleBlur(0.3f)); assertEquals((Float) layer.getCircleBlur().getValue(), (Float) 0.3f); } @@ -180,13 +180,13 @@ public class CircleLayerStyleTest extends BaseStyleTest { layer = new CircleLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("circle-opacity"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(circleOpacity(0.3f)); assertEquals((Float) layer.getCircleOpacity().getValue(), (Float) 0.3f); } @@ -202,13 +202,13 @@ public class CircleLayerStyleTest extends BaseStyleTest { layer = new CircleLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("circle-translate"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(circleTranslate(new Float[] {0f, 0f})); assertEquals((Float[]) layer.getCircleTranslate().getValue(), (Float[]) new Float[] {0f, 0f}); } @@ -224,13 +224,13 @@ public class CircleLayerStyleTest extends BaseStyleTest { layer = new CircleLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("circle-translate-anchor"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(circleTranslateAnchor(CIRCLE_TRANSLATE_ANCHOR_MAP)); assertEquals((String) layer.getCircleTranslateAnchor().getValue(), (String) CIRCLE_TRANSLATE_ANCHOR_MAP); } @@ -246,13 +246,13 @@ public class CircleLayerStyleTest extends BaseStyleTest { layer = new CircleLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("circle-pitch-scale"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(circlePitchScale(CIRCLE_PITCH_SCALE_MAP)); assertEquals((String) layer.getCirclePitchScale().getValue(), (String) CIRCLE_PITCH_SCALE_MAP); } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/CircleLayerTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/CircleLayerTest.java index 782598a0b2..15a0813fa1 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/CircleLayerTest.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/CircleLayerTest.java @@ -70,16 +70,16 @@ public class CircleLayerTest extends BaseStyleTest { layer = new CircleLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("visibility"); assertNotNull(layer); - //Get initial + // Get initial assertEquals(layer.getVisibility().getValue(), VISIBLE); - //Set + // Set layer.setProperties(visibility(NONE)); assertEquals(layer.getVisibility().getValue(), NONE); } @@ -95,13 +95,13 @@ public class CircleLayerTest extends BaseStyleTest { layer = new CircleLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("circle-radius"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(circleRadius(0.3f)); assertEquals((Float) layer.getCircleRadius().getValue(), (Float) 0.3f); } @@ -117,13 +117,13 @@ public class CircleLayerTest extends BaseStyleTest { layer = new CircleLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("circle-color"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(circleColor("rgba(0, 0, 0, 1)")); assertEquals((String) layer.getCircleColor().getValue(), (String) "rgba(0, 0, 0, 1)"); } @@ -139,13 +139,13 @@ public class CircleLayerTest extends BaseStyleTest { layer = new CircleLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("circle-color"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(circleColor(Color.RED)); assertEquals(layer.getCircleColorAsInt(), Color.RED); } @@ -161,13 +161,13 @@ public class CircleLayerTest extends BaseStyleTest { layer = new CircleLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("circle-blur"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(circleBlur(0.3f)); assertEquals((Float) layer.getCircleBlur().getValue(), (Float) 0.3f); } @@ -183,13 +183,13 @@ public class CircleLayerTest extends BaseStyleTest { layer = new CircleLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("circle-opacity"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(circleOpacity(0.3f)); assertEquals((Float) layer.getCircleOpacity().getValue(), (Float) 0.3f); } @@ -205,13 +205,13 @@ public class CircleLayerTest extends BaseStyleTest { layer = new CircleLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("circle-translate"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(circleTranslate(new Float[] {0f, 0f})); assertEquals((Float[]) layer.getCircleTranslate().getValue(), (Float[]) new Float[] {0f, 0f}); } @@ -227,13 +227,13 @@ public class CircleLayerTest extends BaseStyleTest { layer = new CircleLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("circle-translate-anchor"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(circleTranslateAnchor(CIRCLE_TRANSLATE_ANCHOR_MAP)); assertEquals((String) layer.getCircleTranslateAnchor().getValue(), (String) CIRCLE_TRANSLATE_ANCHOR_MAP); } @@ -249,13 +249,13 @@ public class CircleLayerTest extends BaseStyleTest { layer = new CircleLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("circle-pitch-scale"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(circlePitchScale(CIRCLE_PITCH_SCALE_MAP)); assertEquals((String) layer.getCirclePitchScale().getValue(), (String) CIRCLE_PITCH_SCALE_MAP); } @@ -271,13 +271,13 @@ public class CircleLayerTest extends BaseStyleTest { layer = new CircleLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("circle-stroke-width"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(circleStrokeWidth(0.3f)); assertEquals((Float) layer.getCircleStrokeWidth().getValue(), (Float) 0.3f); } @@ -293,13 +293,13 @@ public class CircleLayerTest extends BaseStyleTest { layer = new CircleLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("circle-stroke-color"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(circleStrokeColor("rgba(0, 0, 0, 1)")); assertEquals((String) layer.getCircleStrokeColor().getValue(), (String) "rgba(0, 0, 0, 1)"); } @@ -315,13 +315,13 @@ public class CircleLayerTest extends BaseStyleTest { layer = new CircleLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("circle-stroke-color"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(circleStrokeColor(Color.RED)); assertEquals(layer.getCircleStrokeColorAsInt(), Color.RED); } @@ -337,13 +337,13 @@ public class CircleLayerTest extends BaseStyleTest { layer = new CircleLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("circle-stroke-opacity"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(circleStrokeOpacity(0.3f)); assertEquals((Float) layer.getCircleStrokeOpacity().getValue(), (Float) 0.3f); } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/FillLayerStyleTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/FillLayerStyleTest.java index c8668fa407..6897048e9b 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/FillLayerStyleTest.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/FillLayerStyleTest.java @@ -66,16 +66,16 @@ public class FillLayerStyleTest extends BaseStyleTest { layer = new FillLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("visibility"); assertNotNull(layer); - //Get initial + // Get initial assertEquals(layer.getVisibility().getValue(), VISIBLE); - //Set + // Set layer.setProperties(visibility(NONE)); assertEquals(layer.getVisibility().getValue(), NONE); } @@ -91,13 +91,13 @@ public class FillLayerStyleTest extends BaseStyleTest { layer = new FillLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("fill-antialias"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(fillAntialias(true)); assertEquals((Boolean) layer.getFillAntialias().getValue(), (Boolean) true); } @@ -113,13 +113,13 @@ public class FillLayerStyleTest extends BaseStyleTest { layer = new FillLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("fill-opacity"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(fillOpacity(0.3f)); assertEquals((Float) layer.getFillOpacity().getValue(), (Float) 0.3f); } @@ -135,13 +135,13 @@ public class FillLayerStyleTest extends BaseStyleTest { layer = new FillLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("fill-color"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(fillColor("rgba(0, 0, 0, 1)")); assertEquals((String) layer.getFillColor().getValue(), (String) "rgba(0, 0, 0, 1)"); } @@ -157,13 +157,13 @@ public class FillLayerStyleTest extends BaseStyleTest { layer = new FillLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("fill-color"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(fillColor(Color.RED)); assertEquals(layer.getFillColorAsInt(), Color.RED); } @@ -179,13 +179,13 @@ public class FillLayerStyleTest extends BaseStyleTest { layer = new FillLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("fill-outline-color"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(fillOutlineColor("rgba(0, 0, 0, 1)")); assertEquals((String) layer.getFillOutlineColor().getValue(), (String) "rgba(0, 0, 0, 1)"); } @@ -201,13 +201,13 @@ public class FillLayerStyleTest extends BaseStyleTest { layer = new FillLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("fill-outline-color"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(fillOutlineColor(Color.RED)); assertEquals(layer.getFillOutlineColorAsInt(), Color.RED); } @@ -223,13 +223,13 @@ public class FillLayerStyleTest extends BaseStyleTest { layer = new FillLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("fill-translate"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(fillTranslate(new Float[] {0f, 0f})); assertEquals((Float[]) layer.getFillTranslate().getValue(), (Float[]) new Float[] {0f, 0f}); } @@ -245,13 +245,13 @@ public class FillLayerStyleTest extends BaseStyleTest { layer = new FillLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("fill-translate-anchor"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(fillTranslateAnchor(FILL_TRANSLATE_ANCHOR_MAP)); assertEquals((String) layer.getFillTranslateAnchor().getValue(), (String) FILL_TRANSLATE_ANCHOR_MAP); } @@ -267,13 +267,13 @@ public class FillLayerStyleTest extends BaseStyleTest { layer = new FillLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("fill-pattern"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(fillPattern("pedestrian-polygon")); assertEquals((String) layer.getFillPattern().getValue(), (String) "pedestrian-polygon"); } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/FillLayerTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/FillLayerTest.java index 95360e1273..45fb243ded 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/FillLayerTest.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/FillLayerTest.java @@ -66,16 +66,16 @@ public class FillLayerTest extends BaseStyleTest { layer = new FillLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("visibility"); assertNotNull(layer); - //Get initial + // Get initial assertEquals(layer.getVisibility().getValue(), VISIBLE); - //Set + // Set layer.setProperties(visibility(NONE)); assertEquals(layer.getVisibility().getValue(), NONE); } @@ -91,13 +91,13 @@ public class FillLayerTest extends BaseStyleTest { layer = new FillLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("fill-antialias"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(fillAntialias(true)); assertEquals((Boolean) layer.getFillAntialias().getValue(), (Boolean) true); } @@ -113,13 +113,13 @@ public class FillLayerTest extends BaseStyleTest { layer = new FillLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("fill-opacity"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(fillOpacity(0.3f)); assertEquals((Float) layer.getFillOpacity().getValue(), (Float) 0.3f); } @@ -135,13 +135,13 @@ public class FillLayerTest extends BaseStyleTest { layer = new FillLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("fill-color"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(fillColor("rgba(0, 0, 0, 1)")); assertEquals((String) layer.getFillColor().getValue(), (String) "rgba(0, 0, 0, 1)"); } @@ -157,13 +157,13 @@ public class FillLayerTest extends BaseStyleTest { layer = new FillLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("fill-color"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(fillColor(Color.RED)); assertEquals(layer.getFillColorAsInt(), Color.RED); } @@ -179,13 +179,13 @@ public class FillLayerTest extends BaseStyleTest { layer = new FillLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("fill-outline-color"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(fillOutlineColor("rgba(0, 0, 0, 1)")); assertEquals((String) layer.getFillOutlineColor().getValue(), (String) "rgba(0, 0, 0, 1)"); } @@ -201,13 +201,13 @@ public class FillLayerTest extends BaseStyleTest { layer = new FillLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("fill-outline-color"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(fillOutlineColor(Color.RED)); assertEquals(layer.getFillOutlineColorAsInt(), Color.RED); } @@ -223,13 +223,13 @@ public class FillLayerTest extends BaseStyleTest { layer = new FillLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("fill-translate"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(fillTranslate(new Float[] {0f, 0f})); assertEquals((Float[]) layer.getFillTranslate().getValue(), (Float[]) new Float[] {0f, 0f}); } @@ -245,13 +245,13 @@ public class FillLayerTest extends BaseStyleTest { layer = new FillLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("fill-translate-anchor"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(fillTranslateAnchor(FILL_TRANSLATE_ANCHOR_MAP)); assertEquals((String) layer.getFillTranslateAnchor().getValue(), (String) FILL_TRANSLATE_ANCHOR_MAP); } @@ -267,13 +267,13 @@ public class FillLayerTest extends BaseStyleTest { layer = new FillLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("fill-pattern"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(fillPattern("pedestrian-polygon")); assertEquals((String) layer.getFillPattern().getValue(), (String) "pedestrian-polygon"); } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/LineLayerStyleTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/LineLayerStyleTest.java index 47a38a11ab..011e49dbf9 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/LineLayerStyleTest.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/LineLayerStyleTest.java @@ -75,16 +75,16 @@ public class LineLayerStyleTest extends BaseStyleTest { layer = new LineLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("visibility"); assertNotNull(layer); - //Get initial + // Get initial assertEquals(layer.getVisibility().getValue(), VISIBLE); - //Set + // Set layer.setProperties(visibility(NONE)); assertEquals(layer.getVisibility().getValue(), NONE); } @@ -100,13 +100,13 @@ public class LineLayerStyleTest extends BaseStyleTest { layer = new LineLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("line-cap"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(lineCap(LINE_CAP_BUTT)); assertEquals((String) layer.getLineCap().getValue(), (String) LINE_CAP_BUTT); } @@ -122,13 +122,13 @@ public class LineLayerStyleTest extends BaseStyleTest { layer = new LineLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("line-join"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(lineJoin(LINE_JOIN_BEVEL)); assertEquals((String) layer.getLineJoin().getValue(), (String) LINE_JOIN_BEVEL); } @@ -144,13 +144,13 @@ public class LineLayerStyleTest extends BaseStyleTest { layer = new LineLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("line-miter-limit"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(lineMiterLimit(0.3f)); assertEquals((Float) layer.getLineMiterLimit().getValue(), (Float) 0.3f); } @@ -166,13 +166,13 @@ public class LineLayerStyleTest extends BaseStyleTest { layer = new LineLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("line-round-limit"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(lineRoundLimit(0.3f)); assertEquals((Float) layer.getLineRoundLimit().getValue(), (Float) 0.3f); } @@ -188,13 +188,13 @@ public class LineLayerStyleTest extends BaseStyleTest { layer = new LineLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("line-opacity"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(lineOpacity(0.3f)); assertEquals((Float) layer.getLineOpacity().getValue(), (Float) 0.3f); } @@ -210,13 +210,13 @@ public class LineLayerStyleTest extends BaseStyleTest { layer = new LineLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("line-color"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(lineColor("rgba(0, 0, 0, 1)")); assertEquals((String) layer.getLineColor().getValue(), (String) "rgba(0, 0, 0, 1)"); } @@ -232,13 +232,13 @@ public class LineLayerStyleTest extends BaseStyleTest { layer = new LineLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("line-color"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(lineColor(Color.RED)); assertEquals(layer.getLineColorAsInt(), Color.RED); } @@ -254,13 +254,13 @@ public class LineLayerStyleTest extends BaseStyleTest { layer = new LineLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("line-translate"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(lineTranslate(new Float[] {0f, 0f})); assertEquals((Float[]) layer.getLineTranslate().getValue(), (Float[]) new Float[] {0f, 0f}); } @@ -276,13 +276,13 @@ public class LineLayerStyleTest extends BaseStyleTest { layer = new LineLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("line-translate-anchor"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(lineTranslateAnchor(LINE_TRANSLATE_ANCHOR_MAP)); assertEquals((String) layer.getLineTranslateAnchor().getValue(), (String) LINE_TRANSLATE_ANCHOR_MAP); } @@ -298,13 +298,13 @@ public class LineLayerStyleTest extends BaseStyleTest { layer = new LineLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("line-width"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(lineWidth(0.3f)); assertEquals((Float) layer.getLineWidth().getValue(), (Float) 0.3f); } @@ -320,13 +320,13 @@ public class LineLayerStyleTest extends BaseStyleTest { layer = new LineLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("line-gap-width"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(lineGapWidth(0.3f)); assertEquals((Float) layer.getLineGapWidth().getValue(), (Float) 0.3f); } @@ -342,13 +342,13 @@ public class LineLayerStyleTest extends BaseStyleTest { layer = new LineLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("line-offset"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(lineOffset(0.3f)); assertEquals((Float) layer.getLineOffset().getValue(), (Float) 0.3f); } @@ -364,13 +364,13 @@ public class LineLayerStyleTest extends BaseStyleTest { layer = new LineLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("line-blur"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(lineBlur(0.3f)); assertEquals((Float) layer.getLineBlur().getValue(), (Float) 0.3f); } @@ -386,13 +386,13 @@ public class LineLayerStyleTest extends BaseStyleTest { layer = new LineLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("line-dasharray"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(lineDasharray(new Float[] {})); assertEquals((Float[]) layer.getLineDasharray().getValue(), (Float[]) new Float[] {}); } @@ -408,13 +408,13 @@ public class LineLayerStyleTest extends BaseStyleTest { layer = new LineLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("line-pattern"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(linePattern("pedestrian-polygon")); assertEquals((String) layer.getLinePattern().getValue(), (String) "pedestrian-polygon"); } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/LineLayerTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/LineLayerTest.java index ad091c78b3..db47474814 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/LineLayerTest.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/LineLayerTest.java @@ -75,16 +75,16 @@ public class LineLayerTest extends BaseStyleTest { layer = new LineLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("visibility"); assertNotNull(layer); - //Get initial + // Get initial assertEquals(layer.getVisibility().getValue(), VISIBLE); - //Set + // Set layer.setProperties(visibility(NONE)); assertEquals(layer.getVisibility().getValue(), NONE); } @@ -100,13 +100,13 @@ public class LineLayerTest extends BaseStyleTest { layer = new LineLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("line-cap"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(lineCap(LINE_CAP_BUTT)); assertEquals((String) layer.getLineCap().getValue(), (String) LINE_CAP_BUTT); } @@ -122,13 +122,13 @@ public class LineLayerTest extends BaseStyleTest { layer = new LineLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("line-join"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(lineJoin(LINE_JOIN_BEVEL)); assertEquals((String) layer.getLineJoin().getValue(), (String) LINE_JOIN_BEVEL); } @@ -144,13 +144,13 @@ public class LineLayerTest extends BaseStyleTest { layer = new LineLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("line-miter-limit"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(lineMiterLimit(0.3f)); assertEquals((Float) layer.getLineMiterLimit().getValue(), (Float) 0.3f); } @@ -166,13 +166,13 @@ public class LineLayerTest extends BaseStyleTest { layer = new LineLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("line-round-limit"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(lineRoundLimit(0.3f)); assertEquals((Float) layer.getLineRoundLimit().getValue(), (Float) 0.3f); } @@ -188,13 +188,13 @@ public class LineLayerTest extends BaseStyleTest { layer = new LineLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("line-opacity"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(lineOpacity(0.3f)); assertEquals((Float) layer.getLineOpacity().getValue(), (Float) 0.3f); } @@ -210,13 +210,13 @@ public class LineLayerTest extends BaseStyleTest { layer = new LineLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("line-color"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(lineColor("rgba(0, 0, 0, 1)")); assertEquals((String) layer.getLineColor().getValue(), (String) "rgba(0, 0, 0, 1)"); } @@ -232,13 +232,13 @@ public class LineLayerTest extends BaseStyleTest { layer = new LineLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("line-color"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(lineColor(Color.RED)); assertEquals(layer.getLineColorAsInt(), Color.RED); } @@ -254,13 +254,13 @@ public class LineLayerTest extends BaseStyleTest { layer = new LineLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("line-translate"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(lineTranslate(new Float[] {0f, 0f})); assertEquals((Float[]) layer.getLineTranslate().getValue(), (Float[]) new Float[] {0f, 0f}); } @@ -276,13 +276,13 @@ public class LineLayerTest extends BaseStyleTest { layer = new LineLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("line-translate-anchor"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(lineTranslateAnchor(LINE_TRANSLATE_ANCHOR_MAP)); assertEquals((String) layer.getLineTranslateAnchor().getValue(), (String) LINE_TRANSLATE_ANCHOR_MAP); } @@ -298,13 +298,13 @@ public class LineLayerTest extends BaseStyleTest { layer = new LineLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("line-width"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(lineWidth(0.3f)); assertEquals((Float) layer.getLineWidth().getValue(), (Float) 0.3f); } @@ -320,13 +320,13 @@ public class LineLayerTest extends BaseStyleTest { layer = new LineLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("line-gap-width"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(lineGapWidth(0.3f)); assertEquals((Float) layer.getLineGapWidth().getValue(), (Float) 0.3f); } @@ -342,13 +342,13 @@ public class LineLayerTest extends BaseStyleTest { layer = new LineLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("line-offset"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(lineOffset(0.3f)); assertEquals((Float) layer.getLineOffset().getValue(), (Float) 0.3f); } @@ -364,13 +364,13 @@ public class LineLayerTest extends BaseStyleTest { layer = new LineLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("line-blur"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(lineBlur(0.3f)); assertEquals((Float) layer.getLineBlur().getValue(), (Float) 0.3f); } @@ -386,13 +386,13 @@ public class LineLayerTest extends BaseStyleTest { layer = new LineLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("line-dasharray"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(lineDasharray(new Float[] {})); assertEquals((Float[]) layer.getLineDasharray().getValue(), (Float[]) new Float[] {}); } @@ -408,13 +408,13 @@ public class LineLayerTest extends BaseStyleTest { layer = new LineLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("line-pattern"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(linePattern("pedestrian-polygon")); assertEquals((String) layer.getLinePattern().getValue(), (String) "pedestrian-polygon"); } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/RasterLayerStyleTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/RasterLayerStyleTest.java index eb67b48f7a..7f412320d4 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/RasterLayerStyleTest.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/RasterLayerStyleTest.java @@ -64,16 +64,16 @@ public class RasterLayerStyleTest extends BaseStyleTest { layer = new RasterLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("visibility"); assertNotNull(layer); - //Get initial + // Get initial assertEquals(layer.getVisibility().getValue(), VISIBLE); - //Set + // Set layer.setProperties(visibility(NONE)); assertEquals(layer.getVisibility().getValue(), NONE); } @@ -89,13 +89,13 @@ public class RasterLayerStyleTest extends BaseStyleTest { layer = new RasterLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("raster-opacity"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(rasterOpacity(0.3f)); assertEquals((Float) layer.getRasterOpacity().getValue(), (Float) 0.3f); } @@ -111,13 +111,13 @@ public class RasterLayerStyleTest extends BaseStyleTest { layer = new RasterLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("raster-hue-rotate"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(rasterHueRotate(0.3f)); assertEquals((Float) layer.getRasterHueRotate().getValue(), (Float) 0.3f); } @@ -133,13 +133,13 @@ public class RasterLayerStyleTest extends BaseStyleTest { layer = new RasterLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("raster-brightness-min"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(rasterBrightnessMin(0.3f)); assertEquals((Float) layer.getRasterBrightnessMin().getValue(), (Float) 0.3f); } @@ -155,13 +155,13 @@ public class RasterLayerStyleTest extends BaseStyleTest { layer = new RasterLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("raster-brightness-max"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(rasterBrightnessMax(0.3f)); assertEquals((Float) layer.getRasterBrightnessMax().getValue(), (Float) 0.3f); } @@ -177,13 +177,13 @@ public class RasterLayerStyleTest extends BaseStyleTest { layer = new RasterLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("raster-saturation"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(rasterSaturation(0.3f)); assertEquals((Float) layer.getRasterSaturation().getValue(), (Float) 0.3f); } @@ -199,13 +199,13 @@ public class RasterLayerStyleTest extends BaseStyleTest { layer = new RasterLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("raster-contrast"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(rasterContrast(0.3f)); assertEquals((Float) layer.getRasterContrast().getValue(), (Float) 0.3f); } @@ -221,13 +221,13 @@ public class RasterLayerStyleTest extends BaseStyleTest { layer = new RasterLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("raster-fade-duration"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(rasterFadeDuration(0.3f)); assertEquals((Float) layer.getRasterFadeDuration().getValue(), (Float) 0.3f); } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/RasterLayerTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/RasterLayerTest.java index 169d747b9c..5d230a1c47 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/RasterLayerTest.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/RasterLayerTest.java @@ -64,16 +64,16 @@ public class RasterLayerTest extends BaseStyleTest { layer = new RasterLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("visibility"); assertNotNull(layer); - //Get initial + // Get initial assertEquals(layer.getVisibility().getValue(), VISIBLE); - //Set + // Set layer.setProperties(visibility(NONE)); assertEquals(layer.getVisibility().getValue(), NONE); } @@ -89,13 +89,13 @@ public class RasterLayerTest extends BaseStyleTest { layer = new RasterLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("raster-opacity"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(rasterOpacity(0.3f)); assertEquals((Float) layer.getRasterOpacity().getValue(), (Float) 0.3f); } @@ -111,13 +111,13 @@ public class RasterLayerTest extends BaseStyleTest { layer = new RasterLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("raster-hue-rotate"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(rasterHueRotate(0.3f)); assertEquals((Float) layer.getRasterHueRotate().getValue(), (Float) 0.3f); } @@ -133,13 +133,13 @@ public class RasterLayerTest extends BaseStyleTest { layer = new RasterLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("raster-brightness-min"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(rasterBrightnessMin(0.3f)); assertEquals((Float) layer.getRasterBrightnessMin().getValue(), (Float) 0.3f); } @@ -155,13 +155,13 @@ public class RasterLayerTest extends BaseStyleTest { layer = new RasterLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("raster-brightness-max"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(rasterBrightnessMax(0.3f)); assertEquals((Float) layer.getRasterBrightnessMax().getValue(), (Float) 0.3f); } @@ -177,13 +177,13 @@ public class RasterLayerTest extends BaseStyleTest { layer = new RasterLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("raster-saturation"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(rasterSaturation(0.3f)); assertEquals((Float) layer.getRasterSaturation().getValue(), (Float) 0.3f); } @@ -199,13 +199,13 @@ public class RasterLayerTest extends BaseStyleTest { layer = new RasterLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("raster-contrast"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(rasterContrast(0.3f)); assertEquals((Float) layer.getRasterContrast().getValue(), (Float) 0.3f); } @@ -221,13 +221,13 @@ public class RasterLayerTest extends BaseStyleTest { layer = new RasterLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("raster-fade-duration"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(rasterFadeDuration(0.3f)); assertEquals((Float) layer.getRasterFadeDuration().getValue(), (Float) 0.3f); } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/RuntimeStyleBackgroundLayerTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/RuntimeStyleBackgroundLayerTest.java index 762ae4f846..c95c959644 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/RuntimeStyleBackgroundLayerTest.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/RuntimeStyleBackgroundLayerTest.java @@ -44,10 +44,10 @@ public class RuntimeStyleBackgroundLayerTest BackgroundLayer layer = mapboxMap.getLayerAs("background"); assertNotNull(layer); - //Get initial + // Get initial assertEquals(layer.getVisibility().getValue(), Property.VISIBLE); - //Set + // Set layer.setProperties(PropertyFactory.visibility(Property.NONE)); assertEquals(layer.getVisibility().getValue(), Property.NONE); } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/RuntimeStyleTests.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/RuntimeStyleTests.java index eec00bdde9..a034457944 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/RuntimeStyleTests.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/RuntimeStyleTests.java @@ -93,10 +93,10 @@ public class RuntimeStyleTests { public void perform(UiController uiController, View view) { MapboxMap mapboxMap = rule.getActivity().getMapboxMap(); - //Get initial + // Get initial assertNotNull(mapboxMap.getLayer("building")); - //Remove + // Remove try { mapboxMap.removeLayer("building"); } catch (NoSuchLayerException noSuchSourceException) { @@ -104,37 +104,37 @@ public class RuntimeStyleTests { } assertNull(mapboxMap.getLayer("building")); - //Add + // Add FillLayer layer = new FillLayer("building", "composite"); layer.setSourceLayer("building"); mapboxMap.addLayer(layer); assertNotNull(mapboxMap.getLayer("building")); - //Assure the reference still works + // Assure the reference still works layer.setProperties(PropertyFactory.visibility(Property.VISIBLE)); - //Remove, preserving the reference + // Remove, preserving the reference try { mapboxMap.removeLayer(layer); } catch (NoSuchLayerException noSuchSourceException) { fail("Definitively exists: " + noSuchSourceException.getMessage()); } - //Property setters should still work + // Property setters should still work layer.setProperties(PropertyFactory.fillColor(Color.RED)); - //Re-add the reference... + // Re-add the reference... mapboxMap.addLayer(layer); - //Ensure it's there + // Ensure it's there Assert.assertNotNull(mapboxMap.getLayer(layer.getId())); - //Test adding a duplicate layer + // Test adding a duplicate layer try { mapboxMap.addLayer(new FillLayer("building", "composite")); fail("Should not have been allowed to add a layer with a duplicate id"); } catch (CannotAddLayerException cannotAddLayerException) { - //OK + // OK } } } @@ -155,10 +155,10 @@ public class RuntimeStyleTests { public void perform(UiController uiController, View view) { MapboxMap mapboxMap = rule.getActivity().getMapboxMap(); - //Add initial source + // Add initial source mapboxMap.addSource(new VectorSource("my-source", "mapbox://mapbox.mapbox-terrain-v2")); - //Remove + // Remove try { mapboxMap.removeSource("my-source"); } catch (NoSuchSourceException noSuchSourceException) { @@ -166,30 +166,30 @@ public class RuntimeStyleTests { } assertNull(mapboxMap.getLayer("my-source")); - //Add + // Add Source source = new VectorSource("my-source", "mapbox://mapbox.mapbox-terrain-v2"); mapboxMap.addSource(source); - //Remove, preserving the reference + // Remove, preserving the reference try { mapboxMap.removeSource(source); } catch (NoSuchSourceException noSuchSourceException) { fail("Definitively exists: " + noSuchSourceException.getMessage()); } - //Re-add the reference... + // Re-add the reference... mapboxMap.addSource(source); - //Ensure it's there + // Ensure it's there Assert.assertNotNull(mapboxMap.getSource(source.getId())); - //Test adding a duplicate source + // Test adding a duplicate source try { Source source2 = new VectorSource("my-source", "mapbox://mapbox.mapbox-terrain-v2"); mapboxMap.addSource(source2); fail("Should not have been allowed to add a source with a duplicate id"); } catch (CannotAddSourceException cannotAddSourceException) { - //OK + // OK } } } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/RuntimeStyleTimingTests.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/RuntimeStyleTimingTests.java index 57b0fe72ff..400c5fbc3c 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/RuntimeStyleTimingTests.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/RuntimeStyleTimingTests.java @@ -35,7 +35,7 @@ public class RuntimeStyleTimingTests extends BaseStyleTest { @Test public void testGetAddRemoveLayer() { checkViewIsDisplayed(R.id.mapView); - //We're good if it didn't crash + // We're good if it didn't crash } @After diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/SymbolLayerStyleTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/SymbolLayerStyleTest.java index 5b59d4ceae..30ef3c9674 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/SymbolLayerStyleTest.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/SymbolLayerStyleTest.java @@ -116,16 +116,16 @@ public class SymbolLayerStyleTest extends BaseStyleTest { layer = new SymbolLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("visibility"); assertNotNull(layer); - //Get initial + // Get initial assertEquals(layer.getVisibility().getValue(), VISIBLE); - //Set + // Set layer.setProperties(visibility(NONE)); assertEquals(layer.getVisibility().getValue(), NONE); } @@ -141,13 +141,13 @@ public class SymbolLayerStyleTest extends BaseStyleTest { layer = new SymbolLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("symbol-placement"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(symbolPlacement(SYMBOL_PLACEMENT_POINT)); assertEquals((String) layer.getSymbolPlacement().getValue(), (String) SYMBOL_PLACEMENT_POINT); } @@ -163,13 +163,13 @@ public class SymbolLayerStyleTest extends BaseStyleTest { layer = new SymbolLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("symbol-spacing"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(symbolSpacing(0.3f)); assertEquals((Float) layer.getSymbolSpacing().getValue(), (Float) 0.3f); } @@ -185,13 +185,13 @@ public class SymbolLayerStyleTest extends BaseStyleTest { layer = new SymbolLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("symbol-avoid-edges"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(symbolAvoidEdges(true)); assertEquals((Boolean) layer.getSymbolAvoidEdges().getValue(), (Boolean) true); } @@ -207,13 +207,13 @@ public class SymbolLayerStyleTest extends BaseStyleTest { layer = new SymbolLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("icon-allow-overlap"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(iconAllowOverlap(true)); assertEquals((Boolean) layer.getIconAllowOverlap().getValue(), (Boolean) true); } @@ -229,13 +229,13 @@ public class SymbolLayerStyleTest extends BaseStyleTest { layer = new SymbolLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("icon-ignore-placement"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(iconIgnorePlacement(true)); assertEquals((Boolean) layer.getIconIgnorePlacement().getValue(), (Boolean) true); } @@ -251,13 +251,13 @@ public class SymbolLayerStyleTest extends BaseStyleTest { layer = new SymbolLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("icon-optional"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(iconOptional(true)); assertEquals((Boolean) layer.getIconOptional().getValue(), (Boolean) true); } @@ -273,13 +273,13 @@ public class SymbolLayerStyleTest extends BaseStyleTest { layer = new SymbolLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("icon-rotation-alignment"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(iconRotationAlignment(ICON_ROTATION_ALIGNMENT_MAP)); assertEquals((String) layer.getIconRotationAlignment().getValue(), (String) ICON_ROTATION_ALIGNMENT_MAP); } @@ -295,13 +295,13 @@ public class SymbolLayerStyleTest extends BaseStyleTest { layer = new SymbolLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("icon-size"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(iconSize(0.3f)); assertEquals((Float) layer.getIconSize().getValue(), (Float) 0.3f); } @@ -317,13 +317,13 @@ public class SymbolLayerStyleTest extends BaseStyleTest { layer = new SymbolLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("icon-text-fit"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(iconTextFit(ICON_TEXT_FIT_NONE)); assertEquals((String) layer.getIconTextFit().getValue(), (String) ICON_TEXT_FIT_NONE); } @@ -339,13 +339,13 @@ public class SymbolLayerStyleTest extends BaseStyleTest { layer = new SymbolLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("icon-text-fit-padding"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(iconTextFitPadding(new Float[] {0f, 0f, 0f, 0f})); assertEquals((Float[]) layer.getIconTextFitPadding().getValue(), (Float[]) new Float[] {0f, 0f, 0f, 0f}); } @@ -361,13 +361,13 @@ public class SymbolLayerStyleTest extends BaseStyleTest { layer = new SymbolLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("icon-image"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(iconImage("undefined")); assertEquals((String) layer.getIconImage().getValue(), (String) "undefined"); } @@ -383,13 +383,13 @@ public class SymbolLayerStyleTest extends BaseStyleTest { layer = new SymbolLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("icon-rotate"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(iconRotate(0.3f)); assertEquals((Float) layer.getIconRotate().getValue(), (Float) 0.3f); } @@ -405,13 +405,13 @@ public class SymbolLayerStyleTest extends BaseStyleTest { layer = new SymbolLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("icon-padding"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(iconPadding(0.3f)); assertEquals((Float) layer.getIconPadding().getValue(), (Float) 0.3f); } @@ -427,13 +427,13 @@ public class SymbolLayerStyleTest extends BaseStyleTest { layer = new SymbolLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("icon-keep-upright"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(iconKeepUpright(true)); assertEquals((Boolean) layer.getIconKeepUpright().getValue(), (Boolean) true); } @@ -449,13 +449,13 @@ public class SymbolLayerStyleTest extends BaseStyleTest { layer = new SymbolLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("icon-offset"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(iconOffset(new Float[] {0f, 0f})); assertEquals((Float[]) layer.getIconOffset().getValue(), (Float[]) new Float[] {0f, 0f}); } @@ -471,13 +471,13 @@ public class SymbolLayerStyleTest extends BaseStyleTest { layer = new SymbolLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("text-pitch-alignment"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(textPitchAlignment(TEXT_PITCH_ALIGNMENT_MAP)); assertEquals((String) layer.getTextPitchAlignment().getValue(), (String) TEXT_PITCH_ALIGNMENT_MAP); } @@ -493,13 +493,13 @@ public class SymbolLayerStyleTest extends BaseStyleTest { layer = new SymbolLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("text-rotation-alignment"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(textRotationAlignment(TEXT_ROTATION_ALIGNMENT_MAP)); assertEquals((String) layer.getTextRotationAlignment().getValue(), (String) TEXT_ROTATION_ALIGNMENT_MAP); } @@ -515,13 +515,13 @@ public class SymbolLayerStyleTest extends BaseStyleTest { layer = new SymbolLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("text-field"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(textField("")); assertEquals((String) layer.getTextField().getValue(), (String) ""); } @@ -537,13 +537,13 @@ public class SymbolLayerStyleTest extends BaseStyleTest { layer = new SymbolLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("text-font"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(textFont(new String[] {"Open Sans Regular", "Arial Unicode MS Regular"})); assertEquals((String[]) layer.getTextFont().getValue(), (String[]) new String[] {"Open Sans Regular", "Arial Unicode MS Regular"}); @@ -560,13 +560,13 @@ public class SymbolLayerStyleTest extends BaseStyleTest { layer = new SymbolLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("text-size"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(textSize(0.3f)); assertEquals((Float) layer.getTextSize().getValue(), (Float) 0.3f); } @@ -582,13 +582,13 @@ public class SymbolLayerStyleTest extends BaseStyleTest { layer = new SymbolLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("text-max-width"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(textMaxWidth(0.3f)); assertEquals((Float) layer.getTextMaxWidth().getValue(), (Float) 0.3f); } @@ -604,13 +604,13 @@ public class SymbolLayerStyleTest extends BaseStyleTest { layer = new SymbolLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("text-line-height"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(textLineHeight(0.3f)); assertEquals((Float) layer.getTextLineHeight().getValue(), (Float) 0.3f); } @@ -626,13 +626,13 @@ public class SymbolLayerStyleTest extends BaseStyleTest { layer = new SymbolLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("text-letter-spacing"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(textLetterSpacing(0.3f)); assertEquals((Float) layer.getTextLetterSpacing().getValue(), (Float) 0.3f); } @@ -648,13 +648,13 @@ public class SymbolLayerStyleTest extends BaseStyleTest { layer = new SymbolLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("text-justify"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(textJustify(TEXT_JUSTIFY_LEFT)); assertEquals((String) layer.getTextJustify().getValue(), (String) TEXT_JUSTIFY_LEFT); } @@ -670,13 +670,13 @@ public class SymbolLayerStyleTest extends BaseStyleTest { layer = new SymbolLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("text-anchor"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(textAnchor(TEXT_ANCHOR_CENTER)); assertEquals((String) layer.getTextAnchor().getValue(), (String) TEXT_ANCHOR_CENTER); } @@ -692,13 +692,13 @@ public class SymbolLayerStyleTest extends BaseStyleTest { layer = new SymbolLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("text-max-angle"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(textMaxAngle(0.3f)); assertEquals((Float) layer.getTextMaxAngle().getValue(), (Float) 0.3f); } @@ -714,13 +714,13 @@ public class SymbolLayerStyleTest extends BaseStyleTest { layer = new SymbolLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("text-rotate"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(textRotate(0.3f)); assertEquals((Float) layer.getTextRotate().getValue(), (Float) 0.3f); } @@ -736,13 +736,13 @@ public class SymbolLayerStyleTest extends BaseStyleTest { layer = new SymbolLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("text-padding"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(textPadding(0.3f)); assertEquals((Float) layer.getTextPadding().getValue(), (Float) 0.3f); } @@ -758,13 +758,13 @@ public class SymbolLayerStyleTest extends BaseStyleTest { layer = new SymbolLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("text-keep-upright"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(textKeepUpright(true)); assertEquals((Boolean) layer.getTextKeepUpright().getValue(), (Boolean) true); } @@ -780,13 +780,13 @@ public class SymbolLayerStyleTest extends BaseStyleTest { layer = new SymbolLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("text-transform"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(textTransform(TEXT_TRANSFORM_NONE)); assertEquals((String) layer.getTextTransform().getValue(), (String) TEXT_TRANSFORM_NONE); } @@ -802,13 +802,13 @@ public class SymbolLayerStyleTest extends BaseStyleTest { layer = new SymbolLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("text-offset"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(textOffset(new Float[] {0f, 0f})); assertEquals((Float[]) layer.getTextOffset().getValue(), (Float[]) new Float[] {0f, 0f}); } @@ -824,13 +824,13 @@ public class SymbolLayerStyleTest extends BaseStyleTest { layer = new SymbolLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("text-allow-overlap"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(textAllowOverlap(true)); assertEquals((Boolean) layer.getTextAllowOverlap().getValue(), (Boolean) true); } @@ -846,13 +846,13 @@ public class SymbolLayerStyleTest extends BaseStyleTest { layer = new SymbolLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("text-ignore-placement"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(textIgnorePlacement(true)); assertEquals((Boolean) layer.getTextIgnorePlacement().getValue(), (Boolean) true); } @@ -868,13 +868,13 @@ public class SymbolLayerStyleTest extends BaseStyleTest { layer = new SymbolLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("text-optional"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(textOptional(true)); assertEquals((Boolean) layer.getTextOptional().getValue(), (Boolean) true); } @@ -890,13 +890,13 @@ public class SymbolLayerStyleTest extends BaseStyleTest { layer = new SymbolLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("icon-opacity"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(iconOpacity(0.3f)); assertEquals((Float) layer.getIconOpacity().getValue(), (Float) 0.3f); } @@ -912,13 +912,13 @@ public class SymbolLayerStyleTest extends BaseStyleTest { layer = new SymbolLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("icon-color"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(iconColor("rgba(0, 0, 0, 1)")); assertEquals((String) layer.getIconColor().getValue(), (String) "rgba(0, 0, 0, 1)"); } @@ -934,13 +934,13 @@ public class SymbolLayerStyleTest extends BaseStyleTest { layer = new SymbolLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("icon-color"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(iconColor(Color.RED)); assertEquals(layer.getIconColorAsInt(), Color.RED); } @@ -956,13 +956,13 @@ public class SymbolLayerStyleTest extends BaseStyleTest { layer = new SymbolLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("icon-halo-color"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(iconHaloColor("rgba(0, 0, 0, 1)")); assertEquals((String) layer.getIconHaloColor().getValue(), (String) "rgba(0, 0, 0, 1)"); } @@ -978,13 +978,13 @@ public class SymbolLayerStyleTest extends BaseStyleTest { layer = new SymbolLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("icon-halo-color"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(iconHaloColor(Color.RED)); assertEquals(layer.getIconHaloColorAsInt(), Color.RED); } @@ -1000,13 +1000,13 @@ public class SymbolLayerStyleTest extends BaseStyleTest { layer = new SymbolLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("icon-halo-width"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(iconHaloWidth(0.3f)); assertEquals((Float) layer.getIconHaloWidth().getValue(), (Float) 0.3f); } @@ -1022,13 +1022,13 @@ public class SymbolLayerStyleTest extends BaseStyleTest { layer = new SymbolLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("icon-halo-blur"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(iconHaloBlur(0.3f)); assertEquals((Float) layer.getIconHaloBlur().getValue(), (Float) 0.3f); } @@ -1044,13 +1044,13 @@ public class SymbolLayerStyleTest extends BaseStyleTest { layer = new SymbolLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("icon-translate"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(iconTranslate(new Float[] {0f, 0f})); assertEquals((Float[]) layer.getIconTranslate().getValue(), (Float[]) new Float[] {0f, 0f}); } @@ -1066,13 +1066,13 @@ public class SymbolLayerStyleTest extends BaseStyleTest { layer = new SymbolLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("icon-translate-anchor"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(iconTranslateAnchor(ICON_TRANSLATE_ANCHOR_MAP)); assertEquals((String) layer.getIconTranslateAnchor().getValue(), (String) ICON_TRANSLATE_ANCHOR_MAP); } @@ -1088,13 +1088,13 @@ public class SymbolLayerStyleTest extends BaseStyleTest { layer = new SymbolLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("text-opacity"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(textOpacity(0.3f)); assertEquals((Float) layer.getTextOpacity().getValue(), (Float) 0.3f); } @@ -1110,13 +1110,13 @@ public class SymbolLayerStyleTest extends BaseStyleTest { layer = new SymbolLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("text-color"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(textColor("rgba(0, 0, 0, 1)")); assertEquals((String) layer.getTextColor().getValue(), (String) "rgba(0, 0, 0, 1)"); } @@ -1132,13 +1132,13 @@ public class SymbolLayerStyleTest extends BaseStyleTest { layer = new SymbolLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("text-color"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(textColor(Color.RED)); assertEquals(layer.getTextColorAsInt(), Color.RED); } @@ -1154,13 +1154,13 @@ public class SymbolLayerStyleTest extends BaseStyleTest { layer = new SymbolLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("text-halo-color"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(textHaloColor("rgba(0, 0, 0, 1)")); assertEquals((String) layer.getTextHaloColor().getValue(), (String) "rgba(0, 0, 0, 1)"); } @@ -1176,13 +1176,13 @@ public class SymbolLayerStyleTest extends BaseStyleTest { layer = new SymbolLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("text-halo-color"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(textHaloColor(Color.RED)); assertEquals(layer.getTextHaloColorAsInt(), Color.RED); } @@ -1198,13 +1198,13 @@ public class SymbolLayerStyleTest extends BaseStyleTest { layer = new SymbolLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("text-halo-width"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(textHaloWidth(0.3f)); assertEquals((Float) layer.getTextHaloWidth().getValue(), (Float) 0.3f); } @@ -1220,13 +1220,13 @@ public class SymbolLayerStyleTest extends BaseStyleTest { layer = new SymbolLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("text-halo-blur"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(textHaloBlur(0.3f)); assertEquals((Float) layer.getTextHaloBlur().getValue(), (Float) 0.3f); } @@ -1242,13 +1242,13 @@ public class SymbolLayerStyleTest extends BaseStyleTest { layer = new SymbolLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("text-translate"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(textTranslate(new Float[] {0f, 0f})); assertEquals((Float[]) layer.getTextTranslate().getValue(), (Float[]) new Float[] {0f, 0f}); } @@ -1264,13 +1264,13 @@ public class SymbolLayerStyleTest extends BaseStyleTest { layer = new SymbolLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("text-translate-anchor"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(textTranslateAnchor(TEXT_TRANSLATE_ANCHOR_MAP)); assertEquals((String) layer.getTextTranslateAnchor().getValue(), (String) TEXT_TRANSLATE_ANCHOR_MAP); } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/SymbolLayerTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/SymbolLayerTest.java index f4c50a2ffb..d9ec462656 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/SymbolLayerTest.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/SymbolLayerTest.java @@ -116,16 +116,16 @@ public class SymbolLayerTest extends BaseStyleTest { layer = new SymbolLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("visibility"); assertNotNull(layer); - //Get initial + // Get initial assertEquals(layer.getVisibility().getValue(), VISIBLE); - //Set + // Set layer.setProperties(visibility(NONE)); assertEquals(layer.getVisibility().getValue(), NONE); } @@ -141,13 +141,13 @@ public class SymbolLayerTest extends BaseStyleTest { layer = new SymbolLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("symbol-placement"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(symbolPlacement(SYMBOL_PLACEMENT_POINT)); assertEquals((String) layer.getSymbolPlacement().getValue(), (String) SYMBOL_PLACEMENT_POINT); } @@ -163,13 +163,13 @@ public class SymbolLayerTest extends BaseStyleTest { layer = new SymbolLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("symbol-spacing"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(symbolSpacing(0.3f)); assertEquals((Float) layer.getSymbolSpacing().getValue(), (Float) 0.3f); } @@ -185,13 +185,13 @@ public class SymbolLayerTest extends BaseStyleTest { layer = new SymbolLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("symbol-avoid-edges"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(symbolAvoidEdges(true)); assertEquals((Boolean) layer.getSymbolAvoidEdges().getValue(), (Boolean) true); } @@ -207,13 +207,13 @@ public class SymbolLayerTest extends BaseStyleTest { layer = new SymbolLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("icon-allow-overlap"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(iconAllowOverlap(true)); assertEquals((Boolean) layer.getIconAllowOverlap().getValue(), (Boolean) true); } @@ -229,13 +229,13 @@ public class SymbolLayerTest extends BaseStyleTest { layer = new SymbolLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("icon-ignore-placement"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(iconIgnorePlacement(true)); assertEquals((Boolean) layer.getIconIgnorePlacement().getValue(), (Boolean) true); } @@ -251,13 +251,13 @@ public class SymbolLayerTest extends BaseStyleTest { layer = new SymbolLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("icon-optional"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(iconOptional(true)); assertEquals((Boolean) layer.getIconOptional().getValue(), (Boolean) true); } @@ -273,13 +273,13 @@ public class SymbolLayerTest extends BaseStyleTest { layer = new SymbolLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("icon-rotation-alignment"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(iconRotationAlignment(ICON_ROTATION_ALIGNMENT_MAP)); assertEquals((String) layer.getIconRotationAlignment().getValue(), (String) ICON_ROTATION_ALIGNMENT_MAP); } @@ -295,13 +295,13 @@ public class SymbolLayerTest extends BaseStyleTest { layer = new SymbolLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("icon-size"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(iconSize(0.3f)); assertEquals((Float) layer.getIconSize().getValue(), (Float) 0.3f); } @@ -317,13 +317,13 @@ public class SymbolLayerTest extends BaseStyleTest { layer = new SymbolLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("icon-text-fit"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(iconTextFit(ICON_TEXT_FIT_NONE)); assertEquals((String) layer.getIconTextFit().getValue(), (String) ICON_TEXT_FIT_NONE); } @@ -339,13 +339,13 @@ public class SymbolLayerTest extends BaseStyleTest { layer = new SymbolLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("icon-text-fit-padding"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(iconTextFitPadding(new Float[] {0f, 0f, 0f, 0f})); assertEquals((Float[]) layer.getIconTextFitPadding().getValue(), (Float[]) new Float[] {0f, 0f, 0f, 0f}); } @@ -361,13 +361,13 @@ public class SymbolLayerTest extends BaseStyleTest { layer = new SymbolLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("icon-image"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(iconImage("undefined")); assertEquals((String) layer.getIconImage().getValue(), (String) "undefined"); } @@ -383,13 +383,13 @@ public class SymbolLayerTest extends BaseStyleTest { layer = new SymbolLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("icon-rotate"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(iconRotate(0.3f)); assertEquals((Float) layer.getIconRotate().getValue(), (Float) 0.3f); } @@ -405,13 +405,13 @@ public class SymbolLayerTest extends BaseStyleTest { layer = new SymbolLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("icon-padding"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(iconPadding(0.3f)); assertEquals((Float) layer.getIconPadding().getValue(), (Float) 0.3f); } @@ -427,13 +427,13 @@ public class SymbolLayerTest extends BaseStyleTest { layer = new SymbolLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("icon-keep-upright"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(iconKeepUpright(true)); assertEquals((Boolean) layer.getIconKeepUpright().getValue(), (Boolean) true); } @@ -449,13 +449,13 @@ public class SymbolLayerTest extends BaseStyleTest { layer = new SymbolLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("icon-offset"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(iconOffset(new Float[] {0f, 0f})); assertEquals((Float[]) layer.getIconOffset().getValue(), (Float[]) new Float[] {0f, 0f}); } @@ -471,13 +471,13 @@ public class SymbolLayerTest extends BaseStyleTest { layer = new SymbolLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("text-pitch-alignment"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(textPitchAlignment(TEXT_PITCH_ALIGNMENT_MAP)); assertEquals((String) layer.getTextPitchAlignment().getValue(), (String) TEXT_PITCH_ALIGNMENT_MAP); } @@ -493,13 +493,13 @@ public class SymbolLayerTest extends BaseStyleTest { layer = new SymbolLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("text-rotation-alignment"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(textRotationAlignment(TEXT_ROTATION_ALIGNMENT_MAP)); assertEquals((String) layer.getTextRotationAlignment().getValue(), (String) TEXT_ROTATION_ALIGNMENT_MAP); } @@ -515,13 +515,13 @@ public class SymbolLayerTest extends BaseStyleTest { layer = new SymbolLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("text-field"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(textField("")); assertEquals((String) layer.getTextField().getValue(), (String) ""); } @@ -537,13 +537,13 @@ public class SymbolLayerTest extends BaseStyleTest { layer = new SymbolLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("text-font"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(textFont(new String[] {"Open Sans Regular", "Arial Unicode MS Regular"})); assertEquals((String[]) layer.getTextFont().getValue(), (String[]) new String[] {"Open Sans Regular", "Arial Unicode MS Regular"}); @@ -560,13 +560,13 @@ public class SymbolLayerTest extends BaseStyleTest { layer = new SymbolLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("text-size"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(textSize(0.3f)); assertEquals((Float) layer.getTextSize().getValue(), (Float) 0.3f); } @@ -582,13 +582,13 @@ public class SymbolLayerTest extends BaseStyleTest { layer = new SymbolLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("text-max-width"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(textMaxWidth(0.3f)); assertEquals((Float) layer.getTextMaxWidth().getValue(), (Float) 0.3f); } @@ -604,13 +604,13 @@ public class SymbolLayerTest extends BaseStyleTest { layer = new SymbolLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("text-line-height"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(textLineHeight(0.3f)); assertEquals((Float) layer.getTextLineHeight().getValue(), (Float) 0.3f); } @@ -626,13 +626,13 @@ public class SymbolLayerTest extends BaseStyleTest { layer = new SymbolLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("text-letter-spacing"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(textLetterSpacing(0.3f)); assertEquals((Float) layer.getTextLetterSpacing().getValue(), (Float) 0.3f); } @@ -648,13 +648,13 @@ public class SymbolLayerTest extends BaseStyleTest { layer = new SymbolLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("text-justify"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(textJustify(TEXT_JUSTIFY_LEFT)); assertEquals((String) layer.getTextJustify().getValue(), (String) TEXT_JUSTIFY_LEFT); } @@ -670,13 +670,13 @@ public class SymbolLayerTest extends BaseStyleTest { layer = new SymbolLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("text-anchor"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(textAnchor(TEXT_ANCHOR_CENTER)); assertEquals((String) layer.getTextAnchor().getValue(), (String) TEXT_ANCHOR_CENTER); } @@ -692,13 +692,13 @@ public class SymbolLayerTest extends BaseStyleTest { layer = new SymbolLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("text-max-angle"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(textMaxAngle(0.3f)); assertEquals((Float) layer.getTextMaxAngle().getValue(), (Float) 0.3f); } @@ -714,13 +714,13 @@ public class SymbolLayerTest extends BaseStyleTest { layer = new SymbolLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("text-rotate"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(textRotate(0.3f)); assertEquals((Float) layer.getTextRotate().getValue(), (Float) 0.3f); } @@ -736,13 +736,13 @@ public class SymbolLayerTest extends BaseStyleTest { layer = new SymbolLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("text-padding"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(textPadding(0.3f)); assertEquals((Float) layer.getTextPadding().getValue(), (Float) 0.3f); } @@ -758,13 +758,13 @@ public class SymbolLayerTest extends BaseStyleTest { layer = new SymbolLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("text-keep-upright"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(textKeepUpright(true)); assertEquals((Boolean) layer.getTextKeepUpright().getValue(), (Boolean) true); } @@ -780,13 +780,13 @@ public class SymbolLayerTest extends BaseStyleTest { layer = new SymbolLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("text-transform"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(textTransform(TEXT_TRANSFORM_NONE)); assertEquals((String) layer.getTextTransform().getValue(), (String) TEXT_TRANSFORM_NONE); } @@ -802,13 +802,13 @@ public class SymbolLayerTest extends BaseStyleTest { layer = new SymbolLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("text-offset"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(textOffset(new Float[] {0f, 0f})); assertEquals((Float[]) layer.getTextOffset().getValue(), (Float[]) new Float[] {0f, 0f}); } @@ -824,13 +824,13 @@ public class SymbolLayerTest extends BaseStyleTest { layer = new SymbolLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("text-allow-overlap"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(textAllowOverlap(true)); assertEquals((Boolean) layer.getTextAllowOverlap().getValue(), (Boolean) true); } @@ -846,13 +846,13 @@ public class SymbolLayerTest extends BaseStyleTest { layer = new SymbolLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("text-ignore-placement"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(textIgnorePlacement(true)); assertEquals((Boolean) layer.getTextIgnorePlacement().getValue(), (Boolean) true); } @@ -868,13 +868,13 @@ public class SymbolLayerTest extends BaseStyleTest { layer = new SymbolLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("text-optional"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(textOptional(true)); assertEquals((Boolean) layer.getTextOptional().getValue(), (Boolean) true); } @@ -890,13 +890,13 @@ public class SymbolLayerTest extends BaseStyleTest { layer = new SymbolLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("icon-opacity"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(iconOpacity(0.3f)); assertEquals((Float) layer.getIconOpacity().getValue(), (Float) 0.3f); } @@ -912,13 +912,13 @@ public class SymbolLayerTest extends BaseStyleTest { layer = new SymbolLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("icon-color"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(iconColor("rgba(0, 0, 0, 1)")); assertEquals((String) layer.getIconColor().getValue(), (String) "rgba(0, 0, 0, 1)"); } @@ -934,13 +934,13 @@ public class SymbolLayerTest extends BaseStyleTest { layer = new SymbolLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("icon-color"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(iconColor(Color.RED)); assertEquals(layer.getIconColorAsInt(), Color.RED); } @@ -956,13 +956,13 @@ public class SymbolLayerTest extends BaseStyleTest { layer = new SymbolLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("icon-halo-color"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(iconHaloColor("rgba(0, 0, 0, 1)")); assertEquals((String) layer.getIconHaloColor().getValue(), (String) "rgba(0, 0, 0, 1)"); } @@ -978,13 +978,13 @@ public class SymbolLayerTest extends BaseStyleTest { layer = new SymbolLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("icon-halo-color"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(iconHaloColor(Color.RED)); assertEquals(layer.getIconHaloColorAsInt(), Color.RED); } @@ -1000,13 +1000,13 @@ public class SymbolLayerTest extends BaseStyleTest { layer = new SymbolLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("icon-halo-width"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(iconHaloWidth(0.3f)); assertEquals((Float) layer.getIconHaloWidth().getValue(), (Float) 0.3f); } @@ -1022,13 +1022,13 @@ public class SymbolLayerTest extends BaseStyleTest { layer = new SymbolLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("icon-halo-blur"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(iconHaloBlur(0.3f)); assertEquals((Float) layer.getIconHaloBlur().getValue(), (Float) 0.3f); } @@ -1044,13 +1044,13 @@ public class SymbolLayerTest extends BaseStyleTest { layer = new SymbolLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("icon-translate"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(iconTranslate(new Float[] {0f, 0f})); assertEquals((Float[]) layer.getIconTranslate().getValue(), (Float[]) new Float[] {0f, 0f}); } @@ -1066,13 +1066,13 @@ public class SymbolLayerTest extends BaseStyleTest { layer = new SymbolLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("icon-translate-anchor"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(iconTranslateAnchor(ICON_TRANSLATE_ANCHOR_MAP)); assertEquals((String) layer.getIconTranslateAnchor().getValue(), (String) ICON_TRANSLATE_ANCHOR_MAP); } @@ -1088,13 +1088,13 @@ public class SymbolLayerTest extends BaseStyleTest { layer = new SymbolLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("text-opacity"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(textOpacity(0.3f)); assertEquals((Float) layer.getTextOpacity().getValue(), (Float) 0.3f); } @@ -1110,13 +1110,13 @@ public class SymbolLayerTest extends BaseStyleTest { layer = new SymbolLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("text-color"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(textColor("rgba(0, 0, 0, 1)")); assertEquals((String) layer.getTextColor().getValue(), (String) "rgba(0, 0, 0, 1)"); } @@ -1132,13 +1132,13 @@ public class SymbolLayerTest extends BaseStyleTest { layer = new SymbolLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("text-color"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(textColor(Color.RED)); assertEquals(layer.getTextColorAsInt(), Color.RED); } @@ -1154,13 +1154,13 @@ public class SymbolLayerTest extends BaseStyleTest { layer = new SymbolLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("text-halo-color"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(textHaloColor("rgba(0, 0, 0, 1)")); assertEquals((String) layer.getTextHaloColor().getValue(), (String) "rgba(0, 0, 0, 1)"); } @@ -1176,13 +1176,13 @@ public class SymbolLayerTest extends BaseStyleTest { layer = new SymbolLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("text-halo-color"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(textHaloColor(Color.RED)); assertEquals(layer.getTextHaloColorAsInt(), Color.RED); } @@ -1198,13 +1198,13 @@ public class SymbolLayerTest extends BaseStyleTest { layer = new SymbolLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("text-halo-width"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(textHaloWidth(0.3f)); assertEquals((Float) layer.getTextHaloWidth().getValue(), (Float) 0.3f); } @@ -1220,13 +1220,13 @@ public class SymbolLayerTest extends BaseStyleTest { layer = new SymbolLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("text-halo-blur"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(textHaloBlur(0.3f)); assertEquals((Float) layer.getTextHaloBlur().getValue(), (Float) 0.3f); } @@ -1242,13 +1242,13 @@ public class SymbolLayerTest extends BaseStyleTest { layer = new SymbolLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("text-translate"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(textTranslate(new Float[] {0f, 0f})); assertEquals((Float[]) layer.getTextTranslate().getValue(), (Float[]) new Float[] {0f, 0f}); } @@ -1264,13 +1264,13 @@ public class SymbolLayerTest extends BaseStyleTest { layer = new SymbolLayer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } Timber.i("text-translate-anchor"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(textTranslateAnchor(TEXT_TRANSLATE_ANCHOR_MAP)); assertEquals((String) layer.getTextTranslateAnchor().getValue(), (String) TEXT_TRANSLATE_ANCHOR_MAP); } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/layer.junit.ejs b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/layer.junit.ejs index 3b81b0805b..c9afb8bdf9 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/layer.junit.ejs +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/layer.junit.ejs @@ -63,17 +63,17 @@ public class <%- camelize(type) %>LayerTest extends BaseStyleTest { layer = new <%- camelize(type) %>Layer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } <% } -%> Timber.i("visibility"); assertNotNull(layer); - //Get initial + // Get initial assertEquals(layer.getVisibility().getValue(), VISIBLE); - //Set + // Set layer.setProperties(visibility(NONE)); assertEquals(layer.getVisibility().getValue(), NONE); } @@ -94,14 +94,14 @@ public class <%- camelize(type) %>LayerTest extends BaseStyleTest { layer = new <%- camelize(type) %>Layer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } <% } -%> Timber.i("<%- property.name %>"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(<%- camelizeWithLeadingLowercase(property.name) %>(<%- defaultValueJava(property) %>)); assertEquals((<%- propertyType(property) %>) layer.get<%- camelize(property.name) %>().getValue(), (<%- propertyType(property) %>) <%- defaultValueJava(property) %>); } @@ -122,14 +122,14 @@ public class <%- camelize(type) %>LayerTest extends BaseStyleTest { layer = new <%- camelize(type) %>Layer("my-layer", "composite"); layer.setSourceLayer("composite"); mapboxMap.addLayer(layer); - //Layer reference is now stale, get new reference + // Layer reference is now stale, get new reference layer = mapboxMap.getLayerAs("my-layer"); } <% } -%> Timber.i("<%- property.name %>"); assertNotNull(layer); - //Set and Get + // Set and Get layer.setProperties(<%- camelizeWithLeadingLowercase(property.name) %>(Color.RED)); assertEquals(layer.get<%- camelize(property.name) %>AsInt(), Color.RED); } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/AndroidManifest.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/AndroidManifest.xml index 7d26233996..5c9eeee13e 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/AndroidManifest.xml +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/AndroidManifest.xml @@ -584,4 +584,4 @@ <service android:name="com.mapbox.mapboxsdk.telemetry.TelemetryService"/> </application> -</manifest>
\ No newline at end of file +</manifest> diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/FeatureOverviewActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/FeatureOverviewActivity.java index 3f95f70aef..d124dce780 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/FeatureOverviewActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/FeatureOverviewActivity.java @@ -218,4 +218,4 @@ public class FeatureOverviewActivity extends AppCompatActivity { onFeaturesLoaded(features); } } -}
\ No newline at end of file +} diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/AddRemoveMarkerActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/AddRemoveMarkerActivity.java index 5e4b4bf4d7..883ffa2b9b 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/AddRemoveMarkerActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/AddRemoveMarkerActivity.java @@ -157,4 +157,4 @@ public class AddRemoveMarkerActivity extends AppCompatActivity { super.onDestroy(); mapView.onDestroy(); } -}
\ No newline at end of file +} diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/AnimatedMarkerActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/AnimatedMarkerActivity.java index ad1306e4cd..8df7085ede 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/AnimatedMarkerActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/AnimatedMarkerActivity.java @@ -134,7 +134,7 @@ public class AnimatedMarkerActivity extends AppCompatActivity { private void randomlyMoveMarker(final MarkerView marker) { ValueAnimator animator = animateMoveMarker(marker, getLatLngInBounds()); - //Add listener to restart animation on end + // Add listener to restart animation on end animator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { @@ -162,12 +162,12 @@ public class AnimatedMarkerActivity extends AppCompatActivity { Icon icon = IconFactory.getInstance(AnimatedMarkerActivity.this) .fromResource(carResource); - //View Markers + // View Markers return mapboxMap.addMarker(new MarkerViewOptions() .position(start) .icon(icon), listener); - //GL Markers + // GL Markers // return mapboxMap.addMarker(new MarkerOptions() // .position(start) // .icon(icon)); diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/MarkerViewActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/MarkerViewActivity.java index 7975c127f0..6e02284e2a 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/MarkerViewActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/MarkerViewActivity.java @@ -44,7 +44,7 @@ public class MarkerViewActivity extends AppCompatActivity { new LatLng(38.907227, -77.036530), new LatLng(38.905607, -77.031916), new LatLng(38.889441, -77.050134), - new LatLng(38.888000, -77.050000) //Slight overlap to show re-ordering on selection + new LatLng(38.888000, -77.050000) // Slight overlap to show re-ordering on selection }; private MapboxMap mapboxMap; diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/MarkerViewsInRectangleActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/MarkerViewsInRectangleActivity.java index 9d00e82128..266db3fdd1 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/MarkerViewsInRectangleActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/MarkerViewsInRectangleActivity.java @@ -33,7 +33,7 @@ public class MarkerViewsInRectangleActivity extends AppCompatActivity implements selectionBox = findViewById(R.id.selection_box); - //Initialize map as normal + // Initialize map as normal mapView = (MapView) findViewById(R.id.mapView); mapView.onCreate(savedInstanceState); mapView.getMapAsync(this); @@ -49,14 +49,14 @@ public class MarkerViewsInRectangleActivity extends AppCompatActivity implements @Override public void onClick(View view) { - //Query + // Query int top = selectionBox.getTop() - mapView.getTop(); int left = selectionBox.getLeft() - mapView.getLeft(); RectF box = new RectF(left, top, left + selectionBox.getWidth(), top + selectionBox.getHeight()); Timber.i(String.format("Querying box %s", box)); List<MarkerView> markers = mapboxMap.getMarkerViewsInRect(box); - //Show count + // Show count Toast.makeText( MarkerViewsInRectangleActivity.this, String.format("%s markers inside box", markers.size()), diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/CameraPositionActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/CameraPositionActivity.java index 4405c4c3c6..08399f3b3e 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/CameraPositionActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/CameraPositionActivity.java @@ -190,4 +190,4 @@ public class CameraPositionActivity extends AppCompatActivity implements OnMapRe super.onProgressChanged(seekBar, progress - 180, fromUser); } } -}
\ No newline at end of file +} diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/MaxMinZoomActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/MaxMinZoomActivity.java index c2478fad66..86d5b47275 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/MaxMinZoomActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/MaxMinZoomActivity.java @@ -72,4 +72,4 @@ public class MaxMinZoomActivity extends AppCompatActivity implements OnMapReadyC super.onLowMemory(); mapView.onLowMemory(); } -}
\ No newline at end of file +} diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/ScrollByActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/ScrollByActivity.java index 2f16e862ee..df2137257a 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/ScrollByActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/ScrollByActivity.java @@ -157,4 +157,4 @@ public class ScrollByActivity extends AppCompatActivity implements OnMapReadyCal } } -}
\ No newline at end of file +} diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/espresso/EspressoTestActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/espresso/EspressoTestActivity.java index 677e09e719..0768747712 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/espresso/EspressoTestActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/espresso/EspressoTestActivity.java @@ -21,7 +21,7 @@ public class EspressoTestActivity extends AppCompatActivity implements OnMapRead super.onCreate(savedInstanceState); setContentView(R.layout.activity_camera_test); - //Initialize map as normal + // Initialize map as normal mapView = (MapView) findViewById(R.id.mapView); mapView.onCreate(savedInstanceState); mapView.getMapAsync(this); diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesBoxCountActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesBoxCountActivity.java index 5b66237d0f..c5b4c92bd5 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesBoxCountActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesBoxCountActivity.java @@ -33,7 +33,7 @@ public class QueryRenderedFeaturesBoxCountActivity extends AppCompatActivity { final View selectionBox = findViewById(R.id.selection_box); - //Initialize map as normal + // Initialize map as normal mapView = (MapView) findViewById(R.id.mapView); mapView.onCreate(savedInstanceState); mapView.getMapAsync(new OnMapReadyCallback() { @@ -44,20 +44,20 @@ public class QueryRenderedFeaturesBoxCountActivity extends AppCompatActivity { selectionBox.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { - //Query + // Query int top = selectionBox.getTop() - mapView.getTop(); int left = selectionBox.getLeft() - mapView.getLeft(); RectF box = new RectF(left, top, left + selectionBox.getWidth(), top + selectionBox.getHeight()); Timber.i(String.format("Querying box %s", box)); List<Feature> features = mapboxMap.queryRenderedFeatures(box); - //Show count + // Show count Toast.makeText( QueryRenderedFeaturesBoxCountActivity.this, String.format("%s features in box", features.size()), Toast.LENGTH_SHORT).show(); - //Debug output + // Debug output debugOutput(features); } }); diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesBoxHighlightActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesBoxHighlightActivity.java index 9e7d5e0e03..07b677a788 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesBoxHighlightActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesBoxHighlightActivity.java @@ -37,7 +37,7 @@ public class QueryRenderedFeaturesBoxHighlightActivity extends AppCompatActivity final View selectionBox = findViewById(R.id.selection_box); - //Initialize map as normal + // Initialize map as normal mapView = (MapView) findViewById(R.id.mapView); mapView.onCreate(savedInstanceState); mapView.getMapAsync(new OnMapReadyCallback() { @@ -48,28 +48,28 @@ public class QueryRenderedFeaturesBoxHighlightActivity extends AppCompatActivity selectionBox.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { - //Query + // Query int top = selectionBox.getTop() - mapView.getTop(); int left = selectionBox.getLeft() - mapView.getLeft(); RectF box = new RectF(left, top, left + selectionBox.getWidth(), top + selectionBox.getHeight()); Timber.i(String.format("Querying box %s for buildings", box)); List<Feature> features = mapboxMap.queryRenderedFeatures(box, "building"); - //Show count + // Show count Toast.makeText( QueryRenderedFeaturesBoxHighlightActivity.this, String.format("%s features in box", features.size()), Toast.LENGTH_SHORT).show(); - //remove layer / source if already added + // remove layer / source if already added try { mapboxMap.removeSource("highlighted-shapes-source"); mapboxMap.removeLayer("highlighted-shapes-layer"); } catch (Exception exception) { - //that's ok + // that's ok } - //Add layer / source + // Add layer / source mapboxMap.addSource( new GeoJsonSource("highlighted-shapes-source", FeatureCollection.fromFeatures(features)) diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesBoxSymbolCountActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesBoxSymbolCountActivity.java index 2b3655f01e..7a4c36f30d 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesBoxSymbolCountActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesBoxSymbolCountActivity.java @@ -46,7 +46,7 @@ public class QueryRenderedFeaturesBoxSymbolCountActivity extends AppCompatActivi final View selectionBox = findViewById(R.id.selection_box); - //Initialize map as normal + // Initialize map as normal mapView = (MapView) findViewById(R.id.mapView); mapView.onCreate(savedInstanceState); mapView.getMapAsync(new OnMapReadyCallback() { @@ -55,7 +55,7 @@ public class QueryRenderedFeaturesBoxSymbolCountActivity extends AppCompatActivi public void onMapReady(final MapboxMap mapboxMap) { QueryRenderedFeaturesBoxSymbolCountActivity.this.mapboxMap = mapboxMap; - //Add a symbol layer (also works with annotations) + // Add a symbol layer (also works with annotations) try { mapboxMap.addSource(new GeoJsonSource("symbols-source", readRawResource(R.raw.test_points_utrecht))); } catch (IOException ioException) { @@ -72,14 +72,14 @@ public class QueryRenderedFeaturesBoxSymbolCountActivity extends AppCompatActivi selectionBox.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { - //Query + // Query int top = selectionBox.getTop() - mapView.getTop(); int left = selectionBox.getLeft() - mapView.getLeft(); RectF box = new RectF(left, top, left + selectionBox.getWidth(), top + selectionBox.getHeight()); Timber.i(String.format("Querying box %s", box)); List<Feature> features = mapboxMap.queryRenderedFeatures(box, "symbols-layer"); - //Show count + // Show count if (toast != null) { toast.cancel(); } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesPropertiesActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesPropertiesActivity.java index 24c30c76b5..f6cf09828d 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesPropertiesActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesPropertiesActivity.java @@ -42,7 +42,7 @@ public class QueryRenderedFeaturesPropertiesActivity extends AppCompatActivity { final float density = getResources().getDisplayMetrics().density; - //Initialize map as normal + // Initialize map as normal mapView = (MapView) findViewById(R.id.mapView); mapView.onCreate(savedInstanceState); mapView.getMapAsync(new OnMapReadyCallback() { @@ -50,14 +50,14 @@ public class QueryRenderedFeaturesPropertiesActivity extends AppCompatActivity { public void onMapReady(final MapboxMap mapboxMap) { QueryRenderedFeaturesPropertiesActivity.this.mapboxMap = mapboxMap; - //Add custom window adapter + // Add custom window adapter addCustomInfoWindowAdapter(mapboxMap); - //Add a click listener + // Add a click listener mapboxMap.setOnMapClickListener(new MapboxMap.OnMapClickListener() { @Override public void onMapClick(@NonNull LatLng point) { - //Query + // Query final PointF pixel = mapboxMap.getProjection().toScreenLocation(point); Timber.i(String.format( "Requesting features for %sx%s (%sx%s adjusted for density)", @@ -65,15 +65,15 @@ public class QueryRenderedFeaturesPropertiesActivity extends AppCompatActivity { ); List<Feature> features = mapboxMap.queryRenderedFeatures(pixel); - //Debug output + // Debug output debugOutput(features); - //Remove any previous markers + // Remove any previous markers if (marker != null) { mapboxMap.removeMarker(marker); } - //Add a marker on the clicked point + // Add a marker on the clicked point marker = mapboxMap.addMarker(new CustomMarkerOptions().position(point).features(features)); mapboxMap.selectMarker(marker); } @@ -205,7 +205,7 @@ public class QueryRenderedFeaturesPropertiesActivity extends AppCompatActivity { } private CustomMarkerOptions(Parcel in) { - //Should implement this + // Should implement this } @Override @@ -236,7 +236,7 @@ public class QueryRenderedFeaturesPropertiesActivity extends AppCompatActivity { @Override public void writeToParcel(Parcel out, int flags) { - //Should implement this + // Should implement this } } } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/infowindow/DynamicInfoWindowAdapterActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/infowindow/DynamicInfoWindowAdapterActivity.java index 15749cbd19..5da7a3047b 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/infowindow/DynamicInfoWindowAdapterActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/infowindow/DynamicInfoWindowAdapterActivity.java @@ -48,38 +48,38 @@ public class DynamicInfoWindowAdapterActivity extends AppCompatActivity implemen mapboxMap = map; - //Add info window adapter + // Add info window adapter addCustomInfoWindowAdapter(mapboxMap); - //Keep info windows open on click + // Keep info windows open on click mapboxMap.getUiSettings().setDeselectMarkersOnTap(false); - //Add a marker + // Add a marker final MarkerView marker = addMarker(mapboxMap); mapboxMap.selectMarker(marker); - //On map click, change the info window contents + // On map click, change the info window contents mapboxMap.setOnMapClickListener(new MapboxMap.OnMapClickListener() { @Override public void onMapClick(@NonNull LatLng point) { - //Distance from click to marker + // Distance from click to marker double distanceKm = marker.getPosition().distanceTo(point) / 1000; - //Get the info window + // Get the info window InfoWindow infoWindow = marker.getInfoWindow(); - //Get the view from the info window + // Get the view from the info window if (infoWindow != null && infoWindow.getView() != null) { - //Set the new text on the text view in the info window + // Set the new text on the text view in the info window ((TextView) infoWindow.getView()).setText(String.format("%.2fkm", distanceKm)); - //Update the info window position (as the text length changes) + // Update the info window position (as the text length changes) infoWindow.update(); } } }); - //Focus on Paris + // Focus on Paris mapboxMap.animateCamera(CameraUpdateFactory.newLatLng(paris)); } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/DoubleMapActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/DoubleMapActivity.java index fef2ebaff7..7ec9cb9242 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/DoubleMapActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/DoubleMapActivity.java @@ -177,4 +177,4 @@ public class DoubleMapActivity extends AppCompatActivity { mapViewMini.onSaveInstanceState(outState); } } -}
\ No newline at end of file +} diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/MapInDialogActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/MapInDialogActivity.java index d54a7fe509..0ff5a9daf3 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/MapInDialogActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/MapInDialogActivity.java @@ -101,4 +101,4 @@ public class MapInDialogActivity extends AppCompatActivity { mapView.onSaveInstanceState(outState); } } -}
\ No newline at end of file +} diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/offline/OfflineActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/offline/OfflineActivity.java index 65c84e516f..c2b0cb0769 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/offline/OfflineActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/offline/OfflineActivity.java @@ -67,7 +67,7 @@ public class OfflineActivity extends AppCompatActivity // You can use Mapbox.setConnected(Boolean) to manually set the connectivity // state of your app. This will override any checks performed via the ConnectivityManager. - //Mapbox.getInstance().setConnected(false); + // Mapbox.getInstance().setConnected(false); Boolean connected = Mapbox.isConnected(); Timber.d(String.format(MapboxConstants.MAPBOX_LOCALE, "Mapbox is connected: %b", connected)); diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/CircleLayerActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/CircleLayerActivity.java index 3b3b6a06ce..8cc777e8e8 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/CircleLayerActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/CircleLayerActivity.java @@ -143,4 +143,4 @@ public class CircleLayerActivity extends AppCompatActivity { super.onDestroy(); mapView.onDestroy(); } -}
\ No newline at end of file +} diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/CustomSpriteActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/CustomSpriteActivity.java index 1e9afe4cf0..bcf2fd822c 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/CustomSpriteActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/CustomSpriteActivity.java @@ -61,7 +61,7 @@ public class CustomSpriteActivity extends AppCompatActivity { // Add an icon to reference later mapboxMap.addImage(CUSTOM_ICON, BitmapFactory.decodeResource(getResources(), R.drawable.ic_car_top)); - //Add a source with a geojson point + // Add a source with a geojson point point = Point.fromCoordinates(Position.fromCoordinates(13.400972d, 52.519003d)); source = new GeoJsonSource( "point", @@ -69,10 +69,10 @@ public class CustomSpriteActivity extends AppCompatActivity { ); mapboxMap.addSource(source); - //Add a symbol layer that references that point source + // Add a symbol layer that references that point source layer = new SymbolLayer("layer", "point"); layer.setProperties( - //Set the id of the sprite to use + // Set the id of the sprite to use iconImage(CUSTOM_ICON) ); @@ -81,14 +81,14 @@ public class CustomSpriteActivity extends AppCompatActivity { fab.setImageResource(R.drawable.ic_directions_car_black_24dp); } else { - //Update point + // Update point point = Point.fromCoordinates( Position.fromCoordinates(point.getCoordinates().getLongitude() + 0.001, point.getCoordinates().getLatitude() + 0.001) ); source.setGeoJson(FeatureCollection.fromFeatures(new Feature[] {Feature.fromGeometry(point)})); - //Move the camera as well + // Move the camera as well mapboxMap.moveCamera(CameraUpdateFactory.newLatLng(new LatLng( point.getCoordinates().getLatitude(), point.getCoordinates().getLongitude()))); } @@ -139,4 +139,4 @@ public class CustomSpriteActivity extends AppCompatActivity { super.onDestroy(); mapView.onDestroy(); } -}
\ No newline at end of file +} diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/GeoJsonClusteringActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/GeoJsonClusteringActivity.java index 6cc7a69d3f..d70898d7c6 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/GeoJsonClusteringActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/GeoJsonClusteringActivity.java @@ -45,9 +45,9 @@ public class GeoJsonClusteringActivity extends AppCompatActivity { super.onCreate(savedInstanceState); setContentView(R.layout.activity_geojson_clustering); - //Initialize map as normal + // Initialize map as normal mapView = (MapView) findViewById(R.id.mapView); - //noinspection ConstantConditions + // noinspection ConstantConditions mapView.onCreate(savedInstanceState); mapView.getMapAsync(new OnMapReadyCallback() { @@ -56,7 +56,7 @@ public class GeoJsonClusteringActivity extends AppCompatActivity { mapboxMap = map; mapboxMap.animateCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(37.7749, 122.4194), 0)); - //Add a clustered source with some layers + // Add a clustered source with some layers addClusteredGeoJsonSource(); } }); @@ -116,7 +116,7 @@ public class GeoJsonClusteringActivity extends AppCompatActivity { } private void addClusteredGeoJsonSource() { - //Add a clustered source + // Add a clustered source try { mapboxMap.addSource( new GeoJsonSource("earthquakes", @@ -131,7 +131,7 @@ public class GeoJsonClusteringActivity extends AppCompatActivity { Timber.e("That's not an url... " + malformedUrlException.getMessage()); } - //Add unclustered layer + // Add unclustered layer int[][] layers = new int[][] { new int[] {150, ResourcesCompat.getColor(getResources(), R.color.redAccent, getTheme())}, new int[] {20, ResourcesCompat.getColor(getResources(), R.color.greenAccent, getTheme())}, @@ -143,7 +143,7 @@ public class GeoJsonClusteringActivity extends AppCompatActivity { mapboxMap.addLayer(unclustered); for (int i = 0; i < layers.length; i++) { - //Add some nice circles + // Add some nice circles CircleLayer circles = new CircleLayer("cluster-" + i, "earthquakes"); circles.setProperties( circleColor(layers[i][1]), @@ -157,7 +157,7 @@ public class GeoJsonClusteringActivity extends AppCompatActivity { mapboxMap.addLayer(circles); } - //Add the count labels + // Add the count labels SymbolLayer count = new SymbolLayer("count", "earthquakes"); count.setProperties( textField("{point_count}"), @@ -167,7 +167,7 @@ public class GeoJsonClusteringActivity extends AppCompatActivity { mapboxMap.addLayer(count); - //Zoom out to start + // Zoom out to start mapboxMap.animateCamera(CameraUpdateFactory.zoomTo(1)); } } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/RuntimeStyleActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/RuntimeStyleActivity.java index b84c78a578..f49cf9a8bf 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/RuntimeStyleActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/RuntimeStyleActivity.java @@ -81,7 +81,7 @@ public class RuntimeStyleActivity extends AppCompatActivity { super.onCreate(savedInstanceState); setContentView(R.layout.activity_runtime_style); - //Initialize map as normal + // Initialize map as normal mapView = (MapView) findViewById(R.id.mapView); mapView.onCreate(savedInstanceState); @@ -89,10 +89,10 @@ public class RuntimeStyleActivity extends AppCompatActivity { mapView.getMapAsync(new OnMapReadyCallback() { @Override public void onMapReady(MapboxMap map) { - //Store for later + // Store for later mapboxMap = map; - //Center and Zoom (Amsterdam, zoomed to streets) + // Center and Zoom (Amsterdam, zoomed to streets) mapboxMap.animateCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(52.379189, 4.899431), 14)); } }); @@ -207,7 +207,7 @@ public class RuntimeStyleActivity extends AppCompatActivity { } private void setRoadSymbolPlacement() { - //Zoom so that the labels are visible first + // Zoom so that the labels are visible first mapboxMap.animateCamera(CameraUpdateFactory.zoomTo(14), new DefaultCallback() { @Override public void onFinish() { @@ -244,7 +244,7 @@ public class RuntimeStyleActivity extends AppCompatActivity { } private void removeBuildings() { - //Zoom to see buildings first + // Zoom to see buildings first try { mapboxMap.removeLayer("building"); } catch (NoSuchLayerException noSuchLayerException) { @@ -253,7 +253,7 @@ public class RuntimeStyleActivity extends AppCompatActivity { } private void addParksLayer() { - //Add a source + // Add a source Source source; try { source = new GeoJsonSource("amsterdam-spots", readRawResource(R.raw.amsterdam)); @@ -275,18 +275,18 @@ public class RuntimeStyleActivity extends AppCompatActivity { fillAntialias(true) ); - //Only show me parks (except westerpark with stroke-width == 3) + // Only show me parks (except westerpark with stroke-width == 3) layer.setFilter(all(eq("type", "park"), eq("stroke-width", 2))); mapboxMap.addLayer(layer, "building"); - //layer.setPaintProperty(fillColor(Color.RED)); //XXX But not after the object is attached + // layer.setPaintProperty(fillColor(Color.RED)); // XXX But not after the object is attached - //Or get the object later and set it. It's all good. + // Or get the object later and set it. It's all good. mapboxMap.getLayer("parksLayer").setProperties(fillColor(Color.RED)); - //You can get a typed layer, if you're sure it's of that type. Use with care + // You can get a typed layer, if you're sure it's of that type. Use with care layer = mapboxMap.getLayerAs("parksLayer"); - //And get some properties + // And get some properties PropertyValue<Boolean> fillAntialias = layer.getFillAntialias(); Timber.d("Fill anti alias: " + fillAntialias.getValue()); layer.setProperties(fillTranslateAnchor(FILL_TRANSLATE_ANCHOR_MAP)); @@ -295,12 +295,12 @@ public class RuntimeStyleActivity extends AppCompatActivity { PropertyValue<String> visibility = layer.getVisibility(); Timber.d("Visibility: " + visibility.getValue()); - //Get a good look at it all + // Get a good look at it all mapboxMap.animateCamera(CameraUpdateFactory.zoomTo(12)); } private void addDynamicParksLayer() { - //Load some data + // Load some data FeatureCollection parks; try { String json = readRawResource(R.raw.amsterdam); @@ -314,7 +314,7 @@ public class RuntimeStyleActivity extends AppCompatActivity { return; } - //Add an empty source + // Add an empty source mapboxMap.addSource(new GeoJsonSource("dynamic-park-source")); FillLayer layer = new FillLayer("dynamic-parks-layer", "dynamic-park-source"); @@ -325,15 +325,15 @@ public class RuntimeStyleActivity extends AppCompatActivity { fillAntialias(true) ); - //Only show me parks + // Only show me parks layer.setFilter(all(eq("type", "park"))); mapboxMap.addLayer(layer); - //Get a good look at it all + // Get a good look at it all mapboxMap.animateCamera(CameraUpdateFactory.zoomTo(12)); - //Animate the parks source + // Animate the parks source animateParksSource(parks, 0); } @@ -347,7 +347,7 @@ public class RuntimeStyleActivity extends AppCompatActivity { } Timber.d("Updating parks source"); - //change the source + // change the source int park = counter < parks.getFeatures().size() - 1 ? counter : 0; GeoJsonSource source = mapboxMap.getSourceAs("dynamic-park-source"); @@ -362,14 +362,14 @@ public class RuntimeStyleActivity extends AppCompatActivity { features.add(parks.getFeatures().get(park)); source.setGeoJson(FeatureCollection.fromFeatures(features)); - //Re-post + // Re-post animateParksSource(parks, park + 1); } }, counter == 0 ? 100 : 1000); } private void addTerrainLayer() { - //Add a source + // Add a source Source source = new VectorSource("my-terrain-source", "mapbox://mapbox.mapbox-terrain-v2"); mapboxMap.addSource(source); @@ -384,10 +384,10 @@ public class RuntimeStyleActivity extends AppCompatActivity { mapboxMap.addLayer(layer); - //Need to get a fresh handle + // Need to get a fresh handle layer = mapboxMap.getLayerAs("terrainLayer"); - //Make sure it's also applied after the fact + // Make sure it's also applied after the fact layer.setMinZoom(10); layer.setMaxZoom(15); @@ -397,11 +397,11 @@ public class RuntimeStyleActivity extends AppCompatActivity { } private void addSatelliteLayer() { - //Add a source + // Add a source Source source = new RasterSource("my-raster-source", "mapbox://mapbox.satellite", 512); mapboxMap.addSource(source); - //Add a layer + // Add a layer mapboxMap.addLayer(new RasterLayer("satellite-layer", "my-raster-source")); } @@ -411,7 +411,7 @@ public class RuntimeStyleActivity extends AppCompatActivity { return; } - //Set a zoom function to update the color of the water + // Set a zoom function to update the color of the water layer.setProperties(fillColor(zoom(0.8f, stop(1, fillColor(Color.GREEN)), stop(4, fillColor(Color.BLUE)), @@ -419,7 +419,7 @@ public class RuntimeStyleActivity extends AppCompatActivity { stop(20, fillColor(Color.BLACK)) ))); - //do some animations to show it off properly + // do some animations to show it off properly mapboxMap.animateCamera(CameraUpdateFactory.zoomTo(1), 1500); PropertyValue<String> fillColor = layer.getFillColor(); @@ -453,11 +453,11 @@ public class RuntimeStyleActivity extends AppCompatActivity { } private void addCustomTileSource() { - //Add a source + // Add a source Source source = new VectorSource("custom-tile-source", new TileSet("2.1.0", "https://vector.mapzen.com/osm/all/{z}/{x}/{y}.mvt?api_key=vector-tiles-LM25tq4")); mapboxMap.addSource(source); - //Add a layer + // Add a layer mapboxMap.addLayer( new FillLayer("custom-tile-layers", "custom-tile-source") .withSourceLayer("water") @@ -559,12 +559,12 @@ public class RuntimeStyleActivity extends AppCompatActivity { @Override public void onCancel() { - //noop + // noop } @Override public void onFinish() { - //noop + // noop } } } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/RuntimeStyleTestActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/RuntimeStyleTestActivity.java index 1d242359bc..d3733210ca 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/RuntimeStyleTestActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/RuntimeStyleTestActivity.java @@ -21,7 +21,7 @@ public class RuntimeStyleTestActivity extends AppCompatActivity { super.onCreate(savedInstanceState); setContentView(R.layout.activity_runtime_style); - //Initialize map as normal + // Initialize map as normal mapView = (MapView) findViewById(R.id.mapView); mapView.onCreate(savedInstanceState); mapView.getMapAsync(new OnMapReadyCallback() { diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/RuntimeStyleTimingTestActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/RuntimeStyleTimingTestActivity.java index c57bc0069a..5057578731 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/RuntimeStyleTimingTestActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/RuntimeStyleTimingTestActivity.java @@ -29,7 +29,7 @@ public class RuntimeStyleTimingTestActivity extends AppCompatActivity { super.onCreate(savedInstanceState); setContentView(R.layout.activity_runtime_style); - //Initialize map as normal + // Initialize map as normal mapView = (MapView) findViewById(R.id.mapView); mapView.onCreate(savedInstanceState); mapView.getMapAsync(new OnMapReadyCallback() { diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/StyleFileActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/StyleFileActivity.java index da9fe87f32..9c426cdc6c 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/StyleFileActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/StyleFileActivity.java @@ -81,7 +81,7 @@ public class StyleFileActivity extends AppCompatActivity { } protected void onPostExecute(Long result) { - //Actual file:// usage + // Actual file:// usage mapboxMap.setStyleUrl("file://" + cacheStyleFile.getAbsolutePath()); } @@ -156,4 +156,4 @@ public class StyleFileActivity extends AppCompatActivity { super.onDestroy(); mapView.onDestroy(); } -}
\ No newline at end of file +} diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/SymbolLayerActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/SymbolLayerActivity.java index 33758d3f15..4b7ec2a5bf 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/SymbolLayerActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/SymbolLayerActivity.java @@ -56,21 +56,21 @@ public class SymbolLayerActivity extends AppCompatActivity implements MapboxMap. public void onMapReady(@NonNull final MapboxMap map) { mapboxMap = map; - //Add a image for the makers + // Add a image for the makers mapboxMap.addImage( "my-marker-image", BitmapFactory.decodeResource(SymbolLayerActivity.this.getResources(), R.drawable.mapbox_marker_icon_default) ); - //Add a source + // Add a source FeatureCollection markers = FeatureCollection.fromFeatures(new Feature[] { Feature.fromGeometry(Point.fromCoordinates(new double[] {4.91638, 52.35673}), featureProperties("Marker 1")), Feature.fromGeometry(Point.fromCoordinates(new double[] {4.91638, 52.34673}), featureProperties("Marker 2")) }); mapboxMap.addSource(new GeoJsonSource(MARKER_SOURCE, markers)); - //Add the symbol-layer + // Add the symbol-layer mapboxMap.addLayer( new SymbolLayer(MARKER_LAYER, MARKER_SOURCE) .withProperties( @@ -82,10 +82,10 @@ public class SymbolLayerActivity extends AppCompatActivity implements MapboxMap. ) ); - //Show + // Show mapboxMap.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(52.35273, 4.91638), 14)); - //Set a click-listener so we can manipulate the map + // Set a click-listener so we can manipulate the map mapboxMap.setOnMapClickListener(SymbolLayerActivity.this); } }); @@ -93,13 +93,13 @@ public class SymbolLayerActivity extends AppCompatActivity implements MapboxMap. @Override public void onMapClick(@NonNull LatLng point) { - //Query which features are clicked + // Query which features are clicked PointF screenLoc = mapboxMap.getProjection().toScreenLocation(point); List<Feature> features = mapboxMap.queryRenderedFeatures(screenLoc, MARKER_LAYER); SymbolLayer layer = mapboxMap.getLayerAs(MARKER_LAYER); if (features.size() == 0) { - //Reset + // Reset layer.setProperties(iconSize(1f)); } else { layer.setProperties(iconSize(3f)); @@ -197,4 +197,4 @@ public class SymbolLayerActivity extends AppCompatActivity implements MapboxMap. return super.onOptionsItemSelected(item); } } -}
\ No newline at end of file +} diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/adapter/FeatureAdapter.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/adapter/FeatureAdapter.java index a935c2134f..49d17dc051 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/adapter/FeatureAdapter.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/adapter/FeatureAdapter.java @@ -52,4 +52,4 @@ public class FeatureAdapter extends RecyclerView.Adapter<FeatureAdapter.ViewHold public int getItemCount() { return features.size(); } -}
\ No newline at end of file +} diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/adapter/FeatureSectionAdapter.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/adapter/FeatureSectionAdapter.java index 48da0f47e9..1d89f89f08 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/adapter/FeatureSectionAdapter.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/adapter/FeatureSectionAdapter.java @@ -177,4 +177,4 @@ public class FeatureSectionAdapter extends RecyclerView.Adapter<RecyclerView.Vie return (valid ? adapter.getItemCount() + sections.size() : 0); } -}
\ No newline at end of file +} diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/annotations/CityStateMarker.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/annotations/CityStateMarker.java index 3b9f67aa1e..15b2f0b127 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/annotations/CityStateMarker.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/annotations/CityStateMarker.java @@ -15,4 +15,4 @@ public class CityStateMarker extends Marker { return infoWindowBackgroundColor; } -}
\ No newline at end of file +} diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/annotations/CountryMarker.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/annotations/CountryMarker.java index af97c9df69..6b172ef83f 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/annotations/CountryMarker.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/annotations/CountryMarker.java @@ -21,4 +21,4 @@ public class CountryMarker extends Marker { public int getFlagRes() { return flagRes; } -}
\ No newline at end of file +} diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/annotations/CountryMarkerViewOptions.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/annotations/CountryMarkerViewOptions.java index 4dc9195ffd..6602054f47 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/annotations/CountryMarkerViewOptions.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/annotations/CountryMarkerViewOptions.java @@ -96,4 +96,4 @@ public class CountryMarkerViewOptions extends BaseMarkerViewOptions<CountryMarke return new CountryMarkerViewOptions[size]; } }; -}
\ No newline at end of file +} diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/annotations/PulseMarkerView.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/annotations/PulseMarkerView.java index 971c3359b2..b01c9907e0 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/annotations/PulseMarkerView.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/annotations/PulseMarkerView.java @@ -8,4 +8,4 @@ public class PulseMarkerView extends MarkerView { public PulseMarkerView(BaseMarkerViewOptions baseMarkerViewOptions) { super(baseMarkerViewOptions); } -}
\ No newline at end of file +} diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/annotations/PulseMarkerViewOptions.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/annotations/PulseMarkerViewOptions.java index 20c479fc9b..d9c6357774 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/annotations/PulseMarkerViewOptions.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/annotations/PulseMarkerViewOptions.java @@ -76,4 +76,4 @@ public class PulseMarkerViewOptions extends BaseMarkerViewOptions<PulseMarkerVie return new CountryMarkerViewOptions[size]; } }; -}
\ No newline at end of file +} diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/annotations/TextMarkerView.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/annotations/TextMarkerView.java index f507c5f1ab..dcee5c2409 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/annotations/TextMarkerView.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/annotations/TextMarkerView.java @@ -15,4 +15,4 @@ public class TextMarkerView extends MarkerView { public String getText() { return text; } -}
\ No newline at end of file +} diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/utils/FontCache.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/utils/FontCache.java index e2271bd5ff..10ecf43bd3 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/utils/FontCache.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/utils/FontCache.java @@ -23,4 +23,4 @@ public class FontCache { } return tf; } -}
\ No newline at end of file +} diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/utils/ItemClickSupport.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/utils/ItemClickSupport.java index 414a781544..0939181ef4 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/utils/ItemClickSupport.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/utils/ItemClickSupport.java @@ -92,4 +92,4 @@ public class ItemClickSupport { boolean onItemLongClicked(RecyclerView recyclerView, int position, View view); } -}
\ No newline at end of file +} diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/utils/TimingLogger.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/utils/TimingLogger.java index e096aa202d..6f20d6fb0f 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/utils/TimingLogger.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/utils/TimingLogger.java @@ -106,7 +106,7 @@ public class TimingLogger { * dumpToLog call will do nothing. */ public void reset() { - disabled = false; //!Log.isLoggable(tag, Log.VERBOSE); + disabled = false; // !Log.isLoggable(tag, Log.VERBOSE); if (disabled) { return; } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/anim/pulse.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/anim/pulse.xml index 40bc57ab68..92440b6b9e 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/anim/pulse.xml +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/anim/pulse.xml @@ -21,4 +21,4 @@ android:repeatMode="restart" android:toAlpha="0.0"/> </set> -</set>
\ No newline at end of file +</set> diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/animator/rotate_360.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/animator/rotate_360.xml index e3569966d2..5bfa6ad72f 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/animator/rotate_360.xml +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/animator/rotate_360.xml @@ -5,4 +5,4 @@ android:valueFrom="0" android:valueTo="360" android:valueType="floatType"/> -</set>
\ No newline at end of file +</set> diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/animator/scale_down.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/animator/scale_down.xml index d1067b09c2..f450edb1fb 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/animator/scale_down.xml +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/animator/scale_down.xml @@ -8,4 +8,4 @@ android:propertyName="scaleY" android:duration="300" android:valueTo="1"/> -</set>
\ No newline at end of file +</set> diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/animator/scale_up.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/animator/scale_up.xml index b43ed05513..f8da05f35e 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/animator/scale_up.xml +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/animator/scale_up.xml @@ -8,4 +8,4 @@ android:propertyName="scaleY" android:duration="300" android:valueTo="2"/> -</set>
\ No newline at end of file +</set> diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/drawable/ic_circle.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/drawable/ic_circle.xml index 006b2ce5a8..3217661b64 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/drawable/ic_circle.xml +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/drawable/ic_circle.xml @@ -9,4 +9,4 @@ <size android:width="@dimen/circle_size" android:height="@dimen/circle_size"/> -</shape>
\ No newline at end of file +</shape> diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/drawable/line_divider.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/drawable/line_divider.xml index 28258bdddc..c301b9b6f4 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/drawable/line_divider.xml +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/drawable/line_divider.xml @@ -9,4 +9,4 @@ <solid android:color="@android:color/darker_gray"/> -</shape>
\ No newline at end of file +</shape> diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_add_remove_marker.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_add_remove_marker.xml index c52512195c..6da5a61ecb 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_add_remove_marker.xml +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_add_remove_marker.xml @@ -10,4 +10,4 @@ android:layout_width="match_parent" android:layout_height="match_parent"/> -</LinearLayout>
\ No newline at end of file +</LinearLayout> diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_dynamic_marker.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_dynamic_marker.xml index 76c6988194..e119d3cf7c 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_dynamic_marker.xml +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_dynamic_marker.xml @@ -26,4 +26,4 @@ android:src="@drawable/ic_animate_coordinates" app:backgroundTint="@color/white"/> -</android.support.design.widget.CoordinatorLayout>
\ No newline at end of file +</android.support.design.widget.CoordinatorLayout> diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_feature_overview.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_feature_overview.xml index f917189a70..28b23b633d 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_feature_overview.xml +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_feature_overview.xml @@ -11,4 +11,4 @@ android:layout_height="match_parent" android:scrollbars="vertical"/> -</LinearLayout>
\ No newline at end of file +</LinearLayout> diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_map_in_dialog.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_map_in_dialog.xml index 68c3c1ce5a..3fd66977e2 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_map_in_dialog.xml +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_map_in_dialog.xml @@ -11,4 +11,4 @@ android:layout_gravity="center" android:text="@string/button_open_dialog"/> -</FrameLayout>
\ No newline at end of file +</FrameLayout> diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_metadata_update.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_metadata_update.xml index 9e7715180c..084675fb2c 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_metadata_update.xml +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_metadata_update.xml @@ -18,4 +18,4 @@ android:text="No Results" android:textSize="24sp"/> -</LinearLayout>
\ No newline at end of file +</LinearLayout> diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_multi_map.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_multi_map.xml index f1a690bc84..0b3fd9acdf 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_multi_map.xml +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_multi_map.xml @@ -70,4 +70,4 @@ mapbox:style_url="mapbox://styles/mapbox/dark-v9" mapbox:zoom="15"/> </LinearLayout> -</LinearLayout>
\ No newline at end of file +</LinearLayout> diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_my_location_dot_color.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_my_location_dot_color.xml index 7cd6bd451c..de18e265de 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_my_location_dot_color.xml +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_my_location_dot_color.xml @@ -59,4 +59,4 @@ </LinearLayout> -</RelativeLayout>
\ No newline at end of file +</RelativeLayout> diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_navigation_drawer.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_navigation_drawer.xml index 2bf08fbdc1..26a71bc568 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_navigation_drawer.xml +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_navigation_drawer.xml @@ -30,4 +30,4 @@ android:layout_gravity="start" android:fitsSystemWindows="true" /> -</android.support.v4.widget.DrawerLayout>
\ No newline at end of file +</android.support.v4.widget.DrawerLayout> diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_video_view.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_video_view.xml index b640f9f878..66e4065e5d 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_video_view.xml +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_video_view.xml @@ -34,4 +34,4 @@ mapbox:mapbox_styleUrl="mapbox://styles/mapbox/streets-v9" mapbox:mapbox_cameraZoom="13" /> -</RelativeLayout>
\ No newline at end of file +</RelativeLayout> diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_viewpager.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_viewpager.xml index d2ccda3229..d931cb3643 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_viewpager.xml +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_viewpager.xml @@ -19,4 +19,4 @@ </android.support.v4.view.ViewPager> -</RelativeLayout>
\ No newline at end of file +</RelativeLayout> diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/dialog_camera_position.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/dialog_camera_position.xml index c1ffa7d203..1c9fbbd482 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/dialog_camera_position.xml +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/dialog_camera_position.xml @@ -199,4 +199,4 @@ </RelativeLayout> -</LinearLayout>
\ No newline at end of file +</LinearLayout> diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/fragment_dialog_map.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/fragment_dialog_map.xml index b40ad1273d..8241d0264f 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/fragment_dialog_map.xml +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/fragment_dialog_map.xml @@ -15,4 +15,4 @@ mapbox:mapbox_renderTextureMode="true" mapbox:mapbox_styleUrl="mapbox://styles/mapbox/streets-v9" /> -</LinearLayout>
\ No newline at end of file +</LinearLayout> diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/item_main_feature.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/item_main_feature.xml index d2c493b2e2..b290d013f0 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/item_main_feature.xml +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/item_main_feature.xml @@ -33,4 +33,4 @@ android:textColor="@android:color/black" android:textSize="14sp"/> -</LinearLayout>
\ No newline at end of file +</LinearLayout> diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/section_main_layout.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/section_main_layout.xml index d1e1cb7b54..75f6ac9588 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/section_main_layout.xml +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/section_main_layout.xml @@ -25,4 +25,4 @@ android:textColor="@android:color/black" android:textSize="14sp"/> -</RelativeLayout>
\ No newline at end of file +</RelativeLayout> diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/view_custom_marker.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/view_custom_marker.xml index 98050c061f..c2bbdae775 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/view_custom_marker.xml +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/view_custom_marker.xml @@ -18,4 +18,4 @@ android:layout_centerHorizontal="true" android:padding="2dp"/> -</RelativeLayout>
\ No newline at end of file +</RelativeLayout> diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/view_pulse_marker.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/view_pulse_marker.xml index e1ac50b440..1bb9134764 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/view_pulse_marker.xml +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/view_pulse_marker.xml @@ -18,4 +18,4 @@ android:alpha="0.5" android:src="@drawable/ic_circle"/> -</FrameLayout>
\ No newline at end of file +</FrameLayout> diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/view_text_marker.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/view_text_marker.xml index a13b830067..299865be9e 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/view_text_marker.xml +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/view_text_marker.xml @@ -13,4 +13,4 @@ android:padding="4dp" android:layout_centerInParent="true" /> -</RelativeLayout>
\ No newline at end of file +</RelativeLayout> diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/menu/menu_bulk_marker.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/menu/menu_bulk_marker.xml index ca3850a65d..8b7245c5ca 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/menu/menu_bulk_marker.xml +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/menu/menu_bulk_marker.xml @@ -6,4 +6,4 @@ android:title="Amount of markers" app:actionViewClass="android.widget.Spinner" app:showAsAction="always"/> -</menu>
\ No newline at end of file +</menu> diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/menu/menu_custom_layer.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/menu/menu_custom_layer.xml index ec1f756333..4639dd65ba 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/menu/menu_custom_layer.xml +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/menu/menu_custom_layer.xml @@ -14,4 +14,4 @@ <item android:id="@+id/action_set_color_blue" android:title="Blue" /> -</menu>
\ No newline at end of file +</menu> diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/menu/menu_infowindow.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/menu/menu_infowindow.xml index adca8d2e00..3dc705dbb9 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/menu/menu_infowindow.xml +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/menu/menu_infowindow.xml @@ -16,4 +16,4 @@ android:checked="true"/> </group> -</menu>
\ No newline at end of file +</menu> diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/menu/menu_padding.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/menu/menu_padding.xml index 0db887c4e7..e0052d4a8c 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/menu/menu_padding.xml +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/menu/menu_padding.xml @@ -9,4 +9,4 @@ android:id="@+id/action_bangalore" android:title="Bangalore" mapbox:showAsAction="never" /> -</menu>
\ No newline at end of file +</menu> diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/menu/menu_polygon.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/menu/menu_polygon.xml index 62d4c83594..a7fdf56be5 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/menu/menu_polygon.xml +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/menu/menu_polygon.xml @@ -17,4 +17,4 @@ android:id="@+id/action_id_color" android:title="@string/action_color_polygon" mapbox:showAsAction="never" /> -</menu>
\ No newline at end of file +</menu> diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/menu/menu_polyline.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/menu/menu_polyline.xml index 7c324fc9dc..3dd109a7c1 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/menu/menu_polyline.xml +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/menu/menu_polyline.xml @@ -22,4 +22,4 @@ android:id="@+id/action_id_visible" android:title="@string/action_visibility_polygon" mapbox:showAsAction="never" /> -</menu>
\ No newline at end of file +</menu> diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/menu/menu_runtime_style.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/menu/menu_runtime_style.xml index 18f09db82a..7f49dc7ba4 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/menu/menu_runtime_style.xml +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/menu/menu_runtime_style.xml @@ -58,4 +58,4 @@ android:id="@+id/action_numeric_filter" android:title="Apply numeric fill filter" mapbox:showAsAction="never" /> -</menu>
\ No newline at end of file +</menu> diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/menu/menu_symbol_layer.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/menu/menu_symbol_layer.xml index e6fd1fce45..77468b4861 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/menu/menu_symbol_layer.xml +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/menu/menu_symbol_layer.xml @@ -13,4 +13,4 @@ android:id="@+id/action_toggle_text_font" android:title="Toggle text font"/> -</menu>
\ No newline at end of file +</menu> diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/menu/menu_tracking.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/menu/menu_tracking.xml index 91424d3f5b..940dd9c461 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/menu/menu_tracking.xml +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/menu/menu_tracking.xml @@ -29,4 +29,4 @@ app:showAsAction="never" /> </group> -</menu>
\ No newline at end of file +</menu> diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/menu/menu_zoom.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/menu/menu_zoom.xml index 5cec70afb6..0cea519a24 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/menu/menu_zoom.xml +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/menu/menu_zoom.xml @@ -22,4 +22,4 @@ android:title="Zoom to 4" mapbox:showAsAction="never" /> -</menu>
\ No newline at end of file +</menu> diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/values-v21/attrs.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/values-v21/attrs.xml index 2eb503b057..944f563f2f 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/values-v21/attrs.xml +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/values-v21/attrs.xml @@ -3,4 +3,4 @@ <declare-styleable name="ScrimInsetsView"> <attr name="appInsetForeground" format="reference|color" /> </declare-styleable> -</resources>
\ No newline at end of file +</resources> diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/values-v21/dimens.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/values-v21/dimens.xml index 035b9f3564..c6880f0a6d 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/values-v21/dimens.xml +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/values-v21/dimens.xml @@ -1,4 +1,4 @@ <?xml version="1.0" encoding="utf-8"?> <resources> <dimen name="toolbar_padding_top">25dp</dimen> -</resources>
\ No newline at end of file +</resources> diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/values-v21/styles.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/values-v21/styles.xml index fb2c4ee92e..ab690c664c 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/values-v21/styles.xml +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/values-v21/styles.xml @@ -16,4 +16,4 @@ <item name="colorPrimary">@color/primary</item> </style> -</resources>
\ No newline at end of file +</resources> diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/values/colors.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/values/colors.xml index 3c6fc61bc3..cc13e9c7b2 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/values/colors.xml +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/values/colors.xml @@ -14,4 +14,4 @@ <color name="blueAccent">#2962FF</color> <color name="greenAccent">#1B5E20</color> -</resources>
\ No newline at end of file +</resources> diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/values/ids.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/values/ids.xml index 120bf49fca..6701032d97 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/values/ids.xml +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/values/ids.xml @@ -8,4 +8,4 @@ <item name="toolbar" type="id" /> <item name="container" type="id" /> <item name="item_click_support" type="id" /> -</resources>
\ No newline at end of file +</resources> diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/values/strings.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/values/strings.xml index 3d8c66bde1..fdfad800d6 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/values/strings.xml +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/values/strings.xml @@ -220,4 +220,4 @@ <string name="menuitem_title_rotate_gesture_enabled">Enable rotate gestures</string> <string name="menuitem_title_scroll_gesture_enabled">Enable scroll gestures</string> -</resources>
\ No newline at end of file +</resources> diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/test/java/com/mapbox/mapboxsdk/annotations/AnnotationTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/test/java/com/mapbox/mapboxsdk/annotations/AnnotationTest.java index 611e4f978c..605e159b84 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/test/java/com/mapbox/mapboxsdk/annotations/AnnotationTest.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/test/java/com/mapbox/mapboxsdk/annotations/AnnotationTest.java @@ -88,4 +88,4 @@ public class AnnotationTest { assertSame("hashcode should match", annotation.hashCode(), id); } -}
\ No newline at end of file +} diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/test/java/com/mapbox/mapboxsdk/camera/CameraPositionTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/test/java/com/mapbox/mapboxsdk/camera/CameraPositionTest.java index a8aad8d639..b3eace7856 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/test/java/com/mapbox/mapboxsdk/camera/CameraPositionTest.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/test/java/com/mapbox/mapboxsdk/camera/CameraPositionTest.java @@ -123,4 +123,4 @@ public class CameraPositionTest { Parcelable parcelable = MockParcel.obtain(object); assertEquals("Parcel should match original object", parcelable, object); } -}
\ No newline at end of file +} diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/test/java/com/mapbox/mapboxsdk/geometry/LatLngBoundsTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/test/java/com/mapbox/mapboxsdk/geometry/LatLngBoundsTest.java index a42ca96cf5..60573f4b74 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/test/java/com/mapbox/mapboxsdk/geometry/LatLngBoundsTest.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/test/java/com/mapbox/mapboxsdk/geometry/LatLngBoundsTest.java @@ -202,4 +202,4 @@ public class LatLngBoundsTest { Parcelable parcel = MockParcel.obtain(latLngBounds); assertEquals("Parcel should match original object", parcel, latLngBounds); } -}
\ No newline at end of file +} diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/test/java/com/mapbox/mapboxsdk/maps/UiSettingsTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/test/java/com/mapbox/mapboxsdk/maps/UiSettingsTest.java index 1f532255d7..67213d5e18 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/test/java/com/mapbox/mapboxsdk/maps/UiSettingsTest.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/test/java/com/mapbox/mapboxsdk/maps/UiSettingsTest.java @@ -337,4 +337,4 @@ public class UiSettingsTest { assertEquals("Zoom gesture should be disabled", false, uiSettings.isZoomGesturesEnabled()); assertEquals("Scroll gesture should be disabled", false, uiSettings.isScrollGesturesEnabled()); } -}
\ No newline at end of file +} diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/test/java/com/mapbox/mapboxsdk/telemetry/ExponentialBackOffTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/test/java/com/mapbox/mapboxsdk/telemetry/ExponentialBackOffTest.java index 50ce19c050..fcaef9fa88 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/test/java/com/mapbox/mapboxsdk/telemetry/ExponentialBackOffTest.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/test/java/com/mapbox/mapboxsdk/telemetry/ExponentialBackOffTest.java @@ -16,4 +16,4 @@ public class ExponentialBackOffTest { assertEquals(150000, counter.getNextCount()); assertEquals(180000, counter.getNextCount()); } -}
\ No newline at end of file +} diff --git a/platform/android/MapboxGLAndroidSDKWearTestApp/build.gradle b/platform/android/MapboxGLAndroidSDKWearTestApp/build.gradle index 1f0e8cb72b..c02b869953 100644 --- a/platform/android/MapboxGLAndroidSDKWearTestApp/build.gradle +++ b/platform/android/MapboxGLAndroidSDKWearTestApp/build.gradle @@ -49,4 +49,4 @@ dependencies { } apply from: 'gradle-config.gradle' -apply from: 'gradle-checkstyle.gradle'
\ No newline at end of file +apply from: 'gradle-checkstyle.gradle' diff --git a/platform/android/MapboxGLAndroidSDKWearTestApp/gradle-checkstyle.gradle b/platform/android/MapboxGLAndroidSDKWearTestApp/gradle-checkstyle.gradle index cdcc7f1e23..bfb8341dbc 100644 --- a/platform/android/MapboxGLAndroidSDKWearTestApp/gradle-checkstyle.gradle +++ b/platform/android/MapboxGLAndroidSDKWearTestApp/gradle-checkstyle.gradle @@ -14,4 +14,4 @@ task checkstyle(type: Checkstyle) { exclude '**/gen/**' classpath = files() ignoreFailures = false -}
\ No newline at end of file +} diff --git a/platform/android/MapboxGLAndroidSDKWearTestApp/gradle-config.gradle b/platform/android/MapboxGLAndroidSDKWearTestApp/gradle-config.gradle index fac47cb2a9..27c13b935b 100644 --- a/platform/android/MapboxGLAndroidSDKWearTestApp/gradle-config.gradle +++ b/platform/android/MapboxGLAndroidSDKWearTestApp/gradle-config.gradle @@ -19,4 +19,4 @@ task accessToken { gradle.projectsEvaluated { preBuild.dependsOn('accessToken') -}
\ No newline at end of file +} diff --git a/platform/android/MapboxGLAndroidSDKWearTestApp/src/main/AndroidManifest.xml b/platform/android/MapboxGLAndroidSDKWearTestApp/src/main/AndroidManifest.xml index 22c44f9721..f9beb4c05f 100644 --- a/platform/android/MapboxGLAndroidSDKWearTestApp/src/main/AndroidManifest.xml +++ b/platform/android/MapboxGLAndroidSDKWearTestApp/src/main/AndroidManifest.xml @@ -44,4 +44,4 @@ </application> -</manifest>
\ No newline at end of file +</manifest> diff --git a/platform/android/MapboxGLAndroidSDKWearTestApp/src/main/java/com/mapbox/weartestapp/adapter/FeatureAdapter.java b/platform/android/MapboxGLAndroidSDKWearTestApp/src/main/java/com/mapbox/weartestapp/adapter/FeatureAdapter.java index 7539a84d6e..1ef17e2d7a 100644 --- a/platform/android/MapboxGLAndroidSDKWearTestApp/src/main/java/com/mapbox/weartestapp/adapter/FeatureAdapter.java +++ b/platform/android/MapboxGLAndroidSDKWearTestApp/src/main/java/com/mapbox/weartestapp/adapter/FeatureAdapter.java @@ -75,4 +75,4 @@ public class FeatureAdapter extends WearableRecyclerView.Adapter<FeatureAdapter. public interface ItemSelectedListener { void onItemSelected(int position); } -}
\ No newline at end of file +} diff --git a/platform/android/MapboxGLAndroidSDKWearTestApp/src/main/res/layout/activity_feature_overview.xml b/platform/android/MapboxGLAndroidSDKWearTestApp/src/main/res/layout/activity_feature_overview.xml index 07cfcd3c51..d1a314cfe2 100644 --- a/platform/android/MapboxGLAndroidSDKWearTestApp/src/main/res/layout/activity_feature_overview.xml +++ b/platform/android/MapboxGLAndroidSDKWearTestApp/src/main/res/layout/activity_feature_overview.xml @@ -14,4 +14,4 @@ android:layout_height="match_parent" android:scrollbars="vertical" /> -</android.support.wearable.view.BoxInsetLayout>
\ No newline at end of file +</android.support.wearable.view.BoxInsetLayout> diff --git a/platform/android/MapboxGLAndroidSDKWearTestApp/src/main/res/layout/activity_simple_mapview.xml b/platform/android/MapboxGLAndroidSDKWearTestApp/src/main/res/layout/activity_simple_mapview.xml index 948f92e30b..4dc318174c 100644 --- a/platform/android/MapboxGLAndroidSDKWearTestApp/src/main/res/layout/activity_simple_mapview.xml +++ b/platform/android/MapboxGLAndroidSDKWearTestApp/src/main/res/layout/activity_simple_mapview.xml @@ -19,4 +19,4 @@ mapbox:mapbox_cameraZoom="11" mapbox:mapbox_uiZoomControls="false"/> -</FrameLayout>
\ No newline at end of file +</FrameLayout> diff --git a/platform/android/MapboxGLAndroidSDKWearTestApp/src/main/res/layout/item_curved_layout.xml b/platform/android/MapboxGLAndroidSDKWearTestApp/src/main/res/layout/item_curved_layout.xml index e3a9b476a1..3d81ba3ad5 100644 --- a/platform/android/MapboxGLAndroidSDKWearTestApp/src/main/res/layout/item_curved_layout.xml +++ b/platform/android/MapboxGLAndroidSDKWearTestApp/src/main/res/layout/item_curved_layout.xml @@ -16,4 +16,4 @@ android:textColor="@color/mapboxWhite" android:textSize="14sp"/> -</LinearLayout>
\ No newline at end of file +</LinearLayout> diff --git a/platform/android/MapboxGLAndroidSDKWearTestApp/src/main/res/values/colors.xml b/platform/android/MapboxGLAndroidSDKWearTestApp/src/main/res/values/colors.xml index 1c40e40e1a..5bcdbe93bf 100644 --- a/platform/android/MapboxGLAndroidSDKWearTestApp/src/main/res/values/colors.xml +++ b/platform/android/MapboxGLAndroidSDKWearTestApp/src/main/res/values/colors.xml @@ -28,4 +28,4 @@ <color name="mapboxNavy">#28353D</color> <color name="mapboxNavyDark">#222B30</color> -</resources>
\ No newline at end of file +</resources> diff --git a/platform/android/scripts/generate-style-code.js b/platform/android/scripts/generate-style-code.js index bcfd6bc0df..9c31d0cbbf 100644 --- a/platform/android/scripts/generate-style-code.js +++ b/platform/android/scripts/generate-style-code.js @@ -9,7 +9,7 @@ require('../../../scripts/style-code'); // Specification parsing // -//Collect layer types from spec +// Collect layer types from spec const layers = Object.keys(spec.layer.type.values).map((type) => { const layoutProperties = Object.keys(spec[`layout_${type}`]).reduce((memo, name) => { if (name !== 'visibility') { @@ -34,7 +34,7 @@ const layers = Object.keys(spec.layer.type.values).map((type) => { }; }); -//Process all layer properties +// Process all layer properties const layoutProperties = _(layers).map('layoutProperties').flatten().value(); const paintProperties = _(layers).map('paintProperties').flatten().value(); const allProperties = _(layoutProperties).union(paintProperties).value(); @@ -156,17 +156,17 @@ global.defaultValueJava = function(property) { */ global.propertyFactoryMethodDoc = function (property) { let doc = property.doc; - //Match other items in back ticks + // Match other items in back ticks doc = doc.replace(/`(.+?)`/g, function (m, symbol, offset, str) { if (str.substr(offset - 4, 3) !== 'CSS' && symbol[0].toUpperCase() != symbol[0] && _(enumProperties).filter({'name': symbol}).value().length > 0) { - //Property 'enums' + // Property 'enums' symbol = snakeCaseUpper(symbol); return '{@link Property.' + symbol + '}'; } else if( _(allProperties).filter({'name': symbol}).value().length > 0) { - //Other properties + // Other properties return '{@link PropertyFactory#' + camelizeWithLeadingLowercase(symbol) + '}'; } else { - //Left overs + // Left overs return '`' + symbol + '`'; } }); @@ -193,19 +193,19 @@ global.propertyValueDoc = function (property, value) { return 'is equivalent to {@link Property#' + propertyValue + '}'; }); - //Match other items in back ticks + // Match other items in back ticks doc = doc.replace(/`(.+?)`/g, function (m, symbol, offset, str) { if ('values' in property && Object.keys(property.values).indexOf(symbol) !== -1) { - //Property values + // Property values propertyValue = snakeCaseUpper(property.name) + '_' + snakeCaseUpper(symbol); console.log("Transforming", symbol, propertyValue); return '{@link Property#' + `${propertyValue}` + '}'; } else if (str.substr(offset - 4, 3) !== 'CSS' && symbol[0].toUpperCase() != symbol[0]) { - //Property 'enums' + // Property 'enums' symbol = snakeCaseUpper(symbol); return '{@link ' + symbol + '}'; } else { - //Left overs + // Left overs return symbol } }); @@ -242,7 +242,7 @@ writeIfModified( enumPropertyJavaTemplate({properties: enumProperties}) ); -//De-duplicate enum properties before processing jni property templates +// De-duplicate enum properties before processing jni property templates const enumPropertiesDeDup = _(enumProperties).uniqBy(global.propertyNativeType).value(); // JNI Enum property conversion templates diff --git a/platform/android/src/connectivity_listener.cpp b/platform/android/src/connectivity_listener.cpp index cc2f0a4a81..5b1c0a86e4 100644 --- a/platform/android/src/connectivity_listener.cpp +++ b/platform/android/src/connectivity_listener.cpp @@ -22,12 +22,12 @@ namespace android { jni::Class<ConnectivityListener> ConnectivityListener::javaClass; void ConnectivityListener::registerNative(jni::JNIEnv& env) { - //Lookup the class + // Lookup the class ConnectivityListener::javaClass = *jni::Class<ConnectivityListener>::Find(env).NewGlobalRef(env).release(); #define METHOD(MethodPtr, name) jni::MakeNativePeerMethod<decltype(MethodPtr), (MethodPtr)>(name) - //Register the peer + // Register the peer jni::RegisterNativePeer<ConnectivityListener>( env, ConnectivityListener::javaClass, @@ -39,5 +39,5 @@ namespace android { ); } -} //android -} //mbgl
\ No newline at end of file +} // namespace android +} // namespace mbgl diff --git a/platform/android/src/connectivity_listener.hpp b/platform/android/src/connectivity_listener.hpp index d457dcfd5a..b0d655d027 100644 --- a/platform/android/src/connectivity_listener.hpp +++ b/platform/android/src/connectivity_listener.hpp @@ -27,9 +27,5 @@ public: }; -} //android -} //mbgl - - - - +} // namespace android +} // namespace mbgl diff --git a/platform/android/src/conversion/constant.hpp b/platform/android/src/conversion/constant.hpp index f1a8171b99..2a0b710f73 100644 --- a/platform/android/src/conversion/constant.hpp +++ b/platform/android/src/conversion/constant.hpp @@ -76,7 +76,7 @@ struct Converter<jni::jobject*, T, typename std::enable_if<std::is_integral<T>:: } }; -//TODO: convert integral types to primitive jni types +// TODO: convert integral types to primitive jni types template <> struct Converter<jni::jobject*, std::string> { diff --git a/platform/android/src/conversion/conversion.hpp b/platform/android/src/conversion/conversion.hpp index 1277f3f67e..d1766f9755 100644 --- a/platform/android/src/conversion/conversion.hpp +++ b/platform/android/src/conversion/conversion.hpp @@ -47,4 +47,4 @@ Result<T> convert(jni::JNIEnv& env, const V& value, Args&&...args) { } // namespace conversion } // namespace android -} // namespace mbgl
\ No newline at end of file +} // namespace mbgl diff --git a/platform/android/src/geometry/conversion/feature.hpp b/platform/android/src/geometry/conversion/feature.hpp index f0c77c3389..18f2741d66 100644 --- a/platform/android/src/geometry/conversion/feature.hpp +++ b/platform/android/src/geometry/conversion/feature.hpp @@ -64,7 +64,7 @@ public: static jni::jclass* javaClass = jni::NewGlobalRef(env, &jni::FindClass(env, "com/google/gson/JsonPrimitive")).release(); static jni::jmethodID* constructor = &jni::GetMethodID(env, *javaClass, "<init>", "(Ljava/lang/Boolean;)V"); - //Create JsonPrimitive + // Create JsonPrimitive jni::LocalObject<jni::jobject> converted = jni::NewLocalObject(env, *convert<jni::jobject*, bool>(env, value)); jni::jobject* object = &jni::NewObject(env, *javaClass, *constructor, *converted); @@ -78,7 +78,7 @@ public: static jni::jclass* javaClass = jni::NewGlobalRef(env, &jni::FindClass(env, "com/google/gson/JsonPrimitive")).release(); static jni::jmethodID* constructor = &jni::GetMethodID(env, *javaClass, "<init>", "(Ljava/lang/String;)V"); - //Create JsonPrimitive + // Create JsonPrimitive jni::LocalObject<jni::jobject> converted = jni::NewLocalObject(env, *convert<jni::jobject*, std::string>(env, value)); jni::jobject* object = &jni::NewObject(env, *javaClass, *constructor, converted.get()); @@ -93,7 +93,7 @@ public: static jni::jclass* javaClass = jni::NewGlobalRef(env, &jni::FindClass(env, "com/google/gson/JsonPrimitive")).release(); static jni::jmethodID* constructor = &jni::GetMethodID(env, *javaClass, "<init>", "(Ljava/lang/Number;)V"); - //Create JsonPrimitive + // Create JsonPrimitive jni::LocalObject<jni::jobject> converted = jni::NewLocalObject(env, *convert<jni::jobject*, Number>(env, value)); jni::jobject* object = &jni::NewObject(env, *javaClass, *constructor, converted.get()); @@ -109,10 +109,10 @@ public: static jni::jmethodID* constructor = &jni::GetMethodID(env, *javaClass, "<init>", "()V");; static jni::jmethodID* add = &jni::GetMethodID(env, *javaClass, "add", "(Lcom/google/gson/JsonElement;)V"); - //Create json array + // Create json array jni::jobject* jarray = &jni::NewObject(env, *javaClass, *constructor); - //Add values + // Add values for (const auto &v : values) { jni::LocalObject<jni::jobject> converted = jni::NewLocalObject(env, mbgl::Value::visit(v, *this)); jni::CallMethod<void>(env, jarray, *add, converted.get()); @@ -125,15 +125,15 @@ public: * Json Object */ jni::jobject* operator()(const std::unordered_map<std::string, mbgl::Value> &value) const { - //TODO: clean up duplication here + // TODO: clean up duplication here static jni::jclass* javaClass = jni::NewGlobalRef(env, &jni::FindClass(env, "com/google/gson/JsonObject")).release(); static jni::jmethodID* constructor = &jni::GetMethodID(env, *javaClass, "<init>", "()V");; static jni::jmethodID* add = &jni::GetMethodID(env, *javaClass, "add", "(Ljava/lang/String;Lcom/google/gson/JsonElement;)V"); - //Create json object + // Create json object jni::jobject* jsonObject = &jni::NewObject(env, *javaClass, *constructor); - //Add items + // Add items for (auto &item : value) { jni::LocalObject<jni::jobject> converted = jni::NewLocalObject(env, mbgl::Value::visit(item.second, *this)); jni::LocalObject<jni::jobject> key = jni::NewLocalObject(env, *convert<jni::jobject*, std::string>(env, item.first)); @@ -151,10 +151,10 @@ struct Converter<jni::jobject*, std::unordered_map<std::string, mbgl::Value>> { static jni::jmethodID* constructor = &jni::GetMethodID(env, *javaClass, "<init>", "()V");; static jni::jmethodID* add = &jni::GetMethodID(env, *javaClass, "add", "(Ljava/lang/String;Lcom/google/gson/JsonElement;)V"); - //Create json object + // Create json object jni::jobject* jsonObject = &jni::NewObject(env, *javaClass, *constructor); - //Add items + // Add items PropertyValueEvaluator evaluator {env}; for (auto &item : value) { jni::LocalObject<jni::jobject> converted = jni::NewLocalObject(env, mbgl::Value::visit(item.second, evaluator)); @@ -173,18 +173,18 @@ struct Converter<jni::jobject*, mbgl::Feature> { static jni::jclass* javaClass = jni::NewGlobalRef(env, &jni::FindClass(env, "com/mapbox/services/commons/geojson/Feature")).release(); static jni::jmethodID* fromGeometry = &jni::GetStaticMethodID(env, *javaClass, "fromGeometry", "(Lcom/mapbox/services/commons/geojson/Geometry;Lcom/google/gson/JsonObject;Ljava/lang/String;)Lcom/mapbox/services/commons/geojson/Feature;"); - //Convert Id + // Convert Id FeatureIdVisitor idEvaluator; std::string id = (value.id) ? mapbox::geometry::identifier::visit(value.id.value(), idEvaluator) : ""; jni::LocalObject<jni::jobject> jid = jni::NewLocalObject(env, *convert<jni::jobject*>(env, id)); - //Convert properties + // Convert properties jni::LocalObject<jni::jobject> properties = jni::NewLocalObject(env, *convert<jni::jobject*>(env, value.properties)); - //Convert geometry + // Convert geometry jni::LocalObject<jni::jobject> geometry = jni::NewLocalObject(env, *convert<jni::jobject*>(env, value.geometry)); - //Create feature + // Create feature return {reinterpret_cast<jni::jobject*>(jni::CallStaticMethod<jni::jobject*>(env, *javaClass, *fromGeometry, geometry.get(), properties.get(), jid.get()))}; } }; diff --git a/platform/android/src/geometry/conversion/geometry.hpp b/platform/android/src/geometry/conversion/geometry.hpp index 385ba9034e..2ca63e2c11 100644 --- a/platform/android/src/geometry/conversion/geometry.hpp +++ b/platform/android/src/geometry/conversion/geometry.hpp @@ -27,7 +27,7 @@ public: static jni::jclass* javaClass = jni::NewGlobalRef(env, &jni::FindClass(env, "com/mapbox/services/commons/geojson/Point")).release(); static jni::jmethodID* fromCoordinates = &jni::GetStaticMethodID(env, *javaClass, "fromCoordinates", "([D)Lcom/mapbox/services/commons/geojson/Point;"); - //Create Point + // Create Point jni::LocalObject<jni::jarray<jni::jdouble>> position = jni::NewLocalObject(env, toGeoJsonPosition(env, geometry.x, geometry.y)); return reinterpret_cast<jni::jobject*>(jni::CallStaticMethod<jni::jobject*>(env, *javaClass, *fromCoordinates, position.get())); } @@ -39,7 +39,7 @@ public: static jni::jclass* javaClass = jni::NewGlobalRef(env, &jni::FindClass(env, "com/mapbox/services/commons/geojson/LineString")).release(); static jni::jmethodID* fromCoordinates = &jni::GetStaticMethodID(env, *javaClass, "fromCoordinates", "([[D)Lcom/mapbox/services/commons/geojson/LineString;"); - //Create + // Create jni::LocalObject<jni::jarray<jni::jobject>> coordinates = jni::NewLocalObject(env, toGeoJsonCoordinates(env, geometry)); return reinterpret_cast<jni::jobject*>(jni::CallStaticMethod<jni::jobject*>(env, *javaClass, *fromCoordinates, coordinates.get())); } @@ -51,7 +51,7 @@ public: static jni::jclass* javaClass = jni::NewGlobalRef(env, &jni::FindClass(env, "com/mapbox/services/commons/geojson/MultiPoint")).release(); static jni::jmethodID* fromCoordinates = &jni::GetStaticMethodID(env, *javaClass, "fromCoordinates", "([[D)Lcom/mapbox/services/commons/geojson/MultiPoint;"); - //Create + // Create jni::LocalObject<jni::jarray<jni::jobject>> coordinates = jni::NewLocalObject(env, toGeoJsonCoordinates(env, geometry)); return reinterpret_cast<jni::jobject*>(jni::CallStaticMethod<jni::jobject*>(env, *javaClass, *fromCoordinates, coordinates.get())); } @@ -63,7 +63,7 @@ public: static jni::jclass* javaClass = jni::NewGlobalRef(env, &jni::FindClass(env, "com/mapbox/services/commons/geojson/Polygon")).release(); static jni::jmethodID* fromCoordinates = &jni::GetStaticMethodID(env, *javaClass, "fromCoordinates", "([[[D)Lcom/mapbox/services/commons/geojson/Polygon;"); - //Create + // Create jni::LocalObject<jni::jarray<jni::jobject>> shape = jni::NewLocalObject(env, toShape<>(env, geometry)); return reinterpret_cast<jni::jobject*>(jni::CallStaticMethod<jni::jobject*>(env, *javaClass, *fromCoordinates, shape.get())); } @@ -75,7 +75,7 @@ public: static jni::jclass* javaClass = jni::NewGlobalRef(env, &jni::FindClass(env, "com/mapbox/services/commons/geojson/MultiLineString")).release(); static jni::jmethodID* fromCoordinates = &jni::GetStaticMethodID(env, *javaClass, "fromCoordinates", "([[[D)Lcom/mapbox/services/commons/geojson/MultiLineString;"); - //Create + // Create jni::LocalObject<jni::jarray<jni::jobject>> shape = jni::NewLocalObject(env, toShape<>(env, geometry)); return reinterpret_cast<jni::jobject*>(jni::CallStaticMethod<jni::jobject*>(env, *javaClass, *fromCoordinates, shape.get())); } @@ -92,7 +92,7 @@ public: jni::SetObjectArrayElement(env, *jarray, i, shape.get()); } - //Create the MultiPolygon + // Create the MultiPolygon static jni::jclass* javaClass = jni::NewGlobalRef(env, &jni::FindClass(env, "com/mapbox/services/commons/geojson/MultiPolygon")).release(); static jni::jmethodID* fromGeometries = &jni::GetStaticMethodID(env, *javaClass, "fromCoordinates", "([[[[D)Lcom/mapbox/services/commons/geojson/MultiPolygon;"); return reinterpret_cast<jni::jobject*>(jni::CallStaticMethod<jni::jobject*>(env, *javaClass, *fromGeometries, jarray.get())); @@ -111,7 +111,7 @@ public: jni::SetObjectArrayElement(env, *jarray, i, converted.get()); } - //Turn into array list and create the GeometryCollection + // Turn into array list and create the GeometryCollection static jni::jclass* javaClass = jni::NewGlobalRef(env, &jni::FindClass(env, "com/mapbox/services/commons/geojson/GeometryCollection")).release(); static jni::jmethodID* fromGeometries = &jni::GetStaticMethodID(env, *javaClass, "fromGeometries", "(Ljava/util/List;)Lcom/mapbox/services/commons/geojson/GeometryCollection;"); diff --git a/platform/android/src/java_types.hpp b/platform/android/src/java_types.hpp index 2e2c5fc2d6..b416a75b91 100644 --- a/platform/android/src/java_types.hpp +++ b/platform/android/src/java_types.hpp @@ -32,4 +32,4 @@ namespace java { void registerNatives(JNIEnv&); } } -}
\ No newline at end of file +} diff --git a/platform/android/src/jni.cpp b/platform/android/src/jni.cpp index 1ef7fec8fb..009de89db2 100755 --- a/platform/android/src/jni.cpp +++ b/platform/android/src/jni.cpp @@ -1128,17 +1128,17 @@ jni::jobject* nativeGetLayer(JNIEnv *env, jni::jobject* obj, jlong nativeMapView assert(env); assert(nativeMapViewPtr != 0); - //Get the native map peer + // Get the native map peer NativeMapView *nativeMapView = reinterpret_cast<NativeMapView *>(nativeMapViewPtr); - //Find the layer + // Find the layer mbgl::style::Layer* coreLayer = nativeMapView->getMap().getLayer(std_string_from_jstring(env, layerId)); if (!coreLayer) { mbgl::Log::Debug(mbgl::Event::JNI, "No layer found"); return jni::Object<Layer>(); } - //Create and return the layer's native peer + // Create and return the layer's native peer return createJavaLayerPeer(*env, nativeMapView->getMap(), *coreLayer); } @@ -1189,17 +1189,17 @@ jni::jobject* nativeGetSource(JNIEnv *env, jni::jobject* obj, jni::jlong nativeM assert(env); assert(nativeMapViewPtr != 0); - //Get the native map peer + // Get the native map peer NativeMapView *nativeMapView = reinterpret_cast<NativeMapView *>(nativeMapViewPtr); - //Find the source + // Find the source mbgl::style::Source* coreSource = nativeMapView->getMap().getSource(std_string_from_jstring(env, sourceId)); if (!coreSource) { mbgl::Log::Debug(mbgl::Event::JNI, "No source found"); return jni::Object<Source>(); } - //Create and return the source's native peer + // Create and return the source's native peer return createJavaSourcePeer(*env, nativeMapView->getMap(), *coreSource); } @@ -1255,7 +1255,7 @@ void nativeAddImage(JNIEnv *env, jni::jobject* obj, jlong nativeMapViewPtr, jni: jni::GetArrayRegion(*env, *data, 0, size, reinterpret_cast<jbyte*>(premultipliedImage.data.get())); - //Wrap in a SpriteImage with the correct pixel ratio + // Wrap in a SpriteImage with the correct pixel ratio auto spriteImage = std::make_unique<mbgl::SpriteImage>(std::move(premultipliedImage), float(pixelRatio)); nativeMapView->getMap().addImage(std_string_from_jstring(env, name), std::move(spriteImage)); @@ -2045,6 +2045,6 @@ void registerNatives(JavaVM *vm) { __system_property_get("ro.build.version.release", release); androidRelease = std::string(release); } - -} // android -} // mbgl + +} // namespace android +} // namespace mbgl diff --git a/platform/android/src/jni.hpp b/platform/android/src/jni.hpp index 90ec914cf2..d12030f3c1 100644 --- a/platform/android/src/jni.hpp +++ b/platform/android/src/jni.hpp @@ -23,8 +23,8 @@ extern jmethodID onSnapshotReadyId; extern bool attach_jni_thread(JavaVM* vm, JNIEnv** env, std::string threadName); extern void detach_jni_thread(JavaVM* vm, JNIEnv** env, bool detach); - + extern void registerNatives(JavaVM* vm); -} //android -} //mbgl +} // namespace android +} // namespace mbgl diff --git a/platform/android/src/style/android_conversion.hpp b/platform/android/src/style/android_conversion.hpp index de0ac91502..8ae694d115 100644 --- a/platform/android/src/style/android_conversion.hpp +++ b/platform/android/src/style/android_conversion.hpp @@ -45,7 +45,7 @@ inline optional<mbgl::android::Value> objectMember(const mbgl::android::Value& v template <class Fn> optional<Error> eachMember(const mbgl::android::Value&, Fn&&) { - //TODO + // TODO mbgl::Log::Warning(mbgl::Event::Android, "eachMember not implemented"); return {}; } @@ -82,7 +82,7 @@ inline optional<Value> toValue(const mbgl::android::Value& value) { } else if (value.isString()) { return { value.toString() }; } else if (value.isNumber()) { - //Need to cast to a double here as the float is otherwise considered a bool... + // Need to cast to a double here as the float is otherwise considered a bool... return { (double) value.toNumber() }; } else { return {}; diff --git a/platform/android/src/style/conversion/function.hpp b/platform/android/src/style/conversion/function.hpp index 26dd5c21fd..ed383b7b56 100644 --- a/platform/android/src/style/conversion/function.hpp +++ b/platform/android/src/style/conversion/function.hpp @@ -39,10 +39,10 @@ struct Converter<jni::jobject*, mbgl::style::Function<T>> { static jni::jmethodID* constructor = &jni::GetMethodID(env, *javaClass, "<init>", "([Lcom/mapbox/mapboxsdk/style/layers/Function$Stop;)V"); static jni::jmethodID* withBase = &jni::GetMethodID(env, *javaClass, "withBase", "(F)Lcom/mapbox/mapboxsdk/style/layers/Function;"); - //Create object + // Create object jni::jobject* jfunction = &jni::NewObject(env, *javaClass, *constructor, *toFunctionStopJavaArray(env, value.getStops())); - //Set base + // Set base jni::CallMethod<jni::jobject*>(env, jfunction, *withBase, value.getBase()); return {jfunction}; @@ -51,4 +51,4 @@ struct Converter<jni::jobject*, mbgl::style::Function<T>> { } // namespace conversion } // namespace android -} // namespace mbgl
\ No newline at end of file +} // namespace mbgl diff --git a/platform/android/src/style/conversion/geojson.hpp b/platform/android/src/style/conversion/geojson.hpp index 6bc48b3700..415d96f467 100644 --- a/platform/android/src/style/conversion/geojson.hpp +++ b/platform/android/src/style/conversion/geojson.hpp @@ -19,7 +19,7 @@ namespace conversion { template <> Result<GeoJSON> convertGeoJSON(const mbgl::android::Value& value) { - //Value should be a string wrapped in an object + // Value should be a string wrapped in an object mbgl::android::Value jsonValue = value.get("data"); if(value.isNull()) { return Error { "no json data found" }; @@ -54,4 +54,4 @@ struct Converter<GeoJSON> { } // namespace conversion } // namespace style -} // namespace mbgl
\ No newline at end of file +} // namespace mbgl diff --git a/platform/android/src/style/conversion/property_value.hpp b/platform/android/src/style/conversion/property_value.hpp index 4121192f3f..a89b93794a 100644 --- a/platform/android/src/style/conversion/property_value.hpp +++ b/platform/android/src/style/conversion/property_value.hpp @@ -16,15 +16,15 @@ struct Converter<jni::jobject*, mbgl::style::PropertyValue<T>> { Result<jni::jobject*> operator()(jni::JNIEnv& env, const mbgl::style::PropertyValue<T>& value) const { if(value.isUndefined()) { - //Return a nullptr representing a Java null value + // Return a nullptr representing a Java null value return {nullptr}; } else if (value.isConstant()) { - //Time to convert the constant value + // Time to convert the constant value Result<jni::jobject*> result = convert<jni::jobject*, T>(env, value.asConstant()); return {*result}; - //return converted; + // return converted; } else if (value.isFunction()) { - //Must be a function than + // Must be a function than return convert<jni::jobject*, mbgl::style::Function<T>>(env, value.asFunction()); } else { throw std::runtime_error("Unknown property value type"); @@ -35,4 +35,4 @@ struct Converter<jni::jobject*, mbgl::style::PropertyValue<T>> { } // namespace conversion } // namespace android -} // namespace mbgl
\ No newline at end of file +} // namespace mbgl diff --git a/platform/android/src/style/conversion/types.hpp b/platform/android/src/style/conversion/types.hpp index 1c433bb264..d9921e582e 100644 --- a/platform/android/src/style/conversion/types.hpp +++ b/platform/android/src/style/conversion/types.hpp @@ -95,4 +95,4 @@ struct Converter<jni::jobject*, mbgl::style::CirclePitchScaleType> { } // namespace conversion } // namespace android -} // namespace mbgl
\ No newline at end of file +} // namespace mbgl diff --git a/platform/android/src/style/conversion/types.hpp.ejs b/platform/android/src/style/conversion/types.hpp.ejs index d248d42b72..3cd4764015 100644 --- a/platform/android/src/style/conversion/types.hpp.ejs +++ b/platform/android/src/style/conversion/types.hpp.ejs @@ -37,4 +37,4 @@ struct Converter<jni::jobject*, mbgl::style::<%- propertyNativeType(property) %> } // namespace conversion } // namespace android -} // namespace mbgl
\ No newline at end of file +} // namespace mbgl diff --git a/platform/android/src/style/conversion/types_string_values.hpp b/platform/android/src/style/conversion/types_string_values.hpp index 9f21a2fed9..e3108fdf5b 100644 --- a/platform/android/src/style/conversion/types_string_values.hpp +++ b/platform/android/src/style/conversion/types_string_values.hpp @@ -10,7 +10,7 @@ namespace mbgl { namespace android { namespace conversion { - //visibility + // visibility inline std::string toString(mbgl::style::VisibilityType value) { switch (value) { case mbgl::style::VisibilityType::Visible: @@ -24,7 +24,7 @@ namespace conversion { } } - //line-cap + // line-cap inline std::string toString(mbgl::style::LineCapType value) { switch (value) { case mbgl::style::LineCapType::Butt: @@ -41,7 +41,7 @@ namespace conversion { } } - //line-join + // line-join inline std::string toString(mbgl::style::LineJoinType value) { switch (value) { case mbgl::style::LineJoinType::Bevel: @@ -58,7 +58,7 @@ namespace conversion { } } - //symbol-placement + // symbol-placement inline std::string toString(mbgl::style::SymbolPlacementType value) { switch (value) { case mbgl::style::SymbolPlacementType::Point: @@ -72,7 +72,7 @@ namespace conversion { } } - //icon-rotation-alignment + // icon-rotation-alignment inline std::string toString(mbgl::style::AlignmentType value) { switch (value) { case mbgl::style::AlignmentType::Map: @@ -89,7 +89,7 @@ namespace conversion { } } - //icon-text-fit + // icon-text-fit inline std::string toString(mbgl::style::IconTextFitType value) { switch (value) { case mbgl::style::IconTextFitType::None: @@ -109,7 +109,7 @@ namespace conversion { } } - //text-justify + // text-justify inline std::string toString(mbgl::style::TextJustifyType value) { switch (value) { case mbgl::style::TextJustifyType::Left: @@ -126,7 +126,7 @@ namespace conversion { } } - //text-anchor + // text-anchor inline std::string toString(mbgl::style::TextAnchorType value) { switch (value) { case mbgl::style::TextAnchorType::Center: @@ -161,7 +161,7 @@ namespace conversion { } } - //text-transform + // text-transform inline std::string toString(mbgl::style::TextTransformType value) { switch (value) { case mbgl::style::TextTransformType::None: @@ -178,7 +178,7 @@ namespace conversion { } } - //fill-translate-anchor + // fill-translate-anchor inline std::string toString(mbgl::style::TranslateAnchorType value) { switch (value) { case mbgl::style::TranslateAnchorType::Map: @@ -192,7 +192,7 @@ namespace conversion { } } - //circle-pitch-scale + // circle-pitch-scale inline std::string toString(mbgl::style::CirclePitchScaleType value) { switch (value) { case mbgl::style::CirclePitchScaleType::Map: @@ -209,4 +209,4 @@ namespace conversion { } // namespace conversion } // namespace android -} // namespace mbgl
\ No newline at end of file +} // namespace mbgl diff --git a/platform/android/src/style/conversion/types_string_values.hpp.ejs b/platform/android/src/style/conversion/types_string_values.hpp.ejs index c1646baa1a..bf52919741 100644 --- a/platform/android/src/style/conversion/types_string_values.hpp.ejs +++ b/platform/android/src/style/conversion/types_string_values.hpp.ejs @@ -13,7 +13,7 @@ namespace mbgl { namespace android { namespace conversion { - //visibility + // visibility inline std::string toString(mbgl::style::VisibilityType value) { switch (value) { case mbgl::style::VisibilityType::Visible: @@ -28,7 +28,7 @@ namespace conversion { } <% for (const property of properties) { -%> - //<%- property.name %> + // <%- property.name %> inline std::string toString(mbgl::style::<%- propertyNativeType(property) %> value) { switch (value) { <% for (const value in property.values) { -%> @@ -45,4 +45,4 @@ namespace conversion { } // namespace conversion } // namespace android -} // namespace mbgl
\ No newline at end of file +} // namespace mbgl diff --git a/platform/android/src/style/conversion/url_or_tileset.hpp b/platform/android/src/style/conversion/url_or_tileset.hpp index c1801f56d0..4e502324d0 100644 --- a/platform/android/src/style/conversion/url_or_tileset.hpp +++ b/platform/android/src/style/conversion/url_or_tileset.hpp @@ -35,4 +35,4 @@ struct Converter<variant<std::string, Tileset>> { } } -}
\ No newline at end of file +} diff --git a/platform/android/src/style/layers/background_layer.cpp b/platform/android/src/style/layers/background_layer.cpp index 021ac947ad..6b013ae086 100644 --- a/platform/android/src/style/layers/background_layer.cpp +++ b/platform/android/src/style/layers/background_layer.cpp @@ -47,12 +47,12 @@ namespace android { } void BackgroundLayer::registerNative(jni::JNIEnv& env) { - //Lookup the class + // Lookup the class BackgroundLayer::javaClass = *jni::Class<BackgroundLayer>::Find(env).NewGlobalRef(env).release(); #define METHOD(MethodPtr, name) jni::MakeNativePeerMethod<decltype(MethodPtr), (MethodPtr)>(name) - //Register the peer + // Register the peer jni::RegisterNativePeer<BackgroundLayer>( env, BackgroundLayer::javaClass, "nativePtr", std::make_unique<BackgroundLayer, JNIEnv&, jni::String>, diff --git a/platform/android/src/style/layers/circle_layer.cpp b/platform/android/src/style/layers/circle_layer.cpp index 4a6ba95d31..2b33a2dd47 100644 --- a/platform/android/src/style/layers/circle_layer.cpp +++ b/platform/android/src/style/layers/circle_layer.cpp @@ -89,12 +89,12 @@ namespace android { } void CircleLayer::registerNative(jni::JNIEnv& env) { - //Lookup the class + // Lookup the class CircleLayer::javaClass = *jni::Class<CircleLayer>::Find(env).NewGlobalRef(env).release(); #define METHOD(MethodPtr, name) jni::MakeNativePeerMethod<decltype(MethodPtr), (MethodPtr)>(name) - //Register the peer + // Register the peer jni::RegisterNativePeer<CircleLayer>( env, CircleLayer::javaClass, "nativePtr", std::make_unique<CircleLayer, JNIEnv&, jni::String, jni::String>, diff --git a/platform/android/src/style/layers/custom_layer.cpp b/platform/android/src/style/layers/custom_layer.cpp index d5d330a019..9bdc308d85 100644 --- a/platform/android/src/style/layers/custom_layer.cpp +++ b/platform/android/src/style/layers/custom_layer.cpp @@ -40,12 +40,12 @@ namespace android { } void CustomLayer::registerNative(jni::JNIEnv& env) { - //Lookup the class + // Lookup the class CustomLayer::javaClass = *jni::Class<CustomLayer>::Find(env).NewGlobalRef(env).release(); #define METHOD(MethodPtr, name) jni::MakeNativePeerMethod<decltype(MethodPtr), (MethodPtr)>(name) - //Register the peer + // Register the peer jni::RegisterNativePeer<CustomLayer>( env, CustomLayer::javaClass, "nativePtr", std::make_unique<CustomLayer, JNIEnv&, jni::String, jni::jlong, jni::jlong, jni::jlong, jni::jlong>, diff --git a/platform/android/src/style/layers/fill_layer.cpp b/platform/android/src/style/layers/fill_layer.cpp index 84d47b6afe..d818314f89 100644 --- a/platform/android/src/style/layers/fill_layer.cpp +++ b/platform/android/src/style/layers/fill_layer.cpp @@ -71,12 +71,12 @@ namespace android { } void FillLayer::registerNative(jni::JNIEnv& env) { - //Lookup the class + // Lookup the class FillLayer::javaClass = *jni::Class<FillLayer>::Find(env).NewGlobalRef(env).release(); #define METHOD(MethodPtr, name) jni::MakeNativePeerMethod<decltype(MethodPtr), (MethodPtr)>(name) - //Register the peer + // Register the peer jni::RegisterNativePeer<FillLayer>( env, FillLayer::javaClass, "nativePtr", std::make_unique<FillLayer, JNIEnv&, jni::String, jni::String>, diff --git a/platform/android/src/style/layers/layer.cpp b/platform/android/src/style/layers/layer.cpp index c0c57c839d..bfc09be302 100644 --- a/platform/android/src/style/layers/layer.cpp +++ b/platform/android/src/style/layers/layer.cpp @@ -5,12 +5,12 @@ #include <mbgl/util/logging.hpp> -//Java -> C++ conversion +// Java -> C++ conversion #include <mbgl/style/conversion.hpp> #include <mbgl/style/conversion/layer.hpp> #include <mbgl/style/conversion/source.hpp> -//C++ -> Java conversion +// C++ -> Java conversion #include "../conversion/property_value.hpp" #include <string> @@ -33,15 +33,15 @@ namespace android { } void Layer::addToMap(mbgl::Map& _map, mbgl::optional<std::string> before) { - //Check to see if we own the layer first + // Check to see if we own the layer first if (!ownedLayer) { throw std::runtime_error("Cannot add layer twice"); } - //Add layer to map + // Add layer to map _map.addLayer(releaseCoreLayer(), before); - //Save pointer to the map + // Save pointer to the map this->map = &_map; } @@ -65,7 +65,7 @@ namespace android { void Layer::setLayoutProperty(jni::JNIEnv& env, jni::String jname, jni::Object<> jvalue) { Value value(env, jvalue); - //Convert and set property + // Convert and set property optional<mbgl::style::conversion::Error> error = mbgl::style::conversion::setLayoutProperty(layer, jni::Make<std::string>(env, jname), value); if (error) { mbgl::Log::Error(mbgl::Event::JNI, "Error setting property: " + jni::Make<std::string>(env, jname) + " " + error->message); @@ -76,7 +76,7 @@ namespace android { void Layer::setPaintProperty(jni::JNIEnv& env, jni::String jname, jni::Object<> jvalue) { Value value(env, jvalue); - //Convert and set property + // Convert and set property optional<mbgl::style::conversion::Error> error = mbgl::style::conversion::setPaintProperty(layer, jni::Make<std::string>(env, jname), value, mbgl::optional<std::string>()); if (error) { mbgl::Log::Error(mbgl::Event::JNI, "Error setting property: " + jni::Make<std::string>(env, jname) + " " + error->message); @@ -153,12 +153,12 @@ namespace android { jni::Class<Layer> Layer::javaClass; void Layer::registerNative(jni::JNIEnv& env) { - //Lookup the class + // Lookup the class Layer::javaClass = *jni::Class<Layer>::Find(env).NewGlobalRef(env).release(); #define METHOD(MethodPtr, name) jni::MakeNativePeerMethod<decltype(MethodPtr), (MethodPtr)>(name) - //Register the peer + // Register the peer jni::RegisterNativePeer<Layer>(env, Layer::javaClass, "nativePtr", METHOD(&Layer::getId, "nativeGetId"), METHOD(&Layer::setLayoutProperty, "nativeSetLayoutProperty"), @@ -174,5 +174,5 @@ namespace android { } -} //android -} //mbgl
\ No newline at end of file +} // namespace android +} // namespace mbgl diff --git a/platform/android/src/style/layers/layer.cpp.ejs b/platform/android/src/style/layers/layer.cpp.ejs index 500c76ea7a..9a1274965b 100644 --- a/platform/android/src/style/layers/layer.cpp.ejs +++ b/platform/android/src/style/layers/layer.cpp.ejs @@ -46,12 +46,12 @@ namespace android { } void <%- camelize(type) %>Layer::registerNative(jni::JNIEnv& env) { - //Lookup the class + // Lookup the class <%- camelize(type) %>Layer::javaClass = *jni::Class<<%- camelize(type) %>Layer>::Find(env).NewGlobalRef(env).release(); #define METHOD(MethodPtr, name) jni::MakeNativePeerMethod<decltype(MethodPtr), (MethodPtr)>(name) - //Register the peer + // Register the peer jni::RegisterNativePeer<<%- camelize(type) %>Layer>( env, <%- camelize(type) %>Layer::javaClass, "nativePtr", <% if (type === 'background') { -%> diff --git a/platform/android/src/style/layers/layer.hpp b/platform/android/src/style/layers/layer.hpp index f3cd073552..bf07adad67 100644 --- a/platform/android/src/style/layers/layer.hpp +++ b/platform/android/src/style/layers/layer.hpp @@ -49,7 +49,7 @@ public: void setPaintProperty(jni::JNIEnv&, jni::String, jni::Object<> value); - //Zoom + // Zoom jni::jfloat getMinZoom(jni::JNIEnv&); @@ -65,28 +65,24 @@ public: void setSourceLayer(jni::JNIEnv& env, jni::String sourceLayer); - //Property getters + // Property getters jni::Object<jni::ObjectTag> getVisibility(jni::JNIEnv&); protected: - //Release the owned view and return it + // Release the owned view and return it std::unique_ptr<mbgl::style::Layer> releaseCoreLayer(); - //Owned layer is set when creating a new layer, before adding it to the map + // Owned layer is set when creating a new layer, before adding it to the map std::unique_ptr<mbgl::style::Layer> ownedLayer; - //Raw reference to the layer + // Raw reference to the layer mbgl::style::Layer& layer; - //Map is set when the layer is retrieved or after adding to the map + // Map is set when the layer is retrieved or after adding to the map mbgl::Map* map; }; -} //android -} //mbgl - - - - +} // namespace android +} // namespace mbgl diff --git a/platform/android/src/style/layers/layers.cpp b/platform/android/src/style/layers/layers.cpp index 57dbf6f4b1..c8e981b966 100644 --- a/platform/android/src/style/layers/layers.cpp +++ b/platform/android/src/style/layers/layers.cpp @@ -60,5 +60,5 @@ void registerNativeLayers(jni::JNIEnv& env) { CustomLayer::registerNative(env); } -} //android -} //mbgl
\ No newline at end of file +} // namespace android +} // namespace mbgl diff --git a/platform/android/src/style/layers/layers.hpp b/platform/android/src/style/layers/layers.hpp index 0c979ec2cf..111b521c26 100644 --- a/platform/android/src/style/layers/layers.hpp +++ b/platform/android/src/style/layers/layers.hpp @@ -17,4 +17,4 @@ jni::jobject* createJavaLayerPeer(jni::JNIEnv&, mbgl::Map&, mbgl::style::Layer&) void registerNativeLayers(jni::JNIEnv&); } -}
\ No newline at end of file +} diff --git a/platform/android/src/style/layers/line_layer.cpp b/platform/android/src/style/layers/line_layer.cpp index 2dce8b618a..e53e2060c8 100644 --- a/platform/android/src/style/layers/line_layer.cpp +++ b/platform/android/src/style/layers/line_layer.cpp @@ -113,12 +113,12 @@ namespace android { } void LineLayer::registerNative(jni::JNIEnv& env) { - //Lookup the class + // Lookup the class LineLayer::javaClass = *jni::Class<LineLayer>::Find(env).NewGlobalRef(env).release(); #define METHOD(MethodPtr, name) jni::MakeNativePeerMethod<decltype(MethodPtr), (MethodPtr)>(name) - //Register the peer + // Register the peer jni::RegisterNativePeer<LineLayer>( env, LineLayer::javaClass, "nativePtr", std::make_unique<LineLayer, JNIEnv&, jni::String, jni::String>, diff --git a/platform/android/src/style/layers/raster_layer.cpp b/platform/android/src/style/layers/raster_layer.cpp index 25b26155ae..69fd634bce 100644 --- a/platform/android/src/style/layers/raster_layer.cpp +++ b/platform/android/src/style/layers/raster_layer.cpp @@ -71,12 +71,12 @@ namespace android { } void RasterLayer::registerNative(jni::JNIEnv& env) { - //Lookup the class + // Lookup the class RasterLayer::javaClass = *jni::Class<RasterLayer>::Find(env).NewGlobalRef(env).release(); #define METHOD(MethodPtr, name) jni::MakeNativePeerMethod<decltype(MethodPtr), (MethodPtr)>(name) - //Register the peer + // Register the peer jni::RegisterNativePeer<RasterLayer>( env, RasterLayer::javaClass, "nativePtr", std::make_unique<RasterLayer, JNIEnv&, jni::String, jni::String>, diff --git a/platform/android/src/style/layers/symbol_layer.cpp b/platform/android/src/style/layers/symbol_layer.cpp index 9318d42d5b..14803ae278 100644 --- a/platform/android/src/style/layers/symbol_layer.cpp +++ b/platform/android/src/style/layers/symbol_layer.cpp @@ -317,12 +317,12 @@ namespace android { } void SymbolLayer::registerNative(jni::JNIEnv& env) { - //Lookup the class + // Lookup the class SymbolLayer::javaClass = *jni::Class<SymbolLayer>::Find(env).NewGlobalRef(env).release(); #define METHOD(MethodPtr, name) jni::MakeNativePeerMethod<decltype(MethodPtr), (MethodPtr)>(name) - //Register the peer + // Register the peer jni::RegisterNativePeer<SymbolLayer>( env, SymbolLayer::javaClass, "nativePtr", std::make_unique<SymbolLayer, JNIEnv&, jni::String, jni::String>, diff --git a/platform/android/src/style/sources/geojson_source.cpp b/platform/android/src/style/sources/geojson_source.cpp index 234dccb315..37ce0644c1 100644 --- a/platform/android/src/style/sources/geojson_source.cpp +++ b/platform/android/src/style/sources/geojson_source.cpp @@ -27,19 +27,19 @@ namespace android { void GeoJSONSource::setGeoJSON(jni::JNIEnv& env, jni::Object<> json) { using namespace mbgl::style::conversion; - //Convert the jni object + // Convert the jni object Result<GeoJSON> converted = convert<GeoJSON>(Value(env, json)); if(!converted) { mbgl::Log::Error(mbgl::Event::JNI, "Error setting geo json: " + converted.error().message); return; } - //Update the core source + // Update the core source source.as<mbgl::style::GeoJSONSource>()->GeoJSONSource::setGeoJSON(*converted); } void GeoJSONSource::setURL(jni::JNIEnv& env, jni::String url) { - //Update the core source + // Update the core source source.as<mbgl::style::GeoJSONSource>()->GeoJSONSource::setURL(jni::Make<std::string>(env, url)); } @@ -51,12 +51,12 @@ namespace android { } void GeoJSONSource::registerNative(jni::JNIEnv& env) { - //Lookup the class + // Lookup the class GeoJSONSource::javaClass = *jni::Class<GeoJSONSource>::Find(env).NewGlobalRef(env).release(); #define METHOD(MethodPtr, name) jni::MakeNativePeerMethod<decltype(MethodPtr), (MethodPtr)>(name) - //Register the peer + // Register the peer jni::RegisterNativePeer<GeoJSONSource>( env, GeoJSONSource::javaClass, "nativePtr", std::make_unique<GeoJSONSource, JNIEnv&, jni::String, jni::Object<>>, diff --git a/platform/android/src/style/sources/raster_source.cpp b/platform/android/src/style/sources/raster_source.cpp index b56b56676d..42ac4cda99 100644 --- a/platform/android/src/style/sources/raster_source.cpp +++ b/platform/android/src/style/sources/raster_source.cpp @@ -36,12 +36,12 @@ namespace android { } void RasterSource::registerNative(jni::JNIEnv& env) { - //Lookup the class + // Lookup the class RasterSource::javaClass = *jni::Class<RasterSource>::Find(env).NewGlobalRef(env).release(); #define METHOD(MethodPtr, name) jni::MakeNativePeerMethod<decltype(MethodPtr), (MethodPtr)>(name) - //Register the peer + // Register the peer jni::RegisterNativePeer<RasterSource>( env, RasterSource::javaClass, "nativePtr", std::make_unique<RasterSource, JNIEnv&, jni::String, jni::Object<>, jni::jint>, diff --git a/platform/android/src/style/sources/source.cpp b/platform/android/src/style/sources/source.cpp index aca7bd6a84..b780de5627 100644 --- a/platform/android/src/style/sources/source.cpp +++ b/platform/android/src/style/sources/source.cpp @@ -5,11 +5,11 @@ #include <mbgl/util/logging.hpp> -//Java -> C++ conversion +// Java -> C++ conversion #include <mbgl/style/conversion.hpp> #include <mbgl/style/conversion/source.hpp> -//C++ -> Java conversion +// C++ -> Java conversion #include "../conversion/property_value.hpp" #include <string> @@ -44,15 +44,15 @@ namespace android { } void Source::addToMap(mbgl::Map& _map) { - //Check to see if we own the source first + // Check to see if we own the source first if (!ownedSource) { throw std::runtime_error("Cannot add source twice"); } - //Add source to map + // Add source to map _map.addSource(releaseCoreSource()); - //Save pointer to the map + // Save pointer to the map this->map = &_map; } @@ -64,17 +64,17 @@ namespace android { jni::Class<Source> Source::javaClass; void Source::registerNative(jni::JNIEnv& env) { - //Lookup the class + // Lookup the class Source::javaClass = *jni::Class<Source>::Find(env).NewGlobalRef(env).release(); #define METHOD(MethodPtr, name) jni::MakeNativePeerMethod<decltype(MethodPtr), (MethodPtr)>(name) - //Register the peer + // Register the peer jni::RegisterNativePeer<Source>(env, Source::javaClass, "nativePtr", METHOD(&Source::getId, "nativeGetId") ); } -} //android -} //mbgl
\ No newline at end of file +} // namespace android +} // namespace mbgl diff --git a/platform/android/src/style/sources/source.hpp b/platform/android/src/style/sources/source.hpp index 0e5d354d93..9a9d504d68 100644 --- a/platform/android/src/style/sources/source.hpp +++ b/platform/android/src/style/sources/source.hpp @@ -46,22 +46,18 @@ public: jni::String getId(jni::JNIEnv&); protected: - //Release the owned view and return it + // Release the owned view and return it std::unique_ptr<mbgl::style::Source> releaseCoreSource(); - //Set on newly created sources until added to the map + // Set on newly created sources until added to the map std::unique_ptr<mbgl::style::Source> ownedSource; - //Raw pointer that is valid until the source is removed from the map + // Raw pointer that is valid until the source is removed from the map mbgl::style::Source& source; - //Map pointer is valid for newly created sources only after adding to the map + // Map pointer is valid for newly created sources only after adding to the map mbgl::Map* map; }; -} //android -} //mbgl - - - - +} // namespace android +} // namespace mbgl diff --git a/platform/android/src/style/sources/sources.cpp b/platform/android/src/style/sources/sources.cpp index 210acd607f..cae4bb47b2 100644 --- a/platform/android/src/style/sources/sources.cpp +++ b/platform/android/src/style/sources/sources.cpp @@ -43,4 +43,4 @@ void registerNativeSources(jni::JNIEnv& env) { } } -}
\ No newline at end of file +} diff --git a/platform/android/src/style/sources/sources.hpp b/platform/android/src/style/sources/sources.hpp index 3038873733..09a8b35067 100644 --- a/platform/android/src/style/sources/sources.hpp +++ b/platform/android/src/style/sources/sources.hpp @@ -9,12 +9,12 @@ namespace mbgl { namespace android { - + mbgl::android::Source* initializeSourcePeer(mbgl::Map&, mbgl::style::Source&); - + jni::jobject* createJavaSourcePeer(jni::JNIEnv&, mbgl::Map&, mbgl::style::Source&); - + void registerNativeSources(jni::JNIEnv&); } -}
\ No newline at end of file +} diff --git a/platform/android/src/style/sources/vector_source.cpp b/platform/android/src/style/sources/vector_source.cpp index 0d065a3348..e60d8d4641 100644 --- a/platform/android/src/style/sources/vector_source.cpp +++ b/platform/android/src/style/sources/vector_source.cpp @@ -35,12 +35,12 @@ namespace android { } void VectorSource::registerNative(jni::JNIEnv& env) { - //Lookup the class + // Lookup the class VectorSource::javaClass = *jni::Class<VectorSource>::Find(env).NewGlobalRef(env).release(); #define METHOD(MethodPtr, name) jni::MakeNativePeerMethod<decltype(MethodPtr), (MethodPtr)>(name) - //Register the peer + // Register the peer jni::RegisterNativePeer<VectorSource>( env, VectorSource::javaClass, "nativePtr", std::make_unique<VectorSource, JNIEnv&, jni::String, jni::Object<>>, diff --git a/platform/android/src/style/value.cpp b/platform/android/src/style/value.cpp index c8aad1682b..0b5d81feb1 100644 --- a/platform/android/src/style/value.cpp +++ b/platform/android/src/style/value.cpp @@ -20,7 +20,7 @@ namespace android { JNIEnv& env; }; - //Instance + // Instance Value::Value(jni::JNIEnv& env, jni::jobject* _value) : jenv(env), value(_value, ObjectDeleter(env)) {} diff --git a/platform/android/src/test/Main.java b/platform/android/src/test/Main.java index b6f540f666..b0f3aeb7b9 100644 --- a/platform/android/src/test/Main.java +++ b/platform/android/src/test/Main.java @@ -3,13 +3,13 @@ public class Main { public native void runAllTests(String[] args); public static void main(String[] args) throws Exception { - //Load the tests + // Load the tests System.loadLibrary("mbgl-test"); - //Run the tests + // Run the tests new Main().runAllTests(args); - //Exit explicitly otherwise dalvikvm won't quit + // Exit explicitly otherwise dalvikvm won't quit System.exit(0); } } diff --git a/platform/android/src/timer.cpp b/platform/android/src/timer.cpp index 2eb003b2bd..2d9ee49e9b 100644 --- a/platform/android/src/timer.cpp +++ b/platform/android/src/timer.cpp @@ -23,7 +23,7 @@ public: repeat = repeat_; task = std::move(task_); - //Prevent overflows when timeout is set to Duration::max() + // Prevent overflows when timeout is set to Duration::max() due = (timeout == Duration::max()) ? std::chrono::time_point<Clock>::max() : Clock::now() + timeout; loop->addRunnable(this); } diff --git a/platform/darwin/mbgl/storage/reachability.h b/platform/darwin/mbgl/storage/reachability.h index 78e302eafc..e38c9b1e20 100644 --- a/platform/darwin/mbgl/storage/reachability.h +++ b/platform/darwin/mbgl/storage/reachability.h @@ -63,7 +63,7 @@ typedef void (^NetworkUnreachable)(MGLReachability * reachability); +(instancetype)reachabilityWithHostname:(NSString*)hostname; // This is identical to the function above, but is here to maintain -//compatibility with Apples original code. (see .m) +// compatibility with Apples original code. (see .m) +(instancetype)reachabilityWithHostName:(NSString*)hostname; +(instancetype)reachabilityForInternetConnection; +(instancetype)reachabilityWithAddress:(void *)hostAddress; diff --git a/platform/darwin/mbgl/storage/reachability.m b/platform/darwin/mbgl/storage/reachability.m index aa6746a2a9..2030e7ef71 100644 --- a/platform/darwin/mbgl/storage/reachability.m +++ b/platform/darwin/mbgl/storage/reachability.m @@ -242,10 +242,10 @@ static void TMReachabilityCallback(SCNetworkReachabilityRef target, SCNetworkRea // This is for the case where you flick the airplane mode; // you end up getting something like this: -//Reachability: WR ct----- -//Reachability: -- ------- -//Reachability: WR ct----- -//Reachability: -- ------- +// Reachability: WR ct----- +// Reachability: -- ------- +// Reachability: WR ct----- +// Reachability: -- ------- // We treat this as 4 UNREACHABLE triggers - really apple should do better than this #define testcase (kSCNetworkReachabilityFlagsConnectionRequired | kSCNetworkReachabilityFlagsTransientConnection) diff --git a/platform/darwin/scripts/generate-style-code.js b/platform/darwin/scripts/generate-style-code.js index 3998246580..4b04250070 100644 --- a/platform/darwin/scripts/generate-style-code.js +++ b/platform/darwin/scripts/generate-style-code.js @@ -31,7 +31,7 @@ _.forOwn(cocoaConventions, function (properties, kind) { } delete spec[kind][oldName]; spec[kind][newName] = property; - + // Update requirements in other properties. let updateRequirements = function (property, name) { let requires = property.requires || []; @@ -225,7 +225,7 @@ global.testHelperMessage = function (property, layerType, isFunction) { }; global.propertyDoc = function (propertyName, property, layerType, kind) { - // Match references to other property names & values. + // Match references to other property names & values. // Requires the format 'When `foo` is set to `bar`,'. let doc = property.doc.replace(/`([^`]+?)` is set to `([^`]+?)`/g, function (m, peerPropertyName, propertyValue, offset, str) { let otherProperty = camelizeWithLeadingLowercase(peerPropertyName); @@ -561,13 +561,13 @@ for (var layer of layers) { if (enumProperties.length) { layer.enumProperties = enumProperties; } - + let renamedProperties = {}; _.assign(renamedProperties, _.filter(layer.properties, prop => 'original' in prop || 'getter' in prop)); if (!_.isEmpty(renamedProperties)) { renamedPropertiesByLayerType[layer.type] = renamedProperties; } - + fs.writeFileSync(`platform/darwin/src/${prefix}${camelize(layer.type)}${suffix}.h`, duplicatePlatformDecls(layerH(layer))); fs.writeFileSync(`platform/darwin/src/${prefix}${camelize(layer.type)}${suffix}.mm`, layerM(layer)); fs.writeFileSync(`platform/darwin/test/${prefix}${camelize(layer.type)}${suffix}Tests.mm`, testLayers(layer)); diff --git a/platform/darwin/scripts/update-examples.js b/platform/darwin/scripts/update-examples.js index e6b747a460..404cda102a 100644 --- a/platform/darwin/scripts/update-examples.js +++ b/platform/darwin/scripts/update-examples.js @@ -10,9 +10,9 @@ const examplesSrc = fs.readFileSync('platform/darwin/test/MGLDocumentationExampl // /** Front matter to describe the example. **/ // func testMGLClass$member() { // ... -// //#-example-code +// // #-example-code // let sampleCode: String? -// //#-end-example-code +// // #-end-example-code // ... // } // @@ -35,16 +35,16 @@ function completeSymbolInSource(src, line, exampleCode) { // Split the file contents right before the symbol declaration (but after its documentation comment). let srcUpToSymbol = src.split('\n', line - 1).join('\n'); let srcFromSymbol = src.substr(srcUpToSymbol.length); - + // Match the documentation comment block that is not followed by the beginning or end of a declaration. let commentMatch = srcUpToSymbol.match(/\/\*\*\s*(?:[^*]|\*(?!\/))+?\s*\*\/[^;{}]*?$/); - + // Replace the Swift code block with the test method’s contents. let completedComment = commentMatch[0].replace(/^([ \t]*)```swift\n[^]*?```/m, function (m, indentation) { // Apply the original indentation to each line. return ('```swift\n' + exampleCode + '\n```').replace(/^/gm, indentation); }); - + // Splice the modified comment into the overall file contents. srcUpToSymbol = (srcUpToSymbol.substr(0, commentMatch.index) + completedComment + srcUpToSymbol.substr(commentMatch.index + commentMatch[0].length)); @@ -60,13 +60,13 @@ while ((match = exampleRegex.exec(examplesSrc)) !== null) { // Trim leading whitespace from the example code. exampleCode = exampleCode.replace(new RegExp('^' + indentation, 'gm'), ''); - + examples[testMethodName] = exampleCode; } function completeExamples(os) { console.log(`Installing ${os} SDK examples…`); - + let sdk = os === 'iOS' ? 'iphonesimulator' : 'macosx'; let sysroot = execFileSync('xcrun', ['--show-sdk-path', '--sdk', sdk]).toString().trim(); let umbrellaPath = `platform/${os.toLowerCase()}/src/Mapbox.h`; @@ -88,17 +88,17 @@ function completeExamples(os) { _.forEachRight(substructure['key.substructure'], function (substructure, idx, substructures) { completeSubstructure(substructure, idx, substructures, _.concat(symbolPath, substructure['key.name'])); }); - + let comment = substructure['key.doc.comment']; if (!comment || !comment.match(/^(?:\s*)```swift\n/m)) { return; } - + // Lazily read in the existing file. if (!src) { newSrc = src = fs.readFileSync(path, 'utf8'); } - + // Get the contents of the test method whose name matches the symbol path. let testMethodName = symbolPath.join('$').replace(/\$[+-]/, '$').replace(/:/g, '_'); let example = examples[testMethodName]; @@ -106,23 +106,23 @@ function completeExamples(os) { console.error(`MGLDocumentationExampleTests.${testMethodName}() not found.`); process.exit(1); } - + // Resolve conditional compilation blocks. example = example.replace(/^(\s*)#if\s+os\((iOS|macOS)\)\n([^]*?)(?:^\1#else\n([^]*?))?^\1#endif\b\n?/gm, function (m, indentation, ifOs, ifCase, elseCase) { return (os === ifOs ? ifCase : elseCase).replace(new RegExp('^ ', 'gm'), ''); }).replace(/\n$/, ''); - + // Insert the test method contents into the documentation comment just // above the substructure. let startLine = substructure['key.parsed_scope.start']; newSrc = completeSymbolInSource(newSrc, startLine, example); }); - + if (!src) { return; } - + // Write out the modified file contents. if (src === newSrc) { console.log('Skipping', path); diff --git a/platform/darwin/src/MGLAccountManager.h b/platform/darwin/src/MGLAccountManager.h index c1aebd879c..741cc323cb 100644 --- a/platform/darwin/src/MGLAccountManager.h +++ b/platform/darwin/src/MGLAccountManager.h @@ -17,17 +17,17 @@ MGL_EXPORT Set the <a href="https://www.mapbox.com/help/define-access-token/">Mapbox access token</a> to be used by all instances of MGLMapView in the current application. - + Mapbox-hosted vector tiles and styles require an API access token, which you can obtain from the <a href="https://www.mapbox.com/studio/account/tokens/">Mapbox account page</a>. Access tokens associate requests to Mapbox’s vector tile and style APIs with your Mapbox account. They also deter other developers from using your styles without your permission. - + @param accessToken A Mapbox access token. Calling this method with a value of `nil` has no effect. - + @note You must set the access token before attempting to load any Mapbox-hosted style. Therefore, you should generally set it before creating an instance of MGLMapView. The recommended way to set an access token is to add an entry to diff --git a/platform/darwin/src/MGLAccountManager.m b/platform/darwin/src/MGLAccountManager.m index 31baf4e249..0f5d033031 100644 --- a/platform/darwin/src/MGLAccountManager.m +++ b/platform/darwin/src/MGLAccountManager.m @@ -65,7 +65,7 @@ if (!accessToken.length) { return; } - + [MGLAccountManager sharedManager].accessToken = accessToken; #if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR diff --git a/platform/darwin/src/MGLAnnotation.h b/platform/darwin/src/MGLAnnotation.h index 4c8f600240..a0a58e83a6 100644 --- a/platform/darwin/src/MGLAnnotation.h +++ b/platform/darwin/src/MGLAnnotation.h @@ -13,7 +13,7 @@ NS_ASSUME_NONNULL_BEGIN the visual representation of the annotation but typically coordinate (in conjunction with the map view’s delegate) the creation of an appropriate objects to handle the display. - + An object that adopts this protocol must implement the `coordinate` property. The other methods of this protocol are optional. */ @@ -33,7 +33,7 @@ NS_ASSUME_NONNULL_BEGIN /** The string containing the annotation’s title. - + Although this property is optional, if you support the selection of annotations in your map view, you are expected to provide this property. This string is displayed in the callout for the associated annotation. @@ -42,7 +42,7 @@ NS_ASSUME_NONNULL_BEGIN /** The string containing the annotation’s subtitle. - + This string is displayed in the callout for the associated annotation. */ @property (nonatomic, readonly, copy, nullable) NSString *subtitle; diff --git a/platform/darwin/src/MGLAttributionInfo.h b/platform/darwin/src/MGLAttributionInfo.h index c4e037059e..031a10060f 100644 --- a/platform/darwin/src/MGLAttributionInfo.h +++ b/platform/darwin/src/MGLAttributionInfo.h @@ -16,7 +16,7 @@ MGL_EXPORT /** Returns an initialized attribution info object with the given title and URL. - + @param title The attribution statement’s title. @param URL A URL to more information about the entity named in the attribution. @return An initialized attribution info object. @@ -30,7 +30,7 @@ MGL_EXPORT /** The URL to more information about the entity named in the attribution. - + If this property is set, the attribution statement should be displayed as a hyperlink or action button. Otherwise, if it is `nil`, the attribution statement should be displayed as plain text. @@ -40,7 +40,7 @@ MGL_EXPORT /** A Boolean value indicating whether the attribution statement is a shortcut to a feedback tool. - + If this property is set, the statement should be treated as a way for the user to provide feedback rather than an attribution statement. */ @@ -49,7 +49,7 @@ MGL_EXPORT /** Returns a copy of the `URL` property modified to account for the given center coordinate and zoom level. - + @param centerCoordinate The map’s center coordinate. @param zoomLevel The map’s zoom level. See the `MGLMapView.zoomLevel` property for more information. diff --git a/platform/darwin/src/MGLAttributionInfo.mm b/platform/darwin/src/MGLAttributionInfo.mm index 2546808b34..fa2ae787a5 100644 --- a/platform/darwin/src/MGLAttributionInfo.mm +++ b/platform/darwin/src/MGLAttributionInfo.mm @@ -18,7 +18,7 @@ if (!htmlString) { return @[]; } - + NSDictionary *options = @{ NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType, NSCharacterEncodingDocumentAttribute: @(NSUTF8StringEncoding), @@ -56,7 +56,7 @@ } NSString *styledHTML = [NSString stringWithFormat:@"<style type='text/css'>%@</style>%@", css, htmlString]; NSData *htmlData = [styledHTML dataUsingEncoding:NSUTF8StringEncoding]; - + #if TARGET_OS_IPHONE NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithData:htmlData options:options @@ -67,7 +67,7 @@ options:options documentAttributes:nil]; #endif - + NSMutableArray *infos = [NSMutableArray array]; [attributedString enumerateAttribute:NSLinkAttributeName inRange:attributedString.mgl_wholeRange @@ -75,7 +75,7 @@ usingBlock: ^(id _Nullable value, NSRange range, BOOL * _Nonnull stop) { NSCAssert(!value || [value isKindOfClass:[NSURL class]], @"If present, URL attribute must be an NSURL."); - + // Detect feedback links by the bogus style rule applied above. NSNumber *strokeWidth = [attributedString attribute:NSStrokeWidthAttributeName atIndex:range.location @@ -85,14 +85,14 @@ isFeedbackLink = YES; [attributedString removeAttribute:NSStrokeWidthAttributeName range:range]; } - + // Omit whitespace-only strings. NSAttributedString *title = [[attributedString attributedSubstringFromRange:range] mgl_attributedStringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; if (!title.length) { return; } - + MGLAttributionInfo *info = [[MGLAttributionInfo alloc] initWithTitle:title URL:value]; info.feedbackLink = isFeedbackLink; [infos addObject:info]; @@ -124,7 +124,7 @@ if (!self.feedbackLink) { return nil; } - + NSURLComponents *components = [NSURLComponents componentsWithURL:self.URL resolvingAgainstBaseURL:NO]; components.fragment = [NSString stringWithFormat:@"/%.5f/%.5f/%i", centerCoordinate.longitude, centerCoordinate.latitude, (int)round(zoomLevel + 1)]; @@ -142,7 +142,7 @@ /** Returns whether the given attribution info object overlaps with the receiver by its plain text title. - + @return `NSOrderedAscending` if the given object is a superset of the receiver, `NSOrderedDescending` if it is a subset of the receiver, or `NSOrderedSame` if there is no overlap. @@ -179,14 +179,14 @@ didInsertInfo = YES; } break; - + case NSOrderedAscending: // The info object we’re adding is a subset of the existing one. // Don’t add the object and stop looking. shouldAddInfo = NO; *stop = YES; break; - + default: break; } diff --git a/platform/darwin/src/MGLAttributionInfo_Private.h b/platform/darwin/src/MGLAttributionInfo_Private.h index c9a428b571..4b28fa5266 100644 --- a/platform/darwin/src/MGLAttributionInfo_Private.h +++ b/platform/darwin/src/MGLAttributionInfo_Private.h @@ -11,7 +11,7 @@ NS_ASSUME_NONNULL_BEGIN /** Parses and returns the attribution infos contained in the given HTML source code string. - + @param htmlString The HTML source code to parse. @param fontSize The default text size in points. @param linkColor The default link color. @@ -28,7 +28,7 @@ NS_ASSUME_NONNULL_BEGIN Adds the given attribution info object to the receiver as long as it isn’t redundant to any object already in the receiver. Any existing object that is redundant to the given object is replaced by the given object. - + @param info The info object to add to the receiver. @return True if the given info object was added to the receiver. */ @@ -38,7 +38,7 @@ NS_ASSUME_NONNULL_BEGIN Adds each of the given attribution info objects to the receiver as long as it isn’t redundant to any object already in the receiver. Any existing object that is redundant to the given object is replaced by the given object. - + @param infos An array of info objects to add to the receiver. */ - (void)growArrayByAddingAttributionInfosFromArray:(NS_ARRAY_OF(MGLAttributionInfo *) *)infos; diff --git a/platform/darwin/src/MGLBackgroundStyleLayer.h b/platform/darwin/src/MGLBackgroundStyleLayer.h index 06d7c9ee08..60090ebfef 100644 --- a/platform/darwin/src/MGLBackgroundStyleLayer.h +++ b/platform/darwin/src/MGLBackgroundStyleLayer.h @@ -1,4 +1,4 @@ -// This file is generated. +// This file is generated. // Edit platform/darwin/scripts/generate-style-code.js, then run `make style-code-darwin`. #import "MGLFoundation.h" @@ -13,11 +13,11 @@ NS_ASSUME_NONNULL_BEGIN map content. If the style’s other layers use the Mapbox Streets source, the background style layer is responsible for drawing land, whereas the oceans and other bodies of water are drawn by `MGLFillStyleLayer` objects. - + A background style layer is typically the bottommost layer in a style, because it covers the entire map and can occlude any layers below it. You can therefore access it by getting the last item in the `MGLStyle.layers` array. - + If the background style layer is transparent or omitted from the style, any portion of the map view that does not show another style layer is transparent. */ @@ -31,11 +31,11 @@ MGL_EXPORT #if TARGET_OS_IPHONE /** The color with which the background will be drawn. - + The default value of this property is an `MGLStyleValue` object containing `UIColor.blackColor`. Set this property to `nil` to reset it to the default value. - + This property is only applied to the style if `backgroundPattern` is set to `nil`. Otherwise, it is ignored. */ @@ -43,11 +43,11 @@ MGL_EXPORT #else /** The color with which the background will be drawn. - + The default value of this property is an `MGLStyleValue` object containing `NSColor.blackColor`. Set this property to `nil` to reset it to the default value. - + This property is only applied to the style if `backgroundPattern` is set to `nil`. Otherwise, it is ignored. */ @@ -56,7 +56,7 @@ MGL_EXPORT /** The opacity at which the background will be drawn. - + The default value of this property is an `MGLStyleValue` object containing an `NSNumber` object containing the float `1`. Set this property to `nil` to reset it to the default value. diff --git a/platform/darwin/src/MGLBackgroundStyleLayer.mm b/platform/darwin/src/MGLBackgroundStyleLayer.mm index caf8ca9681..9c359c2db6 100644 --- a/platform/darwin/src/MGLBackgroundStyleLayer.mm +++ b/platform/darwin/src/MGLBackgroundStyleLayer.mm @@ -1,4 +1,4 @@ -// This file is generated. +// This file is generated. // Edit platform/darwin/scripts/generate-style-code.js, then run `make darwin-style-code`. #import "MGLSource.h" diff --git a/platform/darwin/src/MGLCircleStyleLayer.h b/platform/darwin/src/MGLCircleStyleLayer.h index 8d8c4588e7..5f6fa313fb 100644 --- a/platform/darwin/src/MGLCircleStyleLayer.h +++ b/platform/darwin/src/MGLCircleStyleLayer.h @@ -1,4 +1,4 @@ -// This file is generated. +// This file is generated. // Edit platform/darwin/scripts/generate-style-code.js, then run `make style-code-darwin`. #import "MGLFoundation.h" @@ -9,7 +9,7 @@ NS_ASSUME_NONNULL_BEGIN /** Controls the scaling behavior of the circle when the map is pitched. - + Values of this type are used in the `MGLCircleStyleLayer.circleScaleAlignment` property. */ @@ -26,7 +26,7 @@ typedef NS_ENUM(NSUInteger, MGLCircleScaleAlignment) { /** Controls the translation reference point. - + Values of this type are used in the `MGLCircleStyleLayer.circleTranslationAnchor` property. */ @@ -44,25 +44,25 @@ typedef NS_ENUM(NSUInteger, MGLCircleTranslationAnchor) { /** An `MGLCircleStyleLayer` is a style layer that renders one or more filled circles on the map. - + Use a circle style layer to configure the visual appearance of point or point collection features in vector tiles loaded by an `MGLVectorSource` object or `MGLPointAnnotation`, `MGLPointFeature`, `MGLPointCollection`, or `MGLPointCollectionFeature` instances in an `MGLShapeSource` object. - + A circle style layer renders circles whose radii are measured in screen units. To display circles on the map whose radii correspond to real-world distances, use many-sided regular polygons and configure their appearance using an `MGLFillStyleLayer` object. - + You can access an existing circle style layer using the `-[MGLStyle layerWithIdentifier:]` method if you know its identifier; otherwise, find it using the `MGLStyle.layers` property. You can also create a new circle style layer and add it to the style using a method such as `-[MGLStyle addLayer:]`. - + ### Example - + ```swift let layer = MGLCircleStyleLayer(identifier: "circles", source: population) layer.sourceLayerIdentifier = "population" @@ -84,7 +84,7 @@ MGL_EXPORT /** Amount to blur the circle. 1 blurs the circle such that only the centerpoint is full opacity. - + The default value of this property is an `MGLStyleValue` object containing an `NSNumber` object containing the float `0`. Set this property to `nil` to reset it to the default value. @@ -94,7 +94,7 @@ MGL_EXPORT #if TARGET_OS_IPHONE /** The fill color of the circle. - + The default value of this property is an `MGLStyleValue` object containing `UIColor.blackColor`. Set this property to `nil` to reset it to the default value. @@ -103,7 +103,7 @@ MGL_EXPORT #else /** The fill color of the circle. - + The default value of this property is an `MGLStyleValue` object containing `NSColor.blackColor`. Set this property to `nil` to reset it to the default value. @@ -113,7 +113,7 @@ MGL_EXPORT /** The opacity at which the circle will be drawn. - + The default value of this property is an `MGLStyleValue` object containing an `NSNumber` object containing the float `1`. Set this property to `nil` to reset it to the default value. @@ -122,9 +122,9 @@ MGL_EXPORT /** Circle radius. - + This property is measured in points. - + The default value of this property is an `MGLStyleValue` object containing an `NSNumber` object containing the float `5`. Set this property to `nil` to reset it to the default value. @@ -133,11 +133,11 @@ MGL_EXPORT /** Controls the scaling behavior of the circle when the map is pitched. - + The default value of this property is an `MGLStyleValue` object containing an `NSValue` object containing `MGLCircleScaleAlignmentMap`. Set this property to `nil` to reset it to the default value. - + This attribute corresponds to the <a href="https://www.mapbox.com/mapbox-gl-style-spec/#paint-circle-pitch-scale"><code>circle-pitch-scale</code></a> layout property in the Mapbox Style Specification. @@ -149,7 +149,7 @@ MGL_EXPORT #if TARGET_OS_IPHONE /** The stroke color of the circle. - + The default value of this property is an `MGLStyleValue` object containing `UIColor.blackColor`. Set this property to `nil` to reset it to the default value. @@ -158,7 +158,7 @@ MGL_EXPORT #else /** The stroke color of the circle. - + The default value of this property is an `MGLStyleValue` object containing `NSColor.blackColor`. Set this property to `nil` to reset it to the default value. @@ -168,7 +168,7 @@ MGL_EXPORT /** The opacity of the circle's stroke. - + The default value of this property is an `MGLStyleValue` object containing an `NSNumber` object containing the float `1`. Set this property to `nil` to reset it to the default value. @@ -178,9 +178,9 @@ MGL_EXPORT /** The width of the circle's stroke. Strokes are placed outside of the "circle-radius". - + This property is measured in points. - + The default value of this property is an `MGLStyleValue` object containing an `NSNumber` object containing the float `0`. Set this property to `nil` to reset it to the default value. @@ -190,13 +190,13 @@ MGL_EXPORT #if TARGET_OS_IPHONE /** The geometry's offset. - + This property is measured in points. - + The default value of this property is an `MGLStyleValue` object containing an `NSValue` object containing a `CGVector` struct set to 0 points rightward and 0 points downward. Set this property to `nil` to reset it to the default value. - + This attribute corresponds to the <a href="https://www.mapbox.com/mapbox-gl-style-spec/#paint-circle-translate"><code>circle-translate</code></a> layout property in the Mapbox Style Specification. @@ -205,13 +205,13 @@ MGL_EXPORT #else /** The geometry's offset. - + This property is measured in points. - + The default value of this property is an `MGLStyleValue` object containing an `NSValue` object containing a `CGVector` struct set to 0 points rightward and 0 points upward. Set this property to `nil` to reset it to the default value. - + This attribute corresponds to the <a href="https://www.mapbox.com/mapbox-gl-style-spec/#paint-circle-translate"><code>circle-translate</code></a> layout property in the Mapbox Style Specification. @@ -223,14 +223,14 @@ MGL_EXPORT /** Controls the translation reference point. - + The default value of this property is an `MGLStyleValue` object containing an `NSValue` object containing `MGLCircleTranslationAnchorMap`. Set this property to `nil` to reset it to the default value. - + This property is only applied to the style if `circleTranslation` is non-`nil`. Otherwise, it is ignored. - + This attribute corresponds to the <a href="https://www.mapbox.com/mapbox-gl-style-spec/#paint-circle-translate-anchor"><code>circle-translate-anchor</code></a> layout property in the Mapbox Style Specification. diff --git a/platform/darwin/src/MGLCircleStyleLayer.mm b/platform/darwin/src/MGLCircleStyleLayer.mm index adc5ed8dd3..4a639db995 100644 --- a/platform/darwin/src/MGLCircleStyleLayer.mm +++ b/platform/darwin/src/MGLCircleStyleLayer.mm @@ -1,4 +1,4 @@ -// This file is generated. +// This file is generated. // Edit platform/darwin/scripts/generate-style-code.js, then run `make darwin-style-code`. #import "MGLSource.h" @@ -59,7 +59,7 @@ namespace mbgl { - (NSString *)sourceIdentifier { MGLAssertStyleLayerIsValid(); - + return @(self.rawLayer->getSourceID().c_str()); } diff --git a/platform/darwin/src/MGLClockDirectionFormatter.h b/platform/darwin/src/MGLClockDirectionFormatter.h index a428f51c63..86a9452846 100644 --- a/platform/darwin/src/MGLClockDirectionFormatter.h +++ b/platform/darwin/src/MGLClockDirectionFormatter.h @@ -10,7 +10,7 @@ NS_ASSUME_NONNULL_BEGIN of headings relative to the user, known as <i>clock positions</i>. For example, a value of `90` may be formatted as “3 o’clock”, depending on the locale. - + Use this class to create localized heading strings when displaying directions relative to the user’s current location and heading. To format a direction irrespective of the user’s orientation, use `MGLCompassDirectionFormatter` @@ -21,14 +21,14 @@ MGL_EXPORT /** The unit style used by this formatter. - + This property defaults to `NSFormattingUnitStyleMedium`. */ @property (nonatomic) NSFormattingUnitStyle unitStyle; /** Returns a clock position string for the provided value. - + @param direction The heading, measured in degrees, where 0° means “straight ahead” and 90° means “directly to your right”. @return The clock position string appropriately formatted for the receiver’s diff --git a/platform/darwin/src/MGLClockDirectionFormatter.m b/platform/darwin/src/MGLClockDirectionFormatter.m index fd67968e65..62a0ea995d 100644 --- a/platform/darwin/src/MGLClockDirectionFormatter.m +++ b/platform/darwin/src/MGLClockDirectionFormatter.m @@ -28,16 +28,16 @@ case NSFormattingUnitStyleShort: format = NSLocalizedStringWithDefaultValue(@"CLOCK_FMT_SHORT", @"Foundation", nil, @"%@:00", @"Clock position format, short: {hours}:00"); break; - + case NSFormattingUnitStyleMedium: format = NSLocalizedStringWithDefaultValue(@"CLOCK_FMT_MEDIUM", @"Foundation", nil, @"%@ o’clock", @"Clock position format, medium: {hours} o’clock"); - + break; - + case NSFormattingUnitStyleLong: format = NSLocalizedStringWithDefaultValue(@"CLOCK_FMT_LONG", @"Foundation", nil, @"%@ o’clock", @"Clock position format, long: {hours} o’clock"); break; - + default: break; } diff --git a/platform/darwin/src/MGLCompassDirectionFormatter.h b/platform/darwin/src/MGLCompassDirectionFormatter.h index 714e1cc035..b4a3087509 100644 --- a/platform/darwin/src/MGLCompassDirectionFormatter.h +++ b/platform/darwin/src/MGLCompassDirectionFormatter.h @@ -9,7 +9,7 @@ NS_ASSUME_NONNULL_BEGIN The `MGLCompassDirectionFormatter` class provides properly formatted descriptions of absolute headings. For example, a value of `90` may be formatted as “east”, depending on the locale. - + Use this class to create localized heading strings when displaying directions irrespective of the user’s current location. To format a direction relative to the user’s current location, use `MGLClockDirectionFormatter` instead. @@ -19,14 +19,14 @@ MGL_EXPORT /** The unit style used by this formatter. - + This property defaults to `NSFormattingUnitStyleMedium`. */ @property (nonatomic) NSFormattingUnitStyle unitStyle; /** Returns a heading string for the provided value. - + @param direction The heading, measured in degrees, where 0° means “due north” and 90° means “due east”. @return The heading string appropriately formatted for the formatter’s locale. diff --git a/platform/darwin/src/MGLCompassDirectionFormatter.m b/platform/darwin/src/MGLCompassDirectionFormatter.m index c46fe9e4d5..5f0cfae6f7 100644 --- a/platform/darwin/src/MGLCompassDirectionFormatter.m +++ b/platform/darwin/src/MGLCompassDirectionFormatter.m @@ -28,7 +28,7 @@ NSLocalizedStringWithDefaultValue(@"COMPASS_NEbE_SHORT", @"Foundation", nil, @"NEbE", @"Northeast by east, short"), NSLocalizedStringWithDefaultValue(@"COMPASS_ENE_SHORT", @"Foundation", nil, @"ENE", @"East-northeast, short"), NSLocalizedStringWithDefaultValue(@"COMPASS_EbN_SHORT", @"Foundation", nil, @"EbN", @"East by north, short"), - + NSLocalizedStringWithDefaultValue(@"COMPASS_E_SHORT", @"Foundation", nil, @"E", @"East, short"), NSLocalizedStringWithDefaultValue(@"COMPASS_EbS_SHORT", @"Foundation", nil, @"EbS", @"East by south, short"), NSLocalizedStringWithDefaultValue(@"COMPASS_ESE_SHORT", @"Foundation", nil, @"ESE", @"East-southeast, short"), @@ -37,7 +37,7 @@ NSLocalizedStringWithDefaultValue(@"COMPASS_SEbS_SHORT", @"Foundation", nil, @"SEbS", @"Southeast by south, short"), NSLocalizedStringWithDefaultValue(@"COMPASS_SSE_SHORT", @"Foundation", nil, @"SSE", @"South-southeast, short"), NSLocalizedStringWithDefaultValue(@"COMPASS_SbE_SHORT", @"Foundation", nil, @"SbE", @"South by east, short"), - + NSLocalizedStringWithDefaultValue(@"COMPASS_S_SHORT", @"Foundation", nil, @"S", @"South, short"), NSLocalizedStringWithDefaultValue(@"COMPASS_SbW_SHORT", @"Foundation", nil, @"SbW", @"South by west, short"), NSLocalizedStringWithDefaultValue(@"COMPASS_SSW_SHORT", @"Foundation", nil, @"SSW", @"South-southwest, short"), @@ -46,7 +46,7 @@ NSLocalizedStringWithDefaultValue(@"COMPASS_SWbW_SHORT", @"Foundation", nil, @"SWbW", @"Southwest by west, short"), NSLocalizedStringWithDefaultValue(@"COMPASS_WSW_SHORT", @"Foundation", nil, @"WSW", @"West-southwest, short"), NSLocalizedStringWithDefaultValue(@"COMPASS_WbS_SHORT", @"Foundation", nil, @"WbS", @"West by south, short"), - + NSLocalizedStringWithDefaultValue(@"COMPASS_W_SHORT", @"Foundation", nil, @"W", @"West, short"), NSLocalizedStringWithDefaultValue(@"COMPASS_WbN_SHORT", @"Foundation", nil, @"WbN", @"West by north, short"), NSLocalizedStringWithDefaultValue(@"COMPASS_WNW_SHORT", @"Foundation", nil, @"WNW", @"West-northwest, short"), @@ -56,7 +56,7 @@ NSLocalizedStringWithDefaultValue(@"COMPASS_NNW_SHORT", @"Foundation", nil, @"NNW", @"North-northwest, short"), NSLocalizedStringWithDefaultValue(@"COMPASS_NbW_SHORT", @"Foundation", nil, @"NbW", @"North by west, short"), ]; - + longStrings = @[ NSLocalizedStringWithDefaultValue(@"COMPASS_N_LONG", @"Foundation", nil, @"north", @"North, long"), NSLocalizedStringWithDefaultValue(@"COMPASS_NbE_LONG", @"Foundation", nil, @"north by east", @"North by east, long"), @@ -66,7 +66,7 @@ NSLocalizedStringWithDefaultValue(@"COMPASS_NEbE_LONG", @"Foundation", nil, @"northeast by east", @"Northeast by east, long"), NSLocalizedStringWithDefaultValue(@"COMPASS_ENE_LONG", @"Foundation", nil, @"east-northeast", @"East-northeast, long"), NSLocalizedStringWithDefaultValue(@"COMPASS_EbN_LONG", @"Foundation", nil, @"east by north", @"East by north, long"), - + NSLocalizedStringWithDefaultValue(@"COMPASS_E_LONG", @"Foundation", nil, @"east", @"East, long"), NSLocalizedStringWithDefaultValue(@"COMPASS_EbS_LONG", @"Foundation", nil, @"east by south", @"East by south, long"), NSLocalizedStringWithDefaultValue(@"COMPASS_ESE_LONG", @"Foundation", nil, @"east-southeast", @"East-southeast, long"), @@ -75,7 +75,7 @@ NSLocalizedStringWithDefaultValue(@"COMPASS_SEbS_LONG", @"Foundation", nil, @"southeast by south", @"Southeast by south, long"), NSLocalizedStringWithDefaultValue(@"COMPASS_SSE_LONG", @"Foundation", nil, @"south-southeast", @"South-southeast, long"), NSLocalizedStringWithDefaultValue(@"COMPASS_SbE_LONG", @"Foundation", nil, @"south by east", @"South by east, long"), - + NSLocalizedStringWithDefaultValue(@"COMPASS_S_LONG", @"Foundation", nil, @"south", @"South, long"), NSLocalizedStringWithDefaultValue(@"COMPASS_SbW_LONG", @"Foundation", nil, @"south by west", @"South by west, long"), NSLocalizedStringWithDefaultValue(@"COMPASS_SSW_LONG", @"Foundation", nil, @"south-southwest", @"South-southwest, long"), @@ -84,7 +84,7 @@ NSLocalizedStringWithDefaultValue(@"COMPASS_SWbW_LONG", @"Foundation", nil, @"southwest by west", @"Southwest by west, long"), NSLocalizedStringWithDefaultValue(@"COMPASS_WSW_LONG", @"Foundation", nil, @"west-southwest", @"West-southwest, long"), NSLocalizedStringWithDefaultValue(@"COMPASS_WbS_LONG", @"Foundation", nil, @"west by south", @"West by south, long"), - + NSLocalizedStringWithDefaultValue(@"COMPASS_W_LONG", @"Foundation", nil, @"west", @"West, long"), NSLocalizedStringWithDefaultValue(@"COMPASS_WbN_LONG", @"Foundation", nil, @"west by north", @"West by north, long"), NSLocalizedStringWithDefaultValue(@"COMPASS_WNW_LONG", @"Foundation", nil, @"west-northwest", @"West-northwest, long"), @@ -94,15 +94,15 @@ NSLocalizedStringWithDefaultValue(@"COMPASS_NNW_LONG", @"Foundation", nil, @"north-northwest", @"North-northwest, long"), NSLocalizedStringWithDefaultValue(@"COMPASS_NbW_LONG", @"Foundation", nil, @"north by west", @"North by west, long"), ]; - + NSAssert(shortStrings.count == longStrings.count, @"Long and short compass direction string arrays must have the same size."); }); - + NSInteger cardinalPoint = wrap(round(wrap(direction, 0, 360) / 360 * shortStrings.count), 0, shortStrings.count); switch (self.unitStyle) { case NSFormattingUnitStyleShort: return shortStrings[cardinalPoint]; - + case NSFormattingUnitStyleMedium: case NSFormattingUnitStyleLong: return longStrings[cardinalPoint]; diff --git a/platform/darwin/src/MGLCoordinateFormatter.h b/platform/darwin/src/MGLCoordinateFormatter.h index c42c196d5a..63f0de8f19 100644 --- a/platform/darwin/src/MGLCoordinateFormatter.h +++ b/platform/darwin/src/MGLCoordinateFormatter.h @@ -15,7 +15,7 @@ MGL_EXPORT /** Determines whether the output may contain minutes of arc when nonzero. - + The default value of this property is `YES`, causing the receiver to include minutes of arc in its output. If `allowsSeconds` is `YES`, this property is ignored and the output always includes minutes of arc. @@ -24,7 +24,7 @@ MGL_EXPORT /** Determines whether the output may contain seconds of arc when nonzero. - + The default value of this property is `YES`, causing the receiver to include seconds of arc in its output. */ @@ -32,14 +32,14 @@ MGL_EXPORT /** The unit style used by this formatter. - + The default value of this property is `NSFormattingUnitStyleMedium`. */ @property (nonatomic) NSFormattingUnitStyle unitStyle; /** Returns a coordinate string for the provided value. - + @param coordinate The coordinate’s value. @return The coordinate string appropriately formatted for the formatter’s locale. diff --git a/platform/darwin/src/MGLCoordinateFormatter.m b/platform/darwin/src/MGLCoordinateFormatter.m index 682f771faa..fb577d3be3 100644 --- a/platform/darwin/src/MGLCoordinateFormatter.m +++ b/platform/darwin/src/MGLCoordinateFormatter.m @@ -28,7 +28,7 @@ negativeLongitudeFormat = NSLocalizedStringWithDefaultValue(@"COORD_W_SHORT", @"Foundation", nil, @"%@W", @"West longitude format, short: {longitude}"); stringFormat = NSLocalizedStringWithDefaultValue(@"COORD_FMT_SHORT", @"Foundation", nil, @"%@, %@", @"Coordinate pair format, short: {latitude}, {longitude}"); break; - + case NSFormattingUnitStyleMedium: positiveLatitudeFormat = NSLocalizedStringWithDefaultValue(@"COORD_N_MEDIUM", @"Foundation", nil, @"%@ north", @"North latitude format, medium: {latitude}"); negativeLatitudeFormat = NSLocalizedStringWithDefaultValue(@"COORD_S_MEDIUM", @"Foundation", nil, @"%@ south", @"South latitude format, medium: {latitude}"); @@ -36,7 +36,7 @@ negativeLongitudeFormat = NSLocalizedStringWithDefaultValue(@"COORD_W_MEDIUM", @"Foundation", nil, @"%@ west", @"West longitude format, medium: {longitude}"); stringFormat = NSLocalizedStringWithDefaultValue(@"COORD_FMT_MEDIUM", @"Foundation", nil, @"%@, %@", @"Coordinate pair format, medium: {latitude}, {longitude}"); break; - + case NSFormattingUnitStyleLong: positiveLatitudeFormat = NSLocalizedStringWithDefaultValue(@"COORD_N_LONG", @"Foundation", nil, @"%@ north", @"North latitude format, long: {latitude}"); negativeLatitudeFormat = NSLocalizedStringWithDefaultValue(@"COORD_S_LONG", @"Foundation", nil, @"%@ south", @"South latitude format, long: {latitude}"); @@ -57,7 +57,7 @@ - (NSString *)stringFromLocationDegrees:(CLLocationDegrees)degrees positiveFormat:(NSString *)positiveFormat negativeFormat:(NSString *)negativeFormat { CLLocationDegrees minutes = (fabs(degrees) - floor(fabs(degrees))) * 60; CLLocationDegrees seconds = (minutes - floor(minutes)) * 60; - + NSString *degreesFormat; NSString *minutesFormat; NSString *secondsFormat; @@ -71,7 +71,7 @@ degreesMinutesFormat = NSLocalizedStringWithDefaultValue(@"COORD_DM_SHORT", @"Foundation", nil, @"%@%@", @"Coordinate format, short: {degrees}{minutes}"); degreesMinutesSecondsFormat = NSLocalizedStringWithDefaultValue(@"COORD_DMS_SHORT", @"Foundation", nil, @"%@%@%@", @"Coordinate format, short: {degrees}{minutes}{seconds}"); break; - + case NSFormattingUnitStyleMedium: degreesFormat = NSLocalizedStringWithDefaultValue(@"COORD_DEG_MEDIUM", @"Foundation", nil, @"%d°", @"Degrees format, medium: {degrees}"); minutesFormat = NSLocalizedStringWithDefaultValue(@"COORD_MIN_MEDIUM", @"Foundation", nil, @"%d′", @"Minutes format, medium: {minutes}"); @@ -79,7 +79,7 @@ degreesMinutesFormat = NSLocalizedStringWithDefaultValue(@"COORD_DM_MEDIUM", @"Foundation", nil, @"%@%@", @"Coordinate format, medium: {degrees}{minutes}"); degreesMinutesSecondsFormat = NSLocalizedStringWithDefaultValue(@"COORD_DMS_MEDIUM", @"Foundation", nil, @"%@%@%@", @"Coordinate format, medium: {degrees}{minutes}{seconds}"); break; - + case NSFormattingUnitStyleLong: degreesFormat = NSLocalizedStringWithDefaultValue(@"COORD_DEG_LONG", @"Foundation", nil, @"%d degree(s)", @"Degrees format, long"); minutesFormat = NSLocalizedStringWithDefaultValue(@"COORD_MIN_LONG", @"Foundation", nil, @"%d minute(s)", @"Minutes format, long"); @@ -88,9 +88,9 @@ degreesMinutesSecondsFormat = NSLocalizedStringWithDefaultValue(@"COORD_DMS_LONG", @"Foundation", nil, @"%@, %@, and %@", @"Coordinate format, long: {degrees}{minutes}{seconds}"); break; } - + NSString *degreesString = [NSString stringWithFormat:degreesFormat, (int)floor(fabs(degrees))]; - + NSString *string; if (trunc(seconds) > 0 && self.allowsSeconds) { NSString *minutesString = [NSString stringWithFormat:minutesFormat, (int)floor(minutes)]; @@ -104,7 +104,7 @@ } else { string = [NSString stringWithFormat:degreesFormat, (int)round(fabs(degrees))]; } - + if (degrees == 0) { return string; } diff --git a/platform/darwin/src/MGLFeature.h b/platform/darwin/src/MGLFeature.h index 82dbb450cf..8ba5687480 100644 --- a/platform/darwin/src/MGLFeature.h +++ b/platform/darwin/src/MGLFeature.h @@ -14,14 +14,14 @@ NS_ASSUME_NONNULL_BEGIN contained in an `MGLShapeSource` or `MGLVectorSource` object. Each concrete subclass of `MGLShape` in turn has a subclass that conforms to this protocol. A feature object associates a shape with an optional identifier and attributes. - + 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. - + 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 @@ -33,12 +33,12 @@ NS_ASSUME_NONNULL_BEGIN /** An object that uniquely identifies the feature in its containing content source. - + You can configure an `MGLVectorStyleLayer` object to include or exclude a specific feature in an `MGLShapeSource` or `MGLVectorSource`. In the `MGLVectorStyleLayer.predicate` property, compare the special `$id` attribute to the feature’s identifier. - + In vector tiles loaded by `MGLVectorSource` objects, the identifier corresponds to the <a href="https://github.com/mapbox/vector-tile-spec/tree/master/2.1#42-features">feature identifier</a> @@ -46,7 +46,7 @@ NS_ASSUME_NONNULL_BEGIN this property is `nil`. If specified, the identifier may be an integer, floating-point number, or string. These data types are mapped to instances of the following Foundation classes: - + <table> <thead> <tr><th>In the tile source</th><th>This property</th></tr> @@ -57,12 +57,12 @@ NS_ASSUME_NONNULL_BEGIN <tr><td>String</td> <td><code>NSString</code></td></tr> </tbody> </table> - + For details about the identifiers used in most Mapbox-provided styles, consult the <a href="https://www.mapbox.com/vector-tiles/mapbox-streets/">Mapbox Streets</a> layer reference. - + The identifier should be set before adding the feature to an `MGLShapeSource` object; setting it afterwards has no effect on the map’s contents. While it is possible to change this value on feature instances obtained from @@ -73,7 +73,7 @@ NS_ASSUME_NONNULL_BEGIN /** A dictionary of attributes for this feature. - + You can configure an `MGLVectorStyleLayer` object to include or exclude a specific feature in an `MGLShapeSource` or `MGLVectorSource`. In the `MGLVectorStyleLayer.predicate` property, compare a key of the attribute @@ -82,20 +82,20 @@ NS_ASSUME_NONNULL_BEGIN a value above 50 to the important features’ `importance` attribute, then set `MGLVectorStyleLayer.predicate` to an `NSPredicate` with the format `importance > 50`. - + You can also configure some attributes of an `MGLSymbolStyleLayer` object to include the value of an attribute in this dictionary whenever it renders this feature. For example, to label features in an `MGLShapeSource` object by their names, you can assign a `name` attribute to each of the source’s features, then set `MGLSymbolStyleLayer.textField` to an `MGLStyleValue` object containing the string `{name}`. - + In vector tiles loaded by `MGLVectorSource` objects, the keys and values of each feature’s attribute dictionary are determined by the source. Each attribute name is a string, while each attribute value may be a null value, Boolean value, integer, floating-point number, or string. These data types are mapped to instances of the following Foundation classes: - + <table> <thead> <tr><th>In the tile source</th><th>In this dictionary</th></tr> @@ -108,14 +108,14 @@ NS_ASSUME_NONNULL_BEGIN <tr><td>String</td> <td><code>NSString</code></td></tr> </tbody> </table> - + For details about the attribute names and values found in Mapbox-provided vector tile sources, consult the <a href="https://www.mapbox.com/vector-tiles/mapbox-streets/">Mapbox Streets</a> and <a href="https://www.mapbox.com/vector-tiles/mapbox-terrain/">Mapbox Terrain</a> layer references. - + Note that while it is possible to change this value on feature instances obtained from `-[MGLMapView visibleFeaturesAtPoint:]` and related methods, there will be no effect on the map. Setting this value can be useful @@ -126,7 +126,7 @@ NS_ASSUME_NONNULL_BEGIN /** Returns the feature attribute for the given attribute name. - + See the `attributes` property’s documentation for details on keys and values associated with this method. */ @@ -135,10 +135,10 @@ NS_ASSUME_NONNULL_BEGIN /** Returns a dictionary that can be serialized as a GeoJSON Feature representation of an instance of an `MGLFeature` subclass. - - The dictionary includes a `geometry` key corresponding to the receiver’s - underlying geometry data, a `properties` key corresponding to the receiver’s - `attributes` property, and an `id` key corresponding to the receiver’s + + The dictionary includes a `geometry` key corresponding to the receiver’s + underlying geometry data, a `properties` key corresponding to the receiver’s + `attributes` property, and an `id` key corresponding to the receiver’s `identifier` property. */ - (NS_DICTIONARY_OF(NSString *, id) *)geoJSONDictionary; @@ -156,7 +156,7 @@ MGL_EXPORT /** An `MGLPolylineFeature` object associates a polyline shape with an optional identifier and attributes. - + A polyline feature is known as a <a href="https://tools.ietf.org/html/rfc7946#section-3.1.4">LineString</a> feature in GeoJSON. @@ -176,7 +176,7 @@ MGL_EXPORT /** An `MGLPointCollectionFeature` object associates a point collection with an optional identifier and attributes. - + A point collection feature is known as a <a href="https://tools.ietf.org/html/rfc7946#section-3.1.3">MultiPoint</a> feature in GeoJSON. @@ -191,7 +191,7 @@ MGL_EXPORT /** An `MGLMultiPolylineFeature` object associates a multipolyline shape with an optional identifier and attributes. - + A multipolyline feature is known as a <a href="https://tools.ietf.org/html/rfc7946#section-3.1.5">MultiLineString</a> feature in GeoJSON. @@ -211,7 +211,7 @@ MGL_EXPORT /** An `MGLShapeCollectionFeature` object associates a shape collection with an optional identifier and attributes. - + A shape collection feature is known as a <a href="https://tools.ietf.org/html/rfc7946#section-3.3">feature collection</a> in GeoJSON. diff --git a/platform/darwin/src/MGLFeature.mm b/platform/darwin/src/MGLFeature.mm index 3bd7eae535..e169ee19bb 100644 --- a/platform/darwin/src/MGLFeature.mm +++ b/platform/darwin/src/MGLFeature.mm @@ -225,21 +225,21 @@ public: feature.coordinate = toLocationCoordinate2D(geometry); return feature; } - + MGLShape <MGLFeature> * operator()(const mbgl::LineString<T> &geometry) const { std::vector<CLLocationCoordinate2D> coordinates = toLocationCoordinates2D(geometry); return [MGLPolylineFeature polylineWithCoordinates:&coordinates[0] count:coordinates.size()]; } - + MGLShape <MGLFeature> * operator()(const mbgl::Polygon<T> &geometry) const { return toShape<MGLPolygonFeature>(geometry); } - + MGLShape <MGLFeature> * operator()(const mbgl::MultiPoint<T> &geometry) const { std::vector<CLLocationCoordinate2D> coordinates = toLocationCoordinates2D(geometry); return [[MGLPointCollectionFeature alloc] initWithCoordinates:&coordinates[0] count:coordinates.size()]; } - + MGLShape <MGLFeature> * operator()(const mbgl::MultiLineString<T> &geometry) const { NSMutableArray *polylines = [NSMutableArray arrayWithCapacity:geometry.size()]; for (auto &lineString : geometry) { @@ -247,19 +247,19 @@ public: MGLPolyline *polyline = [MGLPolyline polylineWithCoordinates:&coordinates[0] count:coordinates.size()]; [polylines addObject:polyline]; } - + return [MGLMultiPolylineFeature multiPolylineWithPolylines:polylines]; } - + MGLShape <MGLFeature> * operator()(const mbgl::MultiPolygon<T> &geometry) const { NSMutableArray *polygons = [NSMutableArray arrayWithCapacity:geometry.size()]; for (auto &polygon : geometry) { [polygons addObject:toShape(polygon)]; } - + return [MGLMultiPolygonFeature multiPolygonWithPolygons:polygons]; } - + MGLShape <MGLFeature> * operator()(const mapbox::geometry::geometry_collection<T> &collection) const { NSMutableArray *shapes = [NSMutableArray arrayWithCapacity:collection.size()]; for (auto &geometry : collection) { @@ -269,19 +269,19 @@ public: } return [MGLShapeCollectionFeature shapeCollectionWithShapes:shapes]; } - + private: static CLLocationCoordinate2D toLocationCoordinate2D(const mbgl::Point<T> &point) { return CLLocationCoordinate2DMake(point.y, point.x); } - + static std::vector<CLLocationCoordinate2D> toLocationCoordinates2D(const std::vector<mbgl::Point<T>> &points) { std::vector<CLLocationCoordinate2D> coordinates; coordinates.reserve(points.size()); std::transform(points.begin(), points.end(), std::back_inserter(coordinates), toLocationCoordinate2D); return coordinates; } - + template<typename U = MGLPolygon> static U *toShape(const mbgl::Polygon<T> &geometry) { auto &linearRing = geometry.front(); @@ -296,7 +296,7 @@ private: [innerPolygons addObject:innerPolygon]; } } - + return [U polygonWithCoordinates:&coordinates[0] count:coordinates.size() interiorPolygons:innerPolygons]; } }; @@ -309,12 +309,12 @@ public: MGLShape <MGLFeature> *shape = mapbox::geometry::geometry<T>::visit(geometry, evaluator); return shape; } - + MGLShape <MGLFeature> * operator()(const mbgl::Feature &feature) const { MGLShape <MGLFeature> *shape = (MGLShape <MGLFeature> *)MGLFeatureFromMBGLFeature(feature); return shape; } - + MGLShape <MGLFeature> * operator()(const mbgl::FeatureCollection &collection) const { NSMutableArray *shapes = [NSMutableArray arrayWithCapacity:collection.size()]; for (const auto &feature : collection) { @@ -345,7 +345,7 @@ id <MGLFeature> MGLFeatureFromMBGLFeature(const mbgl::Feature &feature) { shape.identifier = mbgl::FeatureIdentifier::visit(*feature.id, ValueEvaluator()); } shape.attributes = attributes; - + return shape; } diff --git a/platform/darwin/src/MGLFeature_Private.h b/platform/darwin/src/MGLFeature_Private.h index 6751b3196a..4137200b98 100644 --- a/platform/darwin/src/MGLFeature_Private.h +++ b/platform/darwin/src/MGLFeature_Private.h @@ -28,7 +28,7 @@ MGLShape* MGLShapeFromGeoJSON(const mapbox::geojson::geojson &geojson); /** Takes an `mbgl::Feature` object, an identifer, and attributes dictionary and - returns the feature object with converted `mbgl::FeatureIdentifier` and + returns the feature object with converted `mbgl::FeatureIdentifier` and `mbgl::PropertyMap` properties. */ mbgl::Feature mbglFeature(mbgl::Feature feature, id identifier, NSDictionary *attributes); diff --git a/platform/darwin/src/MGLFillStyleLayer.h b/platform/darwin/src/MGLFillStyleLayer.h index 2ab02acf5a..f4ba7a0098 100644 --- a/platform/darwin/src/MGLFillStyleLayer.h +++ b/platform/darwin/src/MGLFillStyleLayer.h @@ -1,4 +1,4 @@ -// This file is generated. +// This file is generated. // Edit platform/darwin/scripts/generate-style-code.js, then run `make style-code-darwin`. #import "MGLFoundation.h" @@ -9,7 +9,7 @@ NS_ASSUME_NONNULL_BEGIN /** Controls the translation reference point. - + Values of this type are used in the `MGLFillStyleLayer.fillTranslationAnchor` property. */ @@ -27,20 +27,20 @@ typedef NS_ENUM(NSUInteger, MGLFillTranslationAnchor) { /** An `MGLFillStyleLayer` is a style layer that renders one or more filled (and optionally stroked) polygons on the map. - + Use a fill style layer to configure the visual appearance of polygon or multipolygon features in vector tiles loaded by an `MGLVectorSource` object or `MGLPolygon`, `MGLPolygonFeature`, `MGLMultiPolygon`, or `MGLMultiPolygonFeature` instances in an `MGLShapeSource` object. - + You can access an existing fill style layer using the `-[MGLStyle layerWithIdentifier:]` method if you know its identifier; otherwise, find it using the `MGLStyle.layers` property. You can also create a new fill style layer and add it to the style using a method such as `-[MGLStyle addLayer:]`. - + ### Example - + ```swift let layer = MGLFillStyleLayer(identifier: "parks", source: parks) layer.sourceLayerIdentifier = "parks" @@ -56,11 +56,11 @@ MGL_EXPORT /** Whether or not the fill should be antialiased. - + The default value of this property is an `MGLStyleValue` object containing an `NSNumber` object containing `YES`. Set this property to `nil` to reset it to the default value. - + This attribute corresponds to the <a href="https://www.mapbox.com/mapbox-gl-style-spec/#paint-fill-antialias"><code>fill-antialias</code></a> layout property in the Mapbox Style Specification. @@ -72,11 +72,11 @@ MGL_EXPORT #if TARGET_OS_IPHONE /** The color of the filled part of this layer. - + The default value of this property is an `MGLStyleValue` object containing `UIColor.blackColor`. Set this property to `nil` to reset it to the default value. - + This property is only applied to the style if `fillPattern` is set to `nil`. Otherwise, it is ignored. */ @@ -84,11 +84,11 @@ MGL_EXPORT #else /** The color of the filled part of this layer. - + The default value of this property is an `MGLStyleValue` object containing `NSColor.blackColor`. Set this property to `nil` to reset it to the default value. - + This property is only applied to the style if `fillPattern` is set to `nil`. Otherwise, it is ignored. */ @@ -98,7 +98,7 @@ MGL_EXPORT /** The opacity of the entire fill layer. In contrast to the `fillColor`, this value will also affect the 1pt stroke around the fill, if the stroke is used. - + The default value of this property is an `MGLStyleValue` object containing an `NSNumber` object containing the float `1`. Set this property to `nil` to reset it to the default value. @@ -108,7 +108,7 @@ MGL_EXPORT #if TARGET_OS_IPHONE /** The outline color of the fill. Matches the value of `fillColor` if unspecified. - + This property is only applied to the style if `fillPattern` is set to `nil`, and `fillAntialiased` is set to an `MGLStyleValue` object containing an `NSNumber` object containing `YES`. Otherwise, it is ignored. @@ -117,7 +117,7 @@ MGL_EXPORT #else /** The outline color of the fill. Matches the value of `fillColor` if unspecified. - + This property is only applied to the style if `fillPattern` is set to `nil`, and `fillAntialiased` is set to an `MGLStyleValue` object containing an `NSNumber` object containing `YES`. Otherwise, it is ignored. @@ -134,13 +134,13 @@ MGL_EXPORT #if TARGET_OS_IPHONE /** The geometry's offset. - + This property is measured in points. - + The default value of this property is an `MGLStyleValue` object containing an `NSValue` object containing a `CGVector` struct set to 0 points rightward and 0 points downward. Set this property to `nil` to reset it to the default value. - + This attribute corresponds to the <a href="https://www.mapbox.com/mapbox-gl-style-spec/#paint-fill-translate"><code>fill-translate</code></a> layout property in the Mapbox Style Specification. @@ -149,13 +149,13 @@ MGL_EXPORT #else /** The geometry's offset. - + This property is measured in points. - + The default value of this property is an `MGLStyleValue` object containing an `NSValue` object containing a `CGVector` struct set to 0 points rightward and 0 points upward. Set this property to `nil` to reset it to the default value. - + This attribute corresponds to the <a href="https://www.mapbox.com/mapbox-gl-style-spec/#paint-fill-translate"><code>fill-translate</code></a> layout property in the Mapbox Style Specification. @@ -167,14 +167,14 @@ MGL_EXPORT /** Controls the translation reference point. - + The default value of this property is an `MGLStyleValue` object containing an `NSValue` object containing `MGLFillTranslationAnchorMap`. Set this property to `nil` to reset it to the default value. - + This property is only applied to the style if `fillTranslation` is non-`nil`. Otherwise, it is ignored. - + This attribute corresponds to the <a href="https://www.mapbox.com/mapbox-gl-style-spec/#paint-fill-translate-anchor"><code>fill-translate-anchor</code></a> layout property in the Mapbox Style Specification. diff --git a/platform/darwin/src/MGLFillStyleLayer.mm b/platform/darwin/src/MGLFillStyleLayer.mm index 63a482ac2e..57014e6f60 100644 --- a/platform/darwin/src/MGLFillStyleLayer.mm +++ b/platform/darwin/src/MGLFillStyleLayer.mm @@ -1,4 +1,4 @@ -// This file is generated. +// This file is generated. // Edit platform/darwin/scripts/generate-style-code.js, then run `make darwin-style-code`. #import "MGLSource.h" @@ -54,7 +54,7 @@ namespace mbgl { - (NSString *)sourceIdentifier { MGLAssertStyleLayerIsValid(); - + return @(self.rawLayer->getSourceID().c_str()); } diff --git a/platform/darwin/src/MGLForegroundStyleLayer.h b/platform/darwin/src/MGLForegroundStyleLayer.h index 474e1f6307..87763f4634 100644 --- a/platform/darwin/src/MGLForegroundStyleLayer.h +++ b/platform/darwin/src/MGLForegroundStyleLayer.h @@ -10,7 +10,7 @@ NS_ASSUME_NONNULL_BEGIN /** `MGLForegroundStyleLayer` is an abstract superclass for style layers whose content is defined by an `MGLSource` object. - + Do not create instances of this class directly, and do not create your own subclasses of this class. Instead, create instances of `MGLRasterStyleLayer` and the concrete subclasses of `MGLVectorStyleLayer`. @@ -25,11 +25,11 @@ MGL_EXPORT /** Returns a foreground style layer initialized with an identifier and source. - + After initializing and configuring the style layer, add it to a map view’s style using the `-[MGLStyle addLayer:]` or `-[MGLStyle insertLayer:belowLayer:]` method. - + @param identifier A string that uniquely identifies the source in the style to which it is added. @param source The source from which to obtain the data to style. If the source diff --git a/platform/darwin/src/MGLGeometry.h b/platform/darwin/src/MGLGeometry.h index 408bdb2632..9fcb9dd37c 100644 --- a/platform/darwin/src/MGLGeometry.h +++ b/platform/darwin/src/MGLGeometry.h @@ -101,7 +101,7 @@ NS_INLINE MGLCoordinateBounds MGLCoordinateBoundsOffset(MGLCoordinateBounds boun /** Returns `YES` if the coordinate bounds covers no area. - + @note A bounds may be empty but have a non-zero coordinate span (e.g., when its northeast point lies due north of its southwest point). */ diff --git a/platform/darwin/src/MGLGeometry.mm b/platform/darwin/src/MGLGeometry.mm index 36e096dd03..8c0c5f9cb7 100644 --- a/platform/darwin/src/MGLGeometry.mm +++ b/platform/darwin/src/MGLGeometry.mm @@ -6,7 +6,7 @@ /** Vertical field of view, measured in degrees, for determining the altitude of the viewpoint. - + TransformState::getProjMatrix() has a variable vertical field of view that defaults to 2 arctan ⅓ rad ≈ 36.9° but MapKit uses a vertical field of view of 30°. flyTo() assumes a field of view of 2 arctan ½ rad. */ diff --git a/platform/darwin/src/MGLGeometry_Private.h b/platform/darwin/src/MGLGeometry_Private.h index fc57460128..e6b37b3530 100644 --- a/platform/darwin/src/MGLGeometry_Private.h +++ b/platform/darwin/src/MGLGeometry_Private.h @@ -45,7 +45,7 @@ NS_INLINE mbgl::EdgeInsets MGLEdgeInsetsFromNSEdgeInsets(NSEdgeInsets insets) { #endif /** Converts a map zoom level to a camera altitude. - + @param zoomLevel The zoom level to convert. @param pitch The camera pitch, measured in degrees. @param latitude The latitude of the point at the center of the viewport. @@ -54,7 +54,7 @@ NS_INLINE mbgl::EdgeInsets MGLEdgeInsetsFromNSEdgeInsets(NSEdgeInsets insets) { CLLocationDistance MGLAltitudeForZoomLevel(double zoomLevel, CGFloat pitch, CLLocationDegrees latitude, CGSize size); /** Converts a camera altitude to a map zoom level. - + @param altitude The altitude to convert, measured in meters. @param pitch The camera pitch, measured in degrees. @param latitude The latitude of the point at the center of the viewport. diff --git a/platform/darwin/src/MGLLineStyleLayer.h b/platform/darwin/src/MGLLineStyleLayer.h index 98f2778291..d8c8f6a466 100644 --- a/platform/darwin/src/MGLLineStyleLayer.h +++ b/platform/darwin/src/MGLLineStyleLayer.h @@ -1,4 +1,4 @@ -// This file is generated. +// This file is generated. // Edit platform/darwin/scripts/generate-style-code.js, then run `make style-code-darwin`. #import "MGLFoundation.h" @@ -9,7 +9,7 @@ NS_ASSUME_NONNULL_BEGIN /** The display of line endings. - + Values of this type are used in the `MGLLineStyleLayer.lineCap` property. */ @@ -34,7 +34,7 @@ typedef NS_ENUM(NSUInteger, MGLLineCap) { /** The display of lines when joining. - + Values of this type are used in the `MGLLineStyleLayer.lineJoin` property. */ @@ -59,7 +59,7 @@ typedef NS_ENUM(NSUInteger, MGLLineJoin) { /** Controls the translation reference point. - + Values of this type are used in the `MGLLineStyleLayer.lineTranslationAnchor` property. */ @@ -77,20 +77,20 @@ typedef NS_ENUM(NSUInteger, MGLLineTranslationAnchor) { /** An `MGLLineStyleLayer` is a style layer that renders one or more stroked polylines on the map. - + Use a line style layer to configure the visual appearance of polyline or multipolyline features in vector tiles loaded by an `MGLVectorSource` object or `MGLPolyline`, `MGLPolylineFeature`, `MGLMultiPolyline`, or `MGLMultiPolylineFeature` instances in an `MGLShapeSource` object. - + You can access an existing line style layer using the `-[MGLStyle layerWithIdentifier:]` method if you know its identifier; otherwise, find it using the `MGLStyle.layers` property. You can also create a new line style layer and add it to the style using a method such as `-[MGLStyle addLayer:]`. - + ### Example - + ```swift let layer = MGLLineStyleLayer(identifier: "trails-path", source: trails) layer.sourceLayerIdentifier = "trails" @@ -111,7 +111,7 @@ MGL_EXPORT /** The display of line endings. - + The default value of this property is an `MGLStyleValue` object containing an `NSValue` object containing `MGLLineCapButt`. Set this property to `nil` to reset it to the default value. @@ -120,7 +120,7 @@ MGL_EXPORT /** The display of lines when joining. - + The default value of this property is an `MGLStyleValue` object containing an `NSValue` object containing `MGLLineJoinMiter`. Set this property to `nil` to reset it to the default value. @@ -129,11 +129,11 @@ MGL_EXPORT /** Used to automatically convert miter joins to bevel joins for sharp angles. - + The default value of this property is an `MGLStyleValue` object containing an `NSNumber` object containing the float `2`. Set this property to `nil` to reset it to the default value. - + This property is only applied to the style if `lineJoin` is set to an `MGLStyleValue` object containing an `NSValue` object containing `MGLLineJoinMiter`. Otherwise, it is ignored. @@ -142,11 +142,11 @@ MGL_EXPORT /** Used to automatically convert round joins to miter joins for shallow angles. - + The default value of this property is an `MGLStyleValue` object containing an `NSNumber` object containing the float `1.05`. Set this property to `nil` to reset it to the default value. - + This property is only applied to the style if `lineJoin` is set to an `MGLStyleValue` object containing an `NSValue` object containing `MGLLineJoinRound`. Otherwise, it is ignored. @@ -157,9 +157,9 @@ MGL_EXPORT /** Blur applied to the line, in points. - + This property is measured in points. - + The default value of this property is an `MGLStyleValue` object containing an `NSNumber` object containing the float `0`. Set this property to `nil` to reset it to the default value. @@ -169,11 +169,11 @@ MGL_EXPORT #if TARGET_OS_IPHONE /** The color with which the line will be drawn. - + The default value of this property is an `MGLStyleValue` object containing `UIColor.blackColor`. Set this property to `nil` to reset it to the default value. - + This property is only applied to the style if `linePattern` is set to `nil`. Otherwise, it is ignored. */ @@ -181,11 +181,11 @@ MGL_EXPORT #else /** The color with which the line will be drawn. - + The default value of this property is an `MGLStyleValue` object containing `NSColor.blackColor`. Set this property to `nil` to reset it to the default value. - + This property is only applied to the style if `linePattern` is set to `nil`. Otherwise, it is ignored. */ @@ -196,12 +196,12 @@ MGL_EXPORT Specifies the lengths of the alternating dashes and gaps that form the dash pattern. The lengths are later scaled by the line width. To convert a dash length to points, multiply the length by the current line width. - + This property is measured in line widths. - + This property is only applied to the style if `linePattern` is set to `nil`. Otherwise, it is ignored. - + This attribute corresponds to the <a href="https://www.mapbox.com/mapbox-gl-style-spec/#paint-line-dasharray"><code>line-dasharray</code></a> layout property in the Mapbox Style Specification. @@ -213,9 +213,9 @@ MGL_EXPORT /** Draws a line casing outside of a line's actual path. Value indicates the width of the inner gap. - + This property is measured in points. - + The default value of this property is an `MGLStyleValue` object containing an `NSNumber` object containing the float `0`. Set this property to `nil` to reset it to the default value. @@ -227,9 +227,9 @@ MGL_EXPORT the right, relative to the direction of the line, and a negative value to the left. For polygon features, a positive value results in an inset, and a negative value results in an outset. - + This property is measured in points. - + The default value of this property is an `MGLStyleValue` object containing an `NSNumber` object containing the float `0`. Set this property to `nil` to reset it to the default value. @@ -238,7 +238,7 @@ MGL_EXPORT /** The opacity at which the line will be drawn. - + The default value of this property is an `MGLStyleValue` object containing an `NSNumber` object containing the float `1`. Set this property to `nil` to reset it to the default value. @@ -254,13 +254,13 @@ MGL_EXPORT #if TARGET_OS_IPHONE /** The geometry's offset. - + This property is measured in points. - + The default value of this property is an `MGLStyleValue` object containing an `NSValue` object containing a `CGVector` struct set to 0 points rightward and 0 points downward. Set this property to `nil` to reset it to the default value. - + This attribute corresponds to the <a href="https://www.mapbox.com/mapbox-gl-style-spec/#paint-line-translate"><code>line-translate</code></a> layout property in the Mapbox Style Specification. @@ -269,13 +269,13 @@ MGL_EXPORT #else /** The geometry's offset. - + This property is measured in points. - + The default value of this property is an `MGLStyleValue` object containing an `NSValue` object containing a `CGVector` struct set to 0 points rightward and 0 points upward. Set this property to `nil` to reset it to the default value. - + This attribute corresponds to the <a href="https://www.mapbox.com/mapbox-gl-style-spec/#paint-line-translate"><code>line-translate</code></a> layout property in the Mapbox Style Specification. @@ -287,14 +287,14 @@ MGL_EXPORT /** Controls the translation reference point. - + The default value of this property is an `MGLStyleValue` object containing an `NSValue` object containing `MGLLineTranslationAnchorMap`. Set this property to `nil` to reset it to the default value. - + This property is only applied to the style if `lineTranslation` is non-`nil`. Otherwise, it is ignored. - + This attribute corresponds to the <a href="https://www.mapbox.com/mapbox-gl-style-spec/#paint-line-translate-anchor"><code>line-translate-anchor</code></a> layout property in the Mapbox Style Specification. @@ -305,9 +305,9 @@ MGL_EXPORT /** Stroke thickness. - + This property is measured in points. - + The default value of this property is an `MGLStyleValue` object containing an `NSNumber` object containing the float `1`. Set this property to `nil` to reset it to the default value. diff --git a/platform/darwin/src/MGLLineStyleLayer.mm b/platform/darwin/src/MGLLineStyleLayer.mm index 13408d426c..73ffa9a5ae 100644 --- a/platform/darwin/src/MGLLineStyleLayer.mm +++ b/platform/darwin/src/MGLLineStyleLayer.mm @@ -1,4 +1,4 @@ -// This file is generated. +// This file is generated. // Edit platform/darwin/scripts/generate-style-code.js, then run `make darwin-style-code`. #import "MGLSource.h" @@ -66,7 +66,7 @@ namespace mbgl { - (NSString *)sourceIdentifier { MGLAssertStyleLayerIsValid(); - + return @(self.rawLayer->getSourceID().c_str()); } diff --git a/platform/darwin/src/MGLMapCamera.h b/platform/darwin/src/MGLMapCamera.h index 584d370e6b..a76405df6f 100644 --- a/platform/darwin/src/MGLMapCamera.h +++ b/platform/darwin/src/MGLMapCamera.h @@ -34,7 +34,7 @@ MGL_EXPORT /** Returns a new camera based on information about the camera’s viewpoint and focus point. - + @param centerCoordinate The geographic coordinate on which the map should be centered. @param eyeCoordinate The geometric coordinate at which the camera should be @@ -49,7 +49,7 @@ MGL_EXPORT /** Returns a new camera with the given distance, pitch, and heading. - + @param centerCoordinate The geographic coordinate on which the map should be centered. @param distance The straight-line distance from the viewpoint to the diff --git a/platform/darwin/src/MGLMapCamera.mm b/platform/darwin/src/MGLMapCamera.mm index fafbefd17a..260ea31bbd 100644 --- a/platform/darwin/src/MGLMapCamera.mm +++ b/platform/darwin/src/MGLMapCamera.mm @@ -20,16 +20,16 @@ { mbgl::LatLng centerLatLng = mbgl::LatLng(centerCoordinate.latitude, centerCoordinate.longitude); mbgl::LatLng eyeLatLng = mbgl::LatLng(eyeCoordinate.latitude, eyeCoordinate.longitude); - + mbgl::ProjectedMeters centerMeters = mbgl::Projection::projectedMetersForLatLng(centerLatLng); mbgl::ProjectedMeters eyeMeters = mbgl::Projection::projectedMetersForLatLng(eyeLatLng); CLLocationDirection heading = std::atan((centerMeters.northing - eyeMeters.northing) / (centerMeters.easting - eyeMeters.easting)); - + double groundDistance = std::hypot(centerMeters.northing - eyeMeters.northing, centerMeters.easting - eyeMeters.easting); CGFloat pitch = std::atan(eyeAltitude / groundDistance); - + return [[self alloc] initWithCenterCoordinate:centerCoordinate altitude:eyeAltitude pitch:pitch @@ -108,7 +108,7 @@ { return YES; } - + MGLMapCamera *otherCamera = other; return (_centerCoordinate.latitude == otherCamera.centerCoordinate.latitude && _centerCoordinate.longitude == otherCamera.centerCoordinate.longitude diff --git a/platform/darwin/src/MGLMultiPoint.h b/platform/darwin/src/MGLMultiPoint.h index 31ab5744a3..ca08e5405a 100644 --- a/platform/darwin/src/MGLMultiPoint.h +++ b/platform/darwin/src/MGLMultiPoint.h @@ -9,12 +9,12 @@ NS_ASSUME_NONNULL_BEGIN /** The `MGLMultiPoint` class is an abstract superclass used to define shapes composed of multiple vertices. - + You do not create instances of this class directly. Instead, you create instances of the `MGLPolyline` or `MGLPolygon` classes. However, you can use the method and properties of this class to access information about the vertices of the line or polygon. - + Do not confuse `MGLMultiPoint` with `MGLPointCollection`, which represents a collection of related but disconnected points. */ @@ -23,7 +23,7 @@ MGL_EXPORT /** The array of vertices associated with the shape. - + This C array is a pointer to a structure inside the multipoint object, which may have a lifetime shorter than the multipoint object and will certainly not have a longer lifetime. Therefore, you should copy the C array if it needs to @@ -36,7 +36,7 @@ MGL_EXPORT /** Retrieves the vertices of part of the shape. - + @param coords On input, you must provide a C array of `CLLocationCoordinate2D` structures large enough to hold the desired number of coordinates. On output, this structure contains the requested coordinate data. @@ -50,7 +50,7 @@ MGL_EXPORT /** Sets the shape’s vertices to the given C array of vertices. - + @param coords The array of coordinates defining the shape. The data in this array is copied to the shape’s `coordinates` property. @param count The number of coordinates from the `coords` array. @@ -60,7 +60,7 @@ MGL_EXPORT /** Inserts the given vertices into the shape. If the shape is currently visible on the map, it is redrawn immediately. - + @param coords The array of coordinates to insert into the shape. The data in this array is copied to the shape’s `coordinates` property. @param count The number of items in the `coords` array. @@ -72,7 +72,7 @@ MGL_EXPORT /** Appends the given vertices to the shape. If the shape is currently visible on the map, it is redrawn immediately. - + @param coords The array of coordinates to add to the shape. The data in this array is copied to the shape’s `coordinates` property. @param count The number of items in the `coords` array. @@ -83,15 +83,15 @@ MGL_EXPORT Replaces the vertices at the given range in the shape with the same number of vertices from a given C array. If the shape is currently visible on the map, it is redrawn immediately. - + The number of coordinates in `coords` must be equal to the length of `range`. If you want to insert or delete one or more vertices, use the `-replaceCoordinatesInRange:withCoordinates:count:` method. - + If `range` extends beyond the shape’s `coordinates` property, an `NSRangeException` is raised. If you want to append new vertices to the shape, use the `-appendCoordinates:count:` method. - + @param range The range of vertices to replace. The `location` field indicates the first vertex you are replacing, with `0` being the first vertex, `1` being the second vertex, and so on. The `length` field indicates the number @@ -105,15 +105,15 @@ MGL_EXPORT Replaces the vertices at the given range in the shape with the specified number of vertices from a given C array. If the shape is currently visible on the map, it is redrawn immediately. - + If `count` is greater than the `length` field of `range`, some vertices will effectively be inserted into the shape. On the other hand, if `count` is less than the `length` field of `range`, some vertices will effectively be removed. - + If `range` extends beyond the shape’s `coordinates` property, an `NSRangeException` is raised. If you want to append new vertices to the shape, use the `-appendCoordinates:count:` method. - + @param range The range of vertices to replace. The `location` field indicates the first vertex you are replacing, with `0` being the first vertex, `1` being the second vertex, and so on. The `length` field indicates the number @@ -130,10 +130,10 @@ MGL_EXPORT /** Removes the vertices at the given range from the shape. If the shape is currently visible on the map, it is redrawn immediately. - + If `range` extends beyond the shape’s `coordinates` property, an `NSRangeException` is raised. - + @param range The range of vertices to remove. The `location` field indicates the first vertex you are removing, with `0` being the first vertex, `1` being the second vertex, and so on. The `length` field indicates the number diff --git a/platform/darwin/src/MGLMultiPoint.mm b/platform/darwin/src/MGLMultiPoint.mm index 3b03b78ca6..8e8c5be304 100644 --- a/platform/darwin/src/MGLMultiPoint.mm +++ b/platform/darwin/src/MGLMultiPoint.mm @@ -44,7 +44,7 @@ { if (self == other) return YES; if (![other isKindOfClass:[MGLMultiPoint class]]) return NO; - + MGLMultiPoint *otherMultipoint = other; return ([super isEqual:otherMultipoint] && _coordinates == otherMultipoint->_coordinates); @@ -97,7 +97,7 @@ [NSException raise:NSInvalidArgumentException format:@"A multipoint must have at least one vertex."]; } - + [self willChangeValueForKey:@"coordinates"]; _coordinates = { coords, coords + count }; _bounds = {}; @@ -108,13 +108,13 @@ if (!count) { return; } - + if (index > _coordinates.size()) { [NSException raise:NSRangeException format:@"Invalid index %lu for existing coordinate count %ld", (unsigned long)index, (unsigned long)[self pointCount]]; } - + [self willChangeValueForKey:@"coordinates"]; _coordinates.insert(_coordinates.begin() + index, count, *coords); _bounds = {}; @@ -135,7 +135,7 @@ if (!count && !range.length) { return; } - + if (NSMaxRange(range) > _coordinates.size()) { [NSException raise:NSRangeException format:@"Invalid range %@ for existing coordinate count %ld", diff --git a/platform/darwin/src/MGLNetworkConfiguration.h b/platform/darwin/src/MGLNetworkConfiguration.h index 88fb07e111..644291ee13 100644 --- a/platform/darwin/src/MGLNetworkConfiguration.h +++ b/platform/darwin/src/MGLNetworkConfiguration.h @@ -3,11 +3,11 @@ NS_ASSUME_NONNULL_BEGIN /** - The MGLNetworkConfiguration object provides a global way to set a base API URL for + The MGLNetworkConfiguration object provides a global way to set a base API URL for retrieval of map data, styles, and other resources. - - Currently, MGLNetworkConfiguration is private API in code but is able to be used - by any applications via the `MGLMapboxAPIBaseURL` dictionary key in the + + Currently, MGLNetworkConfiguration is private API in code but is able to be used + by any applications via the `MGLMapboxAPIBaseURL` dictionary key in the application's `Info.plist`. */ @interface MGLNetworkConfiguration : NSObject @@ -15,7 +15,7 @@ NS_ASSUME_NONNULL_BEGIN /// Returns the shared instance of the `MGLNetworkConfiguration` class. + (instancetype)sharedManager; -/// The current API base URL. If `nil`, the Mapbox default base API URL is in use. +/// The current API base URL. If `nil`, the Mapbox default base API URL is in use. @property (atomic, nullable) NSURL *apiBaseURL; @end diff --git a/platform/darwin/src/MGLOfflinePack.h b/platform/darwin/src/MGLOfflinePack.h index 8436434e68..0b2db35b1a 100644 --- a/platform/darwin/src/MGLOfflinePack.h +++ b/platform/darwin/src/MGLOfflinePack.h @@ -11,20 +11,20 @@ NS_ASSUME_NONNULL_BEGIN typedef NS_ENUM (NSInteger, MGLOfflinePackState) { /** It is unknown whether the pack is inactive, active, or complete. - + This is the initial state of a pack. The state of a pack becomes known by the time the shared `MGLOfflineStorage` object sends the first `MGLOfflinePackProgressChangedNotification` about the pack. For inactive packs, you must explicitly request a progress update using the `-[MGLOfflinePack requestProgress]` method. - + An invalid pack always has a state of `MGLOfflinePackStateInvalid`, never `MGLOfflinePackStateUnknown`. */ MGLOfflinePackStateUnknown = 0, /** The pack is incomplete and is not currently downloading. - + This is the initial state of a pack that is created using the `-[MGLOfflineStorage addPackForRegion:withContext:completionHandler:]` method, as well as after the `-[MGLOfflinePack suspend]` method is @@ -33,7 +33,7 @@ typedef NS_ENUM (NSInteger, MGLOfflinePackState) { MGLOfflinePackStateInactive = 1, /** The pack is incomplete and is currently downloading. - + This is the state of a pack after the `-[MGLOfflinePack resume]` method is called. */ @@ -77,7 +77,7 @@ typedef struct MGLOfflinePackProgress { /** The minimum number of resources that must be downloaded in order to view the pack’s full region without any omissions. - + At the beginning of a download, this count is a lower bound; the number of expected resources may increase as the download progresses. */ @@ -85,7 +85,7 @@ typedef struct MGLOfflinePackProgress { /** The maximum number of resources that must be downloaded in order to view the pack’s full region without any omissions. - + At the beginning of a download, when the exact number of required resources is unknown, this field is set to `UINT64_MAX`. Thus this count is always an upper bound. @@ -96,7 +96,7 @@ typedef struct MGLOfflinePackProgress { /** An `MGLOfflinePack` represents a collection of resources necessary for viewing a region offline to a local database. - + To create an instance of `MGLOfflinePack`, use the `+[MGLOfflineStorage addPackForRegion:withContext:completionHandler:]` method. A pack created using `-[MGLOfflinePack init]` is immediately invalid. @@ -111,7 +111,7 @@ MGL_EXPORT /** Arbitrary data stored alongside the downloaded resources. - + The context typically holds application-specific information for identifying the pack, such as a user-selected name. */ @@ -119,7 +119,7 @@ MGL_EXPORT /** The pack’s current state. - + The state of an inactive or completed pack is computed lazily and is set to `MGLOfflinePackStateUnknown` by default. To request the pack’s status, use the `-requestProgress` method. To get notified when the state becomes known and @@ -132,7 +132,7 @@ MGL_EXPORT /** The pack’s current progress. - + The progress of an inactive or completed pack is computed lazily, and all its fields are set to 0 by default. To request the pack’s progress, use the `-requestProgress` method. To get notified when the progress becomes @@ -145,33 +145,33 @@ MGL_EXPORT /** Resumes downloading if the pack is inactive. - + When a pack resumes after being suspended, it may begin by iterating over the already downloaded resources. As a result, the `progress` structure’s `countOfResourcesCompleted` field may revert to 0 before rapidly returning to the level of progress at the time the pack was suspended. - + To temporarily suspend downloading, call the `-suspend` method. */ - (void)resume; /** Temporarily stops downloading if the pack is active. - + A pack suspends asynchronously, so some network requests may be sent after this method is called. Regardless, the `progress` property will not be updated until `-resume` is called. - + If the pack previously reached a higher level of progress before being suspended, it may wait to suspend until it returns to that level. - + To resume downloading, call the `-resume` method. */ - (void)suspend; /** Request an asynchronous update to the pack’s `state` and `progress` properties. - + The state and progress of an inactive or completed pack are computed lazily. If you need the state or progress of a pack whose `state` property is currently set to `MGLOfflinePackStateUnknown`, observe KVO change notifications on this diff --git a/platform/darwin/src/MGLOfflinePack.mm b/platform/darwin/src/MGLOfflinePack.mm index 1f2fd95f2b..218e32940d 100644 --- a/platform/darwin/src/MGLOfflinePack.mm +++ b/platform/darwin/src/MGLOfflinePack.mm @@ -8,7 +8,7 @@ /** Assert that the current offline pack is valid. - + This macro should be used at the beginning of any public-facing instance method of `MGLOfflinePack`. For private methods, an assertion is more appropriate. */ @@ -26,11 +26,11 @@ class MBGLOfflineRegionObserver : public mbgl::OfflineRegionObserver { public: MBGLOfflineRegionObserver(MGLOfflinePack *pack_) : pack(pack_) {} - + void statusChanged(mbgl::OfflineRegionStatus status) override; void responseError(mbgl::Response::Error error) override; void mapboxTileCountLimitExceeded(uint64_t limit) override; - + private: __weak MGLOfflinePack *pack = nullptr; }; @@ -59,7 +59,7 @@ private: if (self = [super init]) { _mbglOfflineRegion = region; _state = MGLOfflinePackStateUnknown; - + mbgl::DefaultFileSource *mbglFileSource = [[MGLOfflineStorage sharedOfflineStorage] mbglFileSource]; mbglFileSource->setOfflineRegionObserver(*_mbglOfflineRegion, std::make_unique<MBGLOfflineRegionObserver>(self)); } @@ -72,7 +72,7 @@ private: - (id <MGLOfflineRegion>)region { MGLAssertOfflinePackIsValid(); - + const mbgl::OfflineRegionDefinition ®ionDefinition = _mbglOfflineRegion->getDefinition(); NSAssert([MGLTilePyramidOfflineRegion conformsToProtocol:@protocol(MGLOfflineRegion_Private)], @"MGLTilePyramidOfflineRegion should conform to MGLOfflineRegion_Private."); return [(id <MGLOfflineRegion_Private>)[MGLTilePyramidOfflineRegion alloc] initWithOfflineRegionDefinition:regionDefinition]; @@ -80,35 +80,35 @@ private: - (NSData *)context { MGLAssertOfflinePackIsValid(); - + const mbgl::OfflineRegionMetadata &metadata = _mbglOfflineRegion->getMetadata(); return [NSData dataWithBytes:&metadata[0] length:metadata.size()]; } - (void)resume { MGLAssertOfflinePackIsValid(); - + self.state = MGLOfflinePackStateActive; - + mbgl::DefaultFileSource *mbglFileSource = [[MGLOfflineStorage sharedOfflineStorage] mbglFileSource]; mbglFileSource->setOfflineRegionDownloadState(*_mbglOfflineRegion, mbgl::OfflineRegionDownloadState::Active); } - (void)suspend { MGLAssertOfflinePackIsValid(); - + if (self.state == MGLOfflinePackStateActive) { self.state = MGLOfflinePackStateInactive; _isSuspending = YES; } - + mbgl::DefaultFileSource *mbglFileSource = [[MGLOfflineStorage sharedOfflineStorage] mbglFileSource]; mbglFileSource->setOfflineRegionDownloadState(*_mbglOfflineRegion, mbgl::OfflineRegionDownloadState::Inactive); } - (void)invalidate { NSAssert(_state != MGLOfflinePackStateInvalid, @"Cannot invalidate an already invalid offline pack."); - + self.state = MGLOfflinePackStateInvalid; mbgl::DefaultFileSource *mbglFileSource = [[MGLOfflineStorage sharedOfflineStorage] mbglFileSource]; mbglFileSource->setOfflineRegionObserver(*self.mbglOfflineRegion, nullptr); @@ -123,9 +123,9 @@ private: NSAssert(_state == MGLOfflinePackStateInvalid, @"A valid MGLOfflinePack has no mbgl::OfflineRegion."); return; } - + NSAssert(_state != MGLOfflinePackStateInvalid, @"Cannot change the state of an invalid offline pack."); - + if (!_isSuspending || state != MGLOfflinePackStateActive) { _isSuspending = NO; _state = state; @@ -134,9 +134,9 @@ private: - (void)requestProgress { MGLAssertOfflinePackIsValid(); - + mbgl::DefaultFileSource *mbglFileSource = [[MGLOfflineStorage sharedOfflineStorage] mbglFileSource]; - + __weak MGLOfflinePack *weakSelf = self; mbglFileSource->getOfflineRegionStatus(*_mbglOfflineRegion, [&, weakSelf](__unused std::exception_ptr exception, mbgl::optional<mbgl::OfflineRegionStatus> status) { if (status) { @@ -151,21 +151,21 @@ private: - (void)offlineRegionStatusDidChange:(mbgl::OfflineRegionStatus)status { NSAssert(_state != MGLOfflinePackStateInvalid, @"Cannot change update progress of an invalid offline pack."); - + switch (status.downloadState) { case mbgl::OfflineRegionDownloadState::Inactive: self.state = status.complete() ? MGLOfflinePackStateComplete : MGLOfflinePackStateInactive; break; - + case mbgl::OfflineRegionDownloadState::Active: self.state = MGLOfflinePackStateActive; break; } - + if (_isSuspending) { return; } - + MGLOfflinePackProgress progress; progress.countOfResourcesCompleted = status.completedResourceCount; progress.countOfBytesCompleted = status.completedResourceSize; @@ -174,7 +174,7 @@ private: progress.countOfResourcesExpected = status.requiredResourceCount; progress.maximumResourcesExpected = status.requiredResourceCountIsPrecise ? status.requiredResourceCount : UINT64_MAX; self.progress = progress; - + [self.delegate offlinePack:self progressDidChange:progress]; } @@ -184,15 +184,15 @@ NSError *MGLErrorFromResponseError(mbgl::Response::Error error) { case mbgl::Response::Error::Reason::NotFound: errorCode = MGLErrorCodeNotFound; break; - + case mbgl::Response::Error::Reason::Server: errorCode = MGLErrorCodeBadServerResponse; break; - + case mbgl::Response::Error::Reason::Connection: errorCode = MGLErrorCodeConnectionFailed; break; - + default: break; } diff --git a/platform/darwin/src/MGLOfflinePack_Private.h b/platform/darwin/src/MGLOfflinePack_Private.h index 95d8ba4323..65156b4e90 100644 --- a/platform/darwin/src/MGLOfflinePack_Private.h +++ b/platform/darwin/src/MGLOfflinePack_Private.h @@ -10,7 +10,7 @@ NS_ASSUME_NONNULL_BEGIN /** The pack’s delegate. - + You can use the offline pack delegate to be notified of any changes in the pack’s progress and of any errors while downloading. For more information, see the `MGLOfflinePackDelegate` documentation. @@ -41,7 +41,7 @@ NS_ASSUME_NONNULL_BEGIN /** Sent whenever the pack’s state or download progress changes. Every change to a field in the `progress` property corresponds to an invocation of this method. - + @param pack The pack whose state of progress changed. @param progress The updated progress. To get the updated state, refer to the `state` property. @@ -50,11 +50,11 @@ NS_ASSUME_NONNULL_BEGIN /** Sent whenever the pack encounters an error while downloading. - + Download errors may be recoverable. For example, this pack’s implementation may attempt to re-request failed resources based on an exponential backoff strategy or upon the restoration of network access. - + @param pack The pack that encountered an error. @param error A download error. For a list of possible error codes, see `MGLErrorCode`. @@ -64,7 +64,7 @@ NS_ASSUME_NONNULL_BEGIN /** Sent when the maximum number of Mapbox-hosted tiles has been downloaded and stored on the current device. - + Once this limit is reached, no instance of `MGLOfflinePack` can download additional tiles from Mapbox APIs until already downloaded tiles are removed by calling the `-[MGLOfflineStorage removePack:withCompletionHandler:]` method. diff --git a/platform/darwin/src/MGLOfflineRegion_Private.h b/platform/darwin/src/MGLOfflineRegion_Private.h index 22106987d0..b1dec8dd64 100644 --- a/platform/darwin/src/MGLOfflineRegion_Private.h +++ b/platform/darwin/src/MGLOfflineRegion_Private.h @@ -11,7 +11,7 @@ NS_ASSUME_NONNULL_BEGIN /** Initializes and returns an offline region backed by the given C++ region definition object. - + @param definition A reference to an offline region definition backing the offline region. */ diff --git a/platform/darwin/src/MGLOfflineStorage.h b/platform/darwin/src/MGLOfflineStorage.h index 9125c5341e..2d376c9222 100644 --- a/platform/darwin/src/MGLOfflineStorage.h +++ b/platform/darwin/src/MGLOfflineStorage.h @@ -14,14 +14,14 @@ NS_ASSUME_NONNULL_BEGIN downloaded or because the pack discovers during the download that more resources are required for offline viewing. This notification is posted whenever any field in the `progress` property changes. - + The `object` is the `MGLOfflinePack` object whose progress changed. The `userInfo` dictionary contains the pack’s current state in the `MGLOfflinePackStateUserInfoKey` key and details about the pack’s current progress in the `MGLOfflinePackProgressUserInfoKey` key. You may also consult the `MGLOfflinePack.state` and `MGLOfflinePack.progress` properties, which provide the same values. - + If you only need to observe changes in a particular pack’s progress, you can alternatively observe KVO change notifications to the pack’s `progress` key path. @@ -34,7 +34,7 @@ extern MGL_EXPORT const NSNotificationName MGLOfflinePackProgressChangedNotifica may not warrant the user’s attention. For example, the pack’s implementation may attempt to re-request failed resources based on an exponential backoff strategy or upon the restoration of network access. - + The `object` is the `MGLOfflinePack` object that encountered the error. The `userInfo` dictionary contains the error object in the `MGLOfflinePackErrorUserInfoKey` key. @@ -44,11 +44,11 @@ extern MGL_EXPORT const NSNotificationName MGLOfflinePackErrorNotification; /** Posted by the shared `MGLOfflineStorage` object when the maximum number of Mapbox-hosted tiles has been downloaded and stored on the current device. - + The `object` is the `MGLOfflinePack` object that reached the tile limit in the course of downloading. The `userInfo` dictionary contains the tile limit in the `MGLOfflinePackMaximumCountUserInfoKey` key. - + Once this limit is reached, no instance of `MGLOfflinePack` can download additional tiles from Mapbox APIs until already downloaded tiles are removed by calling the `-[MGLOfflineStorage removePack:withCompletionHandler:]` method. @@ -107,10 +107,10 @@ extern MGL_EXPORT NSString * const MGLOfflinePackMaximumCountUserInfoKey __attri /** A block to be called once an offline pack has been completely created and added. - + An application typically calls the `-resume` method on the pack inside this completion handler to begin the download. - + @param pack Contains a pointer to the newly added pack, or `nil` if there was an error creating or adding the pack. @param error Contains a pointer to an error object (if any) indicating why the @@ -121,11 +121,11 @@ typedef void (^MGLOfflinePackAdditionCompletionHandler)(MGLOfflinePack * _Nullab /** A block to be called once an offline pack has been completely invalidated and removed. - + Avoid any references to the pack inside this completion handler: by the time this completion handler is executed, the pack has become invalid, and any messages passed to it will raise an exception. - + @param error Contains a pointer to an error object (if any) indicating why the pack could not be invalidated or removed. */ @@ -147,13 +147,13 @@ MGL_EXPORT /** An array of all known offline packs, in the order in which they were created. - + This property is set to `nil`, indicating that the receiver does not yet know the existing packs, for an undefined amount of time starting from the moment the shared offline storage object is initialized until the packs are fetched from the database. After that point, this property is always non-nil, but it may be empty to indicate that no packs are present. - + To detect when the shared offline storage object has finished loading its `packs` property, observe KVO change notifications on the `packs` key path. The initial load results in an `NSKeyValueChangeSetting` change. @@ -163,19 +163,19 @@ MGL_EXPORT /** Creates and registers an offline pack that downloads the resources needed to use the given region offline. - + The resulting pack is added to the shared offline storage object’s `packs` property, then the `completion` block is executed with that pack passed in. - + The pack has an initial state of `MGLOfflinePackStateInactive`. To begin downloading resources, call `-[MGLOfflinePack resume]` on the pack from within the completion handler. To monitor download progress, add an observer for `MGLOfflinePackProgressChangedNotification`s about that pack. - + To detect when any call to this method results in a new pack, observe KVO change notifications on the shared offline storage object’s `packs` key path. Additions to that array result in an `NSKeyValueChangeInsertion` change. - + @param region A region to download. @param context Arbitrary data to store alongside the downloaded resources. @param completion The completion handler to call once the pack has been added. @@ -186,17 +186,17 @@ MGL_EXPORT /** Unregisters the given offline pack and allows resources that are no longer required by any remaining packs to be potentially freed. - + As soon as this method is called on a pack, the pack becomes invalid; any attempt to send it a message will result in an exception being thrown. If an error occurs and the pack cannot be removed, do not attempt to reuse the pack object. Instead, if you need continued access to the pack, suspend all packs and use the `-reloadPacks` method to obtain valid pointers to all the packs. - + To detect when any call to this method results in a pack being removed, observe KVO change notifications on the shared offline storage object’s `packs` key path. Removals from that array result in an `NSKeyValueChangeRemoval` change. - + When you remove an offline pack, any resources that are required by that pack, but not other packs, become eligible for deletion from offline storage. Because the backing store used for offline storage is also used as a general purpose @@ -216,9 +216,9 @@ MGL_EXPORT `packs` property change, even if the underlying data for these packs has not changed. If this method is called while a pack is actively downloading, the behavior is undefined. - + You typically do not need to call this method. - + To detect when the shared offline storage object has finished reloading its `packs` property, observe KVO change notifications on the `packs` key path. A reload results in an `NSKeyValueChangeSetting` change. @@ -228,12 +228,12 @@ MGL_EXPORT /** Sets the maximum number of Mapbox-hosted tiles that may be downloaded and stored on the current device. - + Once this limit is reached, an `MGLOfflinePackMaximumMapboxTilesReachedNotification` is posted for every attempt to download additional tiles until already downloaded tiles are removed by calling the `-removePack:withCompletionHandler:` method. - + @note The <a href="https://www.mapbox.com/tos/">Mapbox Terms of Service</a> prohibits changing or bypassing this limit without permission from Mapbox. Contact your Mapbox sales representative to have the limit raised. @@ -242,7 +242,7 @@ MGL_EXPORT /** The cumulative size, measured in bytes, of all downloaded resources on disk. - + The returned value includes all resources, including tiles, whether downloaded as part of an offline pack or due to caching during normal use of `MGLMapView`. */ diff --git a/platform/darwin/src/MGLOfflineStorage.mm b/platform/darwin/src/MGLOfflineStorage.mm index 10acc58b25..bdecd101d2 100644 --- a/platform/darwin/src/MGLOfflineStorage.mm +++ b/platform/darwin/src/MGLOfflineStorage.mm @@ -161,11 +161,11 @@ NSString * const MGLOfflinePackMaximumCountUserInfoKey = MGLOfflinePackUserInfoK - (void)dealloc { [[MGLNetworkConfiguration sharedManager] removeObserver:self forKeyPath:@"apiBaseURL"]; [[MGLAccountManager sharedManager] removeObserver:self forKeyPath:@"accessToken"]; - + for (MGLOfflinePack *pack in self.packs) { [pack invalidate]; } - + delete _mbglFileSource; _mbglFileSource = nullptr; } @@ -210,7 +210,7 @@ NSString * const MGLOfflinePackMaximumCountUserInfoKey = MGLOfflinePackUserInfoK @"Regions of type %@ are unsupported.", NSStringFromClass([region class])]; return; } - + const mbgl::OfflineTilePyramidRegionDefinition regionDefinition = [(id <MGLOfflineRegion_Private>)region offlineRegionDefinition]; mbgl::OfflineRegionMetadata metadata(context.length); [context getBytes:&metadata[0] length:metadata.size()]; @@ -247,7 +247,7 @@ NSString * const MGLOfflinePackMaximumCountUserInfoKey = MGLOfflinePackUserInfoK completion(nil); return; } - + self.mbglFileSource->deleteOfflineRegion(std::move(*mbglOfflineRegion), [&, completion](std::exception_ptr exception) { NSError *error; if (exception) { @@ -269,7 +269,7 @@ NSString * const MGLOfflinePackMaximumCountUserInfoKey = MGLOfflinePackUserInfoK [pack invalidate]; } self.packs = [packs mutableCopy]; - + for (MGLOfflinePack *pack in packs) { pack.delegate = self; } @@ -312,7 +312,7 @@ NSString * const MGLOfflinePackMaximumCountUserInfoKey = MGLOfflinePackUserInfoK if (!cachePath) { return 0; } - + NSDictionary *attributes = [[NSFileManager defaultManager] attributesOfItemAtPath:cachePath error:NULL]; return attributes.fileSize; } diff --git a/platform/darwin/src/MGLOpenGLStyleLayer.mm b/platform/darwin/src/MGLOpenGLStyleLayer.mm index 5d81eb85ea..da131b6de8 100644 --- a/platform/darwin/src/MGLOpenGLStyleLayer.mm +++ b/platform/darwin/src/MGLOpenGLStyleLayer.mm @@ -11,7 +11,7 @@ /** Runs the preparation handler block contained in the given context, which is implicitly an instance of `MGLOpenGLStyleLayer`. - + @param context An `MGLOpenGLStyleLayer` instance that was provided as context when creating an OpenGL style layer. */ @@ -23,7 +23,7 @@ void MGLPrepareCustomStyleLayer(void *context) { /** Runs the drawing handler block contained in the given context, which is implicitly an instance of `MGLOpenGLStyleLayer`. - + @param context An `MGLOpenGLStyleLayer` instance that was provided as context when creating an OpenGL style layer. */ @@ -43,7 +43,7 @@ void MGLDrawCustomStyleLayer(void *context, const mbgl::style::CustomLayerRender /** Runs the completion handler block contained in the given context, which is implicitly an instance of `MGLOpenGLStyleLayer`. - + @param context An `MGLOpenGLStyleLayer` instance that was provided as context when creating an OpenGL style layer. */ @@ -55,18 +55,18 @@ void MGLFinishCustomStyleLayer(void *context) { /** An `MGLOpenGLStyleLayer` is a style layer that is rendered by OpenGL code that you provide. - + By default, this class does nothing. You can subclass this class to provide custom OpenGL drawing code that is run on each frame of the map. Your subclass should override the `-didMoveToMapView:`, `-willMoveFromMapView:`, and `-drawInMapView:withContext:` methods. - + You can access an existing OpenGL style layer using the `-[MGLStyle layerWithIdentifier:]` method if you know its identifier; otherwise, find it using the `MGLStyle.layers` property. You can also create a new OpenGL style layer and add it to the style using a method such as `-[MGLStyle addLayer:]`. - + @warning This API is undocumented and therefore unsupported. It may change at any time without notice. */ @@ -76,7 +76,7 @@ void MGLFinishCustomStyleLayer(void *context) { /** The map view whose style currently contains the layer. - + If the layer is not currently part of any map view’s style, this property is set to `nil`. */ @@ -90,11 +90,11 @@ void MGLFinishCustomStyleLayer(void *context) { /** Returns an OpenGL style layer object initialized with the given identifier. - + After initializing and configuring the style layer, add it to a map view’s style using the `-[MGLStyle addLayer:]` or `-[MGLStyle insertLayer:belowLayer:]` method. - + @param identifier A string that uniquely identifies the layer in the style to which it is added. @return An initialized OpenGL style layer. @@ -154,58 +154,58 @@ void MGLFinishCustomStyleLayer(void *context) { /** Called immediately after a layer is added to a map view’s style. - + This method is intended to be overridden in a subclass. You can use this method to perform any setup work before the layer is used to draw a frame. For example, you might use this method to compile an OpenGL shader. The default implementation of this method does nothing. - + Any resource acquired in this method must be released in `-willMoveFromMapView:`. - + @param mapView The map view to whose style the layer has been added. */ - (void)didMoveToMapView:(MGLMapView *)mapView { - + } /** Called immediately before a layer is removed from a map view’s style. - + This method is intended to be overridden in a subclass. You can use this method to perform any teardown work once the layer has drawn its last frame and is about to be removed from the style. The default implementation of this method does nothing. - + This method may be called even if `-didMoveToMapView:` has not been called. - + @param mapView The map view from whose style the layer is about to be removed. */ - (void)willMoveFromMapView:(MGLMapView *)mapView { - + } /** Called each time the layer needs to draw a new frame in a map view. - + This method is intended to be overridden in a subclass. You can use this method to draw the layer’s content. The default implementation of this method does nothing. - + Your implementation should not make any assumptions about the OpenGL state, other than that the current OpenGL context is active. It may make changes to the OpenGL state. It is not required to reset values such as the depth mask, stencil mask, or corresponding test flags to their original values. - + Be sure to draw your fragments with a <var>z</var> value of 1 to take advantage of the opaque fragment culling, in case the style contains any opaque layers above this layer. - + @param mapView The map view to which the layer draws. @param context A context structure with information defining the frame to draw. */ - (void)drawInMapView:(MGLMapView *)mapView withContext:(MGLStyleLayerDrawingContext)context { - + } /** diff --git a/platform/darwin/src/MGLOverlay.h b/platform/darwin/src/MGLOverlay.h index cc32bad1e6..462a0c1031 100644 --- a/platform/darwin/src/MGLOverlay.h +++ b/platform/darwin/src/MGLOverlay.h @@ -11,7 +11,7 @@ NS_ASSUME_NONNULL_BEGIN both a point and an area on a map. Overlay objects are essentially data objects that contain the geographic data needed to represent the map area. Overlays can take the form of a polyline or polygon. - + You use overlays to layer more sophisticated content on top of a map view. For example, you could use an overlay to show the boundaries of a national park or trace a bus route along city streets. This SDK defines several concrete classes @@ -26,7 +26,7 @@ NS_ASSUME_NONNULL_BEGIN /** The cooordinate rectangle that encompasses the overlay. (required) (read-only) - + This property contains the smallest rectangle that completely encompasses the overlay. Implementers of this protocol must set this area when implementing their overlay class, and after setting it, you must not change it. @@ -36,11 +36,11 @@ NS_ASSUME_NONNULL_BEGIN /** Returns a Boolean indicating whether the specified rectangle intersects the receiver’s shape. - + You can implement this method to provide more specific bounds checking for an overlay. If you do not implement it, the bounding rectangle is used to detect intersections. - + @param overlayBounds The rectangle to intersect with the receiver’s area. @return `YES` if any part of the map rectangle intersects the receiver’s shape or `NO` if it does not. diff --git a/platform/darwin/src/MGLPointAnnotation.h b/platform/darwin/src/MGLPointAnnotation.h index aeac43bd39..1ef0962f99 100644 --- a/platform/darwin/src/MGLPointAnnotation.h +++ b/platform/darwin/src/MGLPointAnnotation.h @@ -12,12 +12,12 @@ NS_ASSUME_NONNULL_BEGIN `MGLPointAnnotation` object is known as a point annotation or point shape. For example, you could use a point shape to represent a city at low zoom levels, an address at high zoom levels, or the location of a long press gesture. - + You can add point shapes to the map by adding them to an `MGLShapeSource` object. Configure the appearance of an `MGLShapeSource`’s or `MGLVectorSource`’s point shapes collectively using an `MGLCircleStyleLayer` or `MGLSymbolStyleLayer` object. - + For more interactivity, add a selectable point annotation to a map view using the `-[MGLMapView addAnnotation:]` method. Alternatively, define your own model class that conforms to the `MGLAnnotation` protocol. Configure a point @@ -26,10 +26,10 @@ NS_ASSUME_NONNULL_BEGIN `-[MGLMapViewDelegate mapView:viewForAnnotation:]` (iOS only). A point annotation’s `MGLShape.title` and `MGLShape.subtitle` properties define the default content of the annotation’s callout (on iOS) or popover (on macOS). - + To group multiple related points together in one shape, use an `MGLPointCollection` or `MGLShapeCollection` object. - + A point shape is known as a <a href="https://tools.ietf.org/html/rfc7946#section-3.1.2">Point</a> geometry in GeoJSON. diff --git a/platform/darwin/src/MGLPointAnnotation.mm b/platform/darwin/src/MGLPointAnnotation.mm index a2108a9e3b..5fd3e25991 100644 --- a/platform/darwin/src/MGLPointAnnotation.mm +++ b/platform/darwin/src/MGLPointAnnotation.mm @@ -33,7 +33,7 @@ { if (other == self) return YES; if (![other isKindOfClass:[MGLPointAnnotation class]]) return NO; - + MGLPointAnnotation *otherAnnotation = other; return ([super isEqual:other] && self.coordinate.latitude == otherAnnotation.coordinate.latitude diff --git a/platform/darwin/src/MGLPointCollection.h b/platform/darwin/src/MGLPointCollection.h index c7054c6bbf..74b30385a0 100644 --- a/platform/darwin/src/MGLPointCollection.h +++ b/platform/darwin/src/MGLPointCollection.h @@ -11,17 +11,17 @@ points in the collection may be related but are not connected spatially. For example, you could use a point collection to represent all the trees in an orchard. - + You can add point collections to the map by adding them to an `MGLShapeSource` object. Configure the appearance of an `MGLShapeSource`’s or `MGLVectorSource`’s point collections collectively using an `MGLCircleStyleLayer` or `MGLSymbolStyleLayer` object. - + You cannot add an `MGLPointCollection` object directly to a map view as an annotation. However, you can create individual `MGLPointAnnotation` objects from the `coordinates` array and add those annotation objects to the map view using the `-[MGLMapView addAnnotations:]` method. - + A point collection is known as a <a href="https://tools.ietf.org/html/rfc7946#section-3.1.3">MultiPoint</a> geometry in GeoJSON. Do not confuse `MGLPointCollection` with `MGLMultiPoint`, @@ -33,7 +33,7 @@ MGL_EXPORT /** Creates and returns a `MGLPointCollection` object from the specified set of coordinates. - + @param coords The array of coordinates defining the shape. The data in this array is copied to the new object. @param count The number of items in the `coords` array. @@ -49,7 +49,7 @@ MGL_EXPORT /** Retrieves one or more coordinates associated with the shape. - + @param coords On input, you must provide a C array of structures large enough to hold the desired number of coordinates. On output, this structure contains the requested coordinate data. diff --git a/platform/darwin/src/MGLPointCollection.mm b/platform/darwin/src/MGLPointCollection.mm index acd78b8b33..ac4aaed60c 100644 --- a/platform/darwin/src/MGLPointCollection.mm +++ b/platform/darwin/src/MGLPointCollection.mm @@ -44,7 +44,7 @@ NS_ASSUME_NONNULL_BEGIN - (BOOL)isEqual:(id)other { if (self == other) return YES; if (![other isKindOfClass:[MGLPointCollection class]]) return NO; - + MGLPointCollection *otherCollection = (MGLPointCollection *)other; return ([super isEqual:other] && ((![self geoJSONDictionary] && ![otherCollection geoJSONDictionary]) || [[self geoJSONDictionary] isEqualToDictionary:[otherCollection geoJSONDictionary]])); @@ -112,7 +112,7 @@ NS_ASSUME_NONNULL_BEGIN CLLocationCoordinate2D coordinate = self.coordinates[index]; [coordinates addObject:@[@(coordinate.longitude), @(coordinate.latitude)]]; } - + return @{@"type": @"MultiPoint", @"coordinates": coordinates}; } diff --git a/platform/darwin/src/MGLPolygon+MGLAdditions.m b/platform/darwin/src/MGLPolygon+MGLAdditions.m index def4687016..3e76a37157 100644 --- a/platform/darwin/src/MGLPolygon+MGLAdditions.m +++ b/platform/darwin/src/MGLPolygon+MGLAdditions.m @@ -4,14 +4,14 @@ - (NS_ARRAY_OF(id) *)mgl_coordinates { NSMutableArray *coordinates = [NSMutableArray array]; - + NSMutableArray *exteriorRing = [NSMutableArray array]; for (NSUInteger index = 0; index < self.pointCount; index++) { CLLocationCoordinate2D coordinate = self.coordinates[index]; [exteriorRing addObject:@[@(coordinate.longitude), @(coordinate.latitude)]]; } [coordinates addObject:exteriorRing]; - + for (MGLPolygon *interiorPolygon in self.interiorPolygons) { NSMutableArray *interiorRing = [NSMutableArray array]; for (int index = 0; index < interiorPolygon.pointCount; index++) { @@ -20,7 +20,7 @@ } [coordinates addObject:interiorRing]; } - + return [coordinates copy]; } diff --git a/platform/darwin/src/MGLPolygon.h b/platform/darwin/src/MGLPolygon.h index 560741a150..3fcc1be76d 100644 --- a/platform/darwin/src/MGLPolygon.h +++ b/platform/darwin/src/MGLPolygon.h @@ -14,25 +14,25 @@ NS_ASSUME_NONNULL_BEGIN vertices, specified as `CLLocationCoordinate2D` instances, and the edges that connect them. For example, you could use a polygon shape to represent a building, a lake, or an area you want to highlight. - + You can add polygon shapes to the map by adding them to an `MGLShapeSource` object. Configure the appearance of an `MGLShapeSource`’s or `MGLVectorSource`’s polygons collectively using an `MGLFillStyleLayer` or `MGLSymbolStyleLayer` object. - + Alternatively, you can add a polygon overlay directly to a map view using the `-[MGLMapView addAnnotation:]` or `-[MGLMapView addOverlay:]` method. Configure a polygon overlay’s appearance using `-[MGLMapViewDelegate mapView:strokeColorForShapeAnnotation:]` and `-[MGLMapViewDelegate mapView:fillColorForPolygonAnnotation:]`. - + The vertices are automatically connected in the order in which you provide them. You should close the polygon by specifying the same `CLLocationCoordinate2D` as the first and last vertices; otherwise, the polygon’s fill may not cover the area you expect it to. To avoid filling the space within the shape, give the polygon a transparent fill or use an `MGLPolyline` object. - + A polygon may have one or more interior polygons, or holes, that you specify as `MGLPolygon` objects with the `+polygonWithCoordinates:count:interiorPolygons:` method. For example, if a polygon represents a lake, it could exclude an island @@ -40,7 +40,7 @@ NS_ASSUME_NONNULL_BEGIN have interior polygons. To represent a shape that includes a polygon within a hole or, more generally, to group multiple polygons together in one shape, use an `MGLMultiPolygon` or `MGLShapeCollection` object. - + To make the polygon straddle the antimeridian, specify some longitudes less than −180 degrees or greater than 180 degrees. */ @@ -49,11 +49,11 @@ MGL_EXPORT /** The array of polygons nested inside the receiver. - + The area occupied by any interior polygons is excluded from the overall shape. Interior polygons should not overlap. An interior polygon should not have interior polygons of its own. - + If there are no interior polygons, the value of this property is `nil`. */ @property (nonatomic, nullable, readonly) NS_ARRAY_OF(MGLPolygon *) *interiorPolygons; @@ -61,7 +61,7 @@ MGL_EXPORT /** Creates and returns an `MGLPolygon` object from the specified set of coordinates. - + @param coords The array of coordinates defining the shape. The data in this array is copied to the new object. @param count The number of items in the `coords` array. @@ -72,7 +72,7 @@ MGL_EXPORT /** Creates and returns an `MGLPolygon` object from the specified set of coordinates and interior polygons. - + @param coords The array of coordinates defining the shape. The data in this array is copied to the new object. @param count The number of items in the `coords` array. @@ -92,12 +92,12 @@ MGL_EXPORT atoll: the inner island would be one `MGLPolygon` object, while the surrounding atoll would be another. You could also use a multipolygon shape to represent a group of disconnected but related buildings. - + You can add multipolygon shapes to the map by adding them to an `MGLShapeSource` object. Configure the appearance of an `MGLShapeSource`’s or `MGLVectorSource`’s multipolygons collectively using an `MGLFillStyleLayer` or `MGLSymbolStyleLayer` object. - + You cannot add an `MGLMultiPolygon` object directly to a map view using `-[MGLMapView addAnnotation:]` or `-[MGLMapView addOverlay:]`. However, you can add the `polygons` array’s items as overlays individually. @@ -112,7 +112,7 @@ MGL_EXPORT /** Creates and returns a multipolygon object consisting of the given polygons. - + @param polygons The array of polygons defining the shape. @return A new multipolygon object. */ diff --git a/platform/darwin/src/MGLPolygon.mm b/platform/darwin/src/MGLPolygon.mm index 565de017cc..ceafe873bf 100644 --- a/platform/darwin/src/MGLPolygon.mm +++ b/platform/darwin/src/MGLPolygon.mm @@ -44,7 +44,7 @@ - (BOOL)isEqual:(id)other { if (self == other) return YES; if (![other isKindOfClass:[MGLPolygon class]]) return NO; - + MGLPolygon *otherPolygon = (MGLPolygon *)other; return ([super isEqual:otherPolygon] && [[self geoJSONDictionary] isEqualToDictionary:[otherPolygon geoJSONDictionary]]); @@ -80,7 +80,7 @@ } - (mbgl::Annotation)annotationObjectWithDelegate:(id <MGLMultiPointDelegate>)delegate { - + mbgl::FillAnnotation annotation { [self polygon] }; annotation.opacity = { static_cast<float>([delegate alphaForShapeAnnotation:self]) }; annotation.outlineColor = { [delegate strokeColorForShapeAnnotation:self] }; @@ -115,9 +115,9 @@ - (instancetype)initWithPolygons:(NS_ARRAY_OF(MGLPolygon *) *)polygons { if (self = [super init]) { _polygons = polygons; - + mbgl::LatLngBounds bounds = mbgl::LatLngBounds::empty(); - + for (MGLPolygon *polygon in _polygons) { bounds.extend(MGLLatLngBoundsFromCoordinateBounds(polygon.overlayBounds)); } @@ -141,7 +141,7 @@ - (BOOL)isEqual:(id)other { if (self == other) return YES; if (![other isKindOfClass:[MGLMultiPolygon class]]) return NO; - + MGLMultiPolygon *otherMultiPolygon = other; return [super isEqual:other] && [self.polygons isEqualToArray:otherMultiPolygon.polygons]; diff --git a/platform/darwin/src/MGLPolyline.h b/platform/darwin/src/MGLPolyline.h index ca1f8e36cc..b3db0fd39f 100644 --- a/platform/darwin/src/MGLPolyline.h +++ b/platform/darwin/src/MGLPolyline.h @@ -14,28 +14,28 @@ NS_ASSUME_NONNULL_BEGIN specified as `CLLocationCoordinate2D` instances, and the line segments that connect them. For example, you could use an polyline to represent a road or the path along which something moves. - + You can add polyline shapes to the map by adding them to an `MGLShapeSource` object. Configure the appearance of an `MGLShapeSource`’s or `MGLVectorSource`’s polylines collectively using an `MGLLineStyleLayer` or `MGLSymbolStyleLayer` object. - + Alternatively, you can add a polyline overlay directly to a map view using the `-[MGLMapView addAnnotation:]` or `-[MGLMapView addOverlay:]` method. Configure a polyline overlay’s appearance using `-[MGLMapViewDelegate mapView:strokeColorForShapeAnnotation:]` and `-[MGLMapViewDelegate mapView:lineWidthForPolylineAnnotation:]`. - + The vertices are automatically connected in the order in which you provide them. The first and last vertices are not connected to each other, but you can specify the same `CLLocationCoordinate2D` as the first and last vertices in order to close the polyline. To fill the space within the shape, use an `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. - + A polyline is known as a <a href="https://tools.ietf.org/html/rfc7946#section-3.1.4">LineString</a> geometry in GeoJSON. @@ -46,7 +46,7 @@ MGL_EXPORT /** Creates and returns an `MGLPolyline` object from the specified set of coordinates. - + @param coords The array of coordinates defining the shape. The data in this array is copied to the new object. @param count The number of items in the `coords` array. @@ -61,16 +61,16 @@ MGL_EXPORT polylines. For example, you could use a multipolyline shape to represent both sides of a divided highway (dual carriageway), excluding the median (central reservation): each carriageway would be a distinct `MGLPolyline` object. - + You can add multipolyline shapes to the map by adding them to an `MGLShapeSource` object. Configure the appearance of an `MGLShapeSource`’s or `MGLVectorSource`’s multipolylines collectively using an `MGLLineStyleLayer` or `MGLSymbolStyleLayer` object. - + You cannot add an `MGLMultiPolyline` object directly to a map view using `-[MGLMapView addAnnotation:]` or `-[MGLMapView addOverlay:]`. However, you can add the `polylines` array’s items as overlays individually. - + A multipolyline is known as a <a href="https://tools.ietf.org/html/rfc7946#section-3.1.5">MultiLineString</a> geometry in GeoJSON. @@ -85,7 +85,7 @@ MGL_EXPORT /** Creates and returns a multipolyline object consisting of the given polylines. - + @param polylines The array of polylines defining the shape. @return A new multipolyline object. */ diff --git a/platform/darwin/src/MGLPolyline.mm b/platform/darwin/src/MGLPolyline.mm index e6b1cdebf6..454a1b964b 100644 --- a/platform/darwin/src/MGLPolyline.mm +++ b/platform/darwin/src/MGLPolyline.mm @@ -20,13 +20,13 @@ - (mbgl::LineString<double>)lineString { NSUInteger count = self.pointCount; CLLocationCoordinate2D *coordinates = self.coordinates; - + mbgl::LineString<double> geometry; geometry.reserve(self.pointCount); for (NSUInteger i = 0; i < count; i++) { geometry.push_back(mbgl::Point<double>(coordinates[i].longitude, coordinates[i].latitude)); } - + return geometry; } @@ -69,9 +69,9 @@ - (instancetype)initWithPolylines:(NS_ARRAY_OF(MGLPolyline *) *)polylines { if (self = [super init]) { _polylines = polylines; - + mbgl::LatLngBounds bounds = mbgl::LatLngBounds::empty(); - + for (MGLPolyline *polyline in _polylines) { bounds.extend(MGLLatLngBoundsFromCoordinateBounds(polyline.overlayBounds)); } @@ -96,7 +96,7 @@ { if (self == other) return YES; if (![other isKindOfClass:[MGLMultiPolyline class]]) return NO; - + MGLMultiPolyline *otherMultipoline = other; return ([super isEqual:otherMultipoline] && [self.polylines isEqualToArray:otherMultipoline.polylines]); @@ -127,7 +127,7 @@ NSMutableArray *coordinates = [NSMutableArray array]; for (MGLPolylineFeature *feature in self.polylines) { [coordinates addObject: feature.mgl_coordinates]; - } + } return @{@"type": @"MultiLineString", @"coordinates": coordinates}; } diff --git a/platform/darwin/src/MGLRasterSource.h b/platform/darwin/src/MGLRasterSource.h index ac5be60105..694a818246 100644 --- a/platform/darwin/src/MGLRasterSource.h +++ b/platform/darwin/src/MGLRasterSource.h @@ -10,12 +10,12 @@ NS_ASSUME_NONNULL_BEGIN width and height (measured in points) at which the map displays each raster image tile when the map’s zoom level is an integer. The raster source scales its images up or down when the map’s zoom level falls between two integers. - + The default value for this option is 512. Version 4 of the <a href="https://www.mapbox.com/api-documentation/#maps">Mapbox Maps API</a> requires a value of 256, as do many third-party tile servers, so consult your provider’s documentation for the correct value. - + This option is only applicable to `MGLRasterSource` objects; it is ignored when initializing `MGLVectorSource` objects. */ @@ -29,16 +29,16 @@ extern MGL_EXPORT const MGLTileSourceOption MGLTileSourceOptionTileSize; A raster source is added to an `MGLStyle` object along with one or more `MGLRasterStyleLayer` objects. Use a raster style layer to control the appearance of content supplied by the raster source. - + Each <a href="https://www.mapbox.com/mapbox-gl-style-spec/#sources-raster"><code>raster</code></a> source defined by the style JSON file is represented at runtime by an `MGLRasterSource` object that you can use to initialize new style layers. You can also add and remove sources dynamically using methods such as `-[MGLStyle addSource:]` and `-[MGLStyle sourceWithIdentifier:]`. - + ### Example - + ```swift let source = MGLRasterSource(identifier: "clouds", tileURLTemplates: ["https://example.com/raster-tiles/{z}/{x}/{y}.png"], options: [ .minimumZoomLevel: 9, @@ -58,21 +58,21 @@ MGL_EXPORT /** Returns a raster source initialized with an identifier and configuration URL. - + After initializing and configuring the source, add it to a map view’s style using the `-[MGLStyle addSource:]` method. - + The URL may be a full HTTP or HTTPS URL or, for tile sets hosted by Mapbox, a Mapbox URL indicating a map identifier (`mapbox://<mapid>`). The URL should point to a JSON file that conforms to the <a href="https://github.com/mapbox/tilejson-spec/">TileJSON specification</a>. - + If a Mapbox URL is specified, this source uses a tile size of 256. For all other tile sets, the default value is 512. (See the `MGLTileSourceOptionTileSize` documentation for more information about tile sizes.) If you need to use a tile size other than the default, use the `-initWithIdentifier:configurationURL:tileSize:` method. - + @param identifier A string that uniquely identifies the source in the style to which it is added. @param configurationURL A URL to a TileJSON configuration file describing the @@ -84,15 +84,15 @@ MGL_EXPORT /** Returns a raster source initialized with an identifier, configuration URL, and tile size. - + After initializing and configuring the source, add it to a map view’s style using the `-[MGLStyle addSource:]` method. - + The URL may be a full HTTP or HTTPS URL or, for tile sets hosted by Mapbox, a Mapbox URL indicating a map identifier (`mapbox://<mapid>`). The URL should point to a JSON file that conforms to the <a href="https://github.com/mapbox/tilejson-spec/">TileJSON specification</a>. - + @param identifier A string that uniquely identifies the source in the style to which it is added. @param configurationURL A URL to a TileJSON configuration file describing the diff --git a/platform/darwin/src/MGLRasterSource.mm b/platform/darwin/src/MGLRasterSource.mm index fd36413fe0..ccd5212b2a 100644 --- a/platform/darwin/src/MGLRasterSource.mm +++ b/platform/darwin/src/MGLRasterSource.mm @@ -50,7 +50,7 @@ static const CGFloat MGLRasterSourceRetinaTileSize = 512; - (instancetype)initWithIdentifier:(NSString *)identifier tileURLTemplates:(NS_ARRAY_OF(NSString *) *)tileURLTemplates options:(nullable NS_DICTIONARY_OF(MGLTileSourceOption, id) *)options { if (self = [super initWithIdentifier:identifier tileURLTemplates:tileURLTemplates options:options]) { mbgl::Tileset tileSet = MGLTileSetFromTileURLTemplates(tileURLTemplates, options); - + uint16_t tileSize = MGLRasterSourceRetinaTileSize; if (NSNumber *tileSizeNumber = options[MGLTileSourceOptionTileSize]) { if (![tileSizeNumber isKindOfClass:[NSNumber class]]) { @@ -59,7 +59,7 @@ static const CGFloat MGLRasterSourceRetinaTileSize = 512; } tileSize = static_cast<uint16_t>(round(tileSizeNumber.doubleValue)); } - + auto source = std::make_unique<mbgl::style::RasterSource>(identifier.UTF8String, tileSet, tileSize); _pendingSource = std::move(source); self.rawSource = _pendingSource.get(); diff --git a/platform/darwin/src/MGLRasterStyleLayer.h b/platform/darwin/src/MGLRasterStyleLayer.h index cd57a74f6a..d2b887d56f 100644 --- a/platform/darwin/src/MGLRasterStyleLayer.h +++ b/platform/darwin/src/MGLRasterStyleLayer.h @@ -1,4 +1,4 @@ -// This file is generated. +// This file is generated. // Edit platform/darwin/scripts/generate-style-code.js, then run `make style-code-darwin`. #import "MGLFoundation.h" @@ -9,7 +9,7 @@ NS_ASSUME_NONNULL_BEGIN /** An `MGLRasterStyleLayer` is a style layer that renders raster tiles on the map. - + Use a raster style layer to configure the color parameters of raster tiles loaded by an `MGLRasterSource` object. For example, you could use a raster style layer to render <a href="https://www.mapbox.com/satellite/">Mapbox @@ -18,15 +18,15 @@ NS_ASSUME_NONNULL_BEGIN set</a> uploaded to Mapbox Studio, or a raster map authored in <a href="https://tilemill-project.github.io/tilemill/">TileMill</a>, the classic Mapbox Editor, or Mapbox Studio Classic. - + You can access an existing raster style layer using the `-[MGLStyle layerWithIdentifier:]` method if you know its identifier; otherwise, find it using the `MGLStyle.layers` property. You can also create a new raster style layer and add it to the style using a method such as `-[MGLStyle addLayer:]`. - + ### Example - + ```swift let layer = MGLRasterStyleLayer(identifier: "clouds", source: source) layer.rasterOpacity = MGLStyleValue(rawValue: 0.5) @@ -41,11 +41,11 @@ MGL_EXPORT /** Increase or reduce the brightness of the image. The value is the maximum brightness. - + The default value of this property is an `MGLStyleValue` object containing an `NSNumber` object containing the float `1`. Set this property to `nil` to reset it to the default value. - + This attribute corresponds to the <a href="https://www.mapbox.com/mapbox-gl-style-spec/#paint-raster-brightness-max"><code>raster-brightness-max</code></a> layout property in the Mapbox Style Specification. @@ -57,11 +57,11 @@ MGL_EXPORT /** Increase or reduce the brightness of the image. The value is the minimum brightness. - + The default value of this property is an `MGLStyleValue` object containing an `NSNumber` object containing the float `0`. Set this property to `nil` to reset it to the default value. - + This attribute corresponds to the <a href="https://www.mapbox.com/mapbox-gl-style-spec/#paint-raster-brightness-min"><code>raster-brightness-min</code></a> layout property in the Mapbox Style Specification. @@ -72,7 +72,7 @@ MGL_EXPORT /** Increase or reduce the contrast of the image. - + The default value of this property is an `MGLStyleValue` object containing an `NSNumber` object containing the float `0`. Set this property to `nil` to reset it to the default value. @@ -81,9 +81,9 @@ MGL_EXPORT /** Fade duration when a new tile is added. - + This property is measured in milliseconds. - + The default value of this property is an `MGLStyleValue` object containing an `NSNumber` object containing the float `300`. Set this property to `nil` to reset it to the default value. @@ -92,13 +92,13 @@ MGL_EXPORT /** Rotates hues around the color wheel. - + This property is measured in degrees. - + The default value of this property is an `MGLStyleValue` object containing an `NSNumber` object containing the float `0`. Set this property to `nil` to reset it to the default value. - + This attribute corresponds to the <a href="https://www.mapbox.com/mapbox-gl-style-spec/#paint-raster-hue-rotate"><code>raster-hue-rotate</code></a> layout property in the Mapbox Style Specification. @@ -109,7 +109,7 @@ MGL_EXPORT /** The opacity at which the image will be drawn. - + The default value of this property is an `MGLStyleValue` object containing an `NSNumber` object containing the float `1`. Set this property to `nil` to reset it to the default value. @@ -118,7 +118,7 @@ MGL_EXPORT /** Increase or reduce the saturation of the image. - + The default value of this property is an `MGLStyleValue` object containing an `NSNumber` object containing the float `0`. Set this property to `nil` to reset it to the default value. diff --git a/platform/darwin/src/MGLRasterStyleLayer.mm b/platform/darwin/src/MGLRasterStyleLayer.mm index 87afb8da9d..1e0b1602f5 100644 --- a/platform/darwin/src/MGLRasterStyleLayer.mm +++ b/platform/darwin/src/MGLRasterStyleLayer.mm @@ -1,4 +1,4 @@ -// This file is generated. +// This file is generated. // Edit platform/darwin/scripts/generate-style-code.js, then run `make darwin-style-code`. #import "MGLSource.h" @@ -45,7 +45,7 @@ - (NSString *)sourceIdentifier { MGLAssertStyleLayerIsValid(); - + return @(self.rawLayer->getSourceID().c_str()); } diff --git a/platform/darwin/src/MGLShape.h b/platform/darwin/src/MGLShape.h index d1c150d02e..bd8b6152d2 100644 --- a/platform/darwin/src/MGLShape.h +++ b/platform/darwin/src/MGLShape.h @@ -9,19 +9,19 @@ NS_ASSUME_NONNULL_BEGIN `MGLShape` is an abstract class that represents a shape or annotation. Shapes constitute the content of a map – not only the overlays atop the map, but also the content that forms the base map. - + You do not create instances of this class directly or create subclasses of this - class. Instead, you create instances of `MGLPointAnnotation`, + class. Instead, you create instances of `MGLPointAnnotation`, `MGLPointCollection`, `MGLPolyline`, `MGLMultiPolyline`, `MGLPolygon`, `MGLMultiPolygon`, or `MGLShapeCollection`. The shape classes correspond to the <a href="https://tools.ietf.org/html/rfc7946#section-3.1">Geometry</a> object types in the GeoJSON standard, but some have nonstandard names for backwards compatibility. - + Although you do not create instances of this class directly, you can use its `+[MGLShape shapeWithData:encoding:error:]` factory method to create one of the concrete subclasses of `MGLShape` noted above from GeoJSON data. - + You can add shapes to the map by adding them to an `MGLShapeSource` object. Configure the appearance of an `MGLShapeSource`’s or `MGLVectorSource`’s shapes collectively using a concrete instance of `MGLVectorStyleLayer`. Alternatively, @@ -36,21 +36,21 @@ MGL_EXPORT /** Returns an `MGLShape` object initialized with the given data interpreted as a string containing a GeoJSON object. - + If the GeoJSON object is a geometry, the returned value is a kind of `MGLShape`. If it is a feature object, the returned value is a kind of `MGLShape` that conforms to the `MGLFeature` protocol. If it is a feature collection object, the returned value is an instance of `MGLShapeCollectionFeature`. - + ### Example - + ```swift let url = mainBundle.url(forResource: "amsterdam", withExtension: "geojson")! let data = try! Data(contentsOf: url) let feature = try! MGLShape(data: data, encoding: String.Encoding.utf8.rawValue) as! MGLShapeCollectionFeature ``` - + @param data String data containing GeoJSON source code. @param encoding The encoding used by `data`. @param outError Upon return, if an error has occurred, a pointer to an @@ -65,9 +65,9 @@ MGL_EXPORT /** The title of the shape annotation. - + The default value of this property is `nil`. - + This property is ignored when the shape is used in an `MGLShapeSource`. To name a shape used in a shape source, create an `MGLFeature` and add an attribute to the `MGLFeature.attributes` property. @@ -77,7 +77,7 @@ MGL_EXPORT /** The subtitle of the shape annotation. The default value of this property is `nil`. - + This property is ignored when the shape is used in an `MGLShapeSource`. To provide additional information about a shape used in a shape source, create an `MGLFeature` and add an attribute to the `MGLFeature.attributes` property. @@ -88,9 +88,9 @@ MGL_EXPORT /** The tooltip of the shape annotation. - + The default value of this property is `nil`. - + This property is ignored when the shape is used in an `MGLShapeSource`. */ @property (nonatomic, copy, nullable) NSString *toolTip; @@ -102,7 +102,7 @@ MGL_EXPORT /** Returns the GeoJSON string representation of the shape encapsulated in a data object. - + @param encoding The string encoding to use. @return A data object containing the shape’s GeoJSON string representation. */ diff --git a/platform/darwin/src/MGLShape.mm b/platform/darwin/src/MGLShape.mm index 984235fd97..e76e06c7e4 100644 --- a/platform/darwin/src/MGLShape.mm +++ b/platform/darwin/src/MGLShape.mm @@ -21,7 +21,7 @@ bool operator==(const CLLocationCoordinate2D lhs, const CLLocationCoordinate2D r } return nil; } - + try { const auto geojson = mapbox::geojson::parse(string.UTF8String); return MGLShapeFromGeoJSON(geojson); @@ -81,7 +81,7 @@ bool operator==(const CLLocationCoordinate2D lhs, const CLLocationCoordinate2D r { if (other == self) { return YES; } id <MGLAnnotation> annotation = other; - + #if TARGET_OS_IPHONE return ((!_title && ![annotation title]) || [_title isEqualToString:[annotation title]]) && ((!_subtitle && ![annotation subtitle]) || [_subtitle isEqualToString:[annotation subtitle]]); diff --git a/platform/darwin/src/MGLShapeCollection.h b/platform/darwin/src/MGLShapeCollection.h index 79b7e9223a..bb107ee7f0 100644 --- a/platform/darwin/src/MGLShapeCollection.h +++ b/platform/darwin/src/MGLShapeCollection.h @@ -11,26 +11,26 @@ NS_ASSUME_NONNULL_BEGIN An `MGLShapeCollection` object represents a shape consisting of zero or more distinct but related shapes that are instances of `MGLShape`. The constituent shapes can be a mixture of different kinds of shapes. - + `MGLShapeCollection` is most commonly used to add multiple shapes to a single `MGLShapeSource`. Configure the appearance of an `MGLShapeSource`’s or `MGLVectorSource`’s shape collection collectively using an `MGLSymbolStyleLayer` object, or use multiple instances of `MGLCircleStyleLayer`, `MGLFillStyleLayer`, and `MGLLineStyleLayer` to configure the appearance of each kind of shape inside the collection. - + You cannot add an `MGLShapeCollection` object directly to a map view as an annotation. However, you can create individual `MGLPointAnnotation`, `MGLPolyline`, and `MGLPolygon` objects from the `shapes` array and add those annotation objects to the map view using the `-[MGLMapView addAnnotations:]` method. - + To represent a collection of point, polyline, or polygon shapes, it may be more convenient to use an `MGLPointCollection`, `MGLMultiPolyline`, or `MGLMultiPolygon` object, respectively. - - A shape collection is known as a - <a href="https://tools.ietf.org/html/rfc7946#section-3.1.8">GeometryCollection</a> + + A shape collection is known as a + <a href="https://tools.ietf.org/html/rfc7946#section-3.1.8">GeometryCollection</a> geometry in GeoJSON. */ MGL_EXPORT @@ -43,7 +43,7 @@ MGL_EXPORT /** Creates and returns a shape collection consisting of the given shapes. - + @param shapes The array of shapes defining the shape collection. The data in this array is copied to the new object. @return A new shape collection object. diff --git a/platform/darwin/src/MGLShapeCollection.mm b/platform/darwin/src/MGLShapeCollection.mm index 4b468a1cbb..03cab0043f 100644 --- a/platform/darwin/src/MGLShapeCollection.mm +++ b/platform/darwin/src/MGLShapeCollection.mm @@ -32,7 +32,7 @@ - (BOOL)isEqual:(id)other { if (self == other) return YES; if (![other isKindOfClass:[MGLShapeCollection class]]) return NO; - + MGLShapeCollection *otherShapeCollection = other; return [super isEqual:otherShapeCollection] && [_shapes isEqualToArray:otherShapeCollection.shapes]; diff --git a/platform/darwin/src/MGLShapeSource.h b/platform/darwin/src/MGLShapeSource.h index 54c5668260..24cdf82bea 100644 --- a/platform/darwin/src/MGLShapeSource.h +++ b/platform/darwin/src/MGLShapeSource.h @@ -21,7 +21,7 @@ typedef NSString *MGLShapeSourceOption NS_STRING_ENUM; This attribute corresponds to the <a href="https://www.mapbox.com/mapbox-gl-style-spec/#sources-geojson-cluster"><code>cluster</code></a> source property in the Mapbox Style Specification. - + This option only affects point features within a shape source. */ extern MGL_EXPORT const MGLShapeSourceOption MGLShapeSourceOptionClustered; @@ -35,7 +35,7 @@ extern MGL_EXPORT const MGLShapeSourceOption MGLShapeSourceOptionClusterRadius; /** An `NSNumber` object containing an integer; specifies the maximum zoom level at - which to cluster points if clustering is enabled. Defaults to one zoom level + which to cluster points if clustering is enabled. Defaults to one zoom level less than the value of `MGLShapeSourceOptionMaximumZoomLevel` so that, at the maximum zoom level, the shapes are not clustered. @@ -58,8 +58,8 @@ extern MGL_EXPORT const MGLShapeSourceOption MGLShapeSourceOptionMaximumZoomLeve /** An `NSNumber` object containing an integer; specifies the size of the tile - buffer on each side. A value of 0 produces no buffer. A value of 512 produces a - buffer as wide as the tile itself. Larger values produce fewer rendering + buffer on each side. A value of 0 produces no buffer. A value of 512 produces a + buffer as wide as the tile itself. Larger values produce fewer rendering artifacts near tile edges and slower performance. The default value is 128. This attribute corresponds to the @@ -86,7 +86,7 @@ extern MGL_EXPORT const MGLShapeSourceOption MGLShapeSourceOptionSimplificationT <a href="http://geojson.org/">GeoJSON</a> code. A shape source is added to an `MGLStyle` object along with an `MGLVectorStyleLayer` object. The vector style layer defines the appearance of any content supplied by the shape source. - + Each <a href="https://www.mapbox.com/mapbox-gl-style-spec/#sources-geojson"><code>geojson</code></a> source defined by the style JSON file is represented at runtime by an @@ -94,12 +94,12 @@ extern MGL_EXPORT const MGLShapeSourceOption MGLShapeSourceOptionSimplificationT initialize new style layers. You can also add and remove sources dynamically using methods such as `-[MGLStyle addSource:]` and `-[MGLStyle sourceWithIdentifier:]`. - + Any vector style layer initialized with a shape source should have a `nil` value in its `sourceLayerIdentifier` property. - + ### Example - + ```swift var coordinates: [CLLocationCoordinate2D] = [ CLLocationCoordinate2D(latitude: 37.77, longitude: -122.42), @@ -118,7 +118,7 @@ MGL_EXPORT /** Returns a shape source with an identifier, URL, and dictionary of options for the source. - + @param identifier A string that uniquely identifies the source. @param url An HTTP(S) URL, absolute file URL, or local file URL relative to the current application’s resource bundle. @@ -130,17 +130,17 @@ MGL_EXPORT /** Returns a shape source with an identifier, a shape, and dictionary of options for the source. - + To specify attributes about the shape, use an instance of an `MGLShape` subclass that conforms to the `MGLFeature` protocol, such as `MGLPointFeature`. To include multiple shapes in the source, use an `MGLShapeCollection` or `MGLShapeCollectionFeature` object, or use the - `-initWithIdentifier:features:options:` or + `-initWithIdentifier:features:options:` or `-initWithIdentifier:shapes:options:` methods. - + To create a shape from GeoJSON source code, use the `+[MGLShape shapeWithData:encoding:error:]` method. - + @param identifier A string that uniquely identifies the source. @param shape A concrete subclass of `MGLShape` @param options An `NSDictionary` of options for this source. @@ -151,7 +151,7 @@ MGL_EXPORT /** Returns a shape source with an identifier, an array of features, and a dictionary of options for the source. - + Unlike `-initWithIdentifier:shapes:options:`, this method accepts `MGLFeature` instances, such as `MGLPointFeature` objects, whose attributes you can use when applying a predicate to `MGLVectorStyleLayer` or configuring a style layer’s @@ -170,11 +170,11 @@ MGL_EXPORT /** Returns a shape source with an identifier, an array of shapes, and a dictionary of options for the source. - + Any `MGLFeature` instance passed into this initializer is treated as an ordinary shape, causing any attributes to be inaccessible to an `MGLVectorStyleLayer` when - evaluating a predicate or configuring certain layout or paint attributes. To - preserve the attributes associated with each feature, use the + evaluating a predicate or configuring certain layout or paint attributes. To + preserve the attributes associated with each feature, use the `-initWithIdentifier:features:options:` method instead. To create a shape from GeoJSON source code, use the @@ -196,8 +196,8 @@ MGL_EXPORT If the receiver was initialized using `-initWithIdentifier:URL:options:`, this property is set to `nil`. This property is unavailable until the receiver is passed into `-[MGLStyle addSource:]`. - - You can get/set the shapes within a collection via this property. Actions must + + You can get/set the shapes within a collection via this property. Actions must be performed on the application's main thread. */ @property (nonatomic, copy, nullable) MGLShape *shape; diff --git a/platform/darwin/src/MGLShapeSource.mm b/platform/darwin/src/MGLShapeSource.mm index 245b7f2de2..07033d8d45 100644 --- a/platform/darwin/src/MGLShapeSource.mm +++ b/platform/darwin/src/MGLShapeSource.mm @@ -34,10 +34,10 @@ const MGLShapeSourceOption MGLShapeSourceOptionSimplificationTolerance = @"MGLSh if (self = [super initWithIdentifier:identifier]) { auto geoJSONOptions = MGLGeoJSONOptionsFromDictionary(options); auto source = std::make_unique<mbgl::style::GeoJSONSource>(identifier.UTF8String, geoJSONOptions); - + _pendingSource = std::move(source); self.rawSource = _pendingSource.get(); - + self.URL = url; } return self; @@ -47,10 +47,10 @@ const MGLShapeSourceOption MGLShapeSourceOptionSimplificationTolerance = @"MGLSh if (self = [super initWithIdentifier:identifier]) { auto geoJSONOptions = MGLGeoJSONOptionsFromDictionary(options); auto source = std::make_unique<mbgl::style::GeoJSONSource>(identifier.UTF8String, geoJSONOptions); - + _pendingSource = std::move(source); self.rawSource = _pendingSource.get(); - + self.shape = shape; } return self; @@ -128,7 +128,7 @@ const MGLShapeSourceOption MGLShapeSourceOptionSimplificationTolerance = @"MGLSh mbgl::style::GeoJSONOptions MGLGeoJSONOptionsFromDictionary(NS_DICTIONARY_OF(MGLShapeSourceOption, id) *options) { auto geoJSONOptions = mbgl::style::GeoJSONOptions(); - + if (NSNumber *value = options[MGLShapeSourceOptionMaximumZoomLevel]) { if (![value isKindOfClass:[NSNumber class]]) { [NSException raise:NSInvalidArgumentException @@ -136,7 +136,7 @@ mbgl::style::GeoJSONOptions MGLGeoJSONOptionsFromDictionary(NS_DICTIONARY_OF(MGL } geoJSONOptions.maxzoom = value.integerValue; } - + if (NSNumber *value = options[MGLShapeSourceOptionBuffer]) { if (![value isKindOfClass:[NSNumber class]]) { [NSException raise:NSInvalidArgumentException @@ -144,7 +144,7 @@ mbgl::style::GeoJSONOptions MGLGeoJSONOptionsFromDictionary(NS_DICTIONARY_OF(MGL } geoJSONOptions.buffer = value.integerValue; } - + if (NSNumber *value = options[MGLShapeSourceOptionSimplificationTolerance]) { if (![value isKindOfClass:[NSNumber class]]) { [NSException raise:NSInvalidArgumentException @@ -152,7 +152,7 @@ mbgl::style::GeoJSONOptions MGLGeoJSONOptionsFromDictionary(NS_DICTIONARY_OF(MGL } geoJSONOptions.tolerance = value.doubleValue; } - + if (NSNumber *value = options[MGLShapeSourceOptionClusterRadius]) { if (![value isKindOfClass:[NSNumber class]]) { [NSException raise:NSInvalidArgumentException @@ -160,7 +160,7 @@ mbgl::style::GeoJSONOptions MGLGeoJSONOptionsFromDictionary(NS_DICTIONARY_OF(MGL } geoJSONOptions.clusterRadius = value.integerValue; } - + if (NSNumber *value = options[MGLShapeSourceOptionMaximumZoomLevelForClustering]) { if (![value isKindOfClass:[NSNumber class]]) { [NSException raise:NSInvalidArgumentException @@ -168,7 +168,7 @@ mbgl::style::GeoJSONOptions MGLGeoJSONOptionsFromDictionary(NS_DICTIONARY_OF(MGL } geoJSONOptions.clusterMaxZoom = value.integerValue; } - + if (NSNumber *value = options[MGLShapeSourceOptionClustered]) { if (![value isKindOfClass:[NSNumber class]]) { [NSException raise:NSInvalidArgumentException @@ -176,6 +176,6 @@ mbgl::style::GeoJSONOptions MGLGeoJSONOptionsFromDictionary(NS_DICTIONARY_OF(MGL } geoJSONOptions.cluster = value.boolValue; } - + return geoJSONOptions; } diff --git a/platform/darwin/src/MGLSource.h b/platform/darwin/src/MGLSource.h index 7b3242e3ae..8bf48907cc 100644 --- a/platform/darwin/src/MGLSource.h +++ b/platform/darwin/src/MGLSource.h @@ -10,12 +10,12 @@ NS_ASSUME_NONNULL_BEGIN `MGLStyle` object along with an `MGLForegroundStyleLayer` object. The foreground style layer defines the appearance of any content supplied by the source. - + Each source defined by the style JSON file is represented at runtime by an `MGLSource` object that you can use to refine the map’s content. You can also add and remove sources dynamically using methods such as `-[MGLStyle addSource:]` and `-[MGLStyle sourceWithIdentifier:]`. - + Do not create instances of this class directly, and do not create your own subclasses of this class. Instead, create instances of `MGLShapeSource` and the concrete subclasses of `MGLTileSource`, `MGLVectorSource` and `MGLRasterSource`. @@ -29,10 +29,10 @@ MGL_EXPORT /** Returns a source initialized with an identifier. - + After initializing and configuring the source, add it to a map view’s style using the `-[MGLStyle addSource:]` method. - + @param identifier A string that uniquely identifies the source in the style to which it is added. @return An initialized source. diff --git a/platform/darwin/src/MGLSource_Private.h b/platform/darwin/src/MGLSource_Private.h index 6e1d2e379c..acb325e2f3 100644 --- a/platform/darwin/src/MGLSource_Private.h +++ b/platform/darwin/src/MGLSource_Private.h @@ -18,29 +18,29 @@ namespace mbgl { - (instancetype)initWithRawSource:(mbgl::style::Source *)rawSource; /** - A raw pointer to the mbgl object, which is always initialized, either to the + A raw pointer to the mbgl object, which is always initialized, either to the value returned by `mbgl::Map getSource`, or for independently created objects, to the pointer value held in `pendingSource`. In the latter case, this raw - pointer value stays even after ownership of the object is transferred via + pointer value stays even after ownership of the object is transferred via `mbgl::Map addSource`. */ @property (nonatomic) mbgl::style::Source *rawSource; /** 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::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 map via `-[MGLStyle addSource:]` and styled with a + `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 map via `-[MGLStyle addSource:]` and styled with a `MGLLayer`. */ - (void)addToMapView:(MGLMapView *)mapView; /** 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. diff --git a/platform/darwin/src/MGLStyle.h b/platform/darwin/src/MGLStyle.h index f11810fb65..567345a798 100644 --- a/platform/darwin/src/MGLStyle.h +++ b/platform/darwin/src/MGLStyle.h @@ -32,16 +32,16 @@ static MGL_EXPORT const NSInteger MGLStyleDefaultVersion = 9; /** The proxy object for the current map style. - + MGLStyle provides a set of convenience methods for changing Mapbox default styles using `-[MGLMapView styleURL]`. <a href="https://www.mapbox.com/maps/">Learn more about Mapbox default styles</a>. - - It is also possible to directly manipulate the current map style + + It is also possible to directly manipulate the current map style via `-[MGLMapView style]` by updating the style's data sources or layers. - + @note Wait until the map style has finished loading before modifying a map's - style via any of the `MGLStyle` instance methods below. You can use the + style via any of the `MGLStyle` instance methods below. You can use the `-[MGLMapViewDelegate mapView:didFinishLoadingStyle:]` or `-[MGLMapViewDelegate mapViewDidFinishLoadingMap:]` methods as indicators that it's safe to modify the map's style. @@ -211,15 +211,15 @@ MGL_EXPORT /** Adds a new source to the current style. - + @note Adding the same source instance more than once will result in a `MGLRedundantSourceException`. Reusing the same source identifier, even with - different source instances, will result in a - `MGLRedundantSourceIdentifierException`. - - @note Sources should be added in + different source instances, will result in a + `MGLRedundantSourceIdentifierException`. + + @note Sources should be added in `-[MGLMapViewDelegate mapView:didFinishLoadingStyle:]` or - `-[MGLMapViewDelegate mapViewDidFinishLoadingMap:]` to ensure that the map + `-[MGLMapViewDelegate mapViewDidFinishLoadingMap:]` to ensure that the map has loaded the style and is ready to accept a new source. @param source The source to add to the current style. @@ -228,7 +228,7 @@ MGL_EXPORT /** Removes a source from the current style. - + @note Source identifiers are not guaranteed to exist across styles or different versions of the same style. Applications that use this API must first set the style URL to an explicitly versioned style using a convenience method like @@ -251,7 +251,7 @@ MGL_EXPORT /** Returns a style layer with the given identifier in the current style. - + @note Layer identifiers are not guaranteed to exist across styles or different versions of the same style. Applications that use this API must first set the style URL to an explicitly versioned style using a convenience method like @@ -259,7 +259,7 @@ MGL_EXPORT inspectable in Interface Builder, or a manually constructed `NSURL`. This approach also avoids layer identifer name changes that will occur in the default style’s layers over time. - + @return An instance of a concrete subclass of `MGLStyleLayer` associated with the given identifier, or `nil` if the current style contains no such style layer. @@ -268,14 +268,14 @@ MGL_EXPORT /** Adds a new layer on top of existing layers. - + @note Adding the same layer instance more than once will result in a `MGLRedundantLayerException`. Reusing the same layer identifer, even with - different layer instances, will also result in an exception. - - @note Layers should be added in + different layer instances, will also result in an exception. + + @note Layers should be added in `-[MGLMapViewDelegate mapView:didFinishLoadingStyle:]` or - `-[MGLMapViewDelegate mapViewDidFinishLoadingMap:]` to ensure that the map + `-[MGLMapViewDelegate mapViewDidFinishLoadingMap:]` to ensure that the map has loaded the style and is ready to accept a new layer. @param layer The layer object to add to the map view. This object must be an @@ -285,14 +285,14 @@ MGL_EXPORT /** Inserts a new layer into the style at the given index. - + @note Adding the same layer instance more than once will result in a `MGLRedundantLayerException`. Reusing the same layer identifer, even with - different layer instances, will also result in an exception. - + different layer instances, will also result in an exception. + @note Layers should be added in `-[MGLMapViewDelegate mapView:didFinishLoadingStyle:]` or - `-[MGLMapViewDelegate mapViewDidFinishLoadingMap:]` to ensure that the map + `-[MGLMapViewDelegate mapViewDidFinishLoadingMap:]` to ensure that the map has loaded the style and is ready to accept a new layer. @param layer The layer to insert. @@ -304,7 +304,7 @@ MGL_EXPORT /** Inserts a new layer below another layer. - + @note Layer identifiers are not guaranteed to exist across styles or different versions of the same style. Applications that use this API must first set the style URL to an explicitly versioned style using a convenience method like @@ -312,7 +312,7 @@ MGL_EXPORT inspectable in Interface Builder, or a manually constructed `NSURL`. This approach also avoids layer identifer name changes that will occur in the default style’s layers over time. - + Inserting the same layer instance more than once will result in a `MGLRedundantLayerException`. Reusing the same layer identifer, even with different layer instances, will also result in an exception. @@ -324,7 +324,7 @@ MGL_EXPORT /** Inserts a new layer above another layer. - + @note Layer identifiers are not guaranteed to exist across styles or different versions of the same style. Applications that use this API must first set the style URL to an explicitly versioned style using a convenience method like @@ -332,7 +332,7 @@ MGL_EXPORT inspectable in Interface Builder, or a manually constructed `NSURL`. This approach also avoids layer identifer name changes that will occur in the default style’s layers over time. - + Inserting the same layer instance more than once will result in a `MGLRedundantLayerException`. Reusing the same layer identifer, even with different layer instances, will also result in an exception. @@ -344,7 +344,7 @@ MGL_EXPORT /** Removes a layer from the map view. - + @note Layer identifiers are not guaranteed to exist across styles or different versions of the same style. Applications that use this API must first set the style URL to an explicitly versioned style using a convenience method like @@ -383,7 +383,7 @@ MGL_EXPORT /** Deactivates the style class with the given identifier. - + @note Style class names are not guaranteed to exist across styles or different versions of the same style. Applications that use this API must first set the style URL to an explicitly versioned style using a convenience method like @@ -400,15 +400,15 @@ MGL_EXPORT /** Returns the image associated with the given name in the style. - + @note Names and their associated images are not guaranteed to exist across styles or different versions of the same style. Applications that use this API must first set the style URL to an explicitly versioned style using a convenience method like `+[MGLStyle outdoorsStyleURLWithVersion:]`, `MGLMapView`'s “Style URL” inspectable in Interface Builder, or a manually - constructed `NSURL`. This approach also avoids image name changes that will + constructed `NSURL`. This approach also avoids image name changes that will occur in the default style over time. - + @param name The name associated with the image you want to obtain. @return The image associated with the given name, or `nil` if no image is associated with that name. @@ -417,11 +417,11 @@ MGL_EXPORT /** Adds or overrides an image used by the style’s layers. - + To use an image in a style layer, give it a unique name using this method, then set the `iconImageName` property of an `MGLSymbolStyleLayer` object to that name. - + @param image The image for the name. @param name The name of the image to set to the style. */ @@ -429,13 +429,13 @@ MGL_EXPORT /** Removes a name and its associated image from the style. - + @note Names and their associated images are not guaranteed to exist across styles or different versions of the same style. Applications that use this API must first set the style URL to an explicitly versioned style using a convenience method like `+[MGLStyle outdoorsStyleURLWithVersion:]`, `MGLMapView`'s “Style URL” inspectable in Interface Builder, or a manually - constructed `NSURL`. This approach also avoids image name changes that will + constructed `NSURL`. This approach also avoids image name changes that will occur in the default style over time. @param name The name of the image to remove. @@ -446,7 +446,7 @@ MGL_EXPORT /** The duration in seconds to animate any changes to the style URL or to layout and paint attributes. - + By default, this property is set to zero seconds, so any changes take effect without animation. */ @property (nonatomic) NSTimeInterval transitionDuration; diff --git a/platform/darwin/src/MGLStyle.mm b/platform/darwin/src/MGLStyle.mm index 78c719050c..bcb8100800 100644 --- a/platform/darwin/src/MGLStyle.mm +++ b/platform/darwin/src/MGLStyle.mm @@ -217,7 +217,7 @@ static NSURL *MGLStyleURL_emerald; if (![source isKindOfClass:[MGLTileSource class]]) { continue; } - + NSArray *tileSetInfos = [source attributionInfosWithFontSize:fontSize linkColor:linkColor]; [infos growArrayByAddingAttributionInfosFromArray:tileSetInfos]; } @@ -321,7 +321,7 @@ static NSURL *MGLStyleURL_emerald; - (MGLStyleLayer *)layerFromMBGLLayer:(mbgl::style::Layer *)mbglLayer { NSParameterAssert(mbglLayer); - + NSString *identifier = @(mbglLayer->getID().c_str()); MGLStyleLayer *styleLayer; if (auto fillLayer = mbglLayer->as<mbgl::style::FillLayer>()) { @@ -438,7 +438,7 @@ static NSURL *MGLStyleURL_emerald; @"Make sure sibling was obtained using -[MGLStyle layerWithIdentifier:].", sibling]; } - + auto layers = self.mapView.mbglMap->getLayers(); std::string siblingIdentifier = sibling.identifier.UTF8String; NSUInteger index = 0; @@ -448,7 +448,7 @@ static NSURL *MGLStyleURL_emerald; } index++; } - + [self willChangeValueForKey:@"layers"]; if (index + 1 > layers.size()) { [NSException raise:NSInvalidArgumentException diff --git a/platform/darwin/src/MGLStyleLayer.h b/platform/darwin/src/MGLStyleLayer.h index d882ced6e6..55f1a56490 100644 --- a/platform/darwin/src/MGLStyleLayer.h +++ b/platform/darwin/src/MGLStyleLayer.h @@ -9,11 +9,11 @@ NS_ASSUME_NONNULL_BEGIN `MGLStyleLayer` is an abstract base class for style layers. A style layer manages the layout and appearance of content at a specific z-index in a style. An `MGLStyle` object consists of one or more `MGLStyleLayer` objects. - + Each style layer defined by the style JSON file is represented at runtime by an `MGLStyleLayer` object, which you can use to refine the map’s appearance. You can also add and remove style layers dynamically. - + Do not create instances of this class directly, and do not create your own subclasses of this class. Instead, create instances of `MGLBackgroundStyleLayer` and the concrete subclasses of @@ -28,16 +28,16 @@ MGL_EXPORT /** Returns a style layer object initialized with the given identifier. - + The default implementation of this initializer in MGLStyleLayer creates an invalid style layer. Call this initializer on `MGLBackgroundStyleLayer` or one of the concrete subclasses of `MGLForegroundStyleLayer` to create a valid style layer. - + After initializing and configuring the style layer, add it to a map view’s style using the `-[MGLStyle addLayer:]` or - `-[MGLStyle insertLayer:belowLayer:]` method. - + `-[MGLStyle insertLayer:belowLayer:]` method. + @param identifier A string that uniquely identifies the layer in the style to which it is added. @return An initialized style layer. diff --git a/platform/darwin/src/MGLStyleLayer.h.ejs b/platform/darwin/src/MGLStyleLayer.h.ejs index 8ffed66b54..f0a4ba64a3 100644 --- a/platform/darwin/src/MGLStyleLayer.h.ejs +++ b/platform/darwin/src/MGLStyleLayer.h.ejs @@ -5,7 +5,7 @@ const paintProperties = locals.paintProperties; const enumProperties = locals.enumProperties; -%> -// This file is generated. +// This file is generated. // Edit platform/darwin/scripts/generate-style-code.js, then run `make style-code-darwin`. #import "MGLFoundation.h" @@ -22,7 +22,7 @@ NS_ASSUME_NONNULL_BEGIN <% if (property.type == "enum") { -%> /** <%- propertyDoc(property.name, property, type, 'enum').wrap(80, 1) %> - + Values of this type are used in the `MGL<%- camelize(type) %>StyleLayer.<%- camelizeWithLeadingLowercase(property.name) %>` property. */ @@ -41,7 +41,7 @@ typedef NS_ENUM(NSUInteger, MGL<%- camelize(property.name) %>) { <% if (property.type == "enum") { -%> /** <%- propertyDoc(property.name, property, type, 'enum').wrap(80, 1) %> - + Values of this type are used in the `MGL<%- camelize(type) %>StyleLayer.<%- camelizeWithLeadingLowercase(property.name) %>` property. */ @@ -63,15 +63,15 @@ typedef NS_ENUM(NSUInteger, MGL<%- camelize(property.name) %>) { <% } else { -%> /** <%- doc.wrap(80, 1) %> - + You can access an existing <%- type %> style layer using the `-[MGLStyle layerWithIdentifier:]` method if you know its identifier; otherwise, find it using the `MGLStyle.layers` property. You can also create a new <%- type %> style layer and add it to the style using a method such as `-[MGLStyle addLayer:]`. - + ### Example - + ```swift ``` */ diff --git a/platform/darwin/src/MGLStyleLayer.mm b/platform/darwin/src/MGLStyleLayer.mm index 97f8f86b26..47f41e0388 100644 --- a/platform/darwin/src/MGLStyleLayer.mm +++ b/platform/darwin/src/MGLStyleLayer.mm @@ -61,7 +61,7 @@ - (float)minimumZoomLevel { MGLAssertStyleLayerIsValid(); - + return self.rawLayer->getMinZoom(); } diff --git a/platform/darwin/src/MGLStyleLayer.mm.ejs b/platform/darwin/src/MGLStyleLayer.mm.ejs index 9445c3cf21..42b366905c 100644 --- a/platform/darwin/src/MGLStyleLayer.mm.ejs +++ b/platform/darwin/src/MGLStyleLayer.mm.ejs @@ -4,7 +4,7 @@ const paintProperties = locals.paintProperties; const enumProperties = locals.enumProperties; -%> -// This file is generated. +// This file is generated. // Edit platform/darwin/scripts/generate-style-code.js, then run `make darwin-style-code`. #import "MGLSource.h" @@ -95,7 +95,7 @@ namespace mbgl { - (NSString *)sourceIdentifier { MGLAssertStyleLayerIsValid(); - + return @(self.rawLayer->getSourceID().c_str()); } diff --git a/platform/darwin/src/MGLStyleLayer_Private.h b/platform/darwin/src/MGLStyleLayer_Private.h index 8f1cdfb4a1..b5d709a7af 100644 --- a/platform/darwin/src/MGLStyleLayer_Private.h +++ b/platform/darwin/src/MGLStyleLayer_Private.h @@ -53,9 +53,9 @@ NS_ASSUME_NONNULL_BEGIN /** Removes the mbgl style layer that this object represents from the mbgl map. - + When a mbgl style layer is removed, ownership of the object is transferred back - to the `MGLStyleLayer` instance and the unique_ptr reference is valid again. It + to the `MGLStyleLayer` instance and the unique_ptr reference is valid again. It is safe to add the layer back to the style after it is removed. */ - (void)removeFromMapView:(MGLMapView *)mapView; diff --git a/platform/darwin/src/MGLStyleValue.h b/platform/darwin/src/MGLStyleValue.h index 5b6528f6fd..2f462b5a2e 100644 --- a/platform/darwin/src/MGLStyleValue.h +++ b/platform/darwin/src/MGLStyleValue.h @@ -9,13 +9,13 @@ NS_ASSUME_NONNULL_BEGIN An `MGLStyleValue` object is a generic container for a style attribute value. The layout and paint attribute properties of `MGLStyleLayer` can be set to `MGLStyleValue` objects. - + The `MGLStyleValue` class itself represents a class cluster. Under the hood, a particular `MGLStyleValue` object may be either an `MGLStyleConstantValue` to represent a constant value or an `MGLStyleFunction` to represent a value function. Do not initialize an `MGLStyleValue` object directly; instead, use one of the class factory methods to create an `MGLStyleValue` object. - + The `MGLStyleValue` class takes a generic parameter `T` that indicates the Foundation class being wrapped by this class. Common values for `T` include: @@ -34,7 +34,7 @@ MGL_EXPORT /** Creates and returns an `MGLStyleConstantValue` object containing a raw value. - + @param rawValue The constant value contained by the object. @return An `MGLStyleConstantValue` object containing `rawValue`, which is treated as a constant value. @@ -44,7 +44,7 @@ MGL_EXPORT /** Creates and returns an `MGLStyleFunction` object representing a linear zoom level function with any number of stops. - + @param stops A dictionary associating zoom levels with style values. @return An `MGLStyleFunction` object with the given stops. */ @@ -53,7 +53,7 @@ MGL_EXPORT /** Creates and returns an `MGLStyleFunction` object representing a zoom level function with an exponential interpolation base and any number of stops. - + @param interpolationBase The exponential base of the interpolation curve. @param stops A dictionary associating zoom levels with style values. @return An `MGLStyleFunction` object with the given interpolation base and stops. @@ -67,7 +67,7 @@ MGL_EXPORT value that remains constant as the zoom level changes. The layout and paint attribute properties of `MGLStyleLayer` objects can be set to `MGLStyleConstantValue` objects. - + The `MGLStyleConstantValue` class takes a generic parameter `T` that indicates the Foundation class being wrapped by this class. */ @@ -78,7 +78,7 @@ MGL_EXPORT /** Creates and returns an `MGLStyleConstantValue` object containing a raw value. - + @param rawValue The constant value contained by the object. @return An `MGLStyleConstantValue` object containing `rawValue`, which is treated as a constant value. @@ -91,7 +91,7 @@ MGL_EXPORT /** Returns an `MGLStyleConstantValue` object containing a raw value. - + @param rawValue The value contained by the receiver. @return An `MGLStyleConstantValue` object containing `rawValue`. */ @@ -111,7 +111,7 @@ MGL_EXPORT as the zoom level changes. The layout and paint attribute properties of an `MGLStyleLayer` object can be set to `MGLStyleFunction` objects. Use a zoom level function to create the illusion of depth and control data density. - + The `MGLStyleFunction` class takes a generic parameter `T` that indicates the Foundation class being wrapped by this class. */ @@ -123,7 +123,7 @@ MGL_EXPORT /** Creates and returns an `MGLStyleFunction` object representing a linear zoom level function with any number of stops. - + @param stops A dictionary associating zoom levels with style values. @return An `MGLStyleFunction` object with the given stops. */ @@ -132,7 +132,7 @@ MGL_EXPORT /** Creates and returns an `MGLStyleFunction` object representing a zoom level function with an exponential interpolation base and any number of stops. - + @param interpolationBase The exponential base of the interpolation curve. @param stops A dictionary associating zoom levels with style values. @return An `MGLStyleFunction` object with the given interpolation base and stops. @@ -144,7 +144,7 @@ MGL_EXPORT /** Returns an `MGLStyleFunction` object representing a zoom level function with an exponential interpolation base and any number of stops. - + @param interpolationBase The exponential base of the interpolation curve. @param stops A dictionary associating zoom levels with style values. @return An `MGLStyleFunction` object with the given interpolation base and stops. @@ -155,7 +155,7 @@ MGL_EXPORT /** The exponential interpolation base of the function’s interpolation curve. - + The exponential interpolation base controls the rate at which the function’s output values increase. A value of 1 causes the function to increase linearly by zoom level. A higher exponential interpolation base causes the function’s output values to vary @@ -166,7 +166,7 @@ MGL_EXPORT /** A dictionary associating zoom levels with style values. - + Each of the function’s stops is represented by one key-value pair in the dictionary. Each key in the dictionary is an `NSNumber` object containing a floating-point zoom level. Each value in the dictionary is an `MGLStyleValue` diff --git a/platform/darwin/src/MGLStyleValue_Private.h b/platform/darwin/src/MGLStyleValue_Private.h index 2c3de3fb74..3772a7902a 100644 --- a/platform/darwin/src/MGLStyleValue_Private.h +++ b/platform/darwin/src/MGLStyleValue_Private.h @@ -17,7 +17,7 @@ template <typename MBGLType, typename ObjCType, typename MBGLElement = MBGLType, typename ObjCEnum = ObjCType> class MGLStyleValueTransformer { public: - + MGLStyleValue<ObjCType> *toStyleValue(const mbgl::style::PropertyValue<MBGLType> &mbglValue) { if (mbglValue.isConstant()) { return toStyleConstantValue(mbglValue.asConstant()); @@ -109,7 +109,7 @@ private: auto rawValue = toMGLRawStyleValue(mbglValue); return [MGLStyleConstantValue<ObjCType> valueWithRawValue:rawValue]; } - + MGLStyleFunction<ObjCType> *toStyleFunction(const mbgl::style::Function<MBGLType> &mbglFunction) { const auto &mbglStops = mbglFunction.getStops(); NSMutableDictionary *stops = [NSMutableDictionary dictionaryWithCapacity:mbglStops.size()]; @@ -133,29 +133,29 @@ private: NSNumber *toMGLRawStyleValue(const bool mbglStopValue) { return @(mbglStopValue); } - + NSNumber *toMGLRawStyleValue(const float mbglStopValue) { return @(mbglStopValue); } - + NSString *toMGLRawStyleValue(const std::string &mbglStopValue) { return @(mbglStopValue.c_str()); } - + // Offsets NSValue *toMGLRawStyleValue(const std::array<float, 2> &mbglStopValue) { return [NSValue mgl_valueWithOffsetArray:mbglStopValue]; } - + // Padding NSValue *toMGLRawStyleValue(const std::array<float, 4> &mbglStopValue) { return [NSValue mgl_valueWithPaddingArray:mbglStopValue]; } - + MGLColor *toMGLRawStyleValue(const mbgl::Color mbglStopValue) { return [MGLColor mgl_colorWithColor:mbglStopValue]; } - + ObjCType toMGLRawStyleValue(const std::vector<MBGLElement> &mbglStopValue) { NSMutableArray *array = [NSMutableArray arrayWithCapacity:mbglStopValue.size()]; for (const auto &mbglElement: mbglStopValue) { @@ -169,29 +169,29 @@ private: void getMBGLValue(NSNumber *rawValue, bool &mbglValue) { mbglValue = !!rawValue.boolValue; } - + void getMBGLValue(NSNumber *rawValue, float &mbglValue) { mbglValue = rawValue.floatValue; } - + void getMBGLValue(NSString *rawValue, std::string &mbglValue) { mbglValue = rawValue.UTF8String; } - + // Offsets void getMBGLValue(NSValue *rawValue, std::array<float, 2> &mbglValue) { mbglValue = rawValue.mgl_offsetArrayValue; } - + // Padding void getMBGLValue(NSValue *rawValue, std::array<float, 4> &mbglValue) { mbglValue = rawValue.mgl_paddingArrayValue; } - + void getMBGLValue(MGLColor *rawValue, mbgl::Color &mbglValue) { mbglValue = rawValue.mgl_color; } - + void getMBGLValue(ObjCType rawValue, std::vector<MBGLElement> &mbglValue) { mbglValue.reserve(rawValue.count); for (id obj in rawValue) { diff --git a/platform/darwin/src/MGLSymbolStyleLayer.h b/platform/darwin/src/MGLSymbolStyleLayer.h index 23ddd59d0d..431c87a486 100644 --- a/platform/darwin/src/MGLSymbolStyleLayer.h +++ b/platform/darwin/src/MGLSymbolStyleLayer.h @@ -1,4 +1,4 @@ -// This file is generated. +// This file is generated. // Edit platform/darwin/scripts/generate-style-code.js, then run `make style-code-darwin`. #import "MGLFoundation.h" @@ -10,7 +10,7 @@ NS_ASSUME_NONNULL_BEGIN /** In combination with `symbolPlacement`, determines the rotation behavior of icons. - + Values of this type are used in the `MGLSymbolStyleLayer.iconRotationAlignment` property. */ @@ -37,7 +37,7 @@ typedef NS_ENUM(NSUInteger, MGLIconRotationAlignment) { /** Scales the icon to fit around the associated text. - + Values of this type are used in the `MGLSymbolStyleLayer.iconTextFit` property. */ @@ -62,7 +62,7 @@ typedef NS_ENUM(NSUInteger, MGLIconTextFit) { /** Label placement relative to its geometry. - + Values of this type are used in the `MGLSymbolStyleLayer.symbolPlacement` property. */ @@ -80,7 +80,7 @@ typedef NS_ENUM(NSUInteger, MGLSymbolPlacement) { /** Part of the text placed closest to the anchor. - + Values of this type are used in the `MGLSymbolStyleLayer.textAnchor` property. */ @@ -125,7 +125,7 @@ typedef NS_ENUM(NSUInteger, MGLTextAnchor) { /** Text justification options. - + Values of this type are used in the `MGLSymbolStyleLayer.textJustification` property. */ @@ -146,7 +146,7 @@ typedef NS_ENUM(NSUInteger, MGLTextJustification) { /** Orientation of text when map is pitched. - + Values of this type are used in the `MGLSymbolStyleLayer.textPitchAlignment` property. */ @@ -168,7 +168,7 @@ typedef NS_ENUM(NSUInteger, MGLTextPitchAlignment) { /** In combination with `symbolPlacement`, determines the rotation behavior of the individual glyphs forming the text. - + Values of this type are used in the `MGLSymbolStyleLayer.textRotationAlignment` property. */ @@ -195,7 +195,7 @@ typedef NS_ENUM(NSUInteger, MGLTextRotationAlignment) { /** Specifies how to capitalize text. - + Values of this type are used in the `MGLSymbolStyleLayer.textTransform` property. */ @@ -216,7 +216,7 @@ typedef NS_ENUM(NSUInteger, MGLTextTransform) { /** Controls the translation reference point. - + Values of this type are used in the `MGLSymbolStyleLayer.iconTranslationAnchor` property. */ @@ -233,7 +233,7 @@ typedef NS_ENUM(NSUInteger, MGLIconTranslationAnchor) { /** Controls the translation reference point. - + Values of this type are used in the `MGLSymbolStyleLayer.textTranslationAnchor` property. */ @@ -251,19 +251,19 @@ typedef NS_ENUM(NSUInteger, MGLTextTranslationAnchor) { /** An `MGLSymbolStyleLayer` is a style layer that renders icon and text labels at points or along lines on the map. - + Use a symbol style layer to configure the visual appearance of labels for features in vector tiles loaded by an `MGLVectorSource` object or `MGLShape` or `MGLFeature` instances in an `MGLShapeSource` object. - + You can access an existing symbol style layer using the `-[MGLStyle layerWithIdentifier:]` method if you know its identifier; otherwise, find it using the `MGLStyle.layers` property. You can also create a new symbol style layer and add it to the style using a method such as `-[MGLStyle addLayer:]`. - + ### Example - + ```swift let layer = MGLSymbolStyleLayer(identifier: "coffeeshops", source: pois) layer.sourceLayerIdentifier = "pois" @@ -285,14 +285,14 @@ MGL_EXPORT /** If true, the icon will be visible even if it collides with other previously drawn symbols. - + The default value of this property is an `MGLStyleValue` object containing an `NSNumber` object containing `NO`. Set this property to `nil` to reset it to the default value. - + This property is only applied to the style if `iconImageName` is non-`nil`. Otherwise, it is ignored. - + This attribute corresponds to the <a href="https://www.mapbox.com/mapbox-gl-style-spec/#layout-symbol-icon-allow-overlap"><code>icon-allow-overlap</code></a> layout property in the Mapbox Style Specification. @@ -304,14 +304,14 @@ MGL_EXPORT /** If true, other symbols can be visible even if they collide with the icon. - + The default value of this property is an `MGLStyleValue` object containing an `NSNumber` object containing `NO`. Set this property to `nil` to reset it to the default value. - + This property is only applied to the style if `iconImageName` is non-`nil`. Otherwise, it is ignored. - + This attribute corresponds to the <a href="https://www.mapbox.com/mapbox-gl-style-spec/#layout-symbol-icon-ignore-placement"><code>icon-ignore-placement</code></a> layout property in the Mapbox Style Specification. @@ -323,7 +323,7 @@ MGL_EXPORT /** A string with {tokens} replaced, referencing the data property to pull from. - + This attribute corresponds to the <a href="https://www.mapbox.com/mapbox-gl-style-spec/#layout-symbol-icon-image"><code>icon-image</code></a> layout property in the Mapbox Style Specification. @@ -336,11 +336,11 @@ MGL_EXPORT #if TARGET_OS_IPHONE /** Offset distance of icon from its anchor. - + The default value of this property is an `MGLStyleValue` object containing an `NSValue` object containing a `CGVector` struct set to 0 rightward and 0 downward. Set this property to `nil` to reset it to the default value. - + This property is only applied to the style if `iconImageName` is non-`nil`. Otherwise, it is ignored. */ @@ -348,11 +348,11 @@ MGL_EXPORT #else /** Offset distance of icon from its anchor. - + The default value of this property is an `MGLStyleValue` object containing an `NSValue` object containing a `CGVector` struct set to 0 rightward and 0 upward. Set this property to `nil` to reset it to the default value. - + This property is only applied to the style if `iconImageName` is non-`nil`. Otherwise, it is ignored. */ @@ -362,11 +362,11 @@ MGL_EXPORT /** If true, text will display without their corresponding icons when the icon collides with other symbols and the text does not. - + The default value of this property is an `MGLStyleValue` object containing an `NSNumber` object containing `NO`. Set this property to `nil` to reset it to the default value. - + This property is only applied to the style if `iconImageName` is non-`nil`, and `text` is non-`nil`. Otherwise, it is ignored. */ @@ -375,13 +375,13 @@ MGL_EXPORT /** Size of the additional area around the icon bounding box used for detecting symbol collisions. - + This property is measured in points. - + The default value of this property is an `MGLStyleValue` object containing an `NSNumber` object containing the float `2`. Set this property to `nil` to reset it to the default value. - + This property is only applied to the style if `iconImageName` is non-`nil`. Otherwise, it is ignored. */ @@ -389,16 +389,16 @@ MGL_EXPORT /** Rotates the icon clockwise. - + This property is measured in degrees. - + The default value of this property is an `MGLStyleValue` object containing an `NSNumber` object containing the float `0`. Set this property to `nil` to reset it to the default value. - + This property is only applied to the style if `iconImageName` is non-`nil`. Otherwise, it is ignored. - + This attribute corresponds to the <a href="https://www.mapbox.com/mapbox-gl-style-spec/#layout-symbol-icon-rotate"><code>icon-rotate</code></a> layout property in the Mapbox Style Specification. @@ -411,11 +411,11 @@ MGL_EXPORT /** In combination with `symbolPlacement`, determines the rotation behavior of icons. - + The default value of this property is an `MGLStyleValue` object containing an `NSValue` object containing `MGLIconRotationAlignmentAuto`. Set this property to `nil` to reset it to the default value. - + This property is only applied to the style if `iconImageName` is non-`nil`. Otherwise, it is ignored. */ @@ -423,14 +423,14 @@ MGL_EXPORT /** Scale factor for icon. 1 is original size, 3 triples the size. - + The default value of this property is an `MGLStyleValue` object containing an `NSNumber` object containing the float `1`. Set this property to `nil` to reset it to the default value. - + This property is only applied to the style if `iconImageName` is non-`nil`. Otherwise, it is ignored. - + This attribute corresponds to the <a href="https://www.mapbox.com/mapbox-gl-style-spec/#layout-symbol-icon-size"><code>icon-size</code></a> layout property in the Mapbox Style Specification. @@ -442,11 +442,11 @@ MGL_EXPORT /** Scales the icon to fit around the associated text. - + The default value of this property is an `MGLStyleValue` object containing an `NSValue` object containing `MGLIconTextFitNone`. Set this property to `nil` to reset it to the default value. - + This property is only applied to the style if `iconImageName` is non-`nil`, and `text` is non-`nil`. Otherwise, it is ignored. */ @@ -455,13 +455,13 @@ MGL_EXPORT #if TARGET_OS_IPHONE /** Size of the additional area added to dimensions determined by `iconTextFit`. - + This property is measured in points. - + The default value of this property is an `MGLStyleValue` object containing an `NSValue` object containing `UIEdgeInsetsZero`. Set this property to `nil` to reset it to the default value. - + This property is only applied to the style if `iconImageName` is non-`nil`, and `text` is non-`nil`, and `iconTextFit` is set to an `MGLStyleValue` object containing an `NSValue` object containing `MGLIconTextFitBoth`, @@ -471,13 +471,13 @@ MGL_EXPORT #else /** Size of the additional area added to dimensions determined by `iconTextFit`. - + This property is measured in points. - + The default value of this property is an `MGLStyleValue` object containing an `NSValue` object containing `NSEdgeInsetsZero`. Set this property to `nil` to reset it to the default value. - + This property is only applied to the style if `iconImageName` is non-`nil`, and `text` is non-`nil`, and `iconTextFit` is set to an `MGLStyleValue` object containing an `NSValue` object containing `MGLIconTextFitBoth`, @@ -488,17 +488,17 @@ MGL_EXPORT /** If true, the icon may be flipped to prevent it from being rendered upside-down. - + The default value of this property is an `MGLStyleValue` object containing an `NSNumber` object containing `NO`. Set this property to `nil` to reset it to the default value. - + This property is only applied to the style if `iconImageName` is non-`nil`, and `iconRotationAlignment` is set to an `MGLStyleValue` object containing an `NSValue` object containing `MGLIconRotationAlignmentMap`, and `symbolPlacement` is set to an `MGLStyleValue` object containing an `NSValue` object containing `MGLSymbolPlacementLine`. Otherwise, it is ignored. - + This attribute corresponds to the <a href="https://www.mapbox.com/mapbox-gl-style-spec/#layout-symbol-icon-keep-upright"><code>icon-keep-upright</code></a> layout property in the Mapbox Style Specification. @@ -511,17 +511,17 @@ MGL_EXPORT /** If true, the text may be flipped vertically to prevent it from being rendered upside-down. - + The default value of this property is an `MGLStyleValue` object containing an `NSNumber` object containing `YES`. Set this property to `nil` to reset it to the default value. - + This property is only applied to the style if `text` is non-`nil`, and `textRotationAlignment` is set to an `MGLStyleValue` object containing an `NSValue` object containing `MGLTextRotationAlignmentMap`, and `symbolPlacement` is set to an `MGLStyleValue` object containing an `NSValue` object containing `MGLSymbolPlacementLine`. Otherwise, it is ignored. - + This attribute corresponds to the <a href="https://www.mapbox.com/mapbox-gl-style-spec/#layout-symbol-text-keep-upright"><code>text-keep-upright</code></a> layout property in the Mapbox Style Specification. @@ -533,17 +533,17 @@ MGL_EXPORT /** Maximum angle change between adjacent characters. - + This property is measured in degrees. - + The default value of this property is an `MGLStyleValue` object containing an `NSNumber` object containing the float `45`. Set this property to `nil` to reset it to the default value. - + This property is only applied to the style if `text` is non-`nil`, and `symbolPlacement` is set to an `MGLStyleValue` object containing an `NSValue` object containing `MGLSymbolPlacementLine`. Otherwise, it is ignored. - + This attribute corresponds to the <a href="https://www.mapbox.com/mapbox-gl-style-spec/#layout-symbol-text-max-angle"><code>text-max-angle</code></a> layout property in the Mapbox Style Specification. @@ -555,16 +555,16 @@ MGL_EXPORT /** The maximum line width for text wrapping. - + This property is measured in ems. - + The default value of this property is an `MGLStyleValue` object containing an `NSNumber` object containing the float `10`. Set this property to `nil` to reset it to the default value. - + This property is only applied to the style if `text` is non-`nil`. Otherwise, it is ignored. - + This attribute corresponds to the <a href="https://www.mapbox.com/mapbox-gl-style-spec/#layout-symbol-text-max-width"><code>text-max-width</code></a> layout property in the Mapbox Style Specification. @@ -579,11 +579,11 @@ MGL_EXPORT Recommended in layers that don't have enough padding in the vector tile to prevent collisions, or if it is a point symbol layer placed after a line symbol layer. - + The default value of this property is an `MGLStyleValue` object containing an `NSNumber` object containing `NO`. Set this property to `nil` to reset it to the default value. - + This attribute corresponds to the <a href="https://www.mapbox.com/mapbox-gl-style-spec/#layout-symbol-symbol-avoid-edges"><code>symbol-avoid-edges</code></a> layout property in the Mapbox Style Specification. @@ -595,7 +595,7 @@ MGL_EXPORT /** Label placement relative to its geometry. - + The default value of this property is an `MGLStyleValue` object containing an `NSValue` object containing `MGLSymbolPlacementPoint`. Set this property to `nil` to reset it to the default value. @@ -604,13 +604,13 @@ MGL_EXPORT /** Distance between two symbol anchors. - + This property is measured in points. - + The default value of this property is an `MGLStyleValue` object containing an `NSNumber` object containing the float `250`. Set this property to `nil` to reset it to the default value. - + This property is only applied to the style if `symbolPlacement` is set to an `MGLStyleValue` object containing an `NSValue` object containing `MGLSymbolPlacementLine`. Otherwise, it is ignored. @@ -620,10 +620,10 @@ MGL_EXPORT /** Value to use for a text label. Feature properties are specified using tokens like {field_name}. - + The default value of this property is an `MGLStyleValue` object containing the empty string. Set this property to `nil` to reset it to the default value. - + This attribute corresponds to the <a href="https://www.mapbox.com/mapbox-gl-style-spec/#layout-symbol-text-field"><code>text-field</code></a> layout property in the Mapbox Style Specification. @@ -636,14 +636,14 @@ MGL_EXPORT /** If true, the text will be visible even if it collides with other previously drawn symbols. - + The default value of this property is an `MGLStyleValue` object containing an `NSNumber` object containing `NO`. Set this property to `nil` to reset it to the default value. - + This property is only applied to the style if `text` is non-`nil`. Otherwise, it is ignored. - + This attribute corresponds to the <a href="https://www.mapbox.com/mapbox-gl-style-spec/#layout-symbol-text-allow-overlap"><code>text-allow-overlap</code></a> layout property in the Mapbox Style Specification. @@ -655,11 +655,11 @@ MGL_EXPORT /** Part of the text placed closest to the anchor. - + The default value of this property is an `MGLStyleValue` object containing an `NSValue` object containing `MGLTextAnchorCenter`. Set this property to `nil` to reset it to the default value. - + This property is only applied to the style if `text` is non-`nil`. Otherwise, it is ignored. */ @@ -667,24 +667,24 @@ MGL_EXPORT /** An array of font face names used to display the text. - + Each font name must be included in the `{fontstack}` portion of the JSON stylesheet’s <a href="https://www.mapbox.com/mapbox-gl-style-spec/#glyphs"><code>glyphs</code></a> property. You can register a custom font when designing the style in Mapbox Studio. Fonts installed on the system are not used. - + The first font named in the array is applied to the text. For each character in the text, if the first font lacks a glyph for the character, the next font is applied as a fallback, and so on. - + The default value of this property is an `MGLStyleValue` object containing the array `Open Sans Regular`, `Arial Unicode MS Regular`. Set this property to `nil` to reset it to the default value. - + This property is only applied to the style if `text` is non-`nil`. Otherwise, it is ignored. - + This attribute corresponds to the <a href="https://www.mapbox.com/mapbox-gl-style-spec/#layout-symbol-text-font"><code>text-font</code></a> layout property in the Mapbox Style Specification. @@ -696,16 +696,16 @@ MGL_EXPORT /** Font size. - + This property is measured in points. - + The default value of this property is an `MGLStyleValue` object containing an `NSNumber` object containing the float `16`. Set this property to `nil` to reset it to the default value. - + This property is only applied to the style if `text` is non-`nil`. Otherwise, it is ignored. - + This attribute corresponds to the <a href="https://www.mapbox.com/mapbox-gl-style-spec/#layout-symbol-text-size"><code>text-size</code></a> layout property in the Mapbox Style Specification. @@ -717,14 +717,14 @@ MGL_EXPORT /** If true, other symbols can be visible even if they collide with the text. - + The default value of this property is an `MGLStyleValue` object containing an `NSNumber` object containing `NO`. Set this property to `nil` to reset it to the default value. - + This property is only applied to the style if `text` is non-`nil`. Otherwise, it is ignored. - + This attribute corresponds to the <a href="https://www.mapbox.com/mapbox-gl-style-spec/#layout-symbol-text-ignore-placement"><code>text-ignore-placement</code></a> layout property in the Mapbox Style Specification. @@ -736,14 +736,14 @@ MGL_EXPORT /** Text justification options. - + The default value of this property is an `MGLStyleValue` object containing an `NSValue` object containing `MGLTextJustificationCenter`. Set this property to `nil` to reset it to the default value. - + This property is only applied to the style if `text` is non-`nil`. Otherwise, it is ignored. - + This attribute corresponds to the <a href="https://www.mapbox.com/mapbox-gl-style-spec/#layout-symbol-text-justify"><code>text-justify</code></a> layout property in the Mapbox Style Specification. @@ -755,13 +755,13 @@ MGL_EXPORT /** Text tracking amount. - + This property is measured in ems. - + The default value of this property is an `MGLStyleValue` object containing an `NSNumber` object containing the float `0`. Set this property to `nil` to reset it to the default value. - + This property is only applied to the style if `text` is non-`nil`. Otherwise, it is ignored. */ @@ -769,13 +769,13 @@ MGL_EXPORT /** Text leading value for multi-line text. - + This property is measured in ems. - + The default value of this property is an `MGLStyleValue` object containing an `NSNumber` object containing the float `1.2`. Set this property to `nil` to reset it to the default value. - + This property is only applied to the style if `text` is non-`nil`. Otherwise, it is ignored. */ @@ -784,13 +784,13 @@ MGL_EXPORT #if TARGET_OS_IPHONE /** Offset distance of text from its anchor. - + This property is measured in ems. - + The default value of this property is an `MGLStyleValue` object containing an `NSValue` object containing a `CGVector` struct set to 0 ems rightward and 0 ems downward. Set this property to `nil` to reset it to the default value. - + This property is only applied to the style if `text` is non-`nil`. Otherwise, it is ignored. */ @@ -798,13 +798,13 @@ MGL_EXPORT #else /** Offset distance of text from its anchor. - + This property is measured in ems. - + The default value of this property is an `MGLStyleValue` object containing an `NSValue` object containing a `CGVector` struct set to 0 ems rightward and 0 ems upward. Set this property to `nil` to reset it to the default value. - + This property is only applied to the style if `text` is non-`nil`. Otherwise, it is ignored. */ @@ -814,11 +814,11 @@ MGL_EXPORT /** If true, icons will display without their corresponding text when the text collides with other symbols and the icon does not. - + The default value of this property is an `MGLStyleValue` object containing an `NSNumber` object containing `NO`. Set this property to `nil` to reset it to the default value. - + This property is only applied to the style if `text` is non-`nil`, and `iconImageName` is non-`nil`. Otherwise, it is ignored. */ @@ -827,13 +827,13 @@ MGL_EXPORT /** Size of the additional area around the text bounding box used for detecting symbol collisions. - + This property is measured in points. - + The default value of this property is an `MGLStyleValue` object containing an `NSNumber` object containing the float `2`. Set this property to `nil` to reset it to the default value. - + This property is only applied to the style if `text` is non-`nil`. Otherwise, it is ignored. */ @@ -841,11 +841,11 @@ MGL_EXPORT /** Orientation of text when map is pitched. - + The default value of this property is an `MGLStyleValue` object containing an `NSValue` object containing `MGLTextPitchAlignmentAuto`. Set this property to `nil` to reset it to the default value. - + This property is only applied to the style if `text` is non-`nil`. Otherwise, it is ignored. */ @@ -853,16 +853,16 @@ MGL_EXPORT /** Rotates the text clockwise. - + This property is measured in degrees. - + The default value of this property is an `MGLStyleValue` object containing an `NSNumber` object containing the float `0`. Set this property to `nil` to reset it to the default value. - + This property is only applied to the style if `text` is non-`nil`. Otherwise, it is ignored. - + This attribute corresponds to the <a href="https://www.mapbox.com/mapbox-gl-style-spec/#layout-symbol-text-rotate"><code>text-rotate</code></a> layout property in the Mapbox Style Specification. @@ -875,11 +875,11 @@ MGL_EXPORT /** In combination with `symbolPlacement`, determines the rotation behavior of the individual glyphs forming the text. - + The default value of this property is an `MGLStyleValue` object containing an `NSValue` object containing `MGLTextRotationAlignmentAuto`. Set this property to `nil` to reset it to the default value. - + This property is only applied to the style if `text` is non-`nil`. Otherwise, it is ignored. */ @@ -887,11 +887,11 @@ MGL_EXPORT /** Specifies how to capitalize text. - + The default value of this property is an `MGLStyleValue` object containing an `NSValue` object containing `MGLTextTransformNone`. Set this property to `nil` to reset it to the default value. - + This property is only applied to the style if `text` is non-`nil`. Otherwise, it is ignored. */ @@ -903,11 +903,11 @@ MGL_EXPORT /** The tint color to apply to the icon. The `iconImageName` property must be set to a template image. - + The default value of this property is an `MGLStyleValue` object containing `UIColor.blackColor`. Set this property to `nil` to reset it to the default value. - + This property is only applied to the style if `iconImageName` is non-`nil`. Otherwise, it is ignored. */ @@ -916,11 +916,11 @@ MGL_EXPORT /** The tint color to apply to the icon. The `iconImageName` property must be set to a template image. - + The default value of this property is an `MGLStyleValue` object containing `NSColor.blackColor`. Set this property to `nil` to reset it to the default value. - + This property is only applied to the style if `iconImageName` is non-`nil`. Otherwise, it is ignored. */ @@ -929,13 +929,13 @@ MGL_EXPORT /** Fade out the halo towards the outside. - + This property is measured in points. - + The default value of this property is an `MGLStyleValue` object containing an `NSNumber` object containing the float `0`. Set this property to `nil` to reset it to the default value. - + This property is only applied to the style if `iconImageName` is non-`nil`. Otherwise, it is ignored. */ @@ -945,11 +945,11 @@ MGL_EXPORT /** The color of the icon’s halo. The `iconImageName` property must be set to a template image. - + The default value of this property is an `MGLStyleValue` object containing `UIColor.clearColor`. Set this property to `nil` to reset it to the default value. - + This property is only applied to the style if `iconImageName` is non-`nil`. Otherwise, it is ignored. */ @@ -958,11 +958,11 @@ MGL_EXPORT /** The color of the icon’s halo. The `iconImageName` property must be set to a template image. - + The default value of this property is an `MGLStyleValue` object containing `NSColor.clearColor`. Set this property to `nil` to reset it to the default value. - + This property is only applied to the style if `iconImageName` is non-`nil`. Otherwise, it is ignored. */ @@ -971,13 +971,13 @@ MGL_EXPORT /** Distance of halo to the icon outline. - + This property is measured in points. - + The default value of this property is an `MGLStyleValue` object containing an `NSNumber` object containing the float `0`. Set this property to `nil` to reset it to the default value. - + This property is only applied to the style if `iconImageName` is non-`nil`. Otherwise, it is ignored. */ @@ -985,11 +985,11 @@ MGL_EXPORT /** The opacity at which the icon will be drawn. - + The default value of this property is an `MGLStyleValue` object containing an `NSNumber` object containing the float `1`. Set this property to `nil` to reset it to the default value. - + This property is only applied to the style if `iconImageName` is non-`nil`. Otherwise, it is ignored. */ @@ -998,16 +998,16 @@ MGL_EXPORT #if TARGET_OS_IPHONE /** Distance that the icon's anchor is moved from its original placement. - + This property is measured in points. - + The default value of this property is an `MGLStyleValue` object containing an `NSValue` object containing a `CGVector` struct set to 0 points rightward and 0 points downward. Set this property to `nil` to reset it to the default value. - + This property is only applied to the style if `iconImageName` is non-`nil`. Otherwise, it is ignored. - + This attribute corresponds to the <a href="https://www.mapbox.com/mapbox-gl-style-spec/#paint-icon-translate"><code>icon-translate</code></a> layout property in the Mapbox Style Specification. @@ -1016,16 +1016,16 @@ MGL_EXPORT #else /** Distance that the icon's anchor is moved from its original placement. - + This property is measured in points. - + The default value of this property is an `MGLStyleValue` object containing an `NSValue` object containing a `CGVector` struct set to 0 points rightward and 0 points upward. Set this property to `nil` to reset it to the default value. - + This property is only applied to the style if `iconImageName` is non-`nil`. Otherwise, it is ignored. - + This attribute corresponds to the <a href="https://www.mapbox.com/mapbox-gl-style-spec/#paint-icon-translate"><code>icon-translate</code></a> layout property in the Mapbox Style Specification. @@ -1037,14 +1037,14 @@ MGL_EXPORT /** Controls the translation reference point. - + The default value of this property is an `MGLStyleValue` object containing an `NSValue` object containing `MGLIconTranslationAnchorMap`. Set this property to `nil` to reset it to the default value. - + This property is only applied to the style if `iconImageName` is non-`nil`, and `iconTranslation` is non-`nil`. Otherwise, it is ignored. - + This attribute corresponds to the <a href="https://www.mapbox.com/mapbox-gl-style-spec/#paint-icon-translate-anchor"><code>icon-translate-anchor</code></a> layout property in the Mapbox Style Specification. @@ -1056,11 +1056,11 @@ MGL_EXPORT #if TARGET_OS_IPHONE /** The color with which the text will be drawn. - + The default value of this property is an `MGLStyleValue` object containing `UIColor.blackColor`. Set this property to `nil` to reset it to the default value. - + This property is only applied to the style if `text` is non-`nil`. Otherwise, it is ignored. */ @@ -1068,11 +1068,11 @@ MGL_EXPORT #else /** The color with which the text will be drawn. - + The default value of this property is an `MGLStyleValue` object containing `NSColor.blackColor`. Set this property to `nil` to reset it to the default value. - + This property is only applied to the style if `text` is non-`nil`. Otherwise, it is ignored. */ @@ -1081,13 +1081,13 @@ MGL_EXPORT /** The halo's fadeout distance towards the outside. - + This property is measured in points. - + The default value of this property is an `MGLStyleValue` object containing an `NSNumber` object containing the float `0`. Set this property to `nil` to reset it to the default value. - + This property is only applied to the style if `text` is non-`nil`. Otherwise, it is ignored. */ @@ -1096,11 +1096,11 @@ MGL_EXPORT #if TARGET_OS_IPHONE /** The color of the text's halo, which helps it stand out from backgrounds. - + The default value of this property is an `MGLStyleValue` object containing `UIColor.clearColor`. Set this property to `nil` to reset it to the default value. - + This property is only applied to the style if `text` is non-`nil`. Otherwise, it is ignored. */ @@ -1108,11 +1108,11 @@ MGL_EXPORT #else /** The color of the text's halo, which helps it stand out from backgrounds. - + The default value of this property is an `MGLStyleValue` object containing `NSColor.clearColor`. Set this property to `nil` to reset it to the default value. - + This property is only applied to the style if `text` is non-`nil`. Otherwise, it is ignored. */ @@ -1122,13 +1122,13 @@ MGL_EXPORT /** Distance of halo to the font outline. Max text halo width is 1/4 of the font-size. - + This property is measured in points. - + The default value of this property is an `MGLStyleValue` object containing an `NSNumber` object containing the float `0`. Set this property to `nil` to reset it to the default value. - + This property is only applied to the style if `text` is non-`nil`. Otherwise, it is ignored. */ @@ -1136,11 +1136,11 @@ MGL_EXPORT /** The opacity at which the text will be drawn. - + The default value of this property is an `MGLStyleValue` object containing an `NSNumber` object containing the float `1`. Set this property to `nil` to reset it to the default value. - + This property is only applied to the style if `text` is non-`nil`. Otherwise, it is ignored. */ @@ -1149,16 +1149,16 @@ MGL_EXPORT #if TARGET_OS_IPHONE /** Distance that the text's anchor is moved from its original placement. - + This property is measured in points. - + The default value of this property is an `MGLStyleValue` object containing an `NSValue` object containing a `CGVector` struct set to 0 points rightward and 0 points downward. Set this property to `nil` to reset it to the default value. - + This property is only applied to the style if `text` is non-`nil`. Otherwise, it is ignored. - + This attribute corresponds to the <a href="https://www.mapbox.com/mapbox-gl-style-spec/#paint-text-translate"><code>text-translate</code></a> layout property in the Mapbox Style Specification. @@ -1167,16 +1167,16 @@ MGL_EXPORT #else /** Distance that the text's anchor is moved from its original placement. - + This property is measured in points. - + The default value of this property is an `MGLStyleValue` object containing an `NSValue` object containing a `CGVector` struct set to 0 points rightward and 0 points upward. Set this property to `nil` to reset it to the default value. - + This property is only applied to the style if `text` is non-`nil`. Otherwise, it is ignored. - + This attribute corresponds to the <a href="https://www.mapbox.com/mapbox-gl-style-spec/#paint-text-translate"><code>text-translate</code></a> layout property in the Mapbox Style Specification. @@ -1188,14 +1188,14 @@ MGL_EXPORT /** Controls the translation reference point. - + The default value of this property is an `MGLStyleValue` object containing an `NSValue` object containing `MGLTextTranslationAnchorMap`. Set this property to `nil` to reset it to the default value. - + This property is only applied to the style if `text` is non-`nil`, and `textTranslation` is non-`nil`. Otherwise, it is ignored. - + This attribute corresponds to the <a href="https://www.mapbox.com/mapbox-gl-style-spec/#paint-text-translate-anchor"><code>text-translate-anchor</code></a> layout property in the Mapbox Style Specification. diff --git a/platform/darwin/src/MGLSymbolStyleLayer.mm b/platform/darwin/src/MGLSymbolStyleLayer.mm index 493a8c5b6f..b0786d95c2 100644 --- a/platform/darwin/src/MGLSymbolStyleLayer.mm +++ b/platform/darwin/src/MGLSymbolStyleLayer.mm @@ -1,4 +1,4 @@ -// This file is generated. +// This file is generated. // Edit platform/darwin/scripts/generate-style-code.js, then run `make darwin-style-code`. #import "MGLSource.h" @@ -113,7 +113,7 @@ namespace mbgl { - (NSString *)sourceIdentifier { MGLAssertStyleLayerIsValid(); - + return @(self.rawLayer->getSourceID().c_str()); } diff --git a/platform/darwin/src/MGLTilePyramidOfflineRegion.h b/platform/darwin/src/MGLTilePyramidOfflineRegion.h index 4c6237702d..31e5a41920 100644 --- a/platform/darwin/src/MGLTilePyramidOfflineRegion.h +++ b/platform/darwin/src/MGLTilePyramidOfflineRegion.h @@ -15,10 +15,10 @@ MGL_EXPORT /** URL of the style whose resources are required for offline viewing. - + In addition to the JSON stylesheet, different styles may require different font glyphs, sprite sheets, and other resources. - + The URL may be a full HTTP or HTTPS URL or a Mapbox URL indicating the style’s map ID (`mapbox://styles/{user}/{style}`). */ @@ -32,14 +32,14 @@ MGL_EXPORT /** The minimum zoom level for which to download tiles and other resources. - + For more information about zoom levels, `-[MGLMapView zoomLevel]`. */ @property (nonatomic, readonly) double minimumZoomLevel; /** The maximum zoom level for which to download tiles and other resources. - + For more information about zoom levels, `-[MGLMapView zoomLevel]`. */ @property (nonatomic, readonly) double maximumZoomLevel; @@ -49,9 +49,9 @@ MGL_EXPORT /** Initializes a newly created offline region with the given style URL, geographic coordinate bounds, and range of zoom levels. - + This is the designated initializer for `MGLTilePyramidOfflineRegion`. - + @param styleURL URL of the map style for which to download resources. The URL may be a full HTTP or HTTPS URL or a Mapbox URL indicating the style’s map ID (`mapbox://styles/{user}/{style}`). Specify `nil` for the default style. diff --git a/platform/darwin/src/MGLTilePyramidOfflineRegion.mm b/platform/darwin/src/MGLTilePyramidOfflineRegion.mm index f128fbb256..e0d56484bf 100644 --- a/platform/darwin/src/MGLTilePyramidOfflineRegion.mm +++ b/platform/darwin/src/MGLTilePyramidOfflineRegion.mm @@ -35,7 +35,7 @@ if (!styleURL) { styleURL = [MGLStyle streetsStyleURLWithVersion:MGLStyleDefaultVersion]; } - + if (!styleURL.scheme) { [NSException raise:@"Invalid style URL" format: @"%@ does not support setting a relative file URL as the style URL. " @@ -44,7 +44,7 @@ @"For Mapbox-hosted styles, use the mapbox: scheme.", NSStringFromClass([self class])]; } - + _styleURL = styleURL; _bounds = bounds; _minimumZoomLevel = minimumZoomLevel; @@ -80,7 +80,7 @@ MGLCoordinateBounds bounds = MGLCoordinateBoundsMake(sw, ne); double minimumZoomLevel = [coder decodeDoubleForKey:@"minimumZoomLevel"]; double maximumZoomLevel = [coder decodeDoubleForKey:@"maximumZoomLevel"]; - + return [self initWithStyleURL:styleURL bounds:bounds fromZoomLevel:minimumZoomLevel toZoomLevel:maximumZoomLevel]; } @@ -106,7 +106,7 @@ if (![other isKindOfClass:[self class]]) { return NO; } - + MGLTilePyramidOfflineRegion *otherRegion = other; return (_minimumZoomLevel == otherRegion->_minimumZoomLevel && _maximumZoomLevel == otherRegion->_maximumZoomLevel diff --git a/platform/darwin/src/MGLTileSource.h b/platform/darwin/src/MGLTileSource.h index 99d23f4add..bc29b0f95c 100644 --- a/platform/darwin/src/MGLTileSource.h +++ b/platform/darwin/src/MGLTileSource.h @@ -16,7 +16,7 @@ typedef NSString *MGLTileSourceOption NS_STRING_ENUM; /** An `NSNumber` object containing an unsigned integer that specifies the minimum zoom level at which to display tiles from the source. - + The value should be between 0 and 22, inclusive, and less than `MGLTileSourceOptionMaximumZoomLevel`, if specified. The default value for this option is 0. @@ -30,7 +30,7 @@ extern MGL_EXPORT const MGLTileSourceOption MGLTileSourceOptionMinimumZoomLevel; /** An `NSNumber` object containing an unsigned integer that specifies the maximum zoom level at which to display tiles from the source. - + The value should be between 0 and 22, inclusive, and less than `MGLTileSourceOptionMinimumZoomLevel`, if specified. The default value for this option is 22. @@ -46,7 +46,7 @@ extern MGL_EXPORT const MGLTileSourceOption MGLTileSourceOptionMaximumZoomLevel; An HTML string defining the buttons to be displayed in an action sheet when the source is part of a map view’s style and the map view’s attribution button is pressed. - + By default, no attribution statements are displayed. If the `MGLTileSourceOptionAttributionInfos` option is specified, this option is ignored. @@ -61,7 +61,7 @@ extern MGL_EXPORT const MGLTileSourceOption MGLTileSourceOptionAttributionHTMLSt An array of `MGLAttributionInfo` objects defining the buttons to be displayed in an action sheet when the source is part of a map view’s style and the map view’s attribution button is pressed. - + By default, no attribution statements are displayed. */ extern MGL_EXPORT const MGLTileSourceOption MGLTileSourceOptionAttributionInfos; @@ -69,7 +69,7 @@ extern MGL_EXPORT const MGLTileSourceOption MGLTileSourceOptionAttributionInfos; /** An HTML string defining the buttons to be displayed in the map view’s attribution view when the source is part of the map view’s style. - + By default, no attribution statements are displayed. If the `MGLTileSourceOptionAttributionInfos` option is specified, this option is ignored. @@ -84,7 +84,7 @@ extern MGL_EXPORT const MGLTileSourceOption MGLTileSourceOptionAttributionHTMLSt An array of `MGLAttributionInfo` objects defining the buttons to be displayed in the map view’s attribution view when the source is part of the map view’s style. - + By default, no attribution statements are displayed. */ extern MGL_EXPORT const MGLTileSourceOption MGLTileSourceOptionAttributionInfos; @@ -94,7 +94,7 @@ extern MGL_EXPORT const MGLTileSourceOption MGLTileSourceOptionAttributionInfos; An `NSNumber` object containing an unsigned integer that specifies the tile coordinate system for the source’s tile URLs. The integer corresponds to one of the constants described in `MGLTileCoordinateSystem`. - + The default value for this option is `MGLTileCoordinateSystemXYZ`. This option corresponds to the `scheme` key in the @@ -111,16 +111,16 @@ typedef NS_ENUM(NSUInteger, MGLTileCoordinateSystem) { /** The origin is at the top-left (northwest), and `y` values increase southwards. - + This tile coordinate system is used by Mapbox and OpenStreetMap tile servers. */ MGLTileCoordinateSystemXYZ = 0, - + /** The origin is at the bottom-left (southwest), and `y` values increase northwards. - + This tile coordinate system is used by tile servers that conform to the <a href="http://wiki.osgeo.org/wiki/Tile_Map_Service_Specification">Tile Map Service Specification</a>. */ @@ -135,7 +135,7 @@ typedef NS_ENUM(NSUInteger, MGLTileCoordinateSystem) { A tile source is added to an `MGLStyle` object along with one or more `MGLRasterStyleLayer` or `MGLVectorStyleLayer` objects. Use a style layer to control the appearance of content supplied by the tile source. - + Do not create instances of this class directly, and do not create your own subclasses of this class. Instead, create instances of `MGLRasterSource` and `MGLVectorSource`. @@ -150,15 +150,15 @@ MGL_EXPORT /** Returns a tile source initialized with an identifier and configuration URL. - + After initializing and configuring the source, add it to a map view’s style using the `-[MGLStyle addSource:]` method. - + The URL may be a full HTTP or HTTPS URL or, for tile sets hosted by Mapbox, a Mapbox URL indicating a map identifier (`mapbox://<mapid>`). The URL should point to a JSON file that conforms to the <a href="https://github.com/mapbox/tilejson-spec/">TileJSON specification</a>. - + @param identifier A string that uniquely identifies the source in the style to which it is added. @param configurationURL A URL to a TileJSON configuration file describing the @@ -170,27 +170,27 @@ MGL_EXPORT /** Returns a tile source initialized an identifier, tile URL templates, and options. - + After initializing and configuring the source, add it to a map view’s style using the `-[MGLStyle addSource:]` method. - + #### Tile URL templates - + Tile URL templates are strings that specify the URLs of the tile images to load. Each template resembles an absolute URL, but with any number of placeholder strings that the source evaluates based on the tile it needs to load. For example: - + <ul> <li><code>http://www.example.com/tiles/{z}/{x}/{y}.pbf</code> could be evaluated as <code>http://www.example.com/tiles/14/6/9.pbf</code>.</li> <li><code>http://www.example.com/tiles/{z}/{x}/{y}{ratio}.png</code> could be evaluated as <code>http://www.example.com/tiles/14/6/9@2x.png</code>.</li> </ul> - + Tile sources support the following placeholder strings in tile URL templates, all of which are optional: - + <table> <thead> <tr><th>Placeholder string</th><th>Description</th></tr> @@ -256,11 +256,11 @@ MGL_EXPORT </tr> </tbody> </table> - + For more information about the `{x}`, `{y}`, and `{z}` placeholder strings, consult the <a href="https://wiki.openstreetmap.org/wiki/Slippy_map_tilenames">OpenStreetMap Wiki</a>. - + @param identifier A string that uniquely identifies the source in the style to which it is added. @param tileURLTemplates An array of tile URL template strings. Only the first @@ -288,7 +288,7 @@ MGL_EXPORT /** An array of `MGLAttributionInfo` objects that define the attribution statements to be displayed when the map is shown to the user. - + By default, this array is empty. If the source is initialized with a configuration URL, this array is also empty until the configuration JSON file is loaded. diff --git a/platform/darwin/src/MGLTileSource.mm b/platform/darwin/src/MGLTileSource.mm index 1aef81d53c..aa2a299a46 100644 --- a/platform/darwin/src/MGLTileSource.mm +++ b/platform/darwin/src/MGLTileSource.mm @@ -53,11 +53,11 @@ const MGLTileSourceOption MGLTileSourceOptionTileCoordinateSystem = @"MGLTileSou mbgl::Tileset MGLTileSetFromTileURLTemplates(NS_ARRAY_OF(NSString *) *tileURLTemplates, NS_DICTIONARY_OF(MGLTileSourceOption, id) * _Nullable options) { mbgl::Tileset tileSet; - + for (NSString *tileURLTemplate in tileURLTemplates) { tileSet.tiles.push_back(tileURLTemplate.UTF8String); } - + // set the minimum / maximum zoom range to the values specified by this class if they // were set. otherwise, use the core objects default values if (NSNumber *minimumZoomLevel = options[MGLTileSourceOptionMinimumZoomLevel]) { @@ -78,7 +78,7 @@ mbgl::Tileset MGLTileSetFromTileURLTemplates(NS_ARRAY_OF(NSString *) *tileURLTem [NSException raise:NSInvalidArgumentException format:@"MGLTileSourceOptionMinimumZoomLevel must be less than MGLTileSourceOptionMaximumZoomLevel."]; } - + if (NSString *attribution = options[MGLTileSourceOptionAttributionHTMLString]) { if (![attribution isKindOfClass:[NSString class]]) { [NSException raise:NSInvalidArgumentException @@ -86,13 +86,13 @@ mbgl::Tileset MGLTileSetFromTileURLTemplates(NS_ARRAY_OF(NSString *) *tileURLTem } tileSet.attribution = attribution.UTF8String; } - + if (NSArray *attributionInfos = options[MGLTileSourceOptionAttributionInfos]) { if (![attributionInfos isKindOfClass:[NSArray class]]) { [NSException raise:NSInvalidArgumentException format:@"MGLTileSourceOptionAttributionInfos must be set to a string."]; } - + NSAttributedString *attributedString = [MGLAttributionInfo attributedStringForAttributionInfos:attributionInfos]; #if TARGET_OS_IPHONE static NSString * const NSExcludedElementsDocumentAttribute = @"ExcludedElements"; @@ -107,7 +107,7 @@ mbgl::Tileset MGLTileSetFromTileURLTemplates(NS_ARRAY_OF(NSString *) *tileURLTem NSString *html = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; tileSet.attribution = html.UTF8String; } - + if (NSNumber *tileCoordinateSystemNumber = options[MGLTileSourceOptionTileCoordinateSystem]) { if (![tileCoordinateSystemNumber isKindOfClass:[NSValue class]]) { [NSException raise:NSInvalidArgumentException @@ -124,6 +124,6 @@ mbgl::Tileset MGLTileSetFromTileURLTemplates(NS_ARRAY_OF(NSString *) *tileURLTem break; } } - + return tileSet; } diff --git a/platform/darwin/src/MGLTileSource_Private.h b/platform/darwin/src/MGLTileSource_Private.h index 8da69274f2..0d9876d412 100644 --- a/platform/darwin/src/MGLTileSource_Private.h +++ b/platform/darwin/src/MGLTileSource_Private.h @@ -15,7 +15,7 @@ namespace mbgl { /** An HTML string to be displayed as attribution when the map is shown to a user. - + The default value is `nil`. If the source is initialized with a configuration URL, this property is also `nil` until the configuration JSON file is loaded. */ @@ -24,7 +24,7 @@ namespace mbgl { /** A structured representation of the `attribution` property. The default value is `nil`. - + @param fontSize The default text size in points, or 0 to use the default. @param linkColor The default link color, or `nil` to use the default. */ diff --git a/platform/darwin/src/MGLValueEvaluator.h b/platform/darwin/src/MGLValueEvaluator.h index b53cdaa8d2..2779deba90 100644 --- a/platform/darwin/src/MGLValueEvaluator.h +++ b/platform/darwin/src/MGLValueEvaluator.h @@ -10,27 +10,27 @@ public: id operator()(const mbgl::NullValue &) const { return [NSNull null]; } - + id operator()(const bool &value) const { return value ? @YES : @NO; } - + id operator()(const uint64_t &value) const { return @(value); } - + id operator()(const int64_t &value) const { return @(value); } - + id operator()(const double &value) const { return @(value); } - + id operator()(const std::string &value) const { return @(value.c_str()); } - + id operator()(const std::vector<mbgl::Value> &values) const { NSMutableArray *objects = [NSMutableArray arrayWithCapacity:values.size()]; for (const auto &v : values) { @@ -38,7 +38,7 @@ public: } return objects; } - + id operator()(const std::unordered_map<std::string, mbgl::Value> &items) const { NSMutableDictionary *attributes = [NSMutableDictionary dictionaryWithCapacity:items.size()]; for (auto &item : items) { diff --git a/platform/darwin/src/MGLVectorSource.h b/platform/darwin/src/MGLVectorSource.h index bfa52f5b49..2322c62f29 100644 --- a/platform/darwin/src/MGLVectorSource.h +++ b/platform/darwin/src/MGLVectorSource.h @@ -12,22 +12,22 @@ NS_ASSUME_NONNULL_BEGIN A vector source is added to an `MGLStyle` object along with one or more `MGLVectorStyleLayer` objects. A vector style layer defines the appearance of any content supplied by the vector source. - + Each <a href="https://www.mapbox.com/mapbox-gl-style-spec/#sources-vector"><code>vector</code></a> source defined by the style JSON file is represented at runtime by an `MGLVectorSource` object that you can use to initialize new style layers. You can also add and remove sources dynamically using methods such as `-[MGLStyle addSource:]` and `-[MGLStyle sourceWithIdentifier:]`. - + Within each vector tile, each geometric coordinate must lie between −1 × <var>extent</var> and (<var>extent</var> × 2) − 1, inclusive. Any vector style layer initialized with a vector source must have a non-`nil` value in its `sourceLayerIdentifier` property. - + ### Example - + ```swift let source = MGLVectorSource(identifier: "pois", tileURLTemplates: ["https://example.com/vector-tiles/{z}/{x}/{y}.mvt"], options: [ .minimumZoomLevel: 9, diff --git a/platform/darwin/src/MGLVectorSource.mm b/platform/darwin/src/MGLVectorSource.mm index 8fda528546..a16cfa6d81 100644 --- a/platform/darwin/src/MGLVectorSource.mm +++ b/platform/darwin/src/MGLVectorSource.mm @@ -33,7 +33,7 @@ - (instancetype)initWithIdentifier:(NSString *)identifier tileURLTemplates:(NS_ARRAY_OF(NSString *) *)tileURLTemplates options:(nullable NS_DICTIONARY_OF(MGLTileSourceOption, id) *)options { if (self = [super initWithIdentifier:identifier tileURLTemplates:tileURLTemplates options:options]) { mbgl::Tileset tileSet = MGLTileSetFromTileURLTemplates(tileURLTemplates, options); - + auto source = std::make_unique<mbgl::style::VectorSource>(identifier.UTF8String, tileSet); _pendingSource = std::move(source); self.rawSource = _pendingSource.get(); diff --git a/platform/darwin/src/MGLVectorStyleLayer.h b/platform/darwin/src/MGLVectorStyleLayer.h index ca09c11716..c6193e6046 100644 --- a/platform/darwin/src/MGLVectorStyleLayer.h +++ b/platform/darwin/src/MGLVectorStyleLayer.h @@ -8,7 +8,7 @@ NS_ASSUME_NONNULL_BEGIN /** `MGLVectorStyleLayer` is an abstract superclass for style layers whose content is defined by an `MGLShapeSource` or `MGLVectorSource` object. - + Do not create instances of this class directly, and do not create your own subclasses of this class. Instead, create instances of the following concrete subclasses: `MGLCircleStyleLayer`, `MGLFillStyleLayer`, `MGLLineStyleLayer`, @@ -27,15 +27,15 @@ MGL_EXPORT /** The style layer’s predicate. - + Use the style layer’s predicate to include only the features in the source layer that satisfy a condition that you define. If the style layer initially comes from the style, its predicate corresponds to the <a href="https://www.mapbox.com/mapbox-gl-style-spec/#layer-filter">`filter`</a> property in the style JSON. - + The following comparison operators are supported. - + <ul> <li><code>NSEqualToPredicateOperatorType</code> (<code>=</code>, <code>==</code>)</li> <li><code>NSGreaterThanOrEqualToPredicateOperatorType</code> (<code>>=</code>, <code>=></code>)</li> @@ -45,35 +45,35 @@ MGL_EXPORT <li><code>NSNotEqualToPredicateOperatorType</code> (<code>!=</code>, <code><></code>)</li> <li><code>NSBetweenPredicateOperatorType</code> (<code>BETWEEN</code>)</li> </ul> - + The following compound operators are supported: - + <ul> <li><code>NSAndPredicateType</code> (<code>AND</code>, <code>&&</code>)</li> <li><code>NSOrPredicateType</code> (<code>OR</code>, <code>||</code>)</li> <li><code>NSNotPredicateType</code> (<code>NOT</code>, <code>!</code>)</li> </ul> - + The following aggregate operators are supported: - + <ul> <li><code>NSInPredicateOperatorType</code> (<code>IN</code>)</li> <li><code>NSContainsPredicateOperatorType</code> (<code>CONTAINS</code>)</li> </ul> - + To test whether a feature has or lacks a specific attribute, compare the attribute to `NULL` or `NIL`. Predicates created using the `+[NSPredicate predicateWithValue:]` method are also supported. String operators and custom operators are not supported. - + For details about the predicate format string syntax, consult the “Predicate Format String Syntax” chapter of the “<a href="https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/Predicates/">Predicate Programming Guide</a>” in Apple developer documentation. - + The predicate's left-hand expression must be a string that identifies a feature attribute or, alternatively, one of the following special attributes: - + <table> <thead> <tr><th>Attribute</th><th>Meaning</th></tr> @@ -115,33 +115,33 @@ MGL_EXPORT </tr> </tbody> </table> - + The predicate’s right-hand expression must be an `NSString` (to match strings) or `NSNumber` (to match numbers, including Boolean values) or an array of `NSString`s or `NSNumber`s, depending on the operator and the type of values expected for the attribute being tested. For floating-point values, use `-[NSNumber numberWithDouble:]` instead of `-[NSNumber numberWithFloat:]` to avoid precision issues. - + Automatic type casting is not performed. Therefore, a feature only matches this predicate if its value for the attribute in question is of the same type as the value specified in the predicate. Also, operator modifiers such as `c` (for case insensitivity), `d` (for diacritic insensitivity), and `l` (for locale sensitivity) are unsupported for comparison and aggregate operators that are used in the predicate. - - It is possible to create expressions that contain special characters in the - predicate format syntax. This includes the `$` in the `$id` and `$type` special + + It is possible to create expressions that contain special characters in the + predicate format syntax. This includes the `$` in the `$id` and `$type` special style attributes and also `hyphen-minus` and `tag:subtag`. However, you must use `%K` in the format string to represent these variables: `@"%K == 'LineString'", @"$type"`. - + ### Example - + To filter the layer to include only the features whose `index` attribute is 5 or 10 and whose `ele` attribute is at least 1,500, you could create an `NSCompoundPredicate` along these lines: - + ```swift let layer = MGLLineStyleLayer(identifier: "contour", source: terrain) layer.sourceLayerIdentifier = "contours" diff --git a/platform/darwin/src/NSArray+MGLAdditions.mm b/platform/darwin/src/NSArray+MGLAdditions.mm index 8ec344f580..3cab7ff427 100644 --- a/platform/darwin/src/NSArray+MGLAdditions.mm +++ b/platform/darwin/src/NSArray+MGLAdditions.mm @@ -50,15 +50,15 @@ - (std::vector<CLLocationCoordinate2D>)mgl_coordinates { NSUInteger numberOfCoordinates = [self count]; CLLocationCoordinate2D *coords = (CLLocationCoordinate2D *)malloc(numberOfCoordinates * sizeof(CLLocationCoordinate2D)); - + for (NSUInteger i = 0; i < numberOfCoordinates; i++) { coords[i] = CLLocationCoordinate2DMake([self[i][@"latitude"] doubleValue], [self[i][@"longitude"] doubleValue]); } - + std::vector<CLLocationCoordinate2D> coordinates = { coords, coords + numberOfCoordinates }; free(coords); - + return coordinates; } diff --git a/platform/darwin/src/NSComparisonPredicate+MGLAdditions.mm b/platform/darwin/src/NSComparisonPredicate+MGLAdditions.mm index 58b37fae0e..295b3b21f8 100644 --- a/platform/darwin/src/NSComparisonPredicate+MGLAdditions.mm +++ b/platform/darwin/src/NSComparisonPredicate+MGLAdditions.mm @@ -18,28 +18,28 @@ mbgl::style::EqualsFilter eqFilter; eqFilter.key = self.mgl_keyPath.UTF8String; eqFilter.value = self.mgl_constantValue; - + // Convert == nil to NotHasFilter. if (eqFilter.value.is<mbgl::NullValue>()) { mbgl::style::NotHasFilter notHasFilter; notHasFilter.key = eqFilter.key; return notHasFilter; } - + return eqFilter; } case NSNotEqualToPredicateOperatorType: { mbgl::style::NotEqualsFilter neFilter; neFilter.key = self.mgl_keyPath.UTF8String; neFilter.value = self.mgl_constantValue; - + // Convert != nil to HasFilter. if (neFilter.value.is<mbgl::NullValue>()) { mbgl::style::HasFilter hasFilter; hasFilter.key = neFilter.key; return hasFilter; } - + return neFilter; } case NSGreaterThanPredicateOperatorType: { @@ -155,7 +155,7 @@ [NSException raise:NSInvalidArgumentException format:@"NSPredicateOperatorType:%lu is not supported.", (unsigned long)self.predicateOperatorType]; } - + return {}; } @@ -169,7 +169,7 @@ } else if (leftType == NSConstantValueExpressionType && rightType == NSKeyPathExpressionType) { return rightExpression.keyPath; } - + [NSException raise:NSInvalidArgumentException format:@"Comparison predicate must compare an attribute (as a key path) to a constant or vice versa."]; return nil; diff --git a/platform/darwin/src/NSCompoundPredicate+MGLAdditions.mm b/platform/darwin/src/NSCompoundPredicate+MGLAdditions.mm index 2697467198..0039b5af82 100644 --- a/platform/darwin/src/NSCompoundPredicate+MGLAdditions.mm +++ b/platform/darwin/src/NSCompoundPredicate+MGLAdditions.mm @@ -21,19 +21,19 @@ NSAssert(self.subpredicates.count <= 1, @"NOT predicate cannot have multiple subpredicates."); NSPredicate *subpredicate = self.subpredicates.firstObject; mbgl::style::Filter subfilter = subpredicate.mgl_filter; - + // Convert NOT(!= nil) to NotHasFilter. if (subfilter.is<mbgl::style::HasFilter>()) { auto hasFilter = subfilter.get<mbgl::style::HasFilter>(); return mbgl::style::NotHasFilter { .key = hasFilter.key }; } - + // Convert NOT(== nil) to HasFilter. if (subfilter.is<mbgl::style::NotHasFilter>()) { auto hasFilter = subfilter.get<mbgl::style::NotHasFilter>(); return mbgl::style::HasFilter { .key = hasFilter.key }; } - + // Convert NOT(IN) or NOT(CONTAINS) to NotInFilter. if (subfilter.is<mbgl::style::InFilter>()) { auto inFilter = subfilter.get<mbgl::style::InFilter>(); @@ -42,7 +42,7 @@ notInFilter.values = inFilter.values; return notInFilter; } - + // Convert NOT(), NOT(AND), NOT(NOT), NOT(==), etc. into NoneFilter. mbgl::style::NoneFilter noneFilter; if (subfilter.is<mbgl::style::AnyFilter>()) { @@ -64,7 +64,7 @@ return filter; } } - + [NSException raise:@"Compound predicate type not handled" format:@""]; return {}; diff --git a/platform/darwin/src/NSData+MGLAdditions.mm b/platform/darwin/src/NSData+MGLAdditions.mm index ef171c5e1e..97c3bb4a26 100644 --- a/platform/darwin/src/NSData+MGLAdditions.mm +++ b/platform/darwin/src/NSData+MGLAdditions.mm @@ -8,7 +8,7 @@ { std::string string(static_cast<const char*>(self.bytes), self.length); std::string compressed_string = mbgl::util::compress(string); - + return [NSData dataWithBytes:&compressed_string[0] length:compressed_string.length()]; } @@ -16,7 +16,7 @@ { std::string string(static_cast<const char*>(self.bytes), self.length); std::string decompressed_string = mbgl::util::decompress(string); - + return [NSData dataWithBytes:&decompressed_string[0] length:decompressed_string.length()]; } diff --git a/platform/darwin/src/NSExpression+MGLAdditions.mm b/platform/darwin/src/NSExpression+MGLAdditions.mm index b095091b17..f19a41327a 100644 --- a/platform/darwin/src/NSExpression+MGLAdditions.mm +++ b/platform/darwin/src/NSExpression+MGLAdditions.mm @@ -65,7 +65,7 @@ - (mbgl::FeatureIdentifier)mgl_featureIdentifier { mbgl::Value mbglValue = self.mgl_constantMBGLValue; - + if (mbglValue.is<std::string>()) { return mbglValue.get<std::string>(); } @@ -78,7 +78,7 @@ if (mbglValue.is<int64_t>()) { return mbglValue.get<int64_t>(); } - + return {}; } diff --git a/platform/darwin/src/NSPredicate+MGLAdditions.mm b/platform/darwin/src/NSPredicate+MGLAdditions.mm index 0ac68095f9..9fd6639b0a 100644 --- a/platform/darwin/src/NSPredicate+MGLAdditions.mm +++ b/platform/darwin/src/NSPredicate+MGLAdditions.mm @@ -4,7 +4,7 @@ class FilterEvaluator { public: - + NSArray *getPredicates(std::vector<mbgl::style::Filter> filters) { NSMutableArray *predicates = [NSMutableArray arrayWithCapacity:filters.size()]; for (auto filter : filters) { @@ -12,7 +12,7 @@ public: } return predicates; } - + NSExpression *getValues(std::vector<mbgl::Value> values) { NSMutableArray *array = [NSMutableArray arrayWithCapacity:values.size()]; for (auto value : values) { @@ -21,43 +21,43 @@ public: } return [NSExpression expressionForAggregate:array]; } - + NSPredicate *operator()(mbgl::style::NullFilter filter) { return nil; } - + NSPredicate *operator()(mbgl::style::EqualsFilter filter) { return [NSPredicate predicateWithFormat:@"%K == %@", @(filter.key.c_str()), mbgl::Value::visit(filter.value, ValueEvaluator())]; } - + NSPredicate *operator()(mbgl::style::NotEqualsFilter filter) { return [NSPredicate predicateWithFormat:@"%K != %@", @(filter.key.c_str()), mbgl::Value::visit(filter.value, ValueEvaluator())]; } - + NSPredicate *operator()(mbgl::style::GreaterThanFilter filter) { return [NSPredicate predicateWithFormat:@"%K > %@", @(filter.key.c_str()), mbgl::Value::visit(filter.value, ValueEvaluator())]; } - + NSPredicate *operator()(mbgl::style::GreaterThanEqualsFilter filter) { return [NSPredicate predicateWithFormat:@"%K >= %@", @(filter.key.c_str()), mbgl::Value::visit(filter.value, ValueEvaluator())]; } - + NSPredicate *operator()(mbgl::style::LessThanFilter filter) { return [NSPredicate predicateWithFormat:@"%K < %@", @(filter.key.c_str()), mbgl::Value::visit(filter.value, ValueEvaluator())]; } - + NSPredicate *operator()(mbgl::style::LessThanEqualsFilter filter) { return [NSPredicate predicateWithFormat:@"%K <= %@", @(filter.key.c_str()), mbgl::Value::visit(filter.value, ValueEvaluator())]; } - + NSPredicate *operator()(mbgl::style::InFilter filter) { return [NSPredicate predicateWithFormat:@"%K IN %@", @(filter.key.c_str()), getValues(filter.values)]; } - + NSPredicate *operator()(mbgl::style::NotInFilter filter) { return [NSPredicate predicateWithFormat:@"NOT %K IN %@", @(filter.key.c_str()), getValues(filter.values)]; } - + NSPredicate *operator()(mbgl::style::AnyFilter filter) { NSArray *subpredicates = getPredicates(filter.filters); if (subpredicates.count) { @@ -65,13 +65,13 @@ public: } return [NSPredicate predicateWithValue:NO]; } - + NSPredicate *operator()(mbgl::style::AllFilter filter) { // Convert [all, [>=, key, lower], [<=, key, upper]] to key BETWEEN {lower, upper} if (filter.filters.size() == 2) { auto leftFilter = filter.filters[0]; auto rightFilter = filter.filters[1]; - + std::string lowerKey; std::string upperKey; mbgl::Value lowerBound; @@ -83,7 +83,7 @@ public: lowerKey = rightFilter.get<mbgl::style::GreaterThanEqualsFilter>().key; lowerBound = rightFilter.get<mbgl::style::GreaterThanEqualsFilter>().value; } - + if (leftFilter.is<mbgl::style::LessThanEqualsFilter>()) { upperKey = leftFilter.get<mbgl::style::LessThanEqualsFilter>().key; upperBound = leftFilter.get<mbgl::style::LessThanEqualsFilter>().value; @@ -91,7 +91,7 @@ public: upperKey = rightFilter.get<mbgl::style::LessThanEqualsFilter>().key; upperBound = rightFilter.get<mbgl::style::LessThanEqualsFilter>().value; } - + if (!lowerBound.is<mbgl::NullValue>() && !upperBound.is<mbgl::NullValue>() && lowerKey == upperKey) { return [NSPredicate predicateWithFormat:@"%K BETWEEN {%@, %@}", @@ -100,14 +100,14 @@ public: mbgl::Value::visit(upperBound, ValueEvaluator())]; } } - + NSArray *subpredicates = getPredicates(filter.filters); if (subpredicates.count) { return [NSCompoundPredicate andPredicateWithSubpredicates:subpredicates]; } return [NSPredicate predicateWithValue:YES]; } - + NSPredicate *operator()(mbgl::style::NoneFilter filter) { NSArray *subpredicates = getPredicates(filter.filters); if (subpredicates.count > 1) { @@ -119,15 +119,15 @@ public: return [NSPredicate predicateWithValue:YES]; } } - + NSPredicate *operator()(mbgl::style::HasFilter filter) { return [NSPredicate predicateWithFormat:@"%K != nil", @(filter.key.c_str())]; } - + NSPredicate *operator()(mbgl::style::NotHasFilter filter) { return [NSPredicate predicateWithFormat:@"%K == nil", @(filter.key.c_str())]; } - + }; @implementation NSPredicate (MGLAdditions) @@ -138,18 +138,18 @@ public: { return mbgl::style::AllFilter(); } - + if ([self isEqual:[NSPredicate predicateWithValue:NO]]) { return mbgl::style::AnyFilter(); } - + if ([self.predicateFormat hasPrefix:@"BLOCKPREDICATE("]) { [NSException raise:NSInvalidArgumentException format:@"Block-based predicates are not supported."]; } - + [NSException raise:NSInvalidArgumentException format:@"Unrecognized predicate type."]; return {}; diff --git a/platform/darwin/src/NSString+MGLAdditions.h b/platform/darwin/src/NSString+MGLAdditions.h index 246dc084f4..ff72e9d3af 100644 --- a/platform/darwin/src/NSString+MGLAdditions.h +++ b/platform/darwin/src/NSString+MGLAdditions.h @@ -13,7 +13,7 @@ NS_ASSUME_NONNULL_BEGIN /** Returns a title-cased representation of the receiver using the specified locale. - + @param The locale. For strings presented to users, pass in the current locale (`+[NSLocale currentLocale]`). To use the system locale, pass in `nil`. */ diff --git a/platform/darwin/src/NSString+MGLAdditions.m b/platform/darwin/src/NSString+MGLAdditions.m index 5c32f4b789..371ef4023e 100644 --- a/platform/darwin/src/NSString+MGLAdditions.m +++ b/platform/darwin/src/NSString+MGLAdditions.m @@ -45,7 +45,7 @@ scanner.charactersToBeSkipped = nil; NSString *prefix; [scanner scanCharactersFromSet:set intoString:&prefix]; - + NSString *trimmedString = [self.string stringByTrimmingCharactersInSet:set]; return [self attributedSubstringFromRange:NSMakeRange(prefix.length, trimmedString.length)]; } diff --git a/platform/darwin/src/NSValue+MGLAdditions.h b/platform/darwin/src/NSValue+MGLAdditions.h index 4a97c8e115..76388cf2bb 100644 --- a/platform/darwin/src/NSValue+MGLAdditions.h +++ b/platform/darwin/src/NSValue+MGLAdditions.h @@ -15,7 +15,7 @@ NS_ASSUME_NONNULL_BEGIN /** Creates a new value object containing the specified Core Location geographic coordinate structure. - + @param coordinate The value for the new object. @return A new value object that contains the geographic coordinate information. */ @@ -29,7 +29,7 @@ NS_ASSUME_NONNULL_BEGIN /** Creates a new value object containing the specified Mapbox coordinate span structure. - + @param span The value for the new object. @return A new value object that contains the coordinate span information. */ @@ -43,7 +43,7 @@ NS_ASSUME_NONNULL_BEGIN /** Creates a new value object containing the specified Mapbox coordinate bounds structure. - + @param bounds The value for the new object. @return A new value object that contains the coordinate bounds information. */ @@ -59,7 +59,7 @@ NS_ASSUME_NONNULL_BEGIN /** Creates a new value object containing the given `MGLOfflinePackProgress` structure. - + @param progress The value for the new object. @return A new value object that contains the offline pack progress information. */ diff --git a/platform/darwin/src/http_file_source.mm b/platform/darwin/src/http_file_source.mm index caac2123d8..f4b2f8af01 100644 --- a/platform/darwin/src/http_file_source.mm +++ b/platform/darwin/src/http_file_source.mm @@ -100,7 +100,7 @@ public: NSURLSession* session = nil; NSString* userAgent = nil; NSInteger accountType = 0; - + private: NSString* getUserAgent() const; NSBundle* getSDKBundle() const; @@ -108,7 +108,7 @@ private: NSString *HTTPFileSource::Impl::getUserAgent() const { NSMutableArray *userAgentComponents = [NSMutableArray array]; - + NSBundle *appBundle = [NSBundle mainBundle]; if (appBundle) { NSString *appName = appBundle.infoDictionary[@"CFBundleName"]; @@ -118,7 +118,7 @@ NSString *HTTPFileSource::Impl::getUserAgent() const { } else { [userAgentComponents addObject:[NSProcessInfo processInfo].processName]; } - + NSBundle *sdkBundle = HTTPFileSource::Impl::getSDKBundle(); if (sdkBundle) { NSString *versionString = sdkBundle.infoDictionary[@"MGLSemanticVersionString"]; @@ -130,12 +130,12 @@ NSString *HTTPFileSource::Impl::getUserAgent() const { sdkBundle.infoDictionary[@"CFBundleName"], versionString]]; } } - + // Avoid %s here because it inserts hidden bidirectional markers on macOS when the system // language is set to a right-to-left language. [userAgentComponents addObject:[NSString stringWithFormat:@"MapboxGL/%@ (%@)", CFSTR(MBGL_VERSION_STRING), CFSTR(MBGL_VERSION_REV)]]; - + NSString *systemName = @"Darwin"; #if TARGET_OS_IPHONE systemName = @"iOS"; @@ -158,7 +158,7 @@ NSString *HTTPFileSource::Impl::getUserAgent() const { if (systemVersion) { [userAgentComponents addObject:[NSString stringWithFormat:@"%@/%@", systemName, systemVersion]]; } - + NSString *cpu = nil; #if TARGET_CPU_X86 cpu = @"x86"; @@ -172,7 +172,7 @@ NSString *HTTPFileSource::Impl::getUserAgent() const { if (cpu) { [userAgentComponents addObject:[NSString stringWithFormat:@"(%@)", cpu]]; } - + return [userAgentComponents componentsJoinedByString:@" "]; } @@ -295,20 +295,20 @@ std::unique_ptr<AsyncRequest> HTTPFileSource::request(const Resource& resource, response.error = std::make_unique<Error>(Error::Reason::NotFound, "HTTP status code 404"); } else if (responseCode == 429) { - //Get the standard header + // Get the standard header optional<std::string> retryAfter; NSString *retryAfterHeader = headers[@"Retry-After"]; if (retryAfterHeader) { retryAfter = std::string([retryAfterHeader UTF8String]); } - - //Fallback mapbox specific header + + // Fallback mapbox specific header optional<std::string> xRateLimitReset; NSString *xReset = headers[@"x-rate-limit-reset"]; if (xReset) { xRateLimitReset = std::string([xReset UTF8String]); } - + response.error = std::make_unique<Error>(Error::Reason::RateLimit, "HTTP status code 429", http::parseRetryHeaders(retryAfter, xRateLimitReset)); } else if (responseCode >= 500 && responseCode < 600) { response.error = diff --git a/platform/darwin/test/MGLAttributionInfoTests.m b/platform/darwin/test/MGLAttributionInfoTests.m index 3cdb7adffb..74859bda82 100644 --- a/platform/darwin/test/MGLAttributionInfoTests.m +++ b/platform/darwin/test/MGLAttributionInfoTests.m @@ -16,7 +16,7 @@ @"CC BY-SA " @"<a class=\"mapbox-improve-map\" href=\"https://www.mapbox.com/map-feedback/\" target=\"_blank\">Improve this map</a>", }; - + NS_MUTABLE_ARRAY_OF(MGLAttributionInfo *) *infos = [NSMutableArray array]; for (NSUInteger i = 0; i < sizeof(htmlStrings) / sizeof(htmlStrings[0]); i++) { NSArray *subinfos = [MGLAttributionInfo attributionInfosFromHTMLString:htmlStrings[i] @@ -24,25 +24,25 @@ linkColor:nil]; [infos growArrayByAddingAttributionInfosFromArray:subinfos]; } - + XCTAssertEqual(infos.count, 4); - + CLLocationCoordinate2D mapbox = CLLocationCoordinate2DMake(12.9810816, 77.6368034); XCTAssertEqualObjects(infos[0].title.string, @"© Mapbox"); XCTAssertEqualObjects(infos[0].URL, [NSURL URLWithString:@"https://www.mapbox.com/about/maps/"]); XCTAssertFalse(infos[0].feedbackLink); XCTAssertNil([infos[0] feedbackURLAtCenterCoordinate:mapbox zoomLevel:14]); - + XCTAssertEqualObjects(infos[1].title.string, @"©️ OpenStreetMap"); XCTAssertEqualObjects(infos[1].URL, [NSURL URLWithString:@"http://www.openstreetmap.org/about/"]); XCTAssertFalse(infos[1].feedbackLink); XCTAssertNil([infos[1] feedbackURLAtCenterCoordinate:mapbox zoomLevel:14]); - + XCTAssertEqualObjects(infos[2].title.string, @"CC\u00a0BY-SA"); XCTAssertNil(infos[2].URL); XCTAssertFalse(infos[2].feedbackLink); XCTAssertNil([infos[2] feedbackURLAtCenterCoordinate:mapbox zoomLevel:14]); - + XCTAssertEqualObjects(infos[3].title.string, @"Improve this map"); XCTAssertEqualObjects(infos[3].URL, [NSURL URLWithString:@"https://www.mapbox.com/map-feedback/"]); XCTAssertTrue(infos[3].feedbackLink); @@ -54,7 +54,7 @@ static NSString * const htmlStrings[] = { @"<a href=\"https://www.mapbox.com/\">Mapbox</a>", }; - + CGFloat fontSize = 72; MGLColor *color = [MGLColor redColor]; NS_MUTABLE_ARRAY_OF(MGLAttributionInfo *) *infos = [NSMutableArray array]; @@ -64,13 +64,13 @@ linkColor:color]; [infos growArrayByAddingAttributionInfosFromArray:subinfos]; } - + XCTAssertEqual(infos.count, 1); - + XCTAssertEqualObjects(infos[0].title.string, @"Mapbox"); XCTAssertEqualObjects([infos[0].title attribute:NSLinkAttributeName atIndex:0 effectiveRange:nil], [NSURL URLWithString:@"https://www.mapbox.com/"]); XCTAssertEqualObjects([infos[0].title attribute:NSUnderlineStyleAttributeName atIndex:0 effectiveRange:nil], @(NSUnderlineStyleSingle)); - + #if TARGET_OS_IPHONE UIFont *font; #else @@ -78,7 +78,7 @@ #endif font = [infos[0].title attribute:NSFontAttributeName atIndex:0 effectiveRange:nil]; XCTAssertEqual(font.pointSize, fontSize); - + CGFloat r, g, b, a; [color getRed:&r green:&g blue:&b alpha:&a]; MGLColor *linkColor = [infos[0].title attribute:NSForegroundColorAttributeName atIndex:0 effectiveRange:nil]; @@ -98,7 +98,7 @@ @"Hello", @"Hello World", }; - + NS_MUTABLE_ARRAY_OF(MGLAttributionInfo *) *infos = [NSMutableArray array]; for (NSUInteger i = 0; i < sizeof(htmlStrings) / sizeof(htmlStrings[0]); i++) { NSArray *subinfos = [MGLAttributionInfo attributionInfosFromHTMLString:htmlStrings[i] @@ -106,7 +106,7 @@ linkColor:nil]; [infos growArrayByAddingAttributionInfosFromArray:subinfos]; } - + XCTAssertEqual(infos.count, 2); XCTAssertEqualObjects(infos[0].title.string, @"Hello World"); XCTAssertEqualObjects(infos[1].title.string, @"Another Source"); diff --git a/platform/darwin/test/MGLBackgroundStyleLayerTests.mm b/platform/darwin/test/MGLBackgroundStyleLayerTests.mm index 60a332a5e7..e14d00668e 100644 --- a/platform/darwin/test/MGLBackgroundStyleLayerTests.mm +++ b/platform/darwin/test/MGLBackgroundStyleLayerTests.mm @@ -1,4 +1,4 @@ -// This file is generated. +// This file is generated. // Edit platform/darwin/scripts/generate-style-code.js, then run `make style-code-darwin`. #import "MGLStyleLayerTests.h" @@ -21,13 +21,13 @@ XCTAssertNotEqual(layer.rawLayer, nullptr); XCTAssertTrue(layer.rawLayer->is<mbgl::style::BackgroundLayer>()); auto rawLayer = layer.rawLayer->as<mbgl::style::BackgroundLayer>(); - + // background-color { XCTAssertTrue(rawLayer->getBackgroundColor().isUndefined(), @"background-color should be unset initially."); MGLStyleValue<MGLColor *> *defaultStyleValue = layer.backgroundColor; - + MGLStyleValue<MGLColor *> *styleValue = [MGLStyleValue<MGLColor *> valueWithRawValue:[MGLColor redColor]]; layer.backgroundColor = styleValue; mbgl::style::PropertyValue<mbgl::Color> propertyValue = { { 1, 0, 0, 1 } }; @@ -35,7 +35,7 @@ @"Setting backgroundColor to a constant value should update background-color."); XCTAssertEqualObjects(layer.backgroundColor, styleValue, @"backgroundColor should round-trip constant values."); - + styleValue = [MGLStyleValue<MGLColor *> valueWithStops:@{ @18: styleValue, }]; @@ -48,20 +48,20 @@ @"Setting backgroundColor to a function should update background-color."); XCTAssertEqualObjects(layer.backgroundColor, styleValue, @"backgroundColor should round-trip functions."); - + layer.backgroundColor = nil; XCTAssertTrue(rawLayer->getBackgroundColor().isUndefined(), @"Unsetting backgroundColor should return background-color to the default value."); XCTAssertEqualObjects(layer.backgroundColor, defaultStyleValue, @"backgroundColor should return the default value after being unset."); } - + // background-opacity { XCTAssertTrue(rawLayer->getBackgroundOpacity().isUndefined(), @"background-opacity should be unset initially."); MGLStyleValue<NSNumber *> *defaultStyleValue = layer.backgroundOpacity; - + MGLStyleValue<NSNumber *> *styleValue = [MGLStyleValue<NSNumber *> valueWithRawValue:@0xff]; layer.backgroundOpacity = styleValue; mbgl::style::PropertyValue<float> propertyValue = { 0xff }; @@ -69,7 +69,7 @@ @"Setting backgroundOpacity to a constant value should update background-opacity."); XCTAssertEqualObjects(layer.backgroundOpacity, styleValue, @"backgroundOpacity should round-trip constant values."); - + styleValue = [MGLStyleValue<NSNumber *> valueWithStops:@{ @18: styleValue, }]; @@ -82,20 +82,20 @@ @"Setting backgroundOpacity to a function should update background-opacity."); XCTAssertEqualObjects(layer.backgroundOpacity, styleValue, @"backgroundOpacity should round-trip functions."); - + layer.backgroundOpacity = nil; XCTAssertTrue(rawLayer->getBackgroundOpacity().isUndefined(), @"Unsetting backgroundOpacity should return background-opacity to the default value."); XCTAssertEqualObjects(layer.backgroundOpacity, defaultStyleValue, @"backgroundOpacity should return the default value after being unset."); } - + // background-pattern { XCTAssertTrue(rawLayer->getBackgroundPattern().isUndefined(), @"background-pattern should be unset initially."); MGLStyleValue<NSString *> *defaultStyleValue = layer.backgroundPattern; - + MGLStyleValue<NSString *> *styleValue = [MGLStyleValue<NSString *> valueWithRawValue:@"Background Pattern"]; layer.backgroundPattern = styleValue; mbgl::style::PropertyValue<std::string> propertyValue = { "Background Pattern" }; @@ -103,7 +103,7 @@ @"Setting backgroundPattern to a constant value should update background-pattern."); XCTAssertEqualObjects(layer.backgroundPattern, styleValue, @"backgroundPattern should round-trip constant values."); - + styleValue = [MGLStyleValue<NSString *> valueWithStops:@{ @18: styleValue, }]; @@ -116,7 +116,7 @@ @"Setting backgroundPattern to a function should update background-pattern."); XCTAssertEqualObjects(layer.backgroundPattern, styleValue, @"backgroundPattern should round-trip functions."); - + layer.backgroundPattern = nil; XCTAssertTrue(rawLayer->getBackgroundPattern().isUndefined(), @"Unsetting backgroundPattern should return background-pattern to the default value."); diff --git a/platform/darwin/test/MGLCircleStyleLayerTests.mm b/platform/darwin/test/MGLCircleStyleLayerTests.mm index 35e29b31d5..b8eb84a567 100644 --- a/platform/darwin/test/MGLCircleStyleLayerTests.mm +++ b/platform/darwin/test/MGLCircleStyleLayerTests.mm @@ -1,4 +1,4 @@ -// This file is generated. +// This file is generated. // Edit platform/darwin/scripts/generate-style-code.js, then run `make style-code-darwin`. #import "MGLStyleLayerTests.h" @@ -20,13 +20,13 @@ MGLPointFeature *feature = [[MGLPointFeature alloc] init]; MGLShapeSource *source = [[MGLShapeSource alloc] initWithIdentifier:@"sourceID" shape:feature options:nil]; MGLCircleStyleLayer *layer = [[MGLCircleStyleLayer alloc] initWithIdentifier:@"layerID" source:source]; - + XCTAssertNil(layer.sourceLayerIdentifier); layer.sourceLayerIdentifier = @"layerID"; XCTAssertEqualObjects(layer.sourceLayerIdentifier, @"layerID"); layer.sourceLayerIdentifier = nil; XCTAssertNil(layer.sourceLayerIdentifier); - + XCTAssertNil(layer.predicate); layer.predicate = [NSPredicate predicateWithValue:NO]; XCTAssertEqualObjects(layer.predicate, [NSPredicate predicateWithValue:NO]); @@ -37,18 +37,18 @@ - (void)testProperties { MGLPointFeature *feature = [[MGLPointFeature alloc] init]; MGLShapeSource *source = [[MGLShapeSource alloc] initWithIdentifier:@"sourceID" shape:feature options:nil]; - + MGLCircleStyleLayer *layer = [[MGLCircleStyleLayer alloc] initWithIdentifier:@"layerID" source:source]; XCTAssertNotEqual(layer.rawLayer, nullptr); XCTAssertTrue(layer.rawLayer->is<mbgl::style::CircleLayer>()); auto rawLayer = layer.rawLayer->as<mbgl::style::CircleLayer>(); - + // circle-blur { XCTAssertTrue(rawLayer->getCircleBlur().isUndefined(), @"circle-blur should be unset initially."); MGLStyleValue<NSNumber *> *defaultStyleValue = layer.circleBlur; - + MGLStyleValue<NSNumber *> *styleValue = [MGLStyleValue<NSNumber *> valueWithRawValue:@0xff]; layer.circleBlur = styleValue; mbgl::style::PropertyValue<float> propertyValue = { 0xff }; @@ -56,7 +56,7 @@ @"Setting circleBlur to a constant value should update circle-blur."); XCTAssertEqualObjects(layer.circleBlur, styleValue, @"circleBlur should round-trip constant values."); - + styleValue = [MGLStyleValue<NSNumber *> valueWithStops:@{ @18: styleValue, }]; @@ -69,20 +69,20 @@ @"Setting circleBlur to a function should update circle-blur."); XCTAssertEqualObjects(layer.circleBlur, styleValue, @"circleBlur should round-trip functions."); - + layer.circleBlur = nil; XCTAssertTrue(rawLayer->getCircleBlur().isUndefined(), @"Unsetting circleBlur should return circle-blur to the default value."); XCTAssertEqualObjects(layer.circleBlur, defaultStyleValue, @"circleBlur should return the default value after being unset."); } - + // circle-color { XCTAssertTrue(rawLayer->getCircleColor().isUndefined(), @"circle-color should be unset initially."); MGLStyleValue<MGLColor *> *defaultStyleValue = layer.circleColor; - + MGLStyleValue<MGLColor *> *styleValue = [MGLStyleValue<MGLColor *> valueWithRawValue:[MGLColor redColor]]; layer.circleColor = styleValue; mbgl::style::PropertyValue<mbgl::Color> propertyValue = { { 1, 0, 0, 1 } }; @@ -90,7 +90,7 @@ @"Setting circleColor to a constant value should update circle-color."); XCTAssertEqualObjects(layer.circleColor, styleValue, @"circleColor should round-trip constant values."); - + styleValue = [MGLStyleValue<MGLColor *> valueWithStops:@{ @18: styleValue, }]; @@ -103,20 +103,20 @@ @"Setting circleColor to a function should update circle-color."); XCTAssertEqualObjects(layer.circleColor, styleValue, @"circleColor should round-trip functions."); - + layer.circleColor = nil; XCTAssertTrue(rawLayer->getCircleColor().isUndefined(), @"Unsetting circleColor should return circle-color to the default value."); XCTAssertEqualObjects(layer.circleColor, defaultStyleValue, @"circleColor should return the default value after being unset."); } - + // circle-opacity { XCTAssertTrue(rawLayer->getCircleOpacity().isUndefined(), @"circle-opacity should be unset initially."); MGLStyleValue<NSNumber *> *defaultStyleValue = layer.circleOpacity; - + MGLStyleValue<NSNumber *> *styleValue = [MGLStyleValue<NSNumber *> valueWithRawValue:@0xff]; layer.circleOpacity = styleValue; mbgl::style::PropertyValue<float> propertyValue = { 0xff }; @@ -124,7 +124,7 @@ @"Setting circleOpacity to a constant value should update circle-opacity."); XCTAssertEqualObjects(layer.circleOpacity, styleValue, @"circleOpacity should round-trip constant values."); - + styleValue = [MGLStyleValue<NSNumber *> valueWithStops:@{ @18: styleValue, }]; @@ -137,20 +137,20 @@ @"Setting circleOpacity to a function should update circle-opacity."); XCTAssertEqualObjects(layer.circleOpacity, styleValue, @"circleOpacity should round-trip functions."); - + layer.circleOpacity = nil; XCTAssertTrue(rawLayer->getCircleOpacity().isUndefined(), @"Unsetting circleOpacity should return circle-opacity to the default value."); XCTAssertEqualObjects(layer.circleOpacity, defaultStyleValue, @"circleOpacity should return the default value after being unset."); } - + // circle-radius { XCTAssertTrue(rawLayer->getCircleRadius().isUndefined(), @"circle-radius should be unset initially."); MGLStyleValue<NSNumber *> *defaultStyleValue = layer.circleRadius; - + MGLStyleValue<NSNumber *> *styleValue = [MGLStyleValue<NSNumber *> valueWithRawValue:@0xff]; layer.circleRadius = styleValue; mbgl::style::PropertyValue<float> propertyValue = { 0xff }; @@ -158,7 +158,7 @@ @"Setting circleRadius to a constant value should update circle-radius."); XCTAssertEqualObjects(layer.circleRadius, styleValue, @"circleRadius should round-trip constant values."); - + styleValue = [MGLStyleValue<NSNumber *> valueWithStops:@{ @18: styleValue, }]; @@ -171,20 +171,20 @@ @"Setting circleRadius to a function should update circle-radius."); XCTAssertEqualObjects(layer.circleRadius, styleValue, @"circleRadius should round-trip functions."); - + layer.circleRadius = nil; XCTAssertTrue(rawLayer->getCircleRadius().isUndefined(), @"Unsetting circleRadius should return circle-radius to the default value."); XCTAssertEqualObjects(layer.circleRadius, defaultStyleValue, @"circleRadius should return the default value after being unset."); } - + // circle-pitch-scale { XCTAssertTrue(rawLayer->getCirclePitchScale().isUndefined(), @"circle-pitch-scale should be unset initially."); MGLStyleValue<NSValue *> *defaultStyleValue = layer.circleScaleAlignment; - + MGLStyleValue<NSValue *> *styleValue = [MGLStyleValue<NSValue *> valueWithRawValue:[NSValue valueWithMGLCircleScaleAlignment:MGLCircleScaleAlignmentViewport]]; layer.circleScaleAlignment = styleValue; mbgl::style::PropertyValue<mbgl::style::CirclePitchScaleType> propertyValue = { mbgl::style::CirclePitchScaleType::Viewport }; @@ -192,7 +192,7 @@ @"Setting circleScaleAlignment to a constant value should update circle-pitch-scale."); XCTAssertEqualObjects(layer.circleScaleAlignment, styleValue, @"circleScaleAlignment should round-trip constant values."); - + styleValue = [MGLStyleValue<NSValue *> valueWithStops:@{ @18: styleValue, }]; @@ -205,20 +205,20 @@ @"Setting circleScaleAlignment to a function should update circle-pitch-scale."); XCTAssertEqualObjects(layer.circleScaleAlignment, styleValue, @"circleScaleAlignment should round-trip functions."); - + layer.circleScaleAlignment = nil; XCTAssertTrue(rawLayer->getCirclePitchScale().isUndefined(), @"Unsetting circleScaleAlignment should return circle-pitch-scale to the default value."); XCTAssertEqualObjects(layer.circleScaleAlignment, defaultStyleValue, @"circleScaleAlignment should return the default value after being unset."); } - + // circle-stroke-color { XCTAssertTrue(rawLayer->getCircleStrokeColor().isUndefined(), @"circle-stroke-color should be unset initially."); MGLStyleValue<MGLColor *> *defaultStyleValue = layer.circleStrokeColor; - + MGLStyleValue<MGLColor *> *styleValue = [MGLStyleValue<MGLColor *> valueWithRawValue:[MGLColor redColor]]; layer.circleStrokeColor = styleValue; mbgl::style::PropertyValue<mbgl::Color> propertyValue = { { 1, 0, 0, 1 } }; @@ -226,7 +226,7 @@ @"Setting circleStrokeColor to a constant value should update circle-stroke-color."); XCTAssertEqualObjects(layer.circleStrokeColor, styleValue, @"circleStrokeColor should round-trip constant values."); - + styleValue = [MGLStyleValue<MGLColor *> valueWithStops:@{ @18: styleValue, }]; @@ -239,20 +239,20 @@ @"Setting circleStrokeColor to a function should update circle-stroke-color."); XCTAssertEqualObjects(layer.circleStrokeColor, styleValue, @"circleStrokeColor should round-trip functions."); - + layer.circleStrokeColor = nil; XCTAssertTrue(rawLayer->getCircleStrokeColor().isUndefined(), @"Unsetting circleStrokeColor should return circle-stroke-color to the default value."); XCTAssertEqualObjects(layer.circleStrokeColor, defaultStyleValue, @"circleStrokeColor should return the default value after being unset."); } - + // circle-stroke-opacity { XCTAssertTrue(rawLayer->getCircleStrokeOpacity().isUndefined(), @"circle-stroke-opacity should be unset initially."); MGLStyleValue<NSNumber *> *defaultStyleValue = layer.circleStrokeOpacity; - + MGLStyleValue<NSNumber *> *styleValue = [MGLStyleValue<NSNumber *> valueWithRawValue:@0xff]; layer.circleStrokeOpacity = styleValue; mbgl::style::PropertyValue<float> propertyValue = { 0xff }; @@ -260,7 +260,7 @@ @"Setting circleStrokeOpacity to a constant value should update circle-stroke-opacity."); XCTAssertEqualObjects(layer.circleStrokeOpacity, styleValue, @"circleStrokeOpacity should round-trip constant values."); - + styleValue = [MGLStyleValue<NSNumber *> valueWithStops:@{ @18: styleValue, }]; @@ -273,20 +273,20 @@ @"Setting circleStrokeOpacity to a function should update circle-stroke-opacity."); XCTAssertEqualObjects(layer.circleStrokeOpacity, styleValue, @"circleStrokeOpacity should round-trip functions."); - + layer.circleStrokeOpacity = nil; XCTAssertTrue(rawLayer->getCircleStrokeOpacity().isUndefined(), @"Unsetting circleStrokeOpacity should return circle-stroke-opacity to the default value."); XCTAssertEqualObjects(layer.circleStrokeOpacity, defaultStyleValue, @"circleStrokeOpacity should return the default value after being unset."); } - + // circle-stroke-width { XCTAssertTrue(rawLayer->getCircleStrokeWidth().isUndefined(), @"circle-stroke-width should be unset initially."); MGLStyleValue<NSNumber *> *defaultStyleValue = layer.circleStrokeWidth; - + MGLStyleValue<NSNumber *> *styleValue = [MGLStyleValue<NSNumber *> valueWithRawValue:@0xff]; layer.circleStrokeWidth = styleValue; mbgl::style::PropertyValue<float> propertyValue = { 0xff }; @@ -294,7 +294,7 @@ @"Setting circleStrokeWidth to a constant value should update circle-stroke-width."); XCTAssertEqualObjects(layer.circleStrokeWidth, styleValue, @"circleStrokeWidth should round-trip constant values."); - + styleValue = [MGLStyleValue<NSNumber *> valueWithStops:@{ @18: styleValue, }]; @@ -307,20 +307,20 @@ @"Setting circleStrokeWidth to a function should update circle-stroke-width."); XCTAssertEqualObjects(layer.circleStrokeWidth, styleValue, @"circleStrokeWidth should round-trip functions."); - + layer.circleStrokeWidth = nil; XCTAssertTrue(rawLayer->getCircleStrokeWidth().isUndefined(), @"Unsetting circleStrokeWidth should return circle-stroke-width to the default value."); XCTAssertEqualObjects(layer.circleStrokeWidth, defaultStyleValue, @"circleStrokeWidth should return the default value after being unset."); } - + // circle-translate { XCTAssertTrue(rawLayer->getCircleTranslate().isUndefined(), @"circle-translate should be unset initially."); MGLStyleValue<NSValue *> *defaultStyleValue = layer.circleTranslation; - + MGLStyleValue<NSValue *> *styleValue = [MGLStyleValue<NSValue *> valueWithRawValue: #if TARGET_OS_IPHONE [NSValue valueWithCGVector:CGVectorMake(1, 1)] @@ -334,7 +334,7 @@ @"Setting circleTranslation to a constant value should update circle-translate."); XCTAssertEqualObjects(layer.circleTranslation, styleValue, @"circleTranslation should round-trip constant values."); - + styleValue = [MGLStyleValue<NSValue *> valueWithStops:@{ @18: styleValue, }]; @@ -347,20 +347,20 @@ @"Setting circleTranslation to a function should update circle-translate."); XCTAssertEqualObjects(layer.circleTranslation, styleValue, @"circleTranslation should round-trip functions."); - + layer.circleTranslation = nil; XCTAssertTrue(rawLayer->getCircleTranslate().isUndefined(), @"Unsetting circleTranslation should return circle-translate to the default value."); XCTAssertEqualObjects(layer.circleTranslation, defaultStyleValue, @"circleTranslation should return the default value after being unset."); } - + // circle-translate-anchor { XCTAssertTrue(rawLayer->getCircleTranslateAnchor().isUndefined(), @"circle-translate-anchor should be unset initially."); MGLStyleValue<NSValue *> *defaultStyleValue = layer.circleTranslationAnchor; - + MGLStyleValue<NSValue *> *styleValue = [MGLStyleValue<NSValue *> valueWithRawValue:[NSValue valueWithMGLCircleTranslationAnchor:MGLCircleTranslationAnchorViewport]]; layer.circleTranslationAnchor = styleValue; mbgl::style::PropertyValue<mbgl::style::TranslateAnchorType> propertyValue = { mbgl::style::TranslateAnchorType::Viewport }; @@ -368,7 +368,7 @@ @"Setting circleTranslationAnchor to a constant value should update circle-translate-anchor."); XCTAssertEqualObjects(layer.circleTranslationAnchor, styleValue, @"circleTranslationAnchor should round-trip constant values."); - + styleValue = [MGLStyleValue<NSValue *> valueWithStops:@{ @18: styleValue, }]; @@ -381,7 +381,7 @@ @"Setting circleTranslationAnchor to a function should update circle-translate-anchor."); XCTAssertEqualObjects(layer.circleTranslationAnchor, styleValue, @"circleTranslationAnchor should round-trip functions."); - + layer.circleTranslationAnchor = nil; XCTAssertTrue(rawLayer->getCircleTranslateAnchor().isUndefined(), @"Unsetting circleTranslationAnchor should return circle-translate-anchor to the default value."); diff --git a/platform/darwin/test/MGLClockDirectionFormatterTests.m b/platform/darwin/test/MGLClockDirectionFormatterTests.m index a020ed88b2..13e12ae2f2 100644 --- a/platform/darwin/test/MGLClockDirectionFormatterTests.m +++ b/platform/darwin/test/MGLClockDirectionFormatterTests.m @@ -12,59 +12,59 @@ static NSString * const MGLTestLocaleIdentifier = @"en-US"; - (void)testClockDirections { MGLClockDirectionFormatter *shortFormatter = [[MGLClockDirectionFormatter alloc] init]; shortFormatter.unitStyle = NSFormattingUnitStyleShort; - + MGLClockDirectionFormatter *mediumFormatter = [[MGLClockDirectionFormatter alloc] init]; - + MGLClockDirectionFormatter *longFormatter = [[MGLClockDirectionFormatter alloc] init]; longFormatter.unitStyle = NSFormattingUnitStyleLong; - + CLLocationDirection direction; - + direction = -90; XCTAssertEqualObjects(@"9:00", [shortFormatter stringFromDirection:direction]); XCTAssertEqualObjects(@"9 o’clock", [mediumFormatter stringFromDirection:direction]); XCTAssertEqualObjects(@"9 o’clock", [longFormatter stringFromDirection:direction]); - + direction = 0; XCTAssertEqualObjects(@"12:00", [shortFormatter stringFromDirection:direction]); XCTAssertEqualObjects(@"12 o’clock", [mediumFormatter stringFromDirection:direction]); XCTAssertEqualObjects(@"12 o’clock", [longFormatter stringFromDirection:direction]); - + direction = 45; XCTAssertEqualObjects(@"2:00", [shortFormatter stringFromDirection:direction]); XCTAssertEqualObjects(@"2 o’clock", [mediumFormatter stringFromDirection:direction]); XCTAssertEqualObjects(@"2 o’clock", [longFormatter stringFromDirection:direction]); - + direction = 90; XCTAssertEqualObjects(@"3:00", [shortFormatter stringFromDirection:direction]); XCTAssertEqualObjects(@"3 o’clock", [mediumFormatter stringFromDirection:direction]); XCTAssertEqualObjects(@"3 o’clock", [longFormatter stringFromDirection:direction]); - + direction = 180; XCTAssertEqualObjects(@"6:00", [shortFormatter stringFromDirection:direction]); XCTAssertEqualObjects(@"6 o’clock", [mediumFormatter stringFromDirection:direction]); XCTAssertEqualObjects(@"6 o’clock", [longFormatter stringFromDirection:direction]); - + direction = 270; XCTAssertEqualObjects(@"9:00", [shortFormatter stringFromDirection:direction]); XCTAssertEqualObjects(@"9 o’clock", [mediumFormatter stringFromDirection:direction]); XCTAssertEqualObjects(@"9 o’clock", [longFormatter stringFromDirection:direction]); - + direction = 359.34951805867024; XCTAssertEqualObjects(@"12:00", [shortFormatter stringFromDirection:direction]); XCTAssertEqualObjects(@"12 o’clock", [mediumFormatter stringFromDirection:direction]); XCTAssertEqualObjects(@"12 o’clock", [longFormatter stringFromDirection:direction]); - + direction = 360; XCTAssertEqualObjects(@"12:00", [shortFormatter stringFromDirection:direction]); XCTAssertEqualObjects(@"12 o’clock", [mediumFormatter stringFromDirection:direction]); XCTAssertEqualObjects(@"12 o’clock", [longFormatter stringFromDirection:direction]); - + direction = 360.1; XCTAssertEqualObjects(@"12:00", [shortFormatter stringFromDirection:direction]); XCTAssertEqualObjects(@"12 o’clock", [mediumFormatter stringFromDirection:direction]); XCTAssertEqualObjects(@"12 o’clock", [longFormatter stringFromDirection:direction]); - + direction = 720; XCTAssertEqualObjects(@"12:00", [shortFormatter stringFromDirection:direction]); XCTAssertEqualObjects(@"12 o’clock", [mediumFormatter stringFromDirection:direction]); diff --git a/platform/darwin/test/MGLCodingTests.m b/platform/darwin/test/MGLCodingTests.m index b9b299d50f..ff0d674ad1 100644 --- a/platform/darwin/test/MGLCodingTests.m +++ b/platform/darwin/test/MGLCodingTests.m @@ -19,11 +19,11 @@ annotation.coordinate = CLLocationCoordinate2DMake(0.5, 0.5); annotation.title = @"title"; annotation.subtitle = @"subtitle"; - + NSString *filePath = [self temporaryFilePathForClass:MGLPointAnnotation.class]; [NSKeyedArchiver archiveRootObject:annotation toFile:filePath]; MGLPointAnnotation *unarchivedAnnotation = [NSKeyedUnarchiver unarchiveObjectWithFile:filePath]; - + XCTAssertEqualObjects(annotation, unarchivedAnnotation); } @@ -33,11 +33,11 @@ pointFeature.subtitle = @"subtitle"; pointFeature.identifier = @(123); pointFeature.attributes = @{@"bbox": @[@1, @2, @3, @4]}; - + NSString *filePath = [self temporaryFilePathForClass:MGLPointFeature.class]; [NSKeyedArchiver archiveRootObject:pointFeature toFile:filePath]; MGLPointFeature *unarchivedPointFeature = [NSKeyedUnarchiver unarchiveObjectWithFile:filePath]; - + XCTAssertEqualObjects(pointFeature, unarchivedPointFeature); } @@ -46,25 +46,25 @@ CLLocationCoordinate2DMake(0.129631234123, 1.7812739312551), CLLocationCoordinate2DMake(2.532083092342, 3.5216418292392) }; - + NSUInteger numberOfCoordinates = sizeof(coordinates) / sizeof(CLLocationCoordinate2D); - + MGLPolyline *polyline = [MGLPolyline polylineWithCoordinates:coordinates count:numberOfCoordinates]; polyline.title = @"title"; polyline.subtitle = @"subtitle"; - + NSString *filePath = [self temporaryFilePathForClass:[MGLPolyline class]]; [NSKeyedArchiver archiveRootObject:polyline toFile:filePath]; MGLPolyline *unarchivedPolyline = [NSKeyedUnarchiver unarchiveObjectWithFile:filePath]; - + XCTAssertEqualObjects(polyline, unarchivedPolyline); - + CLLocationCoordinate2D otherCoordinates[] = { CLLocationCoordinate2DMake(-1, -2) }; - + [unarchivedPolyline replaceCoordinatesInRange:NSMakeRange(0, 1) withCoordinates:otherCoordinates]; - + XCTAssertNotEqualObjects(polyline, unarchivedPolyline); } @@ -73,18 +73,18 @@ CLLocationCoordinate2DMake(0.664482398, 1.8865675), CLLocationCoordinate2DMake(2.13224687, 3.9984632) }; - + NSUInteger numberOfCoordinates = sizeof(coordinates) / sizeof(CLLocationCoordinate2D); - + MGLPolygon *polygon = [MGLPolygon polygonWithCoordinates:coordinates count:numberOfCoordinates]; polygon.title = nil; polygon.subtitle = @"subtitle"; - + NSString *filePath = [self temporaryFilePathForClass:[MGLPolygon class]]; [NSKeyedArchiver archiveRootObject:polygon toFile:filePath]; - + MGLPolygon *unarchivedPolygon = [NSKeyedUnarchiver unarchiveObjectWithFile:filePath]; - + XCTAssertEqualObjects(polygon, unarchivedPolygon); } @@ -93,24 +93,24 @@ CLLocationCoordinate2DMake(0, 1), CLLocationCoordinate2DMake(10, 20) }; - + NSUInteger numberOfCoordinates = sizeof(coordinates) / sizeof(CLLocationCoordinate2D); - + CLLocationCoordinate2D interiorCoordinates[] = { CLLocationCoordinate2DMake(4, 4), CLLocationCoordinate2DMake(6, 6) }; - + NSUInteger numberOfInteriorCoordinates = sizeof(interiorCoordinates) / sizeof(CLLocationCoordinate2D); - + MGLPolygon *interiorPolygon = [MGLPolygon polygonWithCoordinates:interiorCoordinates count:numberOfInteriorCoordinates]; MGLPolygon *polygon = [MGLPolygon polygonWithCoordinates:coordinates count:numberOfCoordinates interiorPolygons:@[interiorPolygon]]; - + NSString *filePath = [self temporaryFilePathForClass:[MGLPolygon class]]; [NSKeyedArchiver archiveRootObject:polygon toFile:filePath]; - + MGLPolygon *unarchivedPolygon = [NSKeyedUnarchiver unarchiveObjectWithFile:filePath]; - + XCTAssertEqualObjects(polygon, unarchivedPolygon); } @@ -119,21 +119,21 @@ CLLocationCoordinate2DMake(0, 1), CLLocationCoordinate2DMake(10, 20) }; - + NSUInteger numberOfCoordinates = sizeof(coordinates) / sizeof(CLLocationCoordinate2D); MGLPolylineFeature *polylineFeature = [MGLPolylineFeature polylineWithCoordinates:coordinates count:numberOfCoordinates]; polylineFeature.attributes = @{@"bbox": @[@0, @1, @2, @3]}; polylineFeature.identifier = @"identifier"; - + NSString *filePath = [self temporaryFilePathForClass:[MGLPolylineFeature class]]; [NSKeyedArchiver archiveRootObject:polylineFeature toFile:filePath]; - + MGLPolylineFeature *unarchivedPolylineFeature = [NSKeyedUnarchiver unarchiveObjectWithFile:filePath]; - + XCTAssertEqualObjects(polylineFeature, unarchivedPolylineFeature); - + unarchivedPolylineFeature.attributes = @{@"bbox": @[@4, @3, @2, @1]}; - + XCTAssertNotEqualObjects(polylineFeature, unarchivedPolylineFeature); } @@ -142,19 +142,19 @@ CLLocationCoordinate2DMake(0, 1), CLLocationCoordinate2DMake(10, 20) }; - + NSUInteger numberOfCoordinates = sizeof(coordinates) / sizeof(CLLocationCoordinate2D); MGLPolygonFeature *polygonFeature = [MGLPolygonFeature polygonWithCoordinates:coordinates count:numberOfCoordinates]; - + NSString *filePath = [self temporaryFilePathForClass:[MGLPolygonFeature class]]; [NSKeyedArchiver archiveRootObject:polygonFeature toFile:filePath]; - + MGLPolygonFeature *unarchivedPolygonFeature = [NSKeyedUnarchiver unarchiveObjectWithFile:filePath]; - + XCTAssertEqualObjects(polygonFeature, unarchivedPolygonFeature); - + unarchivedPolygonFeature.identifier = @"test"; - + XCTAssertNotEqualObjects(polygonFeature, unarchivedPolygonFeature); } @@ -165,15 +165,15 @@ CLLocationCoordinate2DMake(20, 21), CLLocationCoordinate2DMake(30, 31), }; - + NSUInteger numberOfCoordinates = sizeof(coordinates) / sizeof(CLLocationCoordinate2D); - + MGLPointCollection *pointCollection = [MGLPointCollection pointCollectionWithCoordinates:coordinates count:numberOfCoordinates]; NSString *filePath = [self temporaryFilePathForClass:[MGLPointCollection class]]; [NSKeyedArchiver archiveRootObject:pointCollection toFile:filePath]; - + MGLPointCollection *unarchivedPointCollection = [NSKeyedUnarchiver unarchiveObjectWithFile:filePath]; - + XCTAssertEqualObjects(pointCollection, unarchivedPointCollection); } @@ -184,88 +184,88 @@ feature.coordinate = CLLocationCoordinate2DMake(arc4random() % 90, arc4random() % 180); [features addObject:feature]; } - + CLLocationCoordinate2D coordinates[] = { CLLocationCoordinate2DMake(0, 1), CLLocationCoordinate2DMake(10, 11), CLLocationCoordinate2DMake(20, 21), CLLocationCoordinate2DMake(30, 31), }; - + NSUInteger numberOfCoordinates = sizeof(coordinates) / sizeof(CLLocationCoordinate2D); - + MGLPointCollectionFeature *collection = [MGLPointCollectionFeature pointCollectionWithCoordinates:coordinates count:numberOfCoordinates]; collection.identifier = @"identifier"; collection.attributes = @{@"bbox": @[@1, @2, @3, @4]}; - + NSString *filePath = [self temporaryFilePathForClass:[MGLPointCollectionFeature class]]; [NSKeyedArchiver archiveRootObject:collection toFile:filePath]; - + MGLPointCollectionFeature *unarchivedCollection = [NSKeyedUnarchiver unarchiveObjectWithFile:filePath]; - + XCTAssertEqualObjects(collection, unarchivedCollection); - + unarchivedCollection.identifier = @"newIdentifier"; - + XCTAssertNotEqualObjects(collection, unarchivedCollection); } - (void)testMultiPolyline { - + CLLocationCoordinate2D coordinates[] = { CLLocationCoordinate2DMake(0, 1), CLLocationCoordinate2DMake(10, 11), CLLocationCoordinate2DMake(20, 21), CLLocationCoordinate2DMake(30, 31), }; - + NSUInteger numberOfCoordinates = sizeof(coordinates) / sizeof(CLLocationCoordinate2D); - + NSMutableArray *polylines = [NSMutableArray array]; - + for (NSUInteger i = 0; i < 100; i++) { MGLPolyline *polyline = [MGLPolyline polylineWithCoordinates:coordinates count:numberOfCoordinates]; [polylines addObject:polyline]; } - + MGLMultiPolyline *multiPolyline = [MGLMultiPolyline multiPolylineWithPolylines:polylines]; - + NSString *filePath = [self temporaryFilePathForClass:[MGLMultiPolyline class]]; [NSKeyedArchiver archiveRootObject:multiPolyline toFile:filePath]; - + MGLMultiPolyline *unarchivedMultiPolyline = [NSKeyedUnarchiver unarchiveObjectWithFile:filePath]; MGLMultiPolyline *anotherMultipolyline = [MGLMultiPolyline multiPolylineWithPolylines:[polylines subarrayWithRange:NSMakeRange(0, polylines.count/2)]]; - + XCTAssertEqualObjects(multiPolyline, unarchivedMultiPolyline); XCTAssertNotEqualObjects(unarchivedMultiPolyline, anotherMultipolyline); } - (void)testMultiPolygon { - + CLLocationCoordinate2D coordinates[] = { CLLocationCoordinate2DMake(0, 1), CLLocationCoordinate2DMake(10, 11), CLLocationCoordinate2DMake(20, 21), CLLocationCoordinate2DMake(30, 31), }; - + NSUInteger numberOfCoordinates = sizeof(coordinates) / sizeof(CLLocationCoordinate2D); - + NSMutableArray *polygons = [NSMutableArray array]; - + for (NSUInteger i = 0; i < 100; i++) { MGLPolygon *polygon = [MGLPolygon polygonWithCoordinates:coordinates count:numberOfCoordinates]; [polygons addObject:polygon]; } - + MGLMultiPolygon *multiPolygon = [MGLMultiPolygon multiPolygonWithPolygons:polygons]; - + NSString *filePath = [self temporaryFilePathForClass:[MGLMultiPolygon class]]; [NSKeyedArchiver archiveRootObject:multiPolygon toFile:filePath]; - + MGLMultiPolygon *unarchivedMultiPolygon = [NSKeyedUnarchiver unarchiveObjectWithFile:filePath]; MGLMultiPolygon *anotherMultiPolygon = [MGLMultiPolygon multiPolygonWithPolygons:[polygons subarrayWithRange:NSMakeRange(0, polygons.count/2)]]; - + XCTAssertEqualObjects(multiPolygon, unarchivedMultiPolygon); XCTAssertNotEqualObjects(anotherMultiPolygon, unarchivedMultiPolygon); } @@ -276,20 +276,20 @@ CLLocationCoordinate2DMake(20.91836515, 21.93689215), CLLocationCoordinate2DMake(30.55697246, 31.33988123), }; - + NSUInteger numberOfCoordinates = sizeof(coordinates) / sizeof(CLLocationCoordinate2D); - + MGLPolyline *polyline = [MGLPolyline polylineWithCoordinates:coordinates count:numberOfCoordinates]; MGLPolygon *polygon = [MGLPolygon polygonWithCoordinates:coordinates count:numberOfCoordinates]; - + MGLShapeCollection *shapeCollection = [MGLShapeCollection shapeCollectionWithShapes:@[polyline, polygon]]; - + NSString *filePath = [self temporaryFilePathForClass:[MGLShapeCollection class]]; [NSKeyedArchiver archiveRootObject:shapeCollection toFile:filePath]; - + MGLShapeCollection *unarchivedShapeCollection = [NSKeyedUnarchiver unarchiveObjectWithFile:filePath]; MGLShapeCollection *anotherShapeCollection = [MGLShapeCollection shapeCollectionWithShapes:@[polygon]]; - + XCTAssertEqualObjects(shapeCollection, unarchivedShapeCollection); XCTAssertNotEqualObjects(shapeCollection, anotherShapeCollection); } @@ -300,25 +300,25 @@ CLLocationCoordinate2DMake(20.91836515, 21.93689215), CLLocationCoordinate2DMake(30.55697246, 31.33988123), }; - + NSUInteger numberOfCoordinates = sizeof(coordinates) / sizeof(CLLocationCoordinate2D); - + NSMutableArray *polylines = [NSMutableArray array]; for (NSUInteger i = 0; i < 100; i++) { MGLPolylineFeature *polylineFeature = [MGLPolylineFeature polylineWithCoordinates:coordinates count:numberOfCoordinates]; polylineFeature.identifier = @(arc4random() % 100).stringValue; [polylines addObject:polylineFeature]; } - + MGLMultiPolylineFeature *multiPolylineFeature = [MGLMultiPolylineFeature multiPolylineWithPolylines:polylines]; multiPolylineFeature.attributes = @{@"bbox": @[@4, @3, @2, @1]}; - + NSString *filePath = [self temporaryFilePathForClass:[MGLMultiPolylineFeature class]]; [NSKeyedArchiver archiveRootObject:multiPolylineFeature toFile:filePath]; - + MGLMultiPolylineFeature *unarchivedMultiPolylineFeature = [NSKeyedUnarchiver unarchiveObjectWithFile:filePath]; MGLMultiPolylineFeature *anotherMultiPolylineFeature = [MGLMultiPolylineFeature multiPolylineWithPolylines:[polylines subarrayWithRange:NSMakeRange(0, polylines.count/2)]]; - + XCTAssertEqualObjects(multiPolylineFeature, unarchivedMultiPolylineFeature); XCTAssertNotEqualObjects(unarchivedMultiPolylineFeature, anotherMultiPolylineFeature); } @@ -329,28 +329,28 @@ CLLocationCoordinate2DMake(20.88471238, 21.93684215), CLLocationCoordinate2DMake(30.15697236, 31.32988123), }; - + NSUInteger numberOfCoordinates = sizeof(coordinates) / sizeof(CLLocationCoordinate2D); - + NSMutableArray *polygons = [NSMutableArray array]; for (NSUInteger i = 0; i < 100; i++ ) { MGLPolygonFeature *polygonFeature = [MGLPolygonFeature polygonWithCoordinates:coordinates count:numberOfCoordinates]; polygonFeature.identifier = @(arc4random_uniform(100)).stringValue; [polygons addObject:polygonFeature]; } - + MGLMultiPolygonFeature *multiPolygonFeature = [MGLMultiPolygonFeature multiPolygonWithPolygons:polygons]; multiPolygonFeature.attributes = @{@"bbox": @[@(arc4random_uniform(100)), @(arc4random_uniform(100)), @(arc4random_uniform(100)), @(arc4random_uniform(100))]}; - + NSString *filePath = [self temporaryFilePathForClass:[MGLMultiPolylineFeature class]]; [NSKeyedArchiver archiveRootObject:multiPolygonFeature toFile:filePath]; - + MGLMultiPolygonFeature *unarchivedMultiPolygonFeature = [NSKeyedUnarchiver unarchiveObjectWithFile:filePath]; MGLMultiPolygonFeature *anotherMultiPolygonFeature = [MGLMultiPolygonFeature multiPolygonWithPolygons:[polygons subarrayWithRange:NSMakeRange(0, polygons.count/2)]]; - + XCTAssertEqualObjects(multiPolygonFeature, unarchivedMultiPolygonFeature); XCTAssertNotEqualObjects(anotherMultiPolygonFeature, unarchivedMultiPolygonFeature); } @@ -361,24 +361,24 @@ CLLocationCoordinate2DMake(20.91836515, 21.93689215), CLLocationCoordinate2DMake(30.55697246, 31.33988123), }; - + NSUInteger numberOfCoordinates = sizeof(coordinates) / sizeof(CLLocationCoordinate2D); - + MGLPolylineFeature *polyline = [MGLPolylineFeature polylineWithCoordinates:coordinates count:numberOfCoordinates]; MGLPolygonFeature *polygon = [MGLPolygonFeature polygonWithCoordinates:coordinates count:numberOfCoordinates]; - + MGLShapeCollectionFeature *shapeCollectionFeature = [MGLShapeCollectionFeature shapeCollectionWithShapes:@[polyline, polygon]]; shapeCollectionFeature.identifier = @(arc4random_uniform(100)).stringValue; shapeCollectionFeature.attributes = @{@"bbox":@[@(arc4random_uniform(100)), @(arc4random_uniform(100)), @(arc4random_uniform(100)), @(arc4random_uniform(100))]}; - + NSString *filePath = [self temporaryFilePathForClass:[MGLShapeCollectionFeature class]]; [NSKeyedArchiver archiveRootObject:shapeCollectionFeature toFile:filePath]; - + MGLShapeCollectionFeature *unarchivedShapeCollectionFeature = [NSKeyedUnarchiver unarchiveObjectWithFile:filePath]; - + XCTAssertEqualObjects(shapeCollectionFeature, unarchivedShapeCollectionFeature); } @@ -395,14 +395,14 @@ [[NSColor redColor] drawSwatchInRect:CGRectMake(0, 0, 10, 10)]; [image unlockFocus]; #endif - + MGLAnnotationImage *annotationImage = [MGLAnnotationImage annotationImageWithImage:image reuseIdentifier:@(arc4random_uniform(100)).stringValue]; - + NSString *filePath = [self temporaryFilePathForClass:[MGLAnnotationImage class]]; [NSKeyedArchiver archiveRootObject:annotationImage toFile:filePath]; - + MGLAnnotationImage *unarchivedAnnotationImage = [NSKeyedUnarchiver unarchiveObjectWithFile:filePath]; - + XCTAssertEqualObjects(annotationImage, unarchivedAnnotationImage); } @@ -414,12 +414,12 @@ annotationView.draggable = YES; annotationView.centerOffset = CGVectorMake(10, 10); annotationView.scalesWithViewingDistance = NO; - + NSString *filePath = [self temporaryFilePathForClass:[MGLAnnotationView class]]; [NSKeyedArchiver archiveRootObject:annotationView toFile:filePath]; - + MGLAnnotationView *unarchivedAnnotationView = [NSKeyedUnarchiver unarchiveObjectWithFile:filePath]; - + XCTAssertEqual(annotationView.enabled, unarchivedAnnotationView.enabled); XCTAssertEqual(annotationView.selected, unarchivedAnnotationView.selected); XCTAssertEqual(annotationView.draggable, unarchivedAnnotationView.draggable); @@ -432,12 +432,12 @@ - (void)testUserLocation { MGLUserLocation *userLocation = [[MGLUserLocation alloc] init]; userLocation.location = [[CLLocation alloc] initWithLatitude:1 longitude:1]; - + NSString *filePath = [self temporaryFilePathForClass:[MGLUserLocation class]]; [NSKeyedArchiver archiveRootObject:userLocation toFile:filePath]; - + MGLUserLocation *unarchivedUserLocation = [NSKeyedUnarchiver unarchiveObjectWithFile:filePath]; - + XCTAssertEqualObjects(userLocation, unarchivedUserLocation); unarchivedUserLocation.location = [[CLLocation alloc] initWithLatitude:10 longitude:10]; XCTAssertNotEqualObjects(userLocation, unarchivedUserLocation); @@ -452,12 +452,12 @@ annotationView.draggable = YES; annotationView.centerOffset = CGVectorMake(10, 10); annotationView.scalesWithViewingDistance = NO; - + NSString *filePath = [self temporaryFilePathForClass:[MGLUserLocationAnnotationView class]]; [NSKeyedArchiver archiveRootObject:annotationView toFile:filePath]; - + MGLUserLocationAnnotationView *unarchivedAnnotationView = [NSKeyedUnarchiver unarchiveObjectWithFile:filePath]; - + XCTAssertEqual(annotationView.enabled, unarchivedAnnotationView.enabled); XCTAssertEqual(annotationView.selected, unarchivedAnnotationView.selected); XCTAssertEqual(annotationView.draggable, unarchivedAnnotationView.draggable); diff --git a/platform/darwin/test/MGLCompassDirectionFormatterTests.m b/platform/darwin/test/MGLCompassDirectionFormatterTests.m index bba0317ebf..c4ccc6ac4f 100644 --- a/platform/darwin/test/MGLCompassDirectionFormatterTests.m +++ b/platform/darwin/test/MGLCompassDirectionFormatterTests.m @@ -10,75 +10,75 @@ - (void)testCompassDirections { MGLCompassDirectionFormatter *shortFormatter = [[MGLCompassDirectionFormatter alloc] init]; shortFormatter.unitStyle = NSFormattingUnitStyleShort; - + MGLCompassDirectionFormatter *mediumFormatter = [[MGLCompassDirectionFormatter alloc] init]; XCTAssertEqual(mediumFormatter.unitStyle, NSFormattingUnitStyleMedium, @"Unit style should be medium by default."); - + MGLCompassDirectionFormatter *longFormatter = [[MGLCompassDirectionFormatter alloc] init]; longFormatter.unitStyle = NSFormattingUnitStyleLong; - + CLLocationDirection direction; - + direction = -45; XCTAssertEqualObjects(@"NW", [shortFormatter stringFromDirection:direction]); XCTAssertEqualObjects(@"northwest", [mediumFormatter stringFromDirection:direction]); XCTAssertEqualObjects(@"northwest", [longFormatter stringFromDirection:direction]); - + direction = 0; XCTAssertEqualObjects(@"N", [shortFormatter stringFromDirection:direction]); XCTAssertEqualObjects(@"north", [mediumFormatter stringFromDirection:direction]); XCTAssertEqualObjects(@"north", [longFormatter stringFromDirection:direction]); - + direction = 1; XCTAssertEqualObjects(@"N", [shortFormatter stringFromDirection:direction]); XCTAssertEqualObjects(@"north", [mediumFormatter stringFromDirection:direction]); XCTAssertEqualObjects(@"north", [longFormatter stringFromDirection:direction]); - + direction = 10; XCTAssertEqualObjects(@"NbE", [shortFormatter stringFromDirection:direction]); XCTAssertEqualObjects(@"north by east", [mediumFormatter stringFromDirection:direction]); XCTAssertEqualObjects(@"north by east", [longFormatter stringFromDirection:direction]); - + direction = 20; XCTAssertEqualObjects(@"NNE", [shortFormatter stringFromDirection:direction]); XCTAssertEqualObjects(@"north-northeast", [mediumFormatter stringFromDirection:direction]); XCTAssertEqualObjects(@"north-northeast", [longFormatter stringFromDirection:direction]); - + direction = 45; XCTAssertEqualObjects(@"NE", [shortFormatter stringFromDirection:direction]); XCTAssertEqualObjects(@"northeast", [mediumFormatter stringFromDirection:direction]); XCTAssertEqualObjects(@"northeast", [longFormatter stringFromDirection:direction]); - + direction = 90; XCTAssertEqualObjects(@"E", [shortFormatter stringFromDirection:direction]); XCTAssertEqualObjects(@"east", [mediumFormatter stringFromDirection:direction]); XCTAssertEqualObjects(@"east", [longFormatter stringFromDirection:direction]); - + direction = 180; XCTAssertEqualObjects(@"S", [shortFormatter stringFromDirection:direction]); XCTAssertEqualObjects(@"south", [mediumFormatter stringFromDirection:direction]); XCTAssertEqualObjects(@"south", [longFormatter stringFromDirection:direction]); - + direction = 270; XCTAssertEqualObjects(@"W", [shortFormatter stringFromDirection:direction]); XCTAssertEqualObjects(@"west", [mediumFormatter stringFromDirection:direction]); XCTAssertEqualObjects(@"west", [longFormatter stringFromDirection:direction]); - + direction = 359.34951805867024; XCTAssertEqualObjects(@"N", [shortFormatter stringFromDirection:direction]); XCTAssertEqualObjects(@"north", [mediumFormatter stringFromDirection:direction]); XCTAssertEqualObjects(@"north", [longFormatter stringFromDirection:direction]); - + direction = 360; XCTAssertEqualObjects(@"N", [shortFormatter stringFromDirection:direction]); XCTAssertEqualObjects(@"north", [mediumFormatter stringFromDirection:direction]); XCTAssertEqualObjects(@"north", [longFormatter stringFromDirection:direction]); - + direction = 360.1; XCTAssertEqualObjects(@"N", [shortFormatter stringFromDirection:direction]); XCTAssertEqualObjects(@"north", [mediumFormatter stringFromDirection:direction]); XCTAssertEqualObjects(@"north", [longFormatter stringFromDirection:direction]); - + direction = 720; XCTAssertEqualObjects(@"N", [shortFormatter stringFromDirection:direction]); XCTAssertEqualObjects(@"north", [mediumFormatter stringFromDirection:direction]); diff --git a/platform/darwin/test/MGLCoordinateFormatterTests.m b/platform/darwin/test/MGLCoordinateFormatterTests.m index 6a6c7a3b2e..ac083fa103 100644 --- a/platform/darwin/test/MGLCoordinateFormatterTests.m +++ b/platform/darwin/test/MGLCoordinateFormatterTests.m @@ -12,33 +12,33 @@ shortFormatter.unitStyle = NSFormattingUnitStyleShort; XCTAssertTrue(shortFormatter.allowsSeconds, @"Arcseconds should be allowed by default."); XCTAssertTrue(shortFormatter.allowsMinutes, @"Arcminutes should be allowed by default."); - + MGLCoordinateFormatter *mediumFormatter = [[MGLCoordinateFormatter alloc] init]; XCTAssertEqual(mediumFormatter.unitStyle, NSFormattingUnitStyleMedium, @"Unit style should be medium by default."); - + MGLCoordinateFormatter *longFormatter = [[MGLCoordinateFormatter alloc] init]; longFormatter.unitStyle = NSFormattingUnitStyleLong; - + CLLocationCoordinate2D coordinate; - + coordinate = CLLocationCoordinate2DMake(38.9131982, -77.0325453144239); XCTAssertEqualObjects([shortFormatter stringFromCoordinate:coordinate], @"38°54′48″N, 77°1′57″W"); XCTAssertEqualObjects([mediumFormatter stringFromCoordinate:coordinate], @"38°54′48″ north, 77°1′57″ west"); XCTAssertEqualObjects([longFormatter stringFromCoordinate:coordinate], @"38 degrees, 54 minutes, and 48 seconds north by 77 degrees, 1 minute, and 57 seconds west"); - + shortFormatter.allowsSeconds = NO; mediumFormatter.allowsSeconds = NO; longFormatter.allowsSeconds = NO; - + coordinate = CLLocationCoordinate2DMake(38.9131982, -77.0325453144239); XCTAssertEqualObjects([shortFormatter stringFromCoordinate:coordinate], @"38°55′N, 77°2′W"); XCTAssertEqualObjects([mediumFormatter stringFromCoordinate:coordinate], @"38°55′ north, 77°2′ west"); XCTAssertEqualObjects([longFormatter stringFromCoordinate:coordinate], @"38 degrees and 55 minutes north by 77 degrees and 2 minutes west"); - + shortFormatter.allowsMinutes = NO; mediumFormatter.allowsMinutes = NO; longFormatter.allowsMinutes = NO; - + coordinate = CLLocationCoordinate2DMake(38.9131982, -77.0325453144239); XCTAssertEqualObjects([shortFormatter stringFromCoordinate:coordinate], @"39°N, 77°W"); XCTAssertEqualObjects([mediumFormatter stringFromCoordinate:coordinate], @"39° north, 77° west"); diff --git a/platform/darwin/test/MGLFeatureTests.mm b/platform/darwin/test/MGLFeatureTests.mm index 91ec9d429e..818ad8200e 100644 --- a/platform/darwin/test/MGLFeatureTests.mm +++ b/platform/darwin/test/MGLFeatureTests.mm @@ -12,16 +12,16 @@ - (void)testGeometryConversion { std::vector<mbgl::Feature> features; - + mbgl::Point<double> point = { -90.066667, 29.95 }; features.push_back(mbgl::Feature { point }); - + mbgl::LineString<double> lineString = { { -84.516667, 39.1 }, { -90.066667, 29.95 }, }; features.push_back(mbgl::Feature { lineString }); - + mbgl::Polygon<double> polygon = { { { 1, 1 }, @@ -37,15 +37,15 @@ }, }; features.push_back(mbgl::Feature { polygon }); - + NS_ARRAY_OF(MGLShape <MGLFeature> *) *shapes = MGLFeaturesFromMBGLFeatures(features); XCTAssertEqual(shapes.count, 3, @"All features should be converted into shapes"); - + MGLPointFeature *pointShape = (MGLPointFeature *)shapes[0]; XCTAssertTrue([pointShape isKindOfClass:[MGLPointFeature class]]); XCTAssertEqualObjects([NSValue valueWithMGLCoordinate:pointShape.coordinate], [NSValue valueWithMGLCoordinate:CLLocationCoordinate2DMake(29.95, -90.066667)]); - + MGLPolylineFeature *polylineShape = (MGLPolylineFeature *)shapes[1]; XCTAssertTrue([polylineShape isKindOfClass:[MGLPolylineFeature class]]); XCTAssertEqual(polylineShape.pointCount, 2); @@ -55,7 +55,7 @@ [NSValue valueWithMGLCoordinate:CLLocationCoordinate2DMake(39.1, -84.516667)]); XCTAssertEqualObjects([NSValue valueWithMGLCoordinate:polylineCoordinates[1]], [NSValue valueWithMGLCoordinate:CLLocationCoordinate2DMake(29.95, -90.066667)]); - + MGLPolygonFeature *polygonShape = (MGLPolygonFeature *)shapes[2]; XCTAssertTrue([polygonShape isKindOfClass:[MGLPolygonFeature class]]); XCTAssertEqual(polygonShape.pointCount, 4); @@ -87,7 +87,7 @@ - (void)testPropertyConversion { std::vector<mbgl::Feature> features; - + mbgl::Point<double> point = { -90.066667, 29.95 }; mbgl::Feature pointFeature { point }; pointFeature.id = { UINT64_MAX }; @@ -102,23 +102,23 @@ vector.push_back(false); vector.push_back(true); features.push_back(pointFeature); - + NS_ARRAY_OF(MGLShape <MGLFeature> *) *shapes = MGLFeaturesFromMBGLFeatures(features); XCTAssertEqual(shapes.count, 1, @"All features should be converted into shapes"); - + MGLShape <MGLFeature> *shape = shapes.firstObject; XCTAssertTrue([shape conformsToProtocol:@protocol(MGLFeature)]); XCTAssertTrue([shape isKindOfClass:[MGLShape class]]); - + NSNumber *identifier = shape.identifier; XCTAssertTrue([identifier isKindOfClass:[NSNumber class]], @"Feature identifier should be NSNumber"); XCTAssertEqual(strcmp(identifier.objCType, @encode(uint64_t)), 0, @"Feature identifier should be 64-bit unsigned integer"); - + NSNull *null = [shape attributeForKey:@"null"]; XCTAssertNotNil(null); XCTAssertTrue([null isKindOfClass:[NSNull class]]); XCTAssertEqual(null, shape.attributes[@"null"]); - + NSNumber *boolean = [shape attributeForKey:@"bool"]; XCTAssertNotNil(boolean); XCTAssertTrue([boolean isKindOfClass:[NSNumber class]]); @@ -129,28 +129,28 @@ #endif XCTAssertTrue(boolean.boolValue); XCTAssertEqual(boolean, shape.attributes[@"bool"]); - + NSNumber *unsignedInteger = [shape attributeForKey:@"unsigned int"]; XCTAssertNotNil(unsignedInteger); XCTAssertTrue([unsignedInteger isKindOfClass:[NSNumber class]]); XCTAssertEqual(strcmp(unsignedInteger.objCType, @encode(uint64_t)), 0, @"Unsigned integer property should be converted to unsigned long long NSNumber"); XCTAssertEqual(unsignedInteger.unsignedLongLongValue, UINT64_MAX); XCTAssertEqual(unsignedInteger, shape.attributes[@"unsigned int"]); - + NSNumber *integer = [shape attributeForKey:@"int"]; XCTAssertNotNil(integer); XCTAssertTrue([integer isKindOfClass:[NSNumber class]]); XCTAssertEqual(strcmp(integer.objCType, @encode(int64_t)), 0, @"Integer property should be converted to long long NSNumber"); XCTAssertEqual(integer.longLongValue, INT64_MIN); XCTAssertEqual(integer, shape.attributes[@"int"]); - + NSNumber *floatingPointNumber = [shape attributeForKey:@"double"]; XCTAssertNotNil(floatingPointNumber); XCTAssertTrue([floatingPointNumber isKindOfClass:[NSNumber class]]); XCTAssertEqual(strcmp(floatingPointNumber.objCType, @encode(double)), 0, @"Floating-point number property should be converted to double NSNumber"); XCTAssertEqual(floatingPointNumber.doubleValue, DBL_MAX); XCTAssertEqual(floatingPointNumber, shape.attributes[@"double"]); - + NSString *string = [shape attributeForKey:@"string"]; XCTAssertNotNil(string); XCTAssertTrue([string isKindOfClass:[NSString class]]); @@ -162,11 +162,11 @@ MGLPointFeature *pointFeature = [[MGLPointFeature alloc] init]; CLLocationCoordinate2D coordinate = { 10, 10 }; pointFeature.coordinate = coordinate; - + // A GeoJSON feature // when there are no identifier or properties NSDictionary *geoJSONFeature = [pointFeature geoJSONDictionary]; - + // it has the correct type XCTAssertEqualObjects(geoJSONFeature[@"type"], @"Feature"); // it has the correct geometry @@ -177,17 +177,17 @@ XCTAssertNil(geoJSONFeature[@"id"]); // it has a null representation of the properties object XCTAssertEqualObjects(geoJSONFeature[@"properties"], [NSNull null]); - + // when there is a string identifier pointFeature.identifier = @"string-id"; - + // it has the identifier in the result geoJSONFeature = [pointFeature geoJSONDictionary]; XCTAssertEqualObjects(geoJSONFeature[@"id"], pointFeature.identifier); - + // when there are properties pointFeature.attributes = @{@"name": @"name-value"}; - + // it has the properties value in the result geoJSONFeature = [pointFeature geoJSONDictionary]; XCTAssertEqualObjects(geoJSONFeature[@"properties"], pointFeature.attributes); @@ -198,10 +198,10 @@ CLLocationCoordinate2D coord2 = { 10, 10 }; CLLocationCoordinate2D coords[] = { coord1, coord2 }; MGLPolylineFeature *polyLineFeature = [MGLPolylineFeature polylineWithCoordinates:coords count:2]; - + // A GeoJSON feature NSDictionary *geoJSONFeature = [polyLineFeature geoJSONDictionary]; - + // it has the correct geometry NSDictionary *expectedGeometry = @{@"type": @"LineString", @"coordinates": @[@[@(coord1.longitude), @(coord1.latitude)], @@ -215,10 +215,10 @@ CLLocationCoordinate2D coord3 = { 0, 0 }; CLLocationCoordinate2D coords[] = { coord1, coord2, coord3 }; MGLPolygonFeature *polygonFeature = [MGLPolygonFeature polygonWithCoordinates:coords count:3]; - + // A GeoJSON feature NSDictionary *geoJSONFeature = [polygonFeature geoJSONDictionary]; - + // it has the correct geometry NSDictionary *expectedGeometry = @{@"type": @"Polygon", @"coordinates": @[@[@[@(coord1.longitude), @(coord1.latitude)], @@ -232,15 +232,15 @@ CLLocationCoordinate2D coord2 = { 10, 10 }; CLLocationCoordinate2D coord3 = { 0, 0 }; CLLocationCoordinate2D coords[] = { coord1, coord2, coord3 }; - + MGLPolyline *polyLine1 = [MGLPolyline polylineWithCoordinates:coords count:3]; MGLPolyline *polyLine2 = [MGLPolyline polylineWithCoordinates:coords count:3]; - + MGLMultiPolylineFeature *multiPolylineFeature = [MGLMultiPolylineFeature multiPolylineWithPolylines:@[polyLine1, polyLine2]]; - + // A GeoJSON feature NSDictionary *geoJSONFeature = [multiPolylineFeature geoJSONDictionary]; - + // it has the correct geometry NSDictionary *expectedGeometry = @{@"type": @"MultiLineString", @"coordinates": @[@[@[@(coord1.longitude), @(coord1.latitude)], @@ -257,15 +257,15 @@ CLLocationCoordinate2D coord2 = { 10, 10 }; CLLocationCoordinate2D coord3 = { 0, 0 }; CLLocationCoordinate2D coords[] = { coord1, coord2, coord3 }; - + MGLPolygon *polygon1 = [MGLPolygon polygonWithCoordinates:coords count:3]; MGLPolygon *polygon2 = [MGLPolygon polygonWithCoordinates:coords count:3]; - + MGLMultiPolygonFeature *multiPolylineFeature = [MGLMultiPolygonFeature multiPolygonWithPolygons:@[polygon1, polygon2]]; - + // A GeoJSON feature NSDictionary *geoJSONFeature = [multiPolylineFeature geoJSONDictionary]; - + // it has the correct geometry NSDictionary *expectedGeometry = @{@"type": @"MultiPolygon", @"coordinates": @[ @@ -284,10 +284,10 @@ CLLocationCoordinate2D coord3 = { 0, 0 }; CLLocationCoordinate2D coords[] = { coord1, coord2, coord3 }; MGLPointCollectionFeature *pointCollectionFeature = [MGLPointCollectionFeature pointCollectionWithCoordinates:coords count:3]; - + // A GeoJSON feature NSDictionary *geoJSONFeature = [pointCollectionFeature geoJSONDictionary]; - + // it has the correct geometry NSDictionary *expectedGeometry = @{@"type": @"MultiPoint", @"coordinates": @[@[@(coord1.longitude), @(coord1.latitude)], @@ -301,17 +301,17 @@ MGLPointAnnotation *pointFeature = [[MGLPointAnnotation alloc] init]; CLLocationCoordinate2D pointCoordinate = { 10, 10 }; pointFeature.coordinate = pointCoordinate; - + CLLocationCoordinate2D coord1 = { 0, 0 }; CLLocationCoordinate2D coord2 = { 10, 10 }; CLLocationCoordinate2D coords[] = { coord1, coord2 }; MGLPolyline *polyline = [MGLPolyline polylineWithCoordinates:coords count:2]; - + MGLShapeCollectionFeature *shapeCollectionFeature = [MGLShapeCollectionFeature shapeCollectionWithShapes:@[pointFeature, polyline]]; // A GeoJSON feature NSDictionary *geoJSONFeature = [shapeCollectionFeature geoJSONDictionary]; - + // it has the correct geometry NSDictionary *expectedGeometry = @{@"type": @"GeometryCollection", @"geometries": @[ diff --git a/platform/darwin/test/MGLFillStyleLayerTests.mm b/platform/darwin/test/MGLFillStyleLayerTests.mm index fb50512afd..afc3260a28 100644 --- a/platform/darwin/test/MGLFillStyleLayerTests.mm +++ b/platform/darwin/test/MGLFillStyleLayerTests.mm @@ -1,4 +1,4 @@ -// This file is generated. +// This file is generated. // Edit platform/darwin/scripts/generate-style-code.js, then run `make style-code-darwin`. #import "MGLStyleLayerTests.h" @@ -20,13 +20,13 @@ MGLPointFeature *feature = [[MGLPointFeature alloc] init]; MGLShapeSource *source = [[MGLShapeSource alloc] initWithIdentifier:@"sourceID" shape:feature options:nil]; MGLFillStyleLayer *layer = [[MGLFillStyleLayer alloc] initWithIdentifier:@"layerID" source:source]; - + XCTAssertNil(layer.sourceLayerIdentifier); layer.sourceLayerIdentifier = @"layerID"; XCTAssertEqualObjects(layer.sourceLayerIdentifier, @"layerID"); layer.sourceLayerIdentifier = nil; XCTAssertNil(layer.sourceLayerIdentifier); - + XCTAssertNil(layer.predicate); layer.predicate = [NSPredicate predicateWithValue:NO]; XCTAssertEqualObjects(layer.predicate, [NSPredicate predicateWithValue:NO]); @@ -37,18 +37,18 @@ - (void)testProperties { MGLPointFeature *feature = [[MGLPointFeature alloc] init]; MGLShapeSource *source = [[MGLShapeSource alloc] initWithIdentifier:@"sourceID" shape:feature options:nil]; - + MGLFillStyleLayer *layer = [[MGLFillStyleLayer alloc] initWithIdentifier:@"layerID" source:source]; XCTAssertNotEqual(layer.rawLayer, nullptr); XCTAssertTrue(layer.rawLayer->is<mbgl::style::FillLayer>()); auto rawLayer = layer.rawLayer->as<mbgl::style::FillLayer>(); - + // fill-antialias { XCTAssertTrue(rawLayer->getFillAntialias().isUndefined(), @"fill-antialias should be unset initially."); MGLStyleValue<NSNumber *> *defaultStyleValue = layer.fillAntialiased; - + MGLStyleValue<NSNumber *> *styleValue = [MGLStyleValue<NSNumber *> valueWithRawValue:@NO]; layer.fillAntialiased = styleValue; mbgl::style::PropertyValue<bool> propertyValue = { false }; @@ -56,7 +56,7 @@ @"Setting fillAntialiased to a constant value should update fill-antialias."); XCTAssertEqualObjects(layer.fillAntialiased, styleValue, @"fillAntialiased should round-trip constant values."); - + styleValue = [MGLStyleValue<NSNumber *> valueWithStops:@{ @18: styleValue, }]; @@ -69,20 +69,20 @@ @"Setting fillAntialiased to a function should update fill-antialias."); XCTAssertEqualObjects(layer.fillAntialiased, styleValue, @"fillAntialiased should round-trip functions."); - + layer.fillAntialiased = nil; XCTAssertTrue(rawLayer->getFillAntialias().isUndefined(), @"Unsetting fillAntialiased should return fill-antialias to the default value."); XCTAssertEqualObjects(layer.fillAntialiased, defaultStyleValue, @"fillAntialiased should return the default value after being unset."); } - + // fill-color { XCTAssertTrue(rawLayer->getFillColor().isUndefined(), @"fill-color should be unset initially."); MGLStyleValue<MGLColor *> *defaultStyleValue = layer.fillColor; - + MGLStyleValue<MGLColor *> *styleValue = [MGLStyleValue<MGLColor *> valueWithRawValue:[MGLColor redColor]]; layer.fillColor = styleValue; mbgl::style::PropertyValue<mbgl::Color> propertyValue = { { 1, 0, 0, 1 } }; @@ -90,7 +90,7 @@ @"Setting fillColor to a constant value should update fill-color."); XCTAssertEqualObjects(layer.fillColor, styleValue, @"fillColor should round-trip constant values."); - + styleValue = [MGLStyleValue<MGLColor *> valueWithStops:@{ @18: styleValue, }]; @@ -103,20 +103,20 @@ @"Setting fillColor to a function should update fill-color."); XCTAssertEqualObjects(layer.fillColor, styleValue, @"fillColor should round-trip functions."); - + layer.fillColor = nil; XCTAssertTrue(rawLayer->getFillColor().isUndefined(), @"Unsetting fillColor should return fill-color to the default value."); XCTAssertEqualObjects(layer.fillColor, defaultStyleValue, @"fillColor should return the default value after being unset."); } - + // fill-opacity { XCTAssertTrue(rawLayer->getFillOpacity().isUndefined(), @"fill-opacity should be unset initially."); MGLStyleValue<NSNumber *> *defaultStyleValue = layer.fillOpacity; - + MGLStyleValue<NSNumber *> *styleValue = [MGLStyleValue<NSNumber *> valueWithRawValue:@0xff]; layer.fillOpacity = styleValue; mbgl::style::PropertyValue<float> propertyValue = { 0xff }; @@ -124,7 +124,7 @@ @"Setting fillOpacity to a constant value should update fill-opacity."); XCTAssertEqualObjects(layer.fillOpacity, styleValue, @"fillOpacity should round-trip constant values."); - + styleValue = [MGLStyleValue<NSNumber *> valueWithStops:@{ @18: styleValue, }]; @@ -137,20 +137,20 @@ @"Setting fillOpacity to a function should update fill-opacity."); XCTAssertEqualObjects(layer.fillOpacity, styleValue, @"fillOpacity should round-trip functions."); - + layer.fillOpacity = nil; XCTAssertTrue(rawLayer->getFillOpacity().isUndefined(), @"Unsetting fillOpacity should return fill-opacity to the default value."); XCTAssertEqualObjects(layer.fillOpacity, defaultStyleValue, @"fillOpacity should return the default value after being unset."); } - + // fill-outline-color { XCTAssertTrue(rawLayer->getFillOutlineColor().isUndefined(), @"fill-outline-color should be unset initially."); MGLStyleValue<MGLColor *> *defaultStyleValue = layer.fillOutlineColor; - + MGLStyleValue<MGLColor *> *styleValue = [MGLStyleValue<MGLColor *> valueWithRawValue:[MGLColor redColor]]; layer.fillOutlineColor = styleValue; mbgl::style::PropertyValue<mbgl::Color> propertyValue = { { 1, 0, 0, 1 } }; @@ -158,7 +158,7 @@ @"Setting fillOutlineColor to a constant value should update fill-outline-color."); XCTAssertEqualObjects(layer.fillOutlineColor, styleValue, @"fillOutlineColor should round-trip constant values."); - + styleValue = [MGLStyleValue<MGLColor *> valueWithStops:@{ @18: styleValue, }]; @@ -171,20 +171,20 @@ @"Setting fillOutlineColor to a function should update fill-outline-color."); XCTAssertEqualObjects(layer.fillOutlineColor, styleValue, @"fillOutlineColor should round-trip functions."); - + layer.fillOutlineColor = nil; XCTAssertTrue(rawLayer->getFillOutlineColor().isUndefined(), @"Unsetting fillOutlineColor should return fill-outline-color to the default value."); XCTAssertEqualObjects(layer.fillOutlineColor, defaultStyleValue, @"fillOutlineColor should return the default value after being unset."); } - + // fill-pattern { XCTAssertTrue(rawLayer->getFillPattern().isUndefined(), @"fill-pattern should be unset initially."); MGLStyleValue<NSString *> *defaultStyleValue = layer.fillPattern; - + MGLStyleValue<NSString *> *styleValue = [MGLStyleValue<NSString *> valueWithRawValue:@"Fill Pattern"]; layer.fillPattern = styleValue; mbgl::style::PropertyValue<std::string> propertyValue = { "Fill Pattern" }; @@ -192,7 +192,7 @@ @"Setting fillPattern to a constant value should update fill-pattern."); XCTAssertEqualObjects(layer.fillPattern, styleValue, @"fillPattern should round-trip constant values."); - + styleValue = [MGLStyleValue<NSString *> valueWithStops:@{ @18: styleValue, }]; @@ -205,20 +205,20 @@ @"Setting fillPattern to a function should update fill-pattern."); XCTAssertEqualObjects(layer.fillPattern, styleValue, @"fillPattern should round-trip functions."); - + layer.fillPattern = nil; XCTAssertTrue(rawLayer->getFillPattern().isUndefined(), @"Unsetting fillPattern should return fill-pattern to the default value."); XCTAssertEqualObjects(layer.fillPattern, defaultStyleValue, @"fillPattern should return the default value after being unset."); } - + // fill-translate { XCTAssertTrue(rawLayer->getFillTranslate().isUndefined(), @"fill-translate should be unset initially."); MGLStyleValue<NSValue *> *defaultStyleValue = layer.fillTranslation; - + MGLStyleValue<NSValue *> *styleValue = [MGLStyleValue<NSValue *> valueWithRawValue: #if TARGET_OS_IPHONE [NSValue valueWithCGVector:CGVectorMake(1, 1)] @@ -232,7 +232,7 @@ @"Setting fillTranslation to a constant value should update fill-translate."); XCTAssertEqualObjects(layer.fillTranslation, styleValue, @"fillTranslation should round-trip constant values."); - + styleValue = [MGLStyleValue<NSValue *> valueWithStops:@{ @18: styleValue, }]; @@ -245,20 +245,20 @@ @"Setting fillTranslation to a function should update fill-translate."); XCTAssertEqualObjects(layer.fillTranslation, styleValue, @"fillTranslation should round-trip functions."); - + layer.fillTranslation = nil; XCTAssertTrue(rawLayer->getFillTranslate().isUndefined(), @"Unsetting fillTranslation should return fill-translate to the default value."); XCTAssertEqualObjects(layer.fillTranslation, defaultStyleValue, @"fillTranslation should return the default value after being unset."); } - + // fill-translate-anchor { XCTAssertTrue(rawLayer->getFillTranslateAnchor().isUndefined(), @"fill-translate-anchor should be unset initially."); MGLStyleValue<NSValue *> *defaultStyleValue = layer.fillTranslationAnchor; - + MGLStyleValue<NSValue *> *styleValue = [MGLStyleValue<NSValue *> valueWithRawValue:[NSValue valueWithMGLFillTranslationAnchor:MGLFillTranslationAnchorViewport]]; layer.fillTranslationAnchor = styleValue; mbgl::style::PropertyValue<mbgl::style::TranslateAnchorType> propertyValue = { mbgl::style::TranslateAnchorType::Viewport }; @@ -266,7 +266,7 @@ @"Setting fillTranslationAnchor to a constant value should update fill-translate-anchor."); XCTAssertEqualObjects(layer.fillTranslationAnchor, styleValue, @"fillTranslationAnchor should round-trip constant values."); - + styleValue = [MGLStyleValue<NSValue *> valueWithStops:@{ @18: styleValue, }]; @@ -279,7 +279,7 @@ @"Setting fillTranslationAnchor to a function should update fill-translate-anchor."); XCTAssertEqualObjects(layer.fillTranslationAnchor, styleValue, @"fillTranslationAnchor should round-trip functions."); - + layer.fillTranslationAnchor = nil; XCTAssertTrue(rawLayer->getFillTranslateAnchor().isUndefined(), @"Unsetting fillTranslationAnchor should return fill-translate-anchor to the default value."); diff --git a/platform/darwin/test/MGLGeometryTests.mm b/platform/darwin/test/MGLGeometryTests.mm index 0ffc27b29e..d86f7baff4 100644 --- a/platform/darwin/test/MGLGeometryTests.mm +++ b/platform/darwin/test/MGLGeometryTests.mm @@ -22,7 +22,7 @@ XCTAssertEqualWithAccuracy(180, MGLDegreesFromRadians(M_PI), 5); XCTAssertEqualWithAccuracy(360, MGLDegreesFromRadians(2 * M_PI), 5); XCTAssertEqualWithAccuracy(720, MGLDegreesFromRadians(4 * M_PI), 5); - + XCTAssertEqualWithAccuracy(-360, MGLDegreesFromRadians(MGLRadiansFromDegrees(-360)), 4); XCTAssertEqualWithAccuracy(-180, MGLDegreesFromRadians(MGLRadiansFromDegrees(-180)), 5); XCTAssertEqualWithAccuracy(-90, MGLDegreesFromRadians(MGLRadiansFromDegrees(-90)), 5); @@ -38,17 +38,17 @@ CGSize tallSize = CGSizeMake(600, 1200); CGSize midSize = CGSizeMake(600, 800); CGSize shortSize = CGSizeMake(600, 400); - + XCTAssertEqualWithAccuracy(1800, MGLAltitudeForZoomLevel(MGLZoomLevelForAltitude(1800, 0, 0, midSize), 0, 0, midSize), 1); XCTAssertLessThan(MGLZoomLevelForAltitude(1800, 0, 0, midSize), MGLZoomLevelForAltitude(1800, 0, 0, tallSize)); XCTAssertGreaterThan(MGLZoomLevelForAltitude(1800, 0, 0, midSize), MGLZoomLevelForAltitude(1800, 0, 0, shortSize)); - + XCTAssertEqualWithAccuracy(0, MGLZoomLevelForAltitude(MGLAltitudeForZoomLevel(0, 0, 0, midSize), 0, 0, midSize), 3); XCTAssertEqualWithAccuracy(18, MGLZoomLevelForAltitude(MGLAltitudeForZoomLevel(18, 0, 0, midSize), 0, 0, midSize), 3); - + XCTAssertEqualWithAccuracy(0, MGLZoomLevelForAltitude(MGLAltitudeForZoomLevel(0, 0, 40, midSize), 0, 40, midSize), 3); XCTAssertEqualWithAccuracy(18, MGLZoomLevelForAltitude(MGLAltitudeForZoomLevel(18, 0, 40, midSize), 0, 40, midSize), 3); - + XCTAssertEqualWithAccuracy(0, MGLZoomLevelForAltitude(MGLAltitudeForZoomLevel(0, 60, 40, midSize), 60, 40, midSize), 3); XCTAssertEqualWithAccuracy(18, MGLZoomLevelForAltitude(MGLAltitudeForZoomLevel(18, 60, 40, midSize), 60, 40, midSize), 3); } @@ -56,20 +56,20 @@ - (void)testGeometryBoxing { CLLocationCoordinate2D coordinate = CLLocationCoordinate2DMake(38.9131982, -77.0325453144239); CLLocationCoordinate2D roundTrippedCoordinate = [NSValue valueWithMGLCoordinate:coordinate].MGLCoordinateValue; - + XCTAssertEqual(coordinate.latitude, roundTrippedCoordinate.latitude, @"Latitude should round-trip."); XCTAssertEqual(coordinate.longitude, roundTrippedCoordinate.longitude, @"Longitude should round-trip."); - + MGLCoordinateSpan span = MGLCoordinateSpanMake(4.383333333333335, -4.299999999999997); MGLCoordinateSpan roundTrippedSpan = [NSValue valueWithMGLCoordinateSpan:span].MGLCoordinateSpanValue; - + XCTAssertEqual(span.latitudeDelta, roundTrippedSpan.latitudeDelta, @"Latitude delta should round-trip."); XCTAssertEqual(span.longitudeDelta, roundTrippedSpan.longitudeDelta, @"Longitude delta should round-trip."); - + MGLCoordinateBounds bounds = MGLCoordinateBoundsMake(CLLocationCoordinate2DMake(38.9131982, -77.0325453144239), CLLocationCoordinate2DMake(37.7757368, -122.4135302)); MGLCoordinateBounds roundTrippedBounds = [NSValue valueWithMGLCoordinateBounds:bounds].MGLCoordinateBoundsValue; - + XCTAssertEqualObjects([NSValue valueWithMGLCoordinate:bounds.sw], [NSValue valueWithMGLCoordinate:roundTrippedBounds.sw], @"Southwest should round-trip."); @@ -109,7 +109,7 @@ XCTAssertEqual(feature.attributes.count, 0); XCTAssertEqual(feature.coordinate.latitude, 0); XCTAssertEqual(feature.coordinate.longitude, 0); - + data = [@"{\"type\": \"Feature\", \"feature\": {\"type\": \"Point\", \"coordinates\": [0, 0]}}" dataUsingEncoding:NSUTF8StringEncoding]; error = nil; MGLShape *shape = [MGLShape shapeWithData:data encoding:NSUTF8StringEncoding error:&error]; @@ -121,7 +121,7 @@ MGLPointFeature *feature = [[MGLPointFeature alloc] init]; feature.identifier = @504; feature.coordinate = CLLocationCoordinate2DMake(29.95, -90.066667); - + NSData *data = [feature geoJSONDataUsingEncoding:NSUTF8StringEncoding]; XCTAssertNotNil(data, @"MGLPointFeature should serialize as an UTF-8 string data object."); NSError *error; diff --git a/platform/darwin/test/MGLLineStyleLayerTests.mm b/platform/darwin/test/MGLLineStyleLayerTests.mm index 24a9d7afea..3d0a4133e9 100644 --- a/platform/darwin/test/MGLLineStyleLayerTests.mm +++ b/platform/darwin/test/MGLLineStyleLayerTests.mm @@ -1,4 +1,4 @@ -// This file is generated. +// This file is generated. // Edit platform/darwin/scripts/generate-style-code.js, then run `make style-code-darwin`. #import "MGLStyleLayerTests.h" @@ -20,13 +20,13 @@ MGLPointFeature *feature = [[MGLPointFeature alloc] init]; MGLShapeSource *source = [[MGLShapeSource alloc] initWithIdentifier:@"sourceID" shape:feature options:nil]; MGLLineStyleLayer *layer = [[MGLLineStyleLayer alloc] initWithIdentifier:@"layerID" source:source]; - + XCTAssertNil(layer.sourceLayerIdentifier); layer.sourceLayerIdentifier = @"layerID"; XCTAssertEqualObjects(layer.sourceLayerIdentifier, @"layerID"); layer.sourceLayerIdentifier = nil; XCTAssertNil(layer.sourceLayerIdentifier); - + XCTAssertNil(layer.predicate); layer.predicate = [NSPredicate predicateWithValue:NO]; XCTAssertEqualObjects(layer.predicate, [NSPredicate predicateWithValue:NO]); @@ -37,18 +37,18 @@ - (void)testProperties { MGLPointFeature *feature = [[MGLPointFeature alloc] init]; MGLShapeSource *source = [[MGLShapeSource alloc] initWithIdentifier:@"sourceID" shape:feature options:nil]; - + MGLLineStyleLayer *layer = [[MGLLineStyleLayer alloc] initWithIdentifier:@"layerID" source:source]; XCTAssertNotEqual(layer.rawLayer, nullptr); XCTAssertTrue(layer.rawLayer->is<mbgl::style::LineLayer>()); auto rawLayer = layer.rawLayer->as<mbgl::style::LineLayer>(); - + // line-cap { XCTAssertTrue(rawLayer->getLineCap().isUndefined(), @"line-cap should be unset initially."); MGLStyleValue<NSValue *> *defaultStyleValue = layer.lineCap; - + MGLStyleValue<NSValue *> *styleValue = [MGLStyleValue<NSValue *> valueWithRawValue:[NSValue valueWithMGLLineCap:MGLLineCapSquare]]; layer.lineCap = styleValue; mbgl::style::PropertyValue<mbgl::style::LineCapType> propertyValue = { mbgl::style::LineCapType::Square }; @@ -56,7 +56,7 @@ @"Setting lineCap to a constant value should update line-cap."); XCTAssertEqualObjects(layer.lineCap, styleValue, @"lineCap should round-trip constant values."); - + styleValue = [MGLStyleValue<NSValue *> valueWithStops:@{ @18: styleValue, }]; @@ -69,20 +69,20 @@ @"Setting lineCap to a function should update line-cap."); XCTAssertEqualObjects(layer.lineCap, styleValue, @"lineCap should round-trip functions."); - + layer.lineCap = nil; XCTAssertTrue(rawLayer->getLineCap().isUndefined(), @"Unsetting lineCap should return line-cap to the default value."); XCTAssertEqualObjects(layer.lineCap, defaultStyleValue, @"lineCap should return the default value after being unset."); } - + // line-join { XCTAssertTrue(rawLayer->getLineJoin().isUndefined(), @"line-join should be unset initially."); MGLStyleValue<NSValue *> *defaultStyleValue = layer.lineJoin; - + MGLStyleValue<NSValue *> *styleValue = [MGLStyleValue<NSValue *> valueWithRawValue:[NSValue valueWithMGLLineJoin:MGLLineJoinMiter]]; layer.lineJoin = styleValue; mbgl::style::PropertyValue<mbgl::style::LineJoinType> propertyValue = { mbgl::style::LineJoinType::Miter }; @@ -90,7 +90,7 @@ @"Setting lineJoin to a constant value should update line-join."); XCTAssertEqualObjects(layer.lineJoin, styleValue, @"lineJoin should round-trip constant values."); - + styleValue = [MGLStyleValue<NSValue *> valueWithStops:@{ @18: styleValue, }]; @@ -103,20 +103,20 @@ @"Setting lineJoin to a function should update line-join."); XCTAssertEqualObjects(layer.lineJoin, styleValue, @"lineJoin should round-trip functions."); - + layer.lineJoin = nil; XCTAssertTrue(rawLayer->getLineJoin().isUndefined(), @"Unsetting lineJoin should return line-join to the default value."); XCTAssertEqualObjects(layer.lineJoin, defaultStyleValue, @"lineJoin should return the default value after being unset."); } - + // line-miter-limit { XCTAssertTrue(rawLayer->getLineMiterLimit().isUndefined(), @"line-miter-limit should be unset initially."); MGLStyleValue<NSNumber *> *defaultStyleValue = layer.lineMiterLimit; - + MGLStyleValue<NSNumber *> *styleValue = [MGLStyleValue<NSNumber *> valueWithRawValue:@0xff]; layer.lineMiterLimit = styleValue; mbgl::style::PropertyValue<float> propertyValue = { 0xff }; @@ -124,7 +124,7 @@ @"Setting lineMiterLimit to a constant value should update line-miter-limit."); XCTAssertEqualObjects(layer.lineMiterLimit, styleValue, @"lineMiterLimit should round-trip constant values."); - + styleValue = [MGLStyleValue<NSNumber *> valueWithStops:@{ @18: styleValue, }]; @@ -137,20 +137,20 @@ @"Setting lineMiterLimit to a function should update line-miter-limit."); XCTAssertEqualObjects(layer.lineMiterLimit, styleValue, @"lineMiterLimit should round-trip functions."); - + layer.lineMiterLimit = nil; XCTAssertTrue(rawLayer->getLineMiterLimit().isUndefined(), @"Unsetting lineMiterLimit should return line-miter-limit to the default value."); XCTAssertEqualObjects(layer.lineMiterLimit, defaultStyleValue, @"lineMiterLimit should return the default value after being unset."); } - + // line-round-limit { XCTAssertTrue(rawLayer->getLineRoundLimit().isUndefined(), @"line-round-limit should be unset initially."); MGLStyleValue<NSNumber *> *defaultStyleValue = layer.lineRoundLimit; - + MGLStyleValue<NSNumber *> *styleValue = [MGLStyleValue<NSNumber *> valueWithRawValue:@0xff]; layer.lineRoundLimit = styleValue; mbgl::style::PropertyValue<float> propertyValue = { 0xff }; @@ -158,7 +158,7 @@ @"Setting lineRoundLimit to a constant value should update line-round-limit."); XCTAssertEqualObjects(layer.lineRoundLimit, styleValue, @"lineRoundLimit should round-trip constant values."); - + styleValue = [MGLStyleValue<NSNumber *> valueWithStops:@{ @18: styleValue, }]; @@ -171,20 +171,20 @@ @"Setting lineRoundLimit to a function should update line-round-limit."); XCTAssertEqualObjects(layer.lineRoundLimit, styleValue, @"lineRoundLimit should round-trip functions."); - + layer.lineRoundLimit = nil; XCTAssertTrue(rawLayer->getLineRoundLimit().isUndefined(), @"Unsetting lineRoundLimit should return line-round-limit to the default value."); XCTAssertEqualObjects(layer.lineRoundLimit, defaultStyleValue, @"lineRoundLimit should return the default value after being unset."); } - + // line-blur { XCTAssertTrue(rawLayer->getLineBlur().isUndefined(), @"line-blur should be unset initially."); MGLStyleValue<NSNumber *> *defaultStyleValue = layer.lineBlur; - + MGLStyleValue<NSNumber *> *styleValue = [MGLStyleValue<NSNumber *> valueWithRawValue:@0xff]; layer.lineBlur = styleValue; mbgl::style::PropertyValue<float> propertyValue = { 0xff }; @@ -192,7 +192,7 @@ @"Setting lineBlur to a constant value should update line-blur."); XCTAssertEqualObjects(layer.lineBlur, styleValue, @"lineBlur should round-trip constant values."); - + styleValue = [MGLStyleValue<NSNumber *> valueWithStops:@{ @18: styleValue, }]; @@ -205,20 +205,20 @@ @"Setting lineBlur to a function should update line-blur."); XCTAssertEqualObjects(layer.lineBlur, styleValue, @"lineBlur should round-trip functions."); - + layer.lineBlur = nil; XCTAssertTrue(rawLayer->getLineBlur().isUndefined(), @"Unsetting lineBlur should return line-blur to the default value."); XCTAssertEqualObjects(layer.lineBlur, defaultStyleValue, @"lineBlur should return the default value after being unset."); } - + // line-color { XCTAssertTrue(rawLayer->getLineColor().isUndefined(), @"line-color should be unset initially."); MGLStyleValue<MGLColor *> *defaultStyleValue = layer.lineColor; - + MGLStyleValue<MGLColor *> *styleValue = [MGLStyleValue<MGLColor *> valueWithRawValue:[MGLColor redColor]]; layer.lineColor = styleValue; mbgl::style::PropertyValue<mbgl::Color> propertyValue = { { 1, 0, 0, 1 } }; @@ -226,7 +226,7 @@ @"Setting lineColor to a constant value should update line-color."); XCTAssertEqualObjects(layer.lineColor, styleValue, @"lineColor should round-trip constant values."); - + styleValue = [MGLStyleValue<MGLColor *> valueWithStops:@{ @18: styleValue, }]; @@ -239,20 +239,20 @@ @"Setting lineColor to a function should update line-color."); XCTAssertEqualObjects(layer.lineColor, styleValue, @"lineColor should round-trip functions."); - + layer.lineColor = nil; XCTAssertTrue(rawLayer->getLineColor().isUndefined(), @"Unsetting lineColor should return line-color to the default value."); XCTAssertEqualObjects(layer.lineColor, defaultStyleValue, @"lineColor should return the default value after being unset."); } - + // line-dasharray { XCTAssertTrue(rawLayer->getLineDasharray().isUndefined(), @"line-dasharray should be unset initially."); MGLStyleValue<NSArray<NSNumber *> *> *defaultStyleValue = layer.lineDashPattern; - + MGLStyleValue<NSArray<NSNumber *> *> *styleValue = [MGLStyleValue<NSArray<NSNumber *> *> valueWithRawValue:@[@1, @2]]; layer.lineDashPattern = styleValue; mbgl::style::PropertyValue<std::vector<float>> propertyValue = { {1, 2} }; @@ -260,7 +260,7 @@ @"Setting lineDashPattern to a constant value should update line-dasharray."); XCTAssertEqualObjects(layer.lineDashPattern, styleValue, @"lineDashPattern should round-trip constant values."); - + styleValue = [MGLStyleValue<NSArray<NSNumber *> *> valueWithStops:@{ @18: styleValue, }]; @@ -273,20 +273,20 @@ @"Setting lineDashPattern to a function should update line-dasharray."); XCTAssertEqualObjects(layer.lineDashPattern, styleValue, @"lineDashPattern should round-trip functions."); - + layer.lineDashPattern = nil; XCTAssertTrue(rawLayer->getLineDasharray().isUndefined(), @"Unsetting lineDashPattern should return line-dasharray to the default value."); XCTAssertEqualObjects(layer.lineDashPattern, defaultStyleValue, @"lineDashPattern should return the default value after being unset."); } - + // line-gap-width { XCTAssertTrue(rawLayer->getLineGapWidth().isUndefined(), @"line-gap-width should be unset initially."); MGLStyleValue<NSNumber *> *defaultStyleValue = layer.lineGapWidth; - + MGLStyleValue<NSNumber *> *styleValue = [MGLStyleValue<NSNumber *> valueWithRawValue:@0xff]; layer.lineGapWidth = styleValue; mbgl::style::PropertyValue<float> propertyValue = { 0xff }; @@ -294,7 +294,7 @@ @"Setting lineGapWidth to a constant value should update line-gap-width."); XCTAssertEqualObjects(layer.lineGapWidth, styleValue, @"lineGapWidth should round-trip constant values."); - + styleValue = [MGLStyleValue<NSNumber *> valueWithStops:@{ @18: styleValue, }]; @@ -307,20 +307,20 @@ @"Setting lineGapWidth to a function should update line-gap-width."); XCTAssertEqualObjects(layer.lineGapWidth, styleValue, @"lineGapWidth should round-trip functions."); - + layer.lineGapWidth = nil; XCTAssertTrue(rawLayer->getLineGapWidth().isUndefined(), @"Unsetting lineGapWidth should return line-gap-width to the default value."); XCTAssertEqualObjects(layer.lineGapWidth, defaultStyleValue, @"lineGapWidth should return the default value after being unset."); } - + // line-offset { XCTAssertTrue(rawLayer->getLineOffset().isUndefined(), @"line-offset should be unset initially."); MGLStyleValue<NSNumber *> *defaultStyleValue = layer.lineOffset; - + MGLStyleValue<NSNumber *> *styleValue = [MGLStyleValue<NSNumber *> valueWithRawValue:@0xff]; layer.lineOffset = styleValue; mbgl::style::PropertyValue<float> propertyValue = { 0xff }; @@ -328,7 +328,7 @@ @"Setting lineOffset to a constant value should update line-offset."); XCTAssertEqualObjects(layer.lineOffset, styleValue, @"lineOffset should round-trip constant values."); - + styleValue = [MGLStyleValue<NSNumber *> valueWithStops:@{ @18: styleValue, }]; @@ -341,20 +341,20 @@ @"Setting lineOffset to a function should update line-offset."); XCTAssertEqualObjects(layer.lineOffset, styleValue, @"lineOffset should round-trip functions."); - + layer.lineOffset = nil; XCTAssertTrue(rawLayer->getLineOffset().isUndefined(), @"Unsetting lineOffset should return line-offset to the default value."); XCTAssertEqualObjects(layer.lineOffset, defaultStyleValue, @"lineOffset should return the default value after being unset."); } - + // line-opacity { XCTAssertTrue(rawLayer->getLineOpacity().isUndefined(), @"line-opacity should be unset initially."); MGLStyleValue<NSNumber *> *defaultStyleValue = layer.lineOpacity; - + MGLStyleValue<NSNumber *> *styleValue = [MGLStyleValue<NSNumber *> valueWithRawValue:@0xff]; layer.lineOpacity = styleValue; mbgl::style::PropertyValue<float> propertyValue = { 0xff }; @@ -362,7 +362,7 @@ @"Setting lineOpacity to a constant value should update line-opacity."); XCTAssertEqualObjects(layer.lineOpacity, styleValue, @"lineOpacity should round-trip constant values."); - + styleValue = [MGLStyleValue<NSNumber *> valueWithStops:@{ @18: styleValue, }]; @@ -375,20 +375,20 @@ @"Setting lineOpacity to a function should update line-opacity."); XCTAssertEqualObjects(layer.lineOpacity, styleValue, @"lineOpacity should round-trip functions."); - + layer.lineOpacity = nil; XCTAssertTrue(rawLayer->getLineOpacity().isUndefined(), @"Unsetting lineOpacity should return line-opacity to the default value."); XCTAssertEqualObjects(layer.lineOpacity, defaultStyleValue, @"lineOpacity should return the default value after being unset."); } - + // line-pattern { XCTAssertTrue(rawLayer->getLinePattern().isUndefined(), @"line-pattern should be unset initially."); MGLStyleValue<NSString *> *defaultStyleValue = layer.linePattern; - + MGLStyleValue<NSString *> *styleValue = [MGLStyleValue<NSString *> valueWithRawValue:@"Line Pattern"]; layer.linePattern = styleValue; mbgl::style::PropertyValue<std::string> propertyValue = { "Line Pattern" }; @@ -396,7 +396,7 @@ @"Setting linePattern to a constant value should update line-pattern."); XCTAssertEqualObjects(layer.linePattern, styleValue, @"linePattern should round-trip constant values."); - + styleValue = [MGLStyleValue<NSString *> valueWithStops:@{ @18: styleValue, }]; @@ -409,20 +409,20 @@ @"Setting linePattern to a function should update line-pattern."); XCTAssertEqualObjects(layer.linePattern, styleValue, @"linePattern should round-trip functions."); - + layer.linePattern = nil; XCTAssertTrue(rawLayer->getLinePattern().isUndefined(), @"Unsetting linePattern should return line-pattern to the default value."); XCTAssertEqualObjects(layer.linePattern, defaultStyleValue, @"linePattern should return the default value after being unset."); } - + // line-translate { XCTAssertTrue(rawLayer->getLineTranslate().isUndefined(), @"line-translate should be unset initially."); MGLStyleValue<NSValue *> *defaultStyleValue = layer.lineTranslation; - + MGLStyleValue<NSValue *> *styleValue = [MGLStyleValue<NSValue *> valueWithRawValue: #if TARGET_OS_IPHONE [NSValue valueWithCGVector:CGVectorMake(1, 1)] @@ -436,7 +436,7 @@ @"Setting lineTranslation to a constant value should update line-translate."); XCTAssertEqualObjects(layer.lineTranslation, styleValue, @"lineTranslation should round-trip constant values."); - + styleValue = [MGLStyleValue<NSValue *> valueWithStops:@{ @18: styleValue, }]; @@ -449,20 +449,20 @@ @"Setting lineTranslation to a function should update line-translate."); XCTAssertEqualObjects(layer.lineTranslation, styleValue, @"lineTranslation should round-trip functions."); - + layer.lineTranslation = nil; XCTAssertTrue(rawLayer->getLineTranslate().isUndefined(), @"Unsetting lineTranslation should return line-translate to the default value."); XCTAssertEqualObjects(layer.lineTranslation, defaultStyleValue, @"lineTranslation should return the default value after being unset."); } - + // line-translate-anchor { XCTAssertTrue(rawLayer->getLineTranslateAnchor().isUndefined(), @"line-translate-anchor should be unset initially."); MGLStyleValue<NSValue *> *defaultStyleValue = layer.lineTranslationAnchor; - + MGLStyleValue<NSValue *> *styleValue = [MGLStyleValue<NSValue *> valueWithRawValue:[NSValue valueWithMGLLineTranslationAnchor:MGLLineTranslationAnchorViewport]]; layer.lineTranslationAnchor = styleValue; mbgl::style::PropertyValue<mbgl::style::TranslateAnchorType> propertyValue = { mbgl::style::TranslateAnchorType::Viewport }; @@ -470,7 +470,7 @@ @"Setting lineTranslationAnchor to a constant value should update line-translate-anchor."); XCTAssertEqualObjects(layer.lineTranslationAnchor, styleValue, @"lineTranslationAnchor should round-trip constant values."); - + styleValue = [MGLStyleValue<NSValue *> valueWithStops:@{ @18: styleValue, }]; @@ -483,20 +483,20 @@ @"Setting lineTranslationAnchor to a function should update line-translate-anchor."); XCTAssertEqualObjects(layer.lineTranslationAnchor, styleValue, @"lineTranslationAnchor should round-trip functions."); - + layer.lineTranslationAnchor = nil; XCTAssertTrue(rawLayer->getLineTranslateAnchor().isUndefined(), @"Unsetting lineTranslationAnchor should return line-translate-anchor to the default value."); XCTAssertEqualObjects(layer.lineTranslationAnchor, defaultStyleValue, @"lineTranslationAnchor should return the default value after being unset."); } - + // line-width { XCTAssertTrue(rawLayer->getLineWidth().isUndefined(), @"line-width should be unset initially."); MGLStyleValue<NSNumber *> *defaultStyleValue = layer.lineWidth; - + MGLStyleValue<NSNumber *> *styleValue = [MGLStyleValue<NSNumber *> valueWithRawValue:@0xff]; layer.lineWidth = styleValue; mbgl::style::PropertyValue<float> propertyValue = { 0xff }; @@ -504,7 +504,7 @@ @"Setting lineWidth to a constant value should update line-width."); XCTAssertEqualObjects(layer.lineWidth, styleValue, @"lineWidth should round-trip constant values."); - + styleValue = [MGLStyleValue<NSNumber *> valueWithStops:@{ @18: styleValue, }]; @@ -517,7 +517,7 @@ @"Setting lineWidth to a function should update line-width."); XCTAssertEqualObjects(layer.lineWidth, styleValue, @"lineWidth should round-trip functions."); - + layer.lineWidth = nil; XCTAssertTrue(rawLayer->getLineWidth().isUndefined(), @"Unsetting lineWidth should return line-width to the default value."); diff --git a/platform/darwin/test/MGLNSStringAdditionsTests.m b/platform/darwin/test/MGLNSStringAdditionsTests.m index 0c8a9f8143..f07f2c1423 100644 --- a/platform/darwin/test/MGLNSStringAdditionsTests.m +++ b/platform/darwin/test/MGLNSStringAdditionsTests.m @@ -10,31 +10,31 @@ - (void)testTitleCasedString { NSLocale *locale = [NSLocale currentLocale]; - + XCTAssertEqualObjects([@"© OpenStreetMap" mgl_titleCasedStringWithLocale:locale], @"© OpenStreetMap"); XCTAssertEqualObjects([@"© OSM" mgl_titleCasedStringWithLocale:locale], @"© OSM"); - + XCTAssertEqualObjects([@"Improve this map" mgl_titleCasedStringWithLocale:locale], @"Improve This Map"); XCTAssertEqualObjects([@"Improve This Map" mgl_titleCasedStringWithLocale:locale], @"Improve This Map"); - + XCTAssertEqualObjects([@"Improve the map" mgl_titleCasedStringWithLocale:locale], @"Improve the Map"); XCTAssertEqualObjects([@"Improve The Map" mgl_titleCasedStringWithLocale:locale], @"Improve The Map"); - + XCTAssertEqualObjects([@"Improve a map" mgl_titleCasedStringWithLocale:locale], @"Improve a Map"); XCTAssertEqualObjects([@"Improve A Map" mgl_titleCasedStringWithLocale:locale], @"Improve A Map"); - + XCTAssertEqualObjects([@"Improve for the map" mgl_titleCasedStringWithLocale:locale], @"Improve for the Map"); XCTAssertEqualObjects([@"Improve For The Map" mgl_titleCasedStringWithLocale:locale], @"Improve For The Map"); - + XCTAssertEqualObjects([@"Improve and map" mgl_titleCasedStringWithLocale:locale], @"Improve and Map"); XCTAssertEqualObjects([@"Improve And Map" mgl_titleCasedStringWithLocale:locale], @"Improve And Map"); - + XCTAssertEqualObjects([@"Improve while mapping" mgl_titleCasedStringWithLocale:locale], @"Improve While Mapping"); XCTAssertEqualObjects([@"Improve While Mapping" mgl_titleCasedStringWithLocale:locale], @"Improve While Mapping"); - + XCTAssertEqualObjects([@"Improve with the map" mgl_titleCasedStringWithLocale:locale], @"Improve With the Map"); XCTAssertEqualObjects([@"Improve With The Map" mgl_titleCasedStringWithLocale:locale], @"Improve With The Map"); - + XCTAssertEqualObjects([@"Improve this iPhone" mgl_titleCasedStringWithLocale:locale], @"Improve This iPhone"); XCTAssertEqualObjects([@"Improve This iPhone" mgl_titleCasedStringWithLocale:locale], @"Improve This iPhone"); } diff --git a/platform/darwin/test/MGLOfflinePackTests.m b/platform/darwin/test/MGLOfflinePackTests.m index fa231ba005..f58f306e5d 100644 --- a/platform/darwin/test/MGLOfflinePackTests.m +++ b/platform/darwin/test/MGLOfflinePackTests.m @@ -9,9 +9,9 @@ - (void)testInvalidation { MGLOfflinePack *invalidPack = [[MGLOfflinePack alloc] init]; - + XCTAssertEqual(invalidPack.state, MGLOfflinePackStateInvalid, @"Offline pack should be invalid when initialized independently of MGLOfflineStorage."); - + XCTAssertThrowsSpecificNamed(invalidPack.region, NSException, @"Invalid offline pack", @"Invalid offline pack should raise an exception when accessing its region."); XCTAssertThrowsSpecificNamed(invalidPack.context, NSException, @"Invalid offline pack", @"Invalid offline pack should raise an exception when accessing its context."); XCTAssertThrowsSpecificNamed([invalidPack resume], NSException, @"Invalid offline pack", @"Invalid offline pack should raise an exception when being resumed."); @@ -28,7 +28,7 @@ .maximumResourcesExpected = UINT64_MAX, }; MGLOfflinePackProgress roundTrippedProgress = [NSValue valueWithMGLOfflinePackProgress:progress].MGLOfflinePackProgressValue; - + XCTAssertEqual(progress.countOfResourcesCompleted, roundTrippedProgress.countOfResourcesCompleted, @"Completed resources should round-trip."); XCTAssertEqual(progress.countOfResourcesExpected, roundTrippedProgress.countOfResourcesExpected, @"Expected resources should round-trip."); XCTAssertEqual(progress.countOfBytesCompleted, roundTrippedProgress.countOfBytesCompleted, @"Completed bytes should round-trip."); diff --git a/platform/darwin/test/MGLOfflineRegionTests.m b/platform/darwin/test/MGLOfflineRegionTests.m index bb467dd35b..ff079fe798 100644 --- a/platform/darwin/test/MGLOfflineRegionTests.m +++ b/platform/darwin/test/MGLOfflineRegionTests.m @@ -12,7 +12,7 @@ MGLCoordinateBounds bounds = MGLCoordinateBoundsMake(kCLLocationCoordinate2DInvalid, kCLLocationCoordinate2DInvalid); MGLTilePyramidOfflineRegion *region = [[MGLTilePyramidOfflineRegion alloc] initWithStyleURL:nil bounds:bounds fromZoomLevel:0 toZoomLevel:DBL_MAX]; XCTAssertEqualObjects(region.styleURL, [MGLStyle streetsStyleURLWithVersion:MGLStyleDefaultVersion], @"Streets isn’t the default style."); - + NSURL *localURL = [NSURL URLWithString:@"beautiful.style"]; XCTAssertThrowsSpecificNamed([[MGLTilePyramidOfflineRegion alloc] initWithStyleURL:localURL bounds:bounds fromZoomLevel:0 toZoomLevel:DBL_MAX], NSException, @"Invalid style URL", @"No exception raised when initializing region with a local file URL as the style URL."); } @@ -22,7 +22,7 @@ MGLTilePyramidOfflineRegion *original = [[MGLTilePyramidOfflineRegion alloc] initWithStyleURL:[MGLStyle lightStyleURLWithVersion:MGLStyleDefaultVersion] bounds:bounds fromZoomLevel:5 toZoomLevel:10]; MGLTilePyramidOfflineRegion *copy = [original copy]; XCTAssertEqualObjects(original, copy, @"Tile pyramid region should be equal to its copy."); - + XCTAssertEqualObjects(original.styleURL, copy.styleURL, @"Style URL has changed."); XCTAssert(MGLCoordinateBoundsEqualToCoordinateBounds(original.bounds, copy.bounds), @"Bounds have changed."); XCTAssertEqual(original.minimumZoomLevel, original.minimumZoomLevel, @"Minimum zoom level has changed."); diff --git a/platform/darwin/test/MGLOfflineStorageTests.m b/platform/darwin/test/MGLOfflineStorageTests.m index 07540b5645..de2831d8de 100644 --- a/platform/darwin/test/MGLOfflineStorageTests.m +++ b/platform/darwin/test/MGLOfflineStorageTests.m @@ -10,7 +10,7 @@ - (void)setUp { [super setUp]; - + static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ XCTestExpectation *expectation = [self keyValueObservingExpectationForObject:[MGLOfflineStorage sharedOfflineStorage] keyPath:@"packs" handler:^BOOL(id _Nonnull observedObject, NSDictionary * _Nonnull change) { @@ -23,7 +23,7 @@ } else { [self waitForExpectationsWithTimeout:2 handler:nil]; } - + XCTAssertNotNil([MGLOfflineStorage sharedOfflineStorage].packs, @"Shared offline storage object should have a non-nil collection of packs by this point."); }); } @@ -34,7 +34,7 @@ - (void)testAddPack { NSUInteger countOfPacks = [MGLOfflineStorage sharedOfflineStorage].packs.count; - + NSURL *styleURL = [MGLStyle lightStyleURLWithVersion:8]; /// Somewhere near Grape Grove, Ohio, United States. MGLCoordinateBounds bounds = { @@ -43,14 +43,14 @@ }; double zoomLevel = 20; MGLTilePyramidOfflineRegion *region = [[MGLTilePyramidOfflineRegion alloc] initWithStyleURL:styleURL bounds:bounds fromZoomLevel:zoomLevel toZoomLevel:zoomLevel]; - + NSString *nameKey = @"Name"; NSString *name = @"🍇 Grape Grove"; - + NSData *context = [NSKeyedArchiver archivedDataWithRootObject:@{ nameKey: name, }]; - + __block MGLOfflinePack *pack; [self keyValueObservingExpectationForObject:[MGLOfflineStorage sharedOfflineStorage] keyPath:@"packs" handler:^BOOL(id _Nonnull observedObject, NSDictionary * _Nonnull change) { NSKeyValueChange changeKind = [change[NSKeyValueChangeKindKey] unsignedIntegerValue]; @@ -65,20 +65,20 @@ [additionCompletionHandlerExpectation fulfill]; }]; [self waitForExpectationsWithTimeout:2 handler:nil]; - + XCTAssertEqual([MGLOfflineStorage sharedOfflineStorage].packs.count, countOfPacks + 1, @"Added pack should have been added to the canonical collection of packs owned by the shared offline storage object. This assertion can fail if this test is run before -testAAALoadPacks."); - + XCTAssertEqual(pack, [MGLOfflineStorage sharedOfflineStorage].packs.lastObject, @"Pack should be appended to end of packs array."); - + XCTAssertEqualObjects(pack.region, region, @"Added pack’s region has changed."); - + NSDictionary *userInfo = [NSKeyedUnarchiver unarchiveObjectWithData:pack.context]; XCTAssert([userInfo isKindOfClass:[NSDictionary class]], @"Context of offline pack isn’t a dictionary."); XCTAssert([userInfo[nameKey] isKindOfClass:[NSString class]], @"Name of offline pack isn’t a string."); XCTAssertEqualObjects(userInfo[nameKey], name, @"Name of offline pack has changed."); - + XCTAssertEqual(pack.state, MGLOfflinePackStateInactive, @"New pack should initially have inactive state."); - + [self keyValueObservingExpectationForObject:pack keyPath:@"state" handler:^BOOL(id _Nonnull observedObject, NSDictionary * _Nonnull change) { NSKeyValueChange changeKind = [change[NSKeyValueChangeKindKey] unsignedIntegerValue]; MGLOfflinePackState state = [change[NSKeyValueChangeNewKey] integerValue]; @@ -87,18 +87,18 @@ [self expectationForNotification:MGLOfflinePackProgressChangedNotification object:pack handler:^BOOL(NSNotification * _Nonnull notification) { MGLOfflinePack *notificationPack = notification.object; XCTAssert([notificationPack isKindOfClass:[MGLOfflinePack class]], @"Object of notification should be an MGLOfflinePack."); - + NSDictionary *userInfo = notification.userInfo; XCTAssertNotNil(userInfo, @"Progress change notification should have a userInfo dictionary."); - + NSNumber *stateNumber = userInfo[MGLOfflinePackUserInfoKeyState]; XCTAssert([stateNumber isKindOfClass:[NSNumber class]], @"Progress change notification’s state should be an NSNumber."); XCTAssertEqual(stateNumber.integerValue, pack.state, @"State in a progress change notification should match the pack’s state."); - + NSValue *progressValue = userInfo[MGLOfflinePackUserInfoKeyProgress]; XCTAssert([progressValue isKindOfClass:[NSValue class]], @"Progress change notification’s progress should be an NSValue."); XCTAssertEqualObjects(progressValue, [NSValue valueWithMGLOfflinePackProgress:pack.progress], @"Progress change notification’s progress should match pack’s progress."); - + return notificationPack == pack && pack.state == MGLOfflinePackStateInactive; }]; [pack requestProgress]; @@ -131,10 +131,10 @@ - (void)testRemovePack { NSUInteger countOfPacks = [MGLOfflineStorage sharedOfflineStorage].packs.count; - + MGLOfflinePack *pack = [MGLOfflineStorage sharedOfflineStorage].packs.lastObject; XCTAssertNotNil(pack, @"Added pack should still exist."); - + [self keyValueObservingExpectationForObject:[MGLOfflineStorage sharedOfflineStorage] keyPath:@"packs" handler:^BOOL(id _Nonnull observedObject, NSDictionary * _Nonnull change) { NSKeyValueChange changeKind = [change[NSKeyValueChangeKindKey] unsignedIntegerValue]; NSIndexSet *indices = change[NSKeyValueChangeIndexesKey]; @@ -146,9 +146,9 @@ [completionHandlerExpectation fulfill]; }]; [self waitForExpectationsWithTimeout:1 handler:nil]; - + XCTAssertEqual(pack.state, MGLOfflinePackStateInvalid, @"Removed pack should have been invalidated synchronously."); - + XCTAssertEqual([MGLOfflineStorage sharedOfflineStorage].packs.count, countOfPacks - 1, @"Removed pack should have been removed from the canonical collection of packs owned by the shared offline storage object. This assertion can fail if this test is run before -testAAALoadPacks or -testAddPack."); } diff --git a/platform/darwin/test/MGLPredicateTests.mm b/platform/darwin/test/MGLPredicateTests.mm index fbd144d28a..f34b480a25 100644 --- a/platform/darwin/test/MGLPredicateTests.mm +++ b/platform/darwin/test/MGLPredicateTests.mm @@ -29,61 +29,61 @@ namespace mbgl { mbgl::style::AllFilter expected; MGLAssertEqualFilters(actual, expected); } - + { auto actual = [NSPredicate predicateWithValue:NO].mgl_filter; mbgl::style::AnyFilter expected; MGLAssertEqualFilters(actual, expected); } - + { auto actual = [NSPredicate predicateWithFormat:@"a = 'b'"].mgl_filter; mbgl::style::EqualsFilter expected = { .key = "a", .value = std::string("b") }; MGLAssertEqualFilters(actual, expected); } - + { auto actual = [NSPredicate predicateWithFormat:@"a = nil"].mgl_filter; mbgl::style::NotHasFilter expected = { .key = "a" }; MGLAssertEqualFilters(actual, expected); } - + { auto actual = [NSPredicate predicateWithFormat:@"a != 'b'"].mgl_filter; mbgl::style::NotEqualsFilter expected = { .key = "a", .value = std::string("b") }; MGLAssertEqualFilters(actual, expected); } - + { auto actual = [NSPredicate predicateWithFormat:@"a != nil"].mgl_filter; mbgl::style::HasFilter expected = { .key = "a" }; MGLAssertEqualFilters(actual, expected); } - + { auto actual = [NSPredicate predicateWithFormat:@"a < 'b'"].mgl_filter; mbgl::style::LessThanFilter expected = { .key = "a", .value = std::string("b") }; MGLAssertEqualFilters(actual, expected); } - + { auto actual = [NSPredicate predicateWithFormat:@"a <= 'b'"].mgl_filter; mbgl::style::LessThanEqualsFilter expected = { .key = "a", .value = std::string("b") }; MGLAssertEqualFilters(actual, expected); } - + { auto actual = [NSPredicate predicateWithFormat:@"a > 'b'"].mgl_filter; mbgl::style::GreaterThanFilter expected = { .key = "a", .value = std::string("b") }; MGLAssertEqualFilters(actual, expected); } - + { auto actual = [NSPredicate predicateWithFormat:@"a >= 'b'"].mgl_filter; mbgl::style::GreaterThanEqualsFilter expected = { .key = "a", .value = std::string("b") }; MGLAssertEqualFilters(actual, expected); } - + { auto actual = [NSPredicate predicateWithFormat:@"a BETWEEN {'b', 'z'}"].mgl_filter; mbgl::style::AllFilter expected = { @@ -94,7 +94,7 @@ namespace mbgl { }; MGLAssertEqualFilters(actual, expected); } - + { auto actual = [NSPredicate predicateWithFormat:@"a BETWEEN %@", @[@"b", @"z"]].mgl_filter; mbgl::style::AllFilter expected = { @@ -105,35 +105,35 @@ namespace mbgl { }; MGLAssertEqualFilters(actual, expected); } - + { auto actual = [NSPredicate predicateWithFormat:@"a IN {'b', 'c'}"].mgl_filter; mbgl::style::InFilter expected = { .key = "a", .values = { std::string("b"), std::string("c") } }; MGLAssertEqualFilters(actual, expected); } - + { auto actual = [NSPredicate predicateWithFormat:@"a IN %@", @[@"b", @"c"]].mgl_filter; mbgl::style::InFilter expected = { .key = "a", .values = { std::string("b"), std::string("c") } }; MGLAssertEqualFilters(actual, expected); } - + XCTAssertThrowsSpecificNamed([NSPredicate predicateWithFormat:@"'Mapbox' IN a"].mgl_filter, NSException, NSInvalidArgumentException); - + { auto actual = [NSPredicate predicateWithFormat:@"{'b', 'c'} CONTAINS a"].mgl_filter; mbgl::style::InFilter expected = { .key = "a", .values = { std::string("b"), std::string("c") } }; MGLAssertEqualFilters(actual, expected); } - + { auto actual = [NSPredicate predicateWithFormat:@"%@ CONTAINS a", @[@"b", @"c"]].mgl_filter; mbgl::style::InFilter expected = { .key = "a", .values = { std::string("b"), std::string("c") } }; MGLAssertEqualFilters(actual, expected); } - + XCTAssertThrowsSpecificNamed([NSPredicate predicateWithFormat:@"a CONTAINS 'Mapbox'"].mgl_filter, NSException, NSInvalidArgumentException); - + { auto actual = [NSPredicate predicateWithFormat:@"a == 'b' AND c == 'd'"].mgl_filter; mbgl::style::AllFilter expected = { @@ -144,7 +144,7 @@ namespace mbgl { }; MGLAssertEqualFilters(actual, expected); } - + { auto actual = [NSPredicate predicateWithFormat:@"a == 'b' OR c == 'd'"].mgl_filter; mbgl::style::AnyFilter expected = { @@ -155,7 +155,7 @@ namespace mbgl { }; MGLAssertEqualFilters(actual, expected); } - + { auto actual = [NSPredicate predicateWithFormat:@"NOT(a == 'b' AND c == 'd')"].mgl_filter; mbgl::style::NoneFilter expected = { @@ -170,7 +170,7 @@ namespace mbgl { }; MGLAssertEqualFilters(actual, expected); } - + { auto actual = [NSPredicate predicateWithFormat:@"NOT(a == 'b' OR c == 'd')"].mgl_filter; mbgl::style::NoneFilter expected = { @@ -181,50 +181,50 @@ namespace mbgl { }; MGLAssertEqualFilters(actual, expected); } - + { auto actual = [NSPredicate predicateWithFormat:@"NOT a == nil"].mgl_filter; mbgl::style::HasFilter expected = { .key = "a" }; MGLAssertEqualFilters(actual, expected); } - + { auto actual = [NSPredicate predicateWithFormat:@"NOT a != nil"].mgl_filter; mbgl::style::NotHasFilter expected = { .key = "a" }; MGLAssertEqualFilters(actual, expected); } - + { auto actual = [NSPredicate predicateWithFormat:@"NOT a IN {'b', 'c'}"].mgl_filter; mbgl::style::NotInFilter expected = { .key = "a", .values = { std::string("b"), std::string("c") } }; MGLAssertEqualFilters(actual, expected); } - + { auto actual = [NSPredicate predicateWithFormat:@"NOT a IN %@", @[@"b", @"c"]].mgl_filter; mbgl::style::NotInFilter expected = { .key = "a", .values = { std::string("b"), std::string("c") } }; MGLAssertEqualFilters(actual, expected); } - + { auto actual = [NSPredicate predicateWithFormat:@"NOT {'b', 'c'} CONTAINS a"].mgl_filter; mbgl::style::NotInFilter expected = { .key = "a", .values = { std::string("b"), std::string("c") } }; MGLAssertEqualFilters(actual, expected); } - + { auto actual = [NSPredicate predicateWithFormat:@"NOT %@ CONTAINS a", @[@"b", @"c"]].mgl_filter; mbgl::style::NotInFilter expected = { .key = "a", .values = { std::string("b"), std::string("c") } }; MGLAssertEqualFilters(actual, expected); } - + XCTAssertThrowsSpecificNamed([NSPredicate predicateWithFormat:@"a BEGINSWITH 'L'"].mgl_filter, NSException, NSInvalidArgumentException); XCTAssertThrowsSpecificNamed([NSPredicate predicateWithFormat:@"a ENDSWITH 'itude'"].mgl_filter, NSException, NSInvalidArgumentException); XCTAssertThrowsSpecificNamed([NSPredicate predicateWithFormat:@"a LIKE 'glob?trotter'"].mgl_filter, NSException, NSInvalidArgumentException); XCTAssertThrowsSpecificNamed([NSPredicate predicateWithFormat:@"a MATCHES 'i\\w{18}n'"].mgl_filter, NSException, NSInvalidArgumentException); NSPredicate *selectorPredicate = [NSPredicate predicateWithFormat:@"(SELF isKindOfClass: %@)", [MGLPolyline class]]; XCTAssertThrowsSpecificNamed(selectorPredicate.mgl_filter, NSException, NSInvalidArgumentException); - + XCTAssertThrowsSpecificNamed([NSPredicate predicateWithBlock:^BOOL(id _Nullable evaluatedObject, NSDictionary<NSString *, id> * _Nullable bindings) { XCTAssertTrue(NO, @"Predicate block should not be evaluated."); return NO; @@ -233,47 +233,47 @@ namespace mbgl { - (void)testPredication { XCTAssertNil([NSPredicate mgl_predicateWithFilter:mbgl::style::NullFilter()]); - + { mbgl::style::EqualsFilter filter = { .key = "a", .value = std::string("b") }; XCTAssertEqualObjects([NSPredicate mgl_predicateWithFilter:filter], [NSPredicate predicateWithFormat:@"a = 'b'"]); } - + { mbgl::style::NotHasFilter filter = { .key = "a" }; XCTAssertEqualObjects([NSPredicate mgl_predicateWithFilter:filter], [NSPredicate predicateWithFormat:@"a = nil"]); } - + { mbgl::style::NotEqualsFilter filter = { .key = "a", .value = std::string("b") }; XCTAssertEqualObjects([NSPredicate mgl_predicateWithFilter:filter], [NSPredicate predicateWithFormat:@"a != 'b'"]); } - + { mbgl::style::HasFilter filter = { .key = "a" }; XCTAssertEqualObjects([NSPredicate mgl_predicateWithFilter:filter], [NSPredicate predicateWithFormat:@"a != nil"]); } - + { mbgl::style::LessThanFilter filter = { .key = "a", .value = std::string("b") }; XCTAssertEqualObjects([NSPredicate mgl_predicateWithFilter:filter], [NSPredicate predicateWithFormat:@"a < 'b'"]); } - + { mbgl::style::LessThanEqualsFilter filter = { .key = "a", .value = std::string("b") }; XCTAssertEqualObjects([NSPredicate mgl_predicateWithFilter:filter], [NSPredicate predicateWithFormat:@"a <= 'b'"]); } - + { mbgl::style::GreaterThanFilter filter = { .key = "a", .value = std::string("b") }; XCTAssertEqualObjects([NSPredicate mgl_predicateWithFilter:filter], [NSPredicate predicateWithFormat:@"a > 'b'"]); } - + { mbgl::style::GreaterThanEqualsFilter filter = { .key = "a", .value = std::string("b") }; XCTAssertEqualObjects([NSPredicate mgl_predicateWithFilter:filter], [NSPredicate predicateWithFormat:@"a >= 'b'"]); } - + { mbgl::style::AllFilter filter = { .filters = { @@ -283,7 +283,7 @@ namespace mbgl { }; XCTAssertEqualObjects([NSPredicate mgl_predicateWithFilter:filter], [NSPredicate predicateWithFormat:@"a BETWEEN {'b', 'z'}"]); } - + { mbgl::style::AllFilter filter = { .filters = { @@ -293,22 +293,22 @@ namespace mbgl { }; XCTAssertEqualObjects([NSPredicate mgl_predicateWithFilter:filter], [NSPredicate predicateWithFormat:@"a BETWEEN {'b', 'z'}"]); } - + { mbgl::style::InFilter filter = { .key = "a", .values = { std::string("b"), std::string("c") } }; XCTAssertEqualObjects([NSPredicate mgl_predicateWithFilter:filter].predicateFormat, [NSPredicate predicateWithFormat:@"a IN {'b', 'c'}"].predicateFormat); } - + { mbgl::style::NotInFilter filter = { .key = "a", .values = { std::string("b"), std::string("c") } }; XCTAssertEqualObjects([NSPredicate mgl_predicateWithFilter:filter].predicateFormat, [NSPredicate predicateWithFormat:@"NOT a IN {'b', 'c'}"].predicateFormat); } - + { mbgl::style::AllFilter filter; XCTAssertEqualObjects([NSPredicate mgl_predicateWithFilter:filter], [NSPredicate predicateWithValue:YES]); } - + { mbgl::style::AllFilter filter = { .filters = { @@ -318,12 +318,12 @@ namespace mbgl { }; XCTAssertEqualObjects([NSPredicate mgl_predicateWithFilter:filter], [NSPredicate predicateWithFormat:@"a == 'b' AND c == 'd'"]); } - + { mbgl::style::AnyFilter filter; XCTAssertEqualObjects([NSPredicate mgl_predicateWithFilter:filter], [NSPredicate predicateWithValue:NO]); } - + { mbgl::style::AnyFilter filter = { .filters = { @@ -333,12 +333,12 @@ namespace mbgl { }; XCTAssertEqualObjects([NSPredicate mgl_predicateWithFilter:filter], [NSPredicate predicateWithFormat:@"a == 'b' OR c == 'd'"]); } - + { mbgl::style::NoneFilter filter; XCTAssertEqualObjects([NSPredicate mgl_predicateWithFilter:filter], [NSPredicate predicateWithValue:YES]); } - + { mbgl::style::NoneFilter filter = { .filters = { @@ -355,20 +355,20 @@ namespace mbgl { [self testSymmetryWithFormat:@"a != 1" reverseFormat:@"1 != a" mustRoundTrip:YES]; XCTAssertThrowsSpecificNamed([NSPredicate predicateWithFormat:@"a = b"].mgl_filter, NSException, NSInvalidArgumentException); XCTAssertThrowsSpecificNamed([NSPredicate predicateWithFormat:@"1 = 1"].mgl_filter, NSException, NSInvalidArgumentException); - + // In the predicate format language, $ is a special character denoting a // variable. Use %K to escape the special feature attribute $id. XCTAssertThrowsSpecificNamed([NSPredicate predicateWithFormat:@"$id == 670861802"].mgl_filter, NSException, NSInvalidArgumentException); XCTAssertThrowsSpecificNamed([NSPredicate predicateWithFormat:@"a = $id"].mgl_filter, NSException, NSInvalidArgumentException); - + [self testSymmetryWithFormat:@"a = nil" reverseFormat:@"nil = a" mustRoundTrip:YES]; [self testSymmetryWithFormat:@"a != nil" reverseFormat:@"nil != a" mustRoundTrip:YES]; - + [self testSymmetryWithFormat:@"a < 1" reverseFormat:@"1 > a" mustRoundTrip:YES]; [self testSymmetryWithFormat:@"a <= 1" reverseFormat:@"1 >= a" mustRoundTrip:YES]; [self testSymmetryWithFormat:@"a > 1" reverseFormat:@"1 < a" mustRoundTrip:YES]; [self testSymmetryWithFormat:@"a >= 1" reverseFormat:@"1 <= a" mustRoundTrip:YES]; - + [self testSymmetryWithFormat:@"a BETWEEN {1, 2}" reverseFormat:@"1 <= a && 2 >= a" mustRoundTrip:YES]; [self testSymmetryWithPredicate:[NSPredicate predicateWithFormat:@"a BETWEEN %@", @[@1, @2]] reversePredicate:[NSPredicate predicateWithFormat:@"1 <= a && 2 >= a"] @@ -378,12 +378,12 @@ namespace mbgl { XCTAssertThrowsSpecificNamed(betweenSetPredicate.mgl_filter, NSException, NSInvalidArgumentException); XCTAssertThrowsSpecificNamed([NSPredicate predicateWithFormat:@"a BETWEEN {1}"].mgl_filter, NSException, NSInvalidArgumentException); XCTAssertThrowsSpecificNamed([NSPredicate predicateWithFormat:@"a BETWEEN {1, 2, 3}"].mgl_filter, NSException, NSInvalidArgumentException); - + [self testSymmetryWithFormat:@"a IN {1, 2}" reverseFormat:@"{1, 2} CONTAINS a" mustRoundTrip:NO]; [self testSymmetryWithPredicate:[NSPredicate predicateWithFormat:@"a IN %@", @[@1, @2]] reversePredicate:[NSPredicate predicateWithFormat:@"%@ CONTAINS a", @[@1, @2]] mustRoundTrip:YES]; - + // The reverse formats here are a bit backwards because we canonicalize // a reverse CONTAINS to a forward IN. [self testSymmetryWithFormat:@"{1, 2} CONTAINS a" reverseFormat:@"{1, 2} CONTAINS a" mustRoundTrip:NO]; @@ -406,12 +406,12 @@ namespace mbgl { // example, so compare formats instead of the predicates themselves. XCTAssertEqualObjects(forwardPredicate.predicateFormat, forwardPredicateAfter.predicateFormat); } - + if (reversePredicate) { auto reverseFilter = reversePredicate.mgl_filter; NSPredicate *reversePredicateAfter = [NSPredicate mgl_predicateWithFilter:reverseFilter]; XCTAssertNotEqualObjects(reversePredicate, reversePredicateAfter); - + XCTAssertEqualObjects(forwardPredicateAfter, reversePredicateAfter); } } diff --git a/platform/darwin/test/MGLRasterStyleLayerTests.mm b/platform/darwin/test/MGLRasterStyleLayerTests.mm index 28a201961c..debccd1ef6 100644 --- a/platform/darwin/test/MGLRasterStyleLayerTests.mm +++ b/platform/darwin/test/MGLRasterStyleLayerTests.mm @@ -1,4 +1,4 @@ -// This file is generated. +// This file is generated. // Edit platform/darwin/scripts/generate-style-code.js, then run `make style-code-darwin`. #import "MGLStyleLayerTests.h" @@ -19,18 +19,18 @@ - (void)testProperties { MGLPointFeature *feature = [[MGLPointFeature alloc] init]; MGLShapeSource *source = [[MGLShapeSource alloc] initWithIdentifier:@"sourceID" shape:feature options:nil]; - + MGLRasterStyleLayer *layer = [[MGLRasterStyleLayer alloc] initWithIdentifier:@"layerID" source:source]; XCTAssertNotEqual(layer.rawLayer, nullptr); XCTAssertTrue(layer.rawLayer->is<mbgl::style::RasterLayer>()); auto rawLayer = layer.rawLayer->as<mbgl::style::RasterLayer>(); - + // raster-brightness-max { XCTAssertTrue(rawLayer->getRasterBrightnessMax().isUndefined(), @"raster-brightness-max should be unset initially."); MGLStyleValue<NSNumber *> *defaultStyleValue = layer.maximumRasterBrightness; - + MGLStyleValue<NSNumber *> *styleValue = [MGLStyleValue<NSNumber *> valueWithRawValue:@0xff]; layer.maximumRasterBrightness = styleValue; mbgl::style::PropertyValue<float> propertyValue = { 0xff }; @@ -38,7 +38,7 @@ @"Setting maximumRasterBrightness to a constant value should update raster-brightness-max."); XCTAssertEqualObjects(layer.maximumRasterBrightness, styleValue, @"maximumRasterBrightness should round-trip constant values."); - + styleValue = [MGLStyleValue<NSNumber *> valueWithStops:@{ @18: styleValue, }]; @@ -51,20 +51,20 @@ @"Setting maximumRasterBrightness to a function should update raster-brightness-max."); XCTAssertEqualObjects(layer.maximumRasterBrightness, styleValue, @"maximumRasterBrightness should round-trip functions."); - + layer.maximumRasterBrightness = nil; XCTAssertTrue(rawLayer->getRasterBrightnessMax().isUndefined(), @"Unsetting maximumRasterBrightness should return raster-brightness-max to the default value."); XCTAssertEqualObjects(layer.maximumRasterBrightness, defaultStyleValue, @"maximumRasterBrightness should return the default value after being unset."); } - + // raster-brightness-min { XCTAssertTrue(rawLayer->getRasterBrightnessMin().isUndefined(), @"raster-brightness-min should be unset initially."); MGLStyleValue<NSNumber *> *defaultStyleValue = layer.minimumRasterBrightness; - + MGLStyleValue<NSNumber *> *styleValue = [MGLStyleValue<NSNumber *> valueWithRawValue:@0xff]; layer.minimumRasterBrightness = styleValue; mbgl::style::PropertyValue<float> propertyValue = { 0xff }; @@ -72,7 +72,7 @@ @"Setting minimumRasterBrightness to a constant value should update raster-brightness-min."); XCTAssertEqualObjects(layer.minimumRasterBrightness, styleValue, @"minimumRasterBrightness should round-trip constant values."); - + styleValue = [MGLStyleValue<NSNumber *> valueWithStops:@{ @18: styleValue, }]; @@ -85,20 +85,20 @@ @"Setting minimumRasterBrightness to a function should update raster-brightness-min."); XCTAssertEqualObjects(layer.minimumRasterBrightness, styleValue, @"minimumRasterBrightness should round-trip functions."); - + layer.minimumRasterBrightness = nil; XCTAssertTrue(rawLayer->getRasterBrightnessMin().isUndefined(), @"Unsetting minimumRasterBrightness should return raster-brightness-min to the default value."); XCTAssertEqualObjects(layer.minimumRasterBrightness, defaultStyleValue, @"minimumRasterBrightness should return the default value after being unset."); } - + // raster-contrast { XCTAssertTrue(rawLayer->getRasterContrast().isUndefined(), @"raster-contrast should be unset initially."); MGLStyleValue<NSNumber *> *defaultStyleValue = layer.rasterContrast; - + MGLStyleValue<NSNumber *> *styleValue = [MGLStyleValue<NSNumber *> valueWithRawValue:@0xff]; layer.rasterContrast = styleValue; mbgl::style::PropertyValue<float> propertyValue = { 0xff }; @@ -106,7 +106,7 @@ @"Setting rasterContrast to a constant value should update raster-contrast."); XCTAssertEqualObjects(layer.rasterContrast, styleValue, @"rasterContrast should round-trip constant values."); - + styleValue = [MGLStyleValue<NSNumber *> valueWithStops:@{ @18: styleValue, }]; @@ -119,20 +119,20 @@ @"Setting rasterContrast to a function should update raster-contrast."); XCTAssertEqualObjects(layer.rasterContrast, styleValue, @"rasterContrast should round-trip functions."); - + layer.rasterContrast = nil; XCTAssertTrue(rawLayer->getRasterContrast().isUndefined(), @"Unsetting rasterContrast should return raster-contrast to the default value."); XCTAssertEqualObjects(layer.rasterContrast, defaultStyleValue, @"rasterContrast should return the default value after being unset."); } - + // raster-fade-duration { XCTAssertTrue(rawLayer->getRasterFadeDuration().isUndefined(), @"raster-fade-duration should be unset initially."); MGLStyleValue<NSNumber *> *defaultStyleValue = layer.rasterFadeDuration; - + MGLStyleValue<NSNumber *> *styleValue = [MGLStyleValue<NSNumber *> valueWithRawValue:@0xff]; layer.rasterFadeDuration = styleValue; mbgl::style::PropertyValue<float> propertyValue = { 0xff }; @@ -140,7 +140,7 @@ @"Setting rasterFadeDuration to a constant value should update raster-fade-duration."); XCTAssertEqualObjects(layer.rasterFadeDuration, styleValue, @"rasterFadeDuration should round-trip constant values."); - + styleValue = [MGLStyleValue<NSNumber *> valueWithStops:@{ @18: styleValue, }]; @@ -153,20 +153,20 @@ @"Setting rasterFadeDuration to a function should update raster-fade-duration."); XCTAssertEqualObjects(layer.rasterFadeDuration, styleValue, @"rasterFadeDuration should round-trip functions."); - + layer.rasterFadeDuration = nil; XCTAssertTrue(rawLayer->getRasterFadeDuration().isUndefined(), @"Unsetting rasterFadeDuration should return raster-fade-duration to the default value."); XCTAssertEqualObjects(layer.rasterFadeDuration, defaultStyleValue, @"rasterFadeDuration should return the default value after being unset."); } - + // raster-hue-rotate { XCTAssertTrue(rawLayer->getRasterHueRotate().isUndefined(), @"raster-hue-rotate should be unset initially."); MGLStyleValue<NSNumber *> *defaultStyleValue = layer.rasterHueRotation; - + MGLStyleValue<NSNumber *> *styleValue = [MGLStyleValue<NSNumber *> valueWithRawValue:@0xff]; layer.rasterHueRotation = styleValue; mbgl::style::PropertyValue<float> propertyValue = { 0xff }; @@ -174,7 +174,7 @@ @"Setting rasterHueRotation to a constant value should update raster-hue-rotate."); XCTAssertEqualObjects(layer.rasterHueRotation, styleValue, @"rasterHueRotation should round-trip constant values."); - + styleValue = [MGLStyleValue<NSNumber *> valueWithStops:@{ @18: styleValue, }]; @@ -187,20 +187,20 @@ @"Setting rasterHueRotation to a function should update raster-hue-rotate."); XCTAssertEqualObjects(layer.rasterHueRotation, styleValue, @"rasterHueRotation should round-trip functions."); - + layer.rasterHueRotation = nil; XCTAssertTrue(rawLayer->getRasterHueRotate().isUndefined(), @"Unsetting rasterHueRotation should return raster-hue-rotate to the default value."); XCTAssertEqualObjects(layer.rasterHueRotation, defaultStyleValue, @"rasterHueRotation should return the default value after being unset."); } - + // raster-opacity { XCTAssertTrue(rawLayer->getRasterOpacity().isUndefined(), @"raster-opacity should be unset initially."); MGLStyleValue<NSNumber *> *defaultStyleValue = layer.rasterOpacity; - + MGLStyleValue<NSNumber *> *styleValue = [MGLStyleValue<NSNumber *> valueWithRawValue:@0xff]; layer.rasterOpacity = styleValue; mbgl::style::PropertyValue<float> propertyValue = { 0xff }; @@ -208,7 +208,7 @@ @"Setting rasterOpacity to a constant value should update raster-opacity."); XCTAssertEqualObjects(layer.rasterOpacity, styleValue, @"rasterOpacity should round-trip constant values."); - + styleValue = [MGLStyleValue<NSNumber *> valueWithStops:@{ @18: styleValue, }]; @@ -221,20 +221,20 @@ @"Setting rasterOpacity to a function should update raster-opacity."); XCTAssertEqualObjects(layer.rasterOpacity, styleValue, @"rasterOpacity should round-trip functions."); - + layer.rasterOpacity = nil; XCTAssertTrue(rawLayer->getRasterOpacity().isUndefined(), @"Unsetting rasterOpacity should return raster-opacity to the default value."); XCTAssertEqualObjects(layer.rasterOpacity, defaultStyleValue, @"rasterOpacity should return the default value after being unset."); } - + // raster-saturation { XCTAssertTrue(rawLayer->getRasterSaturation().isUndefined(), @"raster-saturation should be unset initially."); MGLStyleValue<NSNumber *> *defaultStyleValue = layer.rasterSaturation; - + MGLStyleValue<NSNumber *> *styleValue = [MGLStyleValue<NSNumber *> valueWithRawValue:@0xff]; layer.rasterSaturation = styleValue; mbgl::style::PropertyValue<float> propertyValue = { 0xff }; @@ -242,7 +242,7 @@ @"Setting rasterSaturation to a constant value should update raster-saturation."); XCTAssertEqualObjects(layer.rasterSaturation, styleValue, @"rasterSaturation should round-trip constant values."); - + styleValue = [MGLStyleValue<NSNumber *> valueWithStops:@{ @18: styleValue, }]; @@ -255,7 +255,7 @@ @"Setting rasterSaturation to a function should update raster-saturation."); XCTAssertEqualObjects(layer.rasterSaturation, styleValue, @"rasterSaturation should round-trip functions."); - + layer.rasterSaturation = nil; XCTAssertTrue(rawLayer->getRasterSaturation().isUndefined(), @"Unsetting rasterSaturation should return raster-saturation to the default value."); diff --git a/platform/darwin/test/MGLShapeSourceTests.mm b/platform/darwin/test/MGLShapeSourceTests.mm index cf32b5c821..ba85d76020 100644 --- a/platform/darwin/test/MGLShapeSourceTests.mm +++ b/platform/darwin/test/MGLShapeSourceTests.mm @@ -19,7 +19,7 @@ MGLShapeSourceOptionMaximumZoomLevel: @99, MGLShapeSourceOptionBuffer: @1976, MGLShapeSourceOptionSimplificationTolerance: @0.42}; - + auto mbglOptions = MGLGeoJSONOptionsFromDictionary(options); XCTAssertTrue(mbglOptions.cluster); XCTAssertEqual(mbglOptions.clusterRadius, 42); @@ -27,7 +27,7 @@ XCTAssertEqual(mbglOptions.maxzoom, 99); XCTAssertEqual(mbglOptions.buffer, 1976); XCTAssertEqual(mbglOptions.tolerance, 0.42); - + options = @{MGLShapeSourceOptionClustered: @"number 1"}; XCTAssertThrows(MGLGeoJSONOptionsFromDictionary(options)); } @@ -41,26 +41,26 @@ NSDictionary *options = @{ MGLShapeSourceOptionClustered: @YES, }; - + MGLShapeSource *source = [[MGLShapeSource alloc] initWithIdentifier:@"id" shape:[[MGLPointFeature alloc] init] options:options]; XCTAssertTrue([source.shape isKindOfClass:[MGLPointFeature class]]); - + MGLShapeCollectionFeature *feature = [MGLShapeCollectionFeature shapeCollectionWithShapes:@[]]; source = [[MGLShapeSource alloc] initWithIdentifier:@"id" shape:feature options:options]; XCTAssertTrue([source.shape isKindOfClass:[MGLShapeCollectionFeature class]]); } - (void)testMGLShapeSourceWithDataMultipleFeatures { - + NSString *geoJSON = @"{\"type\": \"FeatureCollection\",\"features\": [{\"type\": \"Feature\",\"properties\": {},\"geometry\": {\"type\": \"LineString\",\"coordinates\": [[-107.75390625,40.329795743702064],[-104.34814453125,37.64903402157866]]}}]}"; - + NSData *data = [geoJSON dataUsingEncoding:NSUTF8StringEncoding]; NSError *error; MGLShape *shape = [MGLShape shapeWithData:data encoding:NSUTF8StringEncoding error:&error]; XCTAssertNil(error); XCTAssertNotNil(shape); MGLShapeSource *source = [[MGLShapeSource alloc] initWithIdentifier:@"source-id" shape:shape options:nil]; - + MGLShapeCollection *collection = (MGLShapeCollection *)source.shape; XCTAssertNotNil(collection); XCTAssertEqual(collection.shapes.count, 1); @@ -95,9 +95,9 @@ - (void)testMGLShapeSourceWithPolylineFeatures { CLLocationCoordinate2D coordinates[] = { CLLocationCoordinate2DMake(0, 0), CLLocationCoordinate2DMake(10, 10)}; MGLPolylineFeature *polylineFeature = [MGLPolylineFeature polylineWithCoordinates:coordinates count:2]; - + MGLShapeSource *source = [[MGLShapeSource alloc] initWithIdentifier:@"source-id" shape:polylineFeature options:nil]; - + XCTAssertNotNil(source.shape); XCTAssertTrue([source.shape isMemberOfClass:[MGLPolylineFeature class]]); } @@ -109,7 +109,7 @@ CLLocationCoordinate2DMake(101.0, 1.0), CLLocationCoordinate2DMake(100.0, 1.0), CLLocationCoordinate2DMake(100.0, 0.0)}; - + MGLPolygonFeature *polygonFeature = [MGLPolygonFeature polygonWithCoordinates:coordinates count:5]; polygonFeature.identifier = @"feature-id"; NSString *stringAttribute = @"string"; @@ -123,7 +123,7 @@ @"key-4": arrayValue}; NSArray *arrayOfArrays = @[@[@1, @"string-value", @[@"jagged"]]]; NSArray *arrayOfDictionaries = @[@{@"key": @"value"}]; - + polygonFeature.attributes = @{@"name": stringAttribute, @"bool": boolAttribute, @"double": doubleAttribute, @@ -131,9 +131,9 @@ @"array-attribute": arrayValue, @"array-of-array-attribute": arrayOfArrays, @"array-of-dictionary-attribute": arrayOfDictionaries}; - + MGLShapeSource *source = [[MGLShapeSource alloc] initWithIdentifier:@"source-id" shape:polygonFeature options:nil]; - + XCTAssertNotNil(source.shape); MGLPolygonFeature *expectedPolygonFeature = (MGLPolygonFeature *)source.shape; XCTAssertEqualObjects(expectedPolygonFeature.identifier, polygonFeature.identifier); @@ -155,20 +155,20 @@ CLLocationCoordinate2DMake(101.0, 1.0), CLLocationCoordinate2DMake(100.0, 1.0), CLLocationCoordinate2DMake(100.0, 0.0)}; - + CLLocationCoordinate2D interiorCoordinates[] = { CLLocationCoordinate2DMake(100.2, 0.2), CLLocationCoordinate2DMake(100.8, 0.2), CLLocationCoordinate2DMake(100.8, 0.8), CLLocationCoordinate2DMake(100.2, 0.8), CLLocationCoordinate2DMake(100.2, 0.2)}; - + MGLPolygon *polygon = [MGLPolygon polygonWithCoordinates:interiorCoordinates count:5]; - + MGLPolygonFeature *polygonFeature = [MGLPolygonFeature polygonWithCoordinates:coordinates count:5 interiorPolygons:@[polygon]]; - + MGLShapeSource *source = [[MGLShapeSource alloc] initWithIdentifier:@"source-id" shape:polygonFeature options:nil]; - + XCTAssertNotNil(source.shape); XCTAssertTrue([source.shape isMemberOfClass:[MGLPolygonFeature class]]); } @@ -179,9 +179,9 @@ CLLocationCoordinate2D secondCoordinates[] = { CLLocationCoordinate2DMake(0, 0), CLLocationCoordinate2DMake(10, 10)}; MGLPolylineFeature *secondPolylineFeature = [MGLPolylineFeature polylineWithCoordinates:secondCoordinates count:2]; MGLMultiPolylineFeature *multiPolylineFeature = [MGLMultiPolylineFeature multiPolylineWithPolylines:@[firstPolylineFeature, secondPolylineFeature]]; - + MGLShapeSource *source = [[MGLShapeSource alloc] initWithIdentifier:@"source-id" shape:multiPolylineFeature options:nil]; - + XCTAssertNotNil(source.shape); XCTAssertTrue([source.shape isMemberOfClass:[MGLMultiPolylineFeature class]]); } @@ -193,23 +193,23 @@ CLLocationCoordinate2DMake(101.0, 1.0), CLLocationCoordinate2DMake(100.0, 1.0), CLLocationCoordinate2DMake(100.0, 0.0)}; - + CLLocationCoordinate2D interiorCoordinates[] = { CLLocationCoordinate2DMake(100.2, 0.2), CLLocationCoordinate2DMake(100.8, 0.2), CLLocationCoordinate2DMake(100.8, 0.8), CLLocationCoordinate2DMake(100.2, 0.8), CLLocationCoordinate2DMake(100.2, 0.2)}; - + MGLPolygon *polygon = [MGLPolygon polygonWithCoordinates:interiorCoordinates count:5]; - + MGLPolygonFeature *firstPolygon = [MGLPolygonFeature polygonWithCoordinates:coordinates count:5 interiorPolygons:@[polygon]]; MGLPolygonFeature *secondPolygon = [MGLPolygonFeature polygonWithCoordinates:coordinates count:5 interiorPolygons:@[polygon]]; - + MGLMultiPolygonFeature *multiPolygonFeature = [MGLMultiPolygonFeature multiPolygonWithPolygons:@[firstPolygon, secondPolygon]]; - + MGLShapeSource *source = [[MGLShapeSource alloc] initWithIdentifier:@"source-id" shape:multiPolygonFeature options:nil]; - + XCTAssertNotNil(source.shape); XCTAssertTrue([source.shape isMemberOfClass:[MGLMultiPolygonFeature class]]); } @@ -217,9 +217,9 @@ - (void)testMGLShapeSourceWithPointFeature { MGLPointFeature *pointFeature = [MGLPointFeature new]; pointFeature.coordinate = CLLocationCoordinate2DMake(100.2, 0.2); - + MGLShapeSource *source = [[MGLShapeSource alloc] initWithIdentifier:@"souce-id" shape:pointFeature options:nil]; - + XCTAssertNotNil(source.shape); XCTAssertTrue([source.shape isMemberOfClass:[MGLPointFeature class]]); } @@ -245,34 +245,34 @@ CLLocationCoordinate2DMake(101.0, 1.0), CLLocationCoordinate2DMake(100.0, 1.0), CLLocationCoordinate2DMake(100.0, 0.0)}; - + CLLocationCoordinate2D interiorCoordinates[] = { CLLocationCoordinate2DMake(100.2, 0.2), CLLocationCoordinate2DMake(100.8, 0.2), CLLocationCoordinate2DMake(100.8, 0.8), CLLocationCoordinate2DMake(100.2, 0.8), CLLocationCoordinate2DMake(100.2, 0.2)}; - + MGLPolygon *polygon = [MGLPolygon polygonWithCoordinates:interiorCoordinates count:5]; - + MGLPolygonFeature *polygonFeature = [MGLPolygonFeature polygonWithCoordinates:coordinates count:5 interiorPolygons:@[polygon]]; - + CLLocationCoordinate2D coordinates_2[] = { CLLocationCoordinate2DMake(0, 0), CLLocationCoordinate2DMake(10, 10)}; MGLPolylineFeature *polylineFeature = [MGLPolylineFeature polylineWithCoordinates:coordinates_2 count:2]; - + MGLMultiPolygonFeature *multiPolygonFeature = [MGLMultiPolygonFeature multiPolygonWithPolygons:@[polygonFeature, polygonFeature]]; - + MGLMultiPolylineFeature *multiPolylineFeature = [MGLMultiPolylineFeature multiPolylineWithPolylines:@[polylineFeature, polylineFeature]]; - + MGLPointCollectionFeature *pointCollectionFeature = [MGLPointCollectionFeature pointCollectionWithCoordinates:coordinates count:5]; - + MGLPointFeature *pointFeature = [MGLPointFeature new]; pointFeature.coordinate = CLLocationCoordinate2DMake(100.2, 0.2); - + MGLShapeCollectionFeature *shapeCollectionFeature = [MGLShapeCollectionFeature shapeCollectionWithShapes:@[polygonFeature, polylineFeature, multiPolygonFeature, multiPolylineFeature, pointCollectionFeature, pointFeature]]; MGLShapeSource *source = [[MGLShapeSource alloc] initWithIdentifier:@"source-id" shape:shapeCollectionFeature options:nil]; - + MGLShapeCollectionFeature *shape = (MGLShapeCollectionFeature *)source.shape; XCTAssertNotNil(shape); XCTAssert(shape.shapes.count == 6, @"Shape collection should contain 6 shapes"); diff --git a/platform/darwin/test/MGLStyleLayerTests.m b/platform/darwin/test/MGLStyleLayerTests.m index 1dba9f4305..b51fa02af4 100644 --- a/platform/darwin/test/MGLStyleLayerTests.m +++ b/platform/darwin/test/MGLStyleLayerTests.m @@ -11,22 +11,22 @@ - (void)testProperties { MGLPointFeature *feature = [[MGLPointFeature alloc] init]; MGLShapeSource *source = [[MGLShapeSource alloc] initWithIdentifier:@"sourceID" shape:feature options:nil]; - + MGLFillStyleLayer *layer = [[MGLFillStyleLayer alloc] initWithIdentifier:@"layerID" source:source]; - + XCTAssertEqualObjects(layer.identifier, @"layerID"); XCTAssertEqualObjects(layer.sourceIdentifier, source.identifier); - + XCTAssertTrue(layer.visible); layer.visible = NO; XCTAssertFalse(layer.visible); layer.visible = YES; XCTAssertTrue(layer.visible); - + XCTAssertEqual(layer.minimumZoomLevel, -INFINITY); layer.minimumZoomLevel = 22; XCTAssertEqual(layer.minimumZoomLevel, 22); - + XCTAssertEqual(layer.maximumZoomLevel, INFINITY); layer.maximumZoomLevel = 0; XCTAssertEqual(layer.maximumZoomLevel, 0); diff --git a/platform/darwin/test/MGLStyleLayerTests.mm.ejs b/platform/darwin/test/MGLStyleLayerTests.mm.ejs index 00842a5b4e..d47f1fbe25 100644 --- a/platform/darwin/test/MGLStyleLayerTests.mm.ejs +++ b/platform/darwin/test/MGLStyleLayerTests.mm.ejs @@ -3,7 +3,7 @@ const properties = locals.properties; const enumProperties = locals.enumProperties; -%> -// This file is generated. +// This file is generated. // Edit platform/darwin/scripts/generate-style-code.js, then run `make style-code-darwin`. #import "MGLStyleLayerTests.h" @@ -26,13 +26,13 @@ MGLPointFeature *feature = [[MGLPointFeature alloc] init]; MGLShapeSource *source = [[MGLShapeSource alloc] initWithIdentifier:@"sourceID" shape:feature options:nil]; MGL<%- camelize(type) %>StyleLayer *layer = [[MGL<%- camelize(type) %>StyleLayer alloc] initWithIdentifier:@"layerID" source:source]; - + XCTAssertNil(layer.sourceLayerIdentifier); layer.sourceLayerIdentifier = @"layerID"; XCTAssertEqualObjects(layer.sourceLayerIdentifier, @"layerID"); layer.sourceLayerIdentifier = nil; XCTAssertNil(layer.sourceLayerIdentifier); - + XCTAssertNil(layer.predicate); layer.predicate = [NSPredicate predicateWithValue:NO]; XCTAssertEqualObjects(layer.predicate, [NSPredicate predicateWithValue:NO]); @@ -47,20 +47,20 @@ <% } else { -%> MGLPointFeature *feature = [[MGLPointFeature alloc] init]; MGLShapeSource *source = [[MGLShapeSource alloc] initWithIdentifier:@"sourceID" shape:feature options:nil]; - + MGL<%- camelize(type) %>StyleLayer *layer = [[MGL<%- camelize(type) %>StyleLayer alloc] initWithIdentifier:@"layerID" source:source]; <% } -%> XCTAssertNotEqual(layer.rawLayer, nullptr); XCTAssertTrue(layer.rawLayer->is<mbgl::style::<%- camelize(type) %>Layer>()); auto rawLayer = layer.rawLayer->as<mbgl::style::<%- camelize(type) %>Layer>(); <% for (const property of properties) { -%> - + // <%- originalPropertyName(property) %> { XCTAssertTrue(rawLayer->get<%- camelize(originalPropertyName(property)) %>().isUndefined(), @"<%- originalPropertyName(property) %> should be unset initially."); MGLStyleValue<<%- propertyType(property) %>> *defaultStyleValue = layer.<%- objCName(property) %>; - + MGLStyleValue<<%- propertyType(property) %>> *styleValue = [MGLStyleValue<<%- propertyType(property) %>> valueWithRawValue:<%- objCTestValue(property, type, 3) %>]; layer.<%- objCName(property) %> = styleValue; mbgl::style::PropertyValue<<%- mbglType(property) %>> propertyValue = { <%- mbglTestValue(property, type) %> }; @@ -68,7 +68,7 @@ @"Setting <%- objCName(property) %> to a constant value should update <%- originalPropertyName(property) %>."); XCTAssertEqualObjects(layer.<%- objCName(property) %>, styleValue, @"<%- objCName(property) %> should round-trip constant values."); - + styleValue = [MGLStyleValue<<%- propertyType(property) %>> valueWithStops:@{ @18: styleValue, }]; @@ -82,7 +82,7 @@ XCTAssertEqualObjects(layer.<%- objCName(property) %>, styleValue, @"<%- objCName(property) %> should round-trip functions."); <% if (!property.required) { -%> - + layer.<%- objCName(property) %> = nil; XCTAssertTrue(rawLayer->get<%- camelize(originalPropertyName(property)) %>().isUndefined(), @"Unsetting <%- objCName(property) %> should return <%- originalPropertyName(property) %> to the default value."); diff --git a/platform/darwin/test/MGLStyleTests.mm b/platform/darwin/test/MGLStyleTests.mm index 176217619d..ed86a252fa 100644 --- a/platform/darwin/test/MGLStyleTests.mm +++ b/platform/darwin/test/MGLStyleTests.mm @@ -25,7 +25,7 @@ - (void)setUp { [super setUp]; - + [MGLAccountManager setAccessToken:@"pk.feedcafedeadbeefbadebede"]; NSURL *styleURL = [[NSBundle bundleForClass:[self class]] URLForResource:@"one-liner" withExtension:@"json"]; self.mapView = [[MGLMapView alloc] initWithFrame:CGRectMake(0, 0, 100, 100) styleURL:styleURL]; @@ -39,14 +39,14 @@ - (void)mapView:(MGLMapView *)mapView didFinishLoadingStyle:(MGLStyle *)style { XCTAssertNotNil(mapView.style); XCTAssertEqual(mapView.style, style); - + [_styleLoadingExpectation fulfill]; } - (void)tearDown { _styleLoadingExpectation = nil; self.mapView = nil; - + [super tearDown]; } @@ -81,7 +81,7 @@ XCTAssertEqualObjects([MGLStyle satelliteStyleURLWithVersion:99].absoluteString, @"mapbox://styles/mapbox/satellite-v99"); XCTAssertEqualObjects([MGLStyle satelliteStreetsStyleURLWithVersion:MGLStyleDefaultVersion].absoluteString, @(mbgl::util::default_styles::satelliteStreets.url)); XCTAssertEqualObjects([MGLStyle satelliteStreetsStyleURLWithVersion:99].absoluteString, @"mapbox://styles/mapbox/satellite-streets-v99"); - + static_assert(6 == mbgl::util::default_styles::numOrderedStyles, "MGLStyleTests isn’t testing all the styles in mbgl::util::default_styles."); } @@ -109,17 +109,17 @@ XCTAssertEqual(mbgl::util::default_styles::numOrderedStyles, numVersionedMethods, @"There are %lu default styles but MGLStyleTests only provides versioned style URL methods for %u of them.", mbgl::util::default_styles::numOrderedStyles, numVersionedMethods); - + // Test that all the versioned style methods are in the public header. NSString *styleHeader = self.stringWithContentsOfStyleHeader; - + NSError *versionedMethodError; NSString *versionedMethodExpressionString = @(R"RE(^\+\s*\(NSURL\s*\*\s*\)\s*\w+StyleURLWithVersion\s*:\s*\(\s*NSInteger\s*\)\s*version\s*;)RE"); NSRegularExpression *versionedMethodExpression = [NSRegularExpression regularExpressionWithPattern:versionedMethodExpressionString options:NSRegularExpressionAnchorsMatchLines error:&versionedMethodError]; XCTAssertNil(versionedMethodError, @"Error compiling regular expression to search for versioned methods."); NSUInteger numVersionedMethodDeclarations = [versionedMethodExpression numberOfMatchesInString:styleHeader options:0 range:NSMakeRange(0, styleHeader.length)]; XCTAssertEqual(numVersionedMethodDeclarations, numVersionedMethods); - + // Test that “current version is” statements are present and current for all versioned style methods. NSError *versionError; NSString *versionExpressionString = @(R"RE(current version is `(\d+)`)RE"); @@ -219,15 +219,15 @@ } - (void)testAddingLayersWithDuplicateIdentifiers { - //Just some source + // Just some source MGLVectorSource *source = [[MGLVectorSource alloc] initWithIdentifier:@"my-source" configurationURL:[NSURL URLWithString:@"mapbox://mapbox.mapbox-terrain-v2"]]; [self.style addSource: source]; - - //Add initial layer + + // Add initial layer MGLFillStyleLayer *initial = [[MGLFillStyleLayer alloc] initWithIdentifier:@"my-layer" source:source]; [self.style addLayer:initial]; - - //Try to add the duplicate + + // Try to add the duplicate XCTAssertThrowsSpecificNamed([self.style addLayer:[[MGLFillStyleLayer alloc] initWithIdentifier:@"my-layer" source:source]], NSException, @"MGLRedundantLayerIdentifierException"); XCTAssertThrowsSpecificNamed([self.style insertLayer:[[MGLFillStyleLayer alloc] initWithIdentifier:@"my-layer" source:source] belowLayer:initial],NSException, @"MGLRedundantLayerIdentifierException"); XCTAssertThrowsSpecificNamed([self.style insertLayer:[[MGLFillStyleLayer alloc] initWithIdentifier:@"my-layer" source:source] aboveLayer:initial], NSException, @"MGLRedundantLayerIdentifierException"); @@ -259,10 +259,10 @@ MGLImage *image = [[NSBundle bundleForClass:[self class]] imageForResource:imageName]; #endif XCTAssertNotNil(image); - + [self.style setImage:image forName:imageName]; MGLImage *styleImage = [self.style imageForName:imageName]; - + XCTAssertNotNil(styleImage); XCTAssertEqual(image.size.width, styleImage.size.width); XCTAssertEqual(image.size.height, styleImage.size.height); @@ -273,28 +273,28 @@ NSURL *url = [NSURL fileURLWithPath:filePath]; MGLShapeSource *source = [[MGLShapeSource alloc] initWithIdentifier:@"sourceID" URL:url options:nil]; [self.style addSource:source]; - + MGLCircleStyleLayer *layer1 = [[MGLCircleStyleLayer alloc] initWithIdentifier:@"layer1" source:source]; [self.style addLayer:layer1]; - + MGLCircleStyleLayer *layer3 = [[MGLCircleStyleLayer alloc] initWithIdentifier:@"layer3" source:source]; [self.style addLayer:layer3]; - + MGLCircleStyleLayer *layer2 = [[MGLCircleStyleLayer alloc] initWithIdentifier:@"layer2" source:source]; [self.style insertLayer:layer2 aboveLayer:layer1]; - + MGLCircleStyleLayer *layer4 = [[MGLCircleStyleLayer alloc] initWithIdentifier:@"layer4" source:source]; [self.style insertLayer:layer4 aboveLayer:layer3]; - + MGLCircleStyleLayer *layer0 = [[MGLCircleStyleLayer alloc] initWithIdentifier:@"layer0" source:source]; [self.style insertLayer:layer0 belowLayer:layer1]; - + NSArray<MGLStyleLayer *> *layers = [self.style layers]; NSUInteger startIndex = 0; if ([layers.firstObject.identifier isEqualToString:@"com.mapbox.annotations.points"]) { startIndex++; } - + XCTAssertEqualObjects(layers[startIndex++].identifier, layer0.identifier); XCTAssertEqualObjects(layers[startIndex++].identifier, layer1.identifier); XCTAssertEqualObjects(layers[startIndex++].identifier, layer2.identifier); diff --git a/platform/darwin/test/MGLSymbolStyleLayerTests.mm b/platform/darwin/test/MGLSymbolStyleLayerTests.mm index 80a9c9d3ec..202cbe4e9d 100644 --- a/platform/darwin/test/MGLSymbolStyleLayerTests.mm +++ b/platform/darwin/test/MGLSymbolStyleLayerTests.mm @@ -1,4 +1,4 @@ -// This file is generated. +// This file is generated. // Edit platform/darwin/scripts/generate-style-code.js, then run `make style-code-darwin`. #import "MGLStyleLayerTests.h" @@ -20,13 +20,13 @@ MGLPointFeature *feature = [[MGLPointFeature alloc] init]; MGLShapeSource *source = [[MGLShapeSource alloc] initWithIdentifier:@"sourceID" shape:feature options:nil]; MGLSymbolStyleLayer *layer = [[MGLSymbolStyleLayer alloc] initWithIdentifier:@"layerID" source:source]; - + XCTAssertNil(layer.sourceLayerIdentifier); layer.sourceLayerIdentifier = @"layerID"; XCTAssertEqualObjects(layer.sourceLayerIdentifier, @"layerID"); layer.sourceLayerIdentifier = nil; XCTAssertNil(layer.sourceLayerIdentifier); - + XCTAssertNil(layer.predicate); layer.predicate = [NSPredicate predicateWithValue:NO]; XCTAssertEqualObjects(layer.predicate, [NSPredicate predicateWithValue:NO]); @@ -37,18 +37,18 @@ - (void)testProperties { MGLPointFeature *feature = [[MGLPointFeature alloc] init]; MGLShapeSource *source = [[MGLShapeSource alloc] initWithIdentifier:@"sourceID" shape:feature options:nil]; - + MGLSymbolStyleLayer *layer = [[MGLSymbolStyleLayer alloc] initWithIdentifier:@"layerID" source:source]; XCTAssertNotEqual(layer.rawLayer, nullptr); XCTAssertTrue(layer.rawLayer->is<mbgl::style::SymbolLayer>()); auto rawLayer = layer.rawLayer->as<mbgl::style::SymbolLayer>(); - + // icon-allow-overlap { XCTAssertTrue(rawLayer->getIconAllowOverlap().isUndefined(), @"icon-allow-overlap should be unset initially."); MGLStyleValue<NSNumber *> *defaultStyleValue = layer.iconAllowsOverlap; - + MGLStyleValue<NSNumber *> *styleValue = [MGLStyleValue<NSNumber *> valueWithRawValue:@YES]; layer.iconAllowsOverlap = styleValue; mbgl::style::PropertyValue<bool> propertyValue = { true }; @@ -56,7 +56,7 @@ @"Setting iconAllowsOverlap to a constant value should update icon-allow-overlap."); XCTAssertEqualObjects(layer.iconAllowsOverlap, styleValue, @"iconAllowsOverlap should round-trip constant values."); - + styleValue = [MGLStyleValue<NSNumber *> valueWithStops:@{ @18: styleValue, }]; @@ -69,20 +69,20 @@ @"Setting iconAllowsOverlap to a function should update icon-allow-overlap."); XCTAssertEqualObjects(layer.iconAllowsOverlap, styleValue, @"iconAllowsOverlap should round-trip functions."); - + layer.iconAllowsOverlap = nil; XCTAssertTrue(rawLayer->getIconAllowOverlap().isUndefined(), @"Unsetting iconAllowsOverlap should return icon-allow-overlap to the default value."); XCTAssertEqualObjects(layer.iconAllowsOverlap, defaultStyleValue, @"iconAllowsOverlap should return the default value after being unset."); } - + // icon-ignore-placement { XCTAssertTrue(rawLayer->getIconIgnorePlacement().isUndefined(), @"icon-ignore-placement should be unset initially."); MGLStyleValue<NSNumber *> *defaultStyleValue = layer.iconIgnoresPlacement; - + MGLStyleValue<NSNumber *> *styleValue = [MGLStyleValue<NSNumber *> valueWithRawValue:@YES]; layer.iconIgnoresPlacement = styleValue; mbgl::style::PropertyValue<bool> propertyValue = { true }; @@ -90,7 +90,7 @@ @"Setting iconIgnoresPlacement to a constant value should update icon-ignore-placement."); XCTAssertEqualObjects(layer.iconIgnoresPlacement, styleValue, @"iconIgnoresPlacement should round-trip constant values."); - + styleValue = [MGLStyleValue<NSNumber *> valueWithStops:@{ @18: styleValue, }]; @@ -103,20 +103,20 @@ @"Setting iconIgnoresPlacement to a function should update icon-ignore-placement."); XCTAssertEqualObjects(layer.iconIgnoresPlacement, styleValue, @"iconIgnoresPlacement should round-trip functions."); - + layer.iconIgnoresPlacement = nil; XCTAssertTrue(rawLayer->getIconIgnorePlacement().isUndefined(), @"Unsetting iconIgnoresPlacement should return icon-ignore-placement to the default value."); XCTAssertEqualObjects(layer.iconIgnoresPlacement, defaultStyleValue, @"iconIgnoresPlacement should return the default value after being unset."); } - + // icon-image { XCTAssertTrue(rawLayer->getIconImage().isUndefined(), @"icon-image should be unset initially."); MGLStyleValue<NSString *> *defaultStyleValue = layer.iconImageName; - + MGLStyleValue<NSString *> *styleValue = [MGLStyleValue<NSString *> valueWithRawValue:@"Icon Image"]; layer.iconImageName = styleValue; mbgl::style::PropertyValue<std::string> propertyValue = { "Icon Image" }; @@ -124,7 +124,7 @@ @"Setting iconImageName to a constant value should update icon-image."); XCTAssertEqualObjects(layer.iconImageName, styleValue, @"iconImageName should round-trip constant values."); - + styleValue = [MGLStyleValue<NSString *> valueWithStops:@{ @18: styleValue, }]; @@ -137,20 +137,20 @@ @"Setting iconImageName to a function should update icon-image."); XCTAssertEqualObjects(layer.iconImageName, styleValue, @"iconImageName should round-trip functions."); - + layer.iconImageName = nil; XCTAssertTrue(rawLayer->getIconImage().isUndefined(), @"Unsetting iconImageName should return icon-image to the default value."); XCTAssertEqualObjects(layer.iconImageName, defaultStyleValue, @"iconImageName should return the default value after being unset."); } - + // icon-offset { XCTAssertTrue(rawLayer->getIconOffset().isUndefined(), @"icon-offset should be unset initially."); MGLStyleValue<NSValue *> *defaultStyleValue = layer.iconOffset; - + MGLStyleValue<NSValue *> *styleValue = [MGLStyleValue<NSValue *> valueWithRawValue: #if TARGET_OS_IPHONE [NSValue valueWithCGVector:CGVectorMake(1, 1)] @@ -164,7 +164,7 @@ @"Setting iconOffset to a constant value should update icon-offset."); XCTAssertEqualObjects(layer.iconOffset, styleValue, @"iconOffset should round-trip constant values."); - + styleValue = [MGLStyleValue<NSValue *> valueWithStops:@{ @18: styleValue, }]; @@ -177,20 +177,20 @@ @"Setting iconOffset to a function should update icon-offset."); XCTAssertEqualObjects(layer.iconOffset, styleValue, @"iconOffset should round-trip functions."); - + layer.iconOffset = nil; XCTAssertTrue(rawLayer->getIconOffset().isUndefined(), @"Unsetting iconOffset should return icon-offset to the default value."); XCTAssertEqualObjects(layer.iconOffset, defaultStyleValue, @"iconOffset should return the default value after being unset."); } - + // icon-optional { XCTAssertTrue(rawLayer->getIconOptional().isUndefined(), @"icon-optional should be unset initially."); MGLStyleValue<NSNumber *> *defaultStyleValue = layer.iconOptional; - + MGLStyleValue<NSNumber *> *styleValue = [MGLStyleValue<NSNumber *> valueWithRawValue:@YES]; layer.iconOptional = styleValue; mbgl::style::PropertyValue<bool> propertyValue = { true }; @@ -198,7 +198,7 @@ @"Setting iconOptional to a constant value should update icon-optional."); XCTAssertEqualObjects(layer.iconOptional, styleValue, @"iconOptional should round-trip constant values."); - + styleValue = [MGLStyleValue<NSNumber *> valueWithStops:@{ @18: styleValue, }]; @@ -211,20 +211,20 @@ @"Setting iconOptional to a function should update icon-optional."); XCTAssertEqualObjects(layer.iconOptional, styleValue, @"iconOptional should round-trip functions."); - + layer.iconOptional = nil; XCTAssertTrue(rawLayer->getIconOptional().isUndefined(), @"Unsetting iconOptional should return icon-optional to the default value."); XCTAssertEqualObjects(layer.iconOptional, defaultStyleValue, @"iconOptional should return the default value after being unset."); } - + // icon-padding { XCTAssertTrue(rawLayer->getIconPadding().isUndefined(), @"icon-padding should be unset initially."); MGLStyleValue<NSNumber *> *defaultStyleValue = layer.iconPadding; - + MGLStyleValue<NSNumber *> *styleValue = [MGLStyleValue<NSNumber *> valueWithRawValue:@0xff]; layer.iconPadding = styleValue; mbgl::style::PropertyValue<float> propertyValue = { 0xff }; @@ -232,7 +232,7 @@ @"Setting iconPadding to a constant value should update icon-padding."); XCTAssertEqualObjects(layer.iconPadding, styleValue, @"iconPadding should round-trip constant values."); - + styleValue = [MGLStyleValue<NSNumber *> valueWithStops:@{ @18: styleValue, }]; @@ -245,20 +245,20 @@ @"Setting iconPadding to a function should update icon-padding."); XCTAssertEqualObjects(layer.iconPadding, styleValue, @"iconPadding should round-trip functions."); - + layer.iconPadding = nil; XCTAssertTrue(rawLayer->getIconPadding().isUndefined(), @"Unsetting iconPadding should return icon-padding to the default value."); XCTAssertEqualObjects(layer.iconPadding, defaultStyleValue, @"iconPadding should return the default value after being unset."); } - + // icon-rotate { XCTAssertTrue(rawLayer->getIconRotate().isUndefined(), @"icon-rotate should be unset initially."); MGLStyleValue<NSNumber *> *defaultStyleValue = layer.iconRotation; - + MGLStyleValue<NSNumber *> *styleValue = [MGLStyleValue<NSNumber *> valueWithRawValue:@0xff]; layer.iconRotation = styleValue; mbgl::style::PropertyValue<float> propertyValue = { 0xff }; @@ -266,7 +266,7 @@ @"Setting iconRotation to a constant value should update icon-rotate."); XCTAssertEqualObjects(layer.iconRotation, styleValue, @"iconRotation should round-trip constant values."); - + styleValue = [MGLStyleValue<NSNumber *> valueWithStops:@{ @18: styleValue, }]; @@ -279,20 +279,20 @@ @"Setting iconRotation to a function should update icon-rotate."); XCTAssertEqualObjects(layer.iconRotation, styleValue, @"iconRotation should round-trip functions."); - + layer.iconRotation = nil; XCTAssertTrue(rawLayer->getIconRotate().isUndefined(), @"Unsetting iconRotation should return icon-rotate to the default value."); XCTAssertEqualObjects(layer.iconRotation, defaultStyleValue, @"iconRotation should return the default value after being unset."); } - + // icon-rotation-alignment { XCTAssertTrue(rawLayer->getIconRotationAlignment().isUndefined(), @"icon-rotation-alignment should be unset initially."); MGLStyleValue<NSValue *> *defaultStyleValue = layer.iconRotationAlignment; - + MGLStyleValue<NSValue *> *styleValue = [MGLStyleValue<NSValue *> valueWithRawValue:[NSValue valueWithMGLIconRotationAlignment:MGLIconRotationAlignmentAuto]]; layer.iconRotationAlignment = styleValue; mbgl::style::PropertyValue<mbgl::style::AlignmentType> propertyValue = { mbgl::style::AlignmentType::Auto }; @@ -300,7 +300,7 @@ @"Setting iconRotationAlignment to a constant value should update icon-rotation-alignment."); XCTAssertEqualObjects(layer.iconRotationAlignment, styleValue, @"iconRotationAlignment should round-trip constant values."); - + styleValue = [MGLStyleValue<NSValue *> valueWithStops:@{ @18: styleValue, }]; @@ -313,20 +313,20 @@ @"Setting iconRotationAlignment to a function should update icon-rotation-alignment."); XCTAssertEqualObjects(layer.iconRotationAlignment, styleValue, @"iconRotationAlignment should round-trip functions."); - + layer.iconRotationAlignment = nil; XCTAssertTrue(rawLayer->getIconRotationAlignment().isUndefined(), @"Unsetting iconRotationAlignment should return icon-rotation-alignment to the default value."); XCTAssertEqualObjects(layer.iconRotationAlignment, defaultStyleValue, @"iconRotationAlignment should return the default value after being unset."); } - + // icon-size { XCTAssertTrue(rawLayer->getIconSize().isUndefined(), @"icon-size should be unset initially."); MGLStyleValue<NSNumber *> *defaultStyleValue = layer.iconScale; - + MGLStyleValue<NSNumber *> *styleValue = [MGLStyleValue<NSNumber *> valueWithRawValue:@0xff]; layer.iconScale = styleValue; mbgl::style::PropertyValue<float> propertyValue = { 0xff }; @@ -334,7 +334,7 @@ @"Setting iconScale to a constant value should update icon-size."); XCTAssertEqualObjects(layer.iconScale, styleValue, @"iconScale should round-trip constant values."); - + styleValue = [MGLStyleValue<NSNumber *> valueWithStops:@{ @18: styleValue, }]; @@ -347,20 +347,20 @@ @"Setting iconScale to a function should update icon-size."); XCTAssertEqualObjects(layer.iconScale, styleValue, @"iconScale should round-trip functions."); - + layer.iconScale = nil; XCTAssertTrue(rawLayer->getIconSize().isUndefined(), @"Unsetting iconScale should return icon-size to the default value."); XCTAssertEqualObjects(layer.iconScale, defaultStyleValue, @"iconScale should return the default value after being unset."); } - + // icon-text-fit { XCTAssertTrue(rawLayer->getIconTextFit().isUndefined(), @"icon-text-fit should be unset initially."); MGLStyleValue<NSValue *> *defaultStyleValue = layer.iconTextFit; - + MGLStyleValue<NSValue *> *styleValue = [MGLStyleValue<NSValue *> valueWithRawValue:[NSValue valueWithMGLIconTextFit:MGLIconTextFitBoth]]; layer.iconTextFit = styleValue; mbgl::style::PropertyValue<mbgl::style::IconTextFitType> propertyValue = { mbgl::style::IconTextFitType::Both }; @@ -368,7 +368,7 @@ @"Setting iconTextFit to a constant value should update icon-text-fit."); XCTAssertEqualObjects(layer.iconTextFit, styleValue, @"iconTextFit should round-trip constant values."); - + styleValue = [MGLStyleValue<NSValue *> valueWithStops:@{ @18: styleValue, }]; @@ -381,20 +381,20 @@ @"Setting iconTextFit to a function should update icon-text-fit."); XCTAssertEqualObjects(layer.iconTextFit, styleValue, @"iconTextFit should round-trip functions."); - + layer.iconTextFit = nil; XCTAssertTrue(rawLayer->getIconTextFit().isUndefined(), @"Unsetting iconTextFit should return icon-text-fit to the default value."); XCTAssertEqualObjects(layer.iconTextFit, defaultStyleValue, @"iconTextFit should return the default value after being unset."); } - + // icon-text-fit-padding { XCTAssertTrue(rawLayer->getIconTextFitPadding().isUndefined(), @"icon-text-fit-padding should be unset initially."); MGLStyleValue<NSValue *> *defaultStyleValue = layer.iconTextFitPadding; - + MGLStyleValue<NSValue *> *styleValue = [MGLStyleValue<NSValue *> valueWithRawValue: #if TARGET_OS_IPHONE [NSValue valueWithUIEdgeInsets:UIEdgeInsetsMake(1, 1, 1, 1)] @@ -408,7 +408,7 @@ @"Setting iconTextFitPadding to a constant value should update icon-text-fit-padding."); XCTAssertEqualObjects(layer.iconTextFitPadding, styleValue, @"iconTextFitPadding should round-trip constant values."); - + styleValue = [MGLStyleValue<NSValue *> valueWithStops:@{ @18: styleValue, }]; @@ -421,20 +421,20 @@ @"Setting iconTextFitPadding to a function should update icon-text-fit-padding."); XCTAssertEqualObjects(layer.iconTextFitPadding, styleValue, @"iconTextFitPadding should round-trip functions."); - + layer.iconTextFitPadding = nil; XCTAssertTrue(rawLayer->getIconTextFitPadding().isUndefined(), @"Unsetting iconTextFitPadding should return icon-text-fit-padding to the default value."); XCTAssertEqualObjects(layer.iconTextFitPadding, defaultStyleValue, @"iconTextFitPadding should return the default value after being unset."); } - + // icon-keep-upright { XCTAssertTrue(rawLayer->getIconKeepUpright().isUndefined(), @"icon-keep-upright should be unset initially."); MGLStyleValue<NSNumber *> *defaultStyleValue = layer.keepsIconUpright; - + MGLStyleValue<NSNumber *> *styleValue = [MGLStyleValue<NSNumber *> valueWithRawValue:@YES]; layer.keepsIconUpright = styleValue; mbgl::style::PropertyValue<bool> propertyValue = { true }; @@ -442,7 +442,7 @@ @"Setting keepsIconUpright to a constant value should update icon-keep-upright."); XCTAssertEqualObjects(layer.keepsIconUpright, styleValue, @"keepsIconUpright should round-trip constant values."); - + styleValue = [MGLStyleValue<NSNumber *> valueWithStops:@{ @18: styleValue, }]; @@ -455,20 +455,20 @@ @"Setting keepsIconUpright to a function should update icon-keep-upright."); XCTAssertEqualObjects(layer.keepsIconUpright, styleValue, @"keepsIconUpright should round-trip functions."); - + layer.keepsIconUpright = nil; XCTAssertTrue(rawLayer->getIconKeepUpright().isUndefined(), @"Unsetting keepsIconUpright should return icon-keep-upright to the default value."); XCTAssertEqualObjects(layer.keepsIconUpright, defaultStyleValue, @"keepsIconUpright should return the default value after being unset."); } - + // text-keep-upright { XCTAssertTrue(rawLayer->getTextKeepUpright().isUndefined(), @"text-keep-upright should be unset initially."); MGLStyleValue<NSNumber *> *defaultStyleValue = layer.keepsTextUpright; - + MGLStyleValue<NSNumber *> *styleValue = [MGLStyleValue<NSNumber *> valueWithRawValue:@NO]; layer.keepsTextUpright = styleValue; mbgl::style::PropertyValue<bool> propertyValue = { false }; @@ -476,7 +476,7 @@ @"Setting keepsTextUpright to a constant value should update text-keep-upright."); XCTAssertEqualObjects(layer.keepsTextUpright, styleValue, @"keepsTextUpright should round-trip constant values."); - + styleValue = [MGLStyleValue<NSNumber *> valueWithStops:@{ @18: styleValue, }]; @@ -489,20 +489,20 @@ @"Setting keepsTextUpright to a function should update text-keep-upright."); XCTAssertEqualObjects(layer.keepsTextUpright, styleValue, @"keepsTextUpright should round-trip functions."); - + layer.keepsTextUpright = nil; XCTAssertTrue(rawLayer->getTextKeepUpright().isUndefined(), @"Unsetting keepsTextUpright should return text-keep-upright to the default value."); XCTAssertEqualObjects(layer.keepsTextUpright, defaultStyleValue, @"keepsTextUpright should return the default value after being unset."); } - + // text-max-angle { XCTAssertTrue(rawLayer->getTextMaxAngle().isUndefined(), @"text-max-angle should be unset initially."); MGLStyleValue<NSNumber *> *defaultStyleValue = layer.maximumTextAngle; - + MGLStyleValue<NSNumber *> *styleValue = [MGLStyleValue<NSNumber *> valueWithRawValue:@0xff]; layer.maximumTextAngle = styleValue; mbgl::style::PropertyValue<float> propertyValue = { 0xff }; @@ -510,7 +510,7 @@ @"Setting maximumTextAngle to a constant value should update text-max-angle."); XCTAssertEqualObjects(layer.maximumTextAngle, styleValue, @"maximumTextAngle should round-trip constant values."); - + styleValue = [MGLStyleValue<NSNumber *> valueWithStops:@{ @18: styleValue, }]; @@ -523,20 +523,20 @@ @"Setting maximumTextAngle to a function should update text-max-angle."); XCTAssertEqualObjects(layer.maximumTextAngle, styleValue, @"maximumTextAngle should round-trip functions."); - + layer.maximumTextAngle = nil; XCTAssertTrue(rawLayer->getTextMaxAngle().isUndefined(), @"Unsetting maximumTextAngle should return text-max-angle to the default value."); XCTAssertEqualObjects(layer.maximumTextAngle, defaultStyleValue, @"maximumTextAngle should return the default value after being unset."); } - + // text-max-width { XCTAssertTrue(rawLayer->getTextMaxWidth().isUndefined(), @"text-max-width should be unset initially."); MGLStyleValue<NSNumber *> *defaultStyleValue = layer.maximumTextWidth; - + MGLStyleValue<NSNumber *> *styleValue = [MGLStyleValue<NSNumber *> valueWithRawValue:@0xff]; layer.maximumTextWidth = styleValue; mbgl::style::PropertyValue<float> propertyValue = { 0xff }; @@ -544,7 +544,7 @@ @"Setting maximumTextWidth to a constant value should update text-max-width."); XCTAssertEqualObjects(layer.maximumTextWidth, styleValue, @"maximumTextWidth should round-trip constant values."); - + styleValue = [MGLStyleValue<NSNumber *> valueWithStops:@{ @18: styleValue, }]; @@ -557,20 +557,20 @@ @"Setting maximumTextWidth to a function should update text-max-width."); XCTAssertEqualObjects(layer.maximumTextWidth, styleValue, @"maximumTextWidth should round-trip functions."); - + layer.maximumTextWidth = nil; XCTAssertTrue(rawLayer->getTextMaxWidth().isUndefined(), @"Unsetting maximumTextWidth should return text-max-width to the default value."); XCTAssertEqualObjects(layer.maximumTextWidth, defaultStyleValue, @"maximumTextWidth should return the default value after being unset."); } - + // symbol-avoid-edges { XCTAssertTrue(rawLayer->getSymbolAvoidEdges().isUndefined(), @"symbol-avoid-edges should be unset initially."); MGLStyleValue<NSNumber *> *defaultStyleValue = layer.symbolAvoidsEdges; - + MGLStyleValue<NSNumber *> *styleValue = [MGLStyleValue<NSNumber *> valueWithRawValue:@YES]; layer.symbolAvoidsEdges = styleValue; mbgl::style::PropertyValue<bool> propertyValue = { true }; @@ -578,7 +578,7 @@ @"Setting symbolAvoidsEdges to a constant value should update symbol-avoid-edges."); XCTAssertEqualObjects(layer.symbolAvoidsEdges, styleValue, @"symbolAvoidsEdges should round-trip constant values."); - + styleValue = [MGLStyleValue<NSNumber *> valueWithStops:@{ @18: styleValue, }]; @@ -591,20 +591,20 @@ @"Setting symbolAvoidsEdges to a function should update symbol-avoid-edges."); XCTAssertEqualObjects(layer.symbolAvoidsEdges, styleValue, @"symbolAvoidsEdges should round-trip functions."); - + layer.symbolAvoidsEdges = nil; XCTAssertTrue(rawLayer->getSymbolAvoidEdges().isUndefined(), @"Unsetting symbolAvoidsEdges should return symbol-avoid-edges to the default value."); XCTAssertEqualObjects(layer.symbolAvoidsEdges, defaultStyleValue, @"symbolAvoidsEdges should return the default value after being unset."); } - + // symbol-placement { XCTAssertTrue(rawLayer->getSymbolPlacement().isUndefined(), @"symbol-placement should be unset initially."); MGLStyleValue<NSValue *> *defaultStyleValue = layer.symbolPlacement; - + MGLStyleValue<NSValue *> *styleValue = [MGLStyleValue<NSValue *> valueWithRawValue:[NSValue valueWithMGLSymbolPlacement:MGLSymbolPlacementLine]]; layer.symbolPlacement = styleValue; mbgl::style::PropertyValue<mbgl::style::SymbolPlacementType> propertyValue = { mbgl::style::SymbolPlacementType::Line }; @@ -612,7 +612,7 @@ @"Setting symbolPlacement to a constant value should update symbol-placement."); XCTAssertEqualObjects(layer.symbolPlacement, styleValue, @"symbolPlacement should round-trip constant values."); - + styleValue = [MGLStyleValue<NSValue *> valueWithStops:@{ @18: styleValue, }]; @@ -625,20 +625,20 @@ @"Setting symbolPlacement to a function should update symbol-placement."); XCTAssertEqualObjects(layer.symbolPlacement, styleValue, @"symbolPlacement should round-trip functions."); - + layer.symbolPlacement = nil; XCTAssertTrue(rawLayer->getSymbolPlacement().isUndefined(), @"Unsetting symbolPlacement should return symbol-placement to the default value."); XCTAssertEqualObjects(layer.symbolPlacement, defaultStyleValue, @"symbolPlacement should return the default value after being unset."); } - + // symbol-spacing { XCTAssertTrue(rawLayer->getSymbolSpacing().isUndefined(), @"symbol-spacing should be unset initially."); MGLStyleValue<NSNumber *> *defaultStyleValue = layer.symbolSpacing; - + MGLStyleValue<NSNumber *> *styleValue = [MGLStyleValue<NSNumber *> valueWithRawValue:@0xff]; layer.symbolSpacing = styleValue; mbgl::style::PropertyValue<float> propertyValue = { 0xff }; @@ -646,7 +646,7 @@ @"Setting symbolSpacing to a constant value should update symbol-spacing."); XCTAssertEqualObjects(layer.symbolSpacing, styleValue, @"symbolSpacing should round-trip constant values."); - + styleValue = [MGLStyleValue<NSNumber *> valueWithStops:@{ @18: styleValue, }]; @@ -659,20 +659,20 @@ @"Setting symbolSpacing to a function should update symbol-spacing."); XCTAssertEqualObjects(layer.symbolSpacing, styleValue, @"symbolSpacing should round-trip functions."); - + layer.symbolSpacing = nil; XCTAssertTrue(rawLayer->getSymbolSpacing().isUndefined(), @"Unsetting symbolSpacing should return symbol-spacing to the default value."); XCTAssertEqualObjects(layer.symbolSpacing, defaultStyleValue, @"symbolSpacing should return the default value after being unset."); } - + // text-field { XCTAssertTrue(rawLayer->getTextField().isUndefined(), @"text-field should be unset initially."); MGLStyleValue<NSString *> *defaultStyleValue = layer.text; - + MGLStyleValue<NSString *> *styleValue = [MGLStyleValue<NSString *> valueWithRawValue:@"Text Field"]; layer.text = styleValue; mbgl::style::PropertyValue<std::string> propertyValue = { "Text Field" }; @@ -680,7 +680,7 @@ @"Setting text to a constant value should update text-field."); XCTAssertEqualObjects(layer.text, styleValue, @"text should round-trip constant values."); - + styleValue = [MGLStyleValue<NSString *> valueWithStops:@{ @18: styleValue, }]; @@ -693,20 +693,20 @@ @"Setting text to a function should update text-field."); XCTAssertEqualObjects(layer.text, styleValue, @"text should round-trip functions."); - + layer.text = nil; XCTAssertTrue(rawLayer->getTextField().isUndefined(), @"Unsetting text should return text-field to the default value."); XCTAssertEqualObjects(layer.text, defaultStyleValue, @"text should return the default value after being unset."); } - + // text-allow-overlap { XCTAssertTrue(rawLayer->getTextAllowOverlap().isUndefined(), @"text-allow-overlap should be unset initially."); MGLStyleValue<NSNumber *> *defaultStyleValue = layer.textAllowsOverlap; - + MGLStyleValue<NSNumber *> *styleValue = [MGLStyleValue<NSNumber *> valueWithRawValue:@YES]; layer.textAllowsOverlap = styleValue; mbgl::style::PropertyValue<bool> propertyValue = { true }; @@ -714,7 +714,7 @@ @"Setting textAllowsOverlap to a constant value should update text-allow-overlap."); XCTAssertEqualObjects(layer.textAllowsOverlap, styleValue, @"textAllowsOverlap should round-trip constant values."); - + styleValue = [MGLStyleValue<NSNumber *> valueWithStops:@{ @18: styleValue, }]; @@ -727,20 +727,20 @@ @"Setting textAllowsOverlap to a function should update text-allow-overlap."); XCTAssertEqualObjects(layer.textAllowsOverlap, styleValue, @"textAllowsOverlap should round-trip functions."); - + layer.textAllowsOverlap = nil; XCTAssertTrue(rawLayer->getTextAllowOverlap().isUndefined(), @"Unsetting textAllowsOverlap should return text-allow-overlap to the default value."); XCTAssertEqualObjects(layer.textAllowsOverlap, defaultStyleValue, @"textAllowsOverlap should return the default value after being unset."); } - + // text-anchor { XCTAssertTrue(rawLayer->getTextAnchor().isUndefined(), @"text-anchor should be unset initially."); MGLStyleValue<NSValue *> *defaultStyleValue = layer.textAnchor; - + MGLStyleValue<NSValue *> *styleValue = [MGLStyleValue<NSValue *> valueWithRawValue:[NSValue valueWithMGLTextAnchor:MGLTextAnchorBottomRight]]; layer.textAnchor = styleValue; mbgl::style::PropertyValue<mbgl::style::TextAnchorType> propertyValue = { mbgl::style::TextAnchorType::BottomRight }; @@ -748,7 +748,7 @@ @"Setting textAnchor to a constant value should update text-anchor."); XCTAssertEqualObjects(layer.textAnchor, styleValue, @"textAnchor should round-trip constant values."); - + styleValue = [MGLStyleValue<NSValue *> valueWithStops:@{ @18: styleValue, }]; @@ -761,20 +761,20 @@ @"Setting textAnchor to a function should update text-anchor."); XCTAssertEqualObjects(layer.textAnchor, styleValue, @"textAnchor should round-trip functions."); - + layer.textAnchor = nil; XCTAssertTrue(rawLayer->getTextAnchor().isUndefined(), @"Unsetting textAnchor should return text-anchor to the default value."); XCTAssertEqualObjects(layer.textAnchor, defaultStyleValue, @"textAnchor should return the default value after being unset."); } - + // text-font { XCTAssertTrue(rawLayer->getTextFont().isUndefined(), @"text-font should be unset initially."); MGLStyleValue<NSArray<NSString *> *> *defaultStyleValue = layer.textFontNames; - + MGLStyleValue<NSArray<NSString *> *> *styleValue = [MGLStyleValue<NSArray<NSString *> *> valueWithRawValue:@[@"Text Font", @"Tnof Txet"]]; layer.textFontNames = styleValue; mbgl::style::PropertyValue<std::vector<std::string>> propertyValue = { { "Text Font", "Tnof Txet" } }; @@ -782,7 +782,7 @@ @"Setting textFontNames to a constant value should update text-font."); XCTAssertEqualObjects(layer.textFontNames, styleValue, @"textFontNames should round-trip constant values."); - + styleValue = [MGLStyleValue<NSArray<NSString *> *> valueWithStops:@{ @18: styleValue, }]; @@ -795,20 +795,20 @@ @"Setting textFontNames to a function should update text-font."); XCTAssertEqualObjects(layer.textFontNames, styleValue, @"textFontNames should round-trip functions."); - + layer.textFontNames = nil; XCTAssertTrue(rawLayer->getTextFont().isUndefined(), @"Unsetting textFontNames should return text-font to the default value."); XCTAssertEqualObjects(layer.textFontNames, defaultStyleValue, @"textFontNames should return the default value after being unset."); } - + // text-size { XCTAssertTrue(rawLayer->getTextSize().isUndefined(), @"text-size should be unset initially."); MGLStyleValue<NSNumber *> *defaultStyleValue = layer.textFontSize; - + MGLStyleValue<NSNumber *> *styleValue = [MGLStyleValue<NSNumber *> valueWithRawValue:@0xff]; layer.textFontSize = styleValue; mbgl::style::PropertyValue<float> propertyValue = { 0xff }; @@ -816,7 +816,7 @@ @"Setting textFontSize to a constant value should update text-size."); XCTAssertEqualObjects(layer.textFontSize, styleValue, @"textFontSize should round-trip constant values."); - + styleValue = [MGLStyleValue<NSNumber *> valueWithStops:@{ @18: styleValue, }]; @@ -829,20 +829,20 @@ @"Setting textFontSize to a function should update text-size."); XCTAssertEqualObjects(layer.textFontSize, styleValue, @"textFontSize should round-trip functions."); - + layer.textFontSize = nil; XCTAssertTrue(rawLayer->getTextSize().isUndefined(), @"Unsetting textFontSize should return text-size to the default value."); XCTAssertEqualObjects(layer.textFontSize, defaultStyleValue, @"textFontSize should return the default value after being unset."); } - + // text-ignore-placement { XCTAssertTrue(rawLayer->getTextIgnorePlacement().isUndefined(), @"text-ignore-placement should be unset initially."); MGLStyleValue<NSNumber *> *defaultStyleValue = layer.textIgnoresPlacement; - + MGLStyleValue<NSNumber *> *styleValue = [MGLStyleValue<NSNumber *> valueWithRawValue:@YES]; layer.textIgnoresPlacement = styleValue; mbgl::style::PropertyValue<bool> propertyValue = { true }; @@ -850,7 +850,7 @@ @"Setting textIgnoresPlacement to a constant value should update text-ignore-placement."); XCTAssertEqualObjects(layer.textIgnoresPlacement, styleValue, @"textIgnoresPlacement should round-trip constant values."); - + styleValue = [MGLStyleValue<NSNumber *> valueWithStops:@{ @18: styleValue, }]; @@ -863,20 +863,20 @@ @"Setting textIgnoresPlacement to a function should update text-ignore-placement."); XCTAssertEqualObjects(layer.textIgnoresPlacement, styleValue, @"textIgnoresPlacement should round-trip functions."); - + layer.textIgnoresPlacement = nil; XCTAssertTrue(rawLayer->getTextIgnorePlacement().isUndefined(), @"Unsetting textIgnoresPlacement should return text-ignore-placement to the default value."); XCTAssertEqualObjects(layer.textIgnoresPlacement, defaultStyleValue, @"textIgnoresPlacement should return the default value after being unset."); } - + // text-justify { XCTAssertTrue(rawLayer->getTextJustify().isUndefined(), @"text-justify should be unset initially."); MGLStyleValue<NSValue *> *defaultStyleValue = layer.textJustification; - + MGLStyleValue<NSValue *> *styleValue = [MGLStyleValue<NSValue *> valueWithRawValue:[NSValue valueWithMGLTextJustification:MGLTextJustificationRight]]; layer.textJustification = styleValue; mbgl::style::PropertyValue<mbgl::style::TextJustifyType> propertyValue = { mbgl::style::TextJustifyType::Right }; @@ -884,7 +884,7 @@ @"Setting textJustification to a constant value should update text-justify."); XCTAssertEqualObjects(layer.textJustification, styleValue, @"textJustification should round-trip constant values."); - + styleValue = [MGLStyleValue<NSValue *> valueWithStops:@{ @18: styleValue, }]; @@ -897,20 +897,20 @@ @"Setting textJustification to a function should update text-justify."); XCTAssertEqualObjects(layer.textJustification, styleValue, @"textJustification should round-trip functions."); - + layer.textJustification = nil; XCTAssertTrue(rawLayer->getTextJustify().isUndefined(), @"Unsetting textJustification should return text-justify to the default value."); XCTAssertEqualObjects(layer.textJustification, defaultStyleValue, @"textJustification should return the default value after being unset."); } - + // text-letter-spacing { XCTAssertTrue(rawLayer->getTextLetterSpacing().isUndefined(), @"text-letter-spacing should be unset initially."); MGLStyleValue<NSNumber *> *defaultStyleValue = layer.textLetterSpacing; - + MGLStyleValue<NSNumber *> *styleValue = [MGLStyleValue<NSNumber *> valueWithRawValue:@0xff]; layer.textLetterSpacing = styleValue; mbgl::style::PropertyValue<float> propertyValue = { 0xff }; @@ -918,7 +918,7 @@ @"Setting textLetterSpacing to a constant value should update text-letter-spacing."); XCTAssertEqualObjects(layer.textLetterSpacing, styleValue, @"textLetterSpacing should round-trip constant values."); - + styleValue = [MGLStyleValue<NSNumber *> valueWithStops:@{ @18: styleValue, }]; @@ -931,20 +931,20 @@ @"Setting textLetterSpacing to a function should update text-letter-spacing."); XCTAssertEqualObjects(layer.textLetterSpacing, styleValue, @"textLetterSpacing should round-trip functions."); - + layer.textLetterSpacing = nil; XCTAssertTrue(rawLayer->getTextLetterSpacing().isUndefined(), @"Unsetting textLetterSpacing should return text-letter-spacing to the default value."); XCTAssertEqualObjects(layer.textLetterSpacing, defaultStyleValue, @"textLetterSpacing should return the default value after being unset."); } - + // text-line-height { XCTAssertTrue(rawLayer->getTextLineHeight().isUndefined(), @"text-line-height should be unset initially."); MGLStyleValue<NSNumber *> *defaultStyleValue = layer.textLineHeight; - + MGLStyleValue<NSNumber *> *styleValue = [MGLStyleValue<NSNumber *> valueWithRawValue:@0xff]; layer.textLineHeight = styleValue; mbgl::style::PropertyValue<float> propertyValue = { 0xff }; @@ -952,7 +952,7 @@ @"Setting textLineHeight to a constant value should update text-line-height."); XCTAssertEqualObjects(layer.textLineHeight, styleValue, @"textLineHeight should round-trip constant values."); - + styleValue = [MGLStyleValue<NSNumber *> valueWithStops:@{ @18: styleValue, }]; @@ -965,20 +965,20 @@ @"Setting textLineHeight to a function should update text-line-height."); XCTAssertEqualObjects(layer.textLineHeight, styleValue, @"textLineHeight should round-trip functions."); - + layer.textLineHeight = nil; XCTAssertTrue(rawLayer->getTextLineHeight().isUndefined(), @"Unsetting textLineHeight should return text-line-height to the default value."); XCTAssertEqualObjects(layer.textLineHeight, defaultStyleValue, @"textLineHeight should return the default value after being unset."); } - + // text-offset { XCTAssertTrue(rawLayer->getTextOffset().isUndefined(), @"text-offset should be unset initially."); MGLStyleValue<NSValue *> *defaultStyleValue = layer.textOffset; - + MGLStyleValue<NSValue *> *styleValue = [MGLStyleValue<NSValue *> valueWithRawValue: #if TARGET_OS_IPHONE [NSValue valueWithCGVector:CGVectorMake(1, 1)] @@ -992,7 +992,7 @@ @"Setting textOffset to a constant value should update text-offset."); XCTAssertEqualObjects(layer.textOffset, styleValue, @"textOffset should round-trip constant values."); - + styleValue = [MGLStyleValue<NSValue *> valueWithStops:@{ @18: styleValue, }]; @@ -1005,20 +1005,20 @@ @"Setting textOffset to a function should update text-offset."); XCTAssertEqualObjects(layer.textOffset, styleValue, @"textOffset should round-trip functions."); - + layer.textOffset = nil; XCTAssertTrue(rawLayer->getTextOffset().isUndefined(), @"Unsetting textOffset should return text-offset to the default value."); XCTAssertEqualObjects(layer.textOffset, defaultStyleValue, @"textOffset should return the default value after being unset."); } - + // text-optional { XCTAssertTrue(rawLayer->getTextOptional().isUndefined(), @"text-optional should be unset initially."); MGLStyleValue<NSNumber *> *defaultStyleValue = layer.textOptional; - + MGLStyleValue<NSNumber *> *styleValue = [MGLStyleValue<NSNumber *> valueWithRawValue:@YES]; layer.textOptional = styleValue; mbgl::style::PropertyValue<bool> propertyValue = { true }; @@ -1026,7 +1026,7 @@ @"Setting textOptional to a constant value should update text-optional."); XCTAssertEqualObjects(layer.textOptional, styleValue, @"textOptional should round-trip constant values."); - + styleValue = [MGLStyleValue<NSNumber *> valueWithStops:@{ @18: styleValue, }]; @@ -1039,20 +1039,20 @@ @"Setting textOptional to a function should update text-optional."); XCTAssertEqualObjects(layer.textOptional, styleValue, @"textOptional should round-trip functions."); - + layer.textOptional = nil; XCTAssertTrue(rawLayer->getTextOptional().isUndefined(), @"Unsetting textOptional should return text-optional to the default value."); XCTAssertEqualObjects(layer.textOptional, defaultStyleValue, @"textOptional should return the default value after being unset."); } - + // text-padding { XCTAssertTrue(rawLayer->getTextPadding().isUndefined(), @"text-padding should be unset initially."); MGLStyleValue<NSNumber *> *defaultStyleValue = layer.textPadding; - + MGLStyleValue<NSNumber *> *styleValue = [MGLStyleValue<NSNumber *> valueWithRawValue:@0xff]; layer.textPadding = styleValue; mbgl::style::PropertyValue<float> propertyValue = { 0xff }; @@ -1060,7 +1060,7 @@ @"Setting textPadding to a constant value should update text-padding."); XCTAssertEqualObjects(layer.textPadding, styleValue, @"textPadding should round-trip constant values."); - + styleValue = [MGLStyleValue<NSNumber *> valueWithStops:@{ @18: styleValue, }]; @@ -1073,20 +1073,20 @@ @"Setting textPadding to a function should update text-padding."); XCTAssertEqualObjects(layer.textPadding, styleValue, @"textPadding should round-trip functions."); - + layer.textPadding = nil; XCTAssertTrue(rawLayer->getTextPadding().isUndefined(), @"Unsetting textPadding should return text-padding to the default value."); XCTAssertEqualObjects(layer.textPadding, defaultStyleValue, @"textPadding should return the default value after being unset."); } - + // text-pitch-alignment { XCTAssertTrue(rawLayer->getTextPitchAlignment().isUndefined(), @"text-pitch-alignment should be unset initially."); MGLStyleValue<NSValue *> *defaultStyleValue = layer.textPitchAlignment; - + MGLStyleValue<NSValue *> *styleValue = [MGLStyleValue<NSValue *> valueWithRawValue:[NSValue valueWithMGLTextPitchAlignment:MGLTextPitchAlignmentAuto]]; layer.textPitchAlignment = styleValue; mbgl::style::PropertyValue<mbgl::style::AlignmentType> propertyValue = { mbgl::style::AlignmentType::Auto }; @@ -1094,7 +1094,7 @@ @"Setting textPitchAlignment to a constant value should update text-pitch-alignment."); XCTAssertEqualObjects(layer.textPitchAlignment, styleValue, @"textPitchAlignment should round-trip constant values."); - + styleValue = [MGLStyleValue<NSValue *> valueWithStops:@{ @18: styleValue, }]; @@ -1107,20 +1107,20 @@ @"Setting textPitchAlignment to a function should update text-pitch-alignment."); XCTAssertEqualObjects(layer.textPitchAlignment, styleValue, @"textPitchAlignment should round-trip functions."); - + layer.textPitchAlignment = nil; XCTAssertTrue(rawLayer->getTextPitchAlignment().isUndefined(), @"Unsetting textPitchAlignment should return text-pitch-alignment to the default value."); XCTAssertEqualObjects(layer.textPitchAlignment, defaultStyleValue, @"textPitchAlignment should return the default value after being unset."); } - + // text-rotate { XCTAssertTrue(rawLayer->getTextRotate().isUndefined(), @"text-rotate should be unset initially."); MGLStyleValue<NSNumber *> *defaultStyleValue = layer.textRotation; - + MGLStyleValue<NSNumber *> *styleValue = [MGLStyleValue<NSNumber *> valueWithRawValue:@0xff]; layer.textRotation = styleValue; mbgl::style::PropertyValue<float> propertyValue = { 0xff }; @@ -1128,7 +1128,7 @@ @"Setting textRotation to a constant value should update text-rotate."); XCTAssertEqualObjects(layer.textRotation, styleValue, @"textRotation should round-trip constant values."); - + styleValue = [MGLStyleValue<NSNumber *> valueWithStops:@{ @18: styleValue, }]; @@ -1141,20 +1141,20 @@ @"Setting textRotation to a function should update text-rotate."); XCTAssertEqualObjects(layer.textRotation, styleValue, @"textRotation should round-trip functions."); - + layer.textRotation = nil; XCTAssertTrue(rawLayer->getTextRotate().isUndefined(), @"Unsetting textRotation should return text-rotate to the default value."); XCTAssertEqualObjects(layer.textRotation, defaultStyleValue, @"textRotation should return the default value after being unset."); } - + // text-rotation-alignment { XCTAssertTrue(rawLayer->getTextRotationAlignment().isUndefined(), @"text-rotation-alignment should be unset initially."); MGLStyleValue<NSValue *> *defaultStyleValue = layer.textRotationAlignment; - + MGLStyleValue<NSValue *> *styleValue = [MGLStyleValue<NSValue *> valueWithRawValue:[NSValue valueWithMGLTextRotationAlignment:MGLTextRotationAlignmentAuto]]; layer.textRotationAlignment = styleValue; mbgl::style::PropertyValue<mbgl::style::AlignmentType> propertyValue = { mbgl::style::AlignmentType::Auto }; @@ -1162,7 +1162,7 @@ @"Setting textRotationAlignment to a constant value should update text-rotation-alignment."); XCTAssertEqualObjects(layer.textRotationAlignment, styleValue, @"textRotationAlignment should round-trip constant values."); - + styleValue = [MGLStyleValue<NSValue *> valueWithStops:@{ @18: styleValue, }]; @@ -1175,20 +1175,20 @@ @"Setting textRotationAlignment to a function should update text-rotation-alignment."); XCTAssertEqualObjects(layer.textRotationAlignment, styleValue, @"textRotationAlignment should round-trip functions."); - + layer.textRotationAlignment = nil; XCTAssertTrue(rawLayer->getTextRotationAlignment().isUndefined(), @"Unsetting textRotationAlignment should return text-rotation-alignment to the default value."); XCTAssertEqualObjects(layer.textRotationAlignment, defaultStyleValue, @"textRotationAlignment should return the default value after being unset."); } - + // text-transform { XCTAssertTrue(rawLayer->getTextTransform().isUndefined(), @"text-transform should be unset initially."); MGLStyleValue<NSValue *> *defaultStyleValue = layer.textTransform; - + MGLStyleValue<NSValue *> *styleValue = [MGLStyleValue<NSValue *> valueWithRawValue:[NSValue valueWithMGLTextTransform:MGLTextTransformLowercase]]; layer.textTransform = styleValue; mbgl::style::PropertyValue<mbgl::style::TextTransformType> propertyValue = { mbgl::style::TextTransformType::Lowercase }; @@ -1196,7 +1196,7 @@ @"Setting textTransform to a constant value should update text-transform."); XCTAssertEqualObjects(layer.textTransform, styleValue, @"textTransform should round-trip constant values."); - + styleValue = [MGLStyleValue<NSValue *> valueWithStops:@{ @18: styleValue, }]; @@ -1209,20 +1209,20 @@ @"Setting textTransform to a function should update text-transform."); XCTAssertEqualObjects(layer.textTransform, styleValue, @"textTransform should round-trip functions."); - + layer.textTransform = nil; XCTAssertTrue(rawLayer->getTextTransform().isUndefined(), @"Unsetting textTransform should return text-transform to the default value."); XCTAssertEqualObjects(layer.textTransform, defaultStyleValue, @"textTransform should return the default value after being unset."); } - + // icon-color { XCTAssertTrue(rawLayer->getIconColor().isUndefined(), @"icon-color should be unset initially."); MGLStyleValue<MGLColor *> *defaultStyleValue = layer.iconColor; - + MGLStyleValue<MGLColor *> *styleValue = [MGLStyleValue<MGLColor *> valueWithRawValue:[MGLColor redColor]]; layer.iconColor = styleValue; mbgl::style::PropertyValue<mbgl::Color> propertyValue = { { 1, 0, 0, 1 } }; @@ -1230,7 +1230,7 @@ @"Setting iconColor to a constant value should update icon-color."); XCTAssertEqualObjects(layer.iconColor, styleValue, @"iconColor should round-trip constant values."); - + styleValue = [MGLStyleValue<MGLColor *> valueWithStops:@{ @18: styleValue, }]; @@ -1243,20 +1243,20 @@ @"Setting iconColor to a function should update icon-color."); XCTAssertEqualObjects(layer.iconColor, styleValue, @"iconColor should round-trip functions."); - + layer.iconColor = nil; XCTAssertTrue(rawLayer->getIconColor().isUndefined(), @"Unsetting iconColor should return icon-color to the default value."); XCTAssertEqualObjects(layer.iconColor, defaultStyleValue, @"iconColor should return the default value after being unset."); } - + // icon-halo-blur { XCTAssertTrue(rawLayer->getIconHaloBlur().isUndefined(), @"icon-halo-blur should be unset initially."); MGLStyleValue<NSNumber *> *defaultStyleValue = layer.iconHaloBlur; - + MGLStyleValue<NSNumber *> *styleValue = [MGLStyleValue<NSNumber *> valueWithRawValue:@0xff]; layer.iconHaloBlur = styleValue; mbgl::style::PropertyValue<float> propertyValue = { 0xff }; @@ -1264,7 +1264,7 @@ @"Setting iconHaloBlur to a constant value should update icon-halo-blur."); XCTAssertEqualObjects(layer.iconHaloBlur, styleValue, @"iconHaloBlur should round-trip constant values."); - + styleValue = [MGLStyleValue<NSNumber *> valueWithStops:@{ @18: styleValue, }]; @@ -1277,20 +1277,20 @@ @"Setting iconHaloBlur to a function should update icon-halo-blur."); XCTAssertEqualObjects(layer.iconHaloBlur, styleValue, @"iconHaloBlur should round-trip functions."); - + layer.iconHaloBlur = nil; XCTAssertTrue(rawLayer->getIconHaloBlur().isUndefined(), @"Unsetting iconHaloBlur should return icon-halo-blur to the default value."); XCTAssertEqualObjects(layer.iconHaloBlur, defaultStyleValue, @"iconHaloBlur should return the default value after being unset."); } - + // icon-halo-color { XCTAssertTrue(rawLayer->getIconHaloColor().isUndefined(), @"icon-halo-color should be unset initially."); MGLStyleValue<MGLColor *> *defaultStyleValue = layer.iconHaloColor; - + MGLStyleValue<MGLColor *> *styleValue = [MGLStyleValue<MGLColor *> valueWithRawValue:[MGLColor redColor]]; layer.iconHaloColor = styleValue; mbgl::style::PropertyValue<mbgl::Color> propertyValue = { { 1, 0, 0, 1 } }; @@ -1298,7 +1298,7 @@ @"Setting iconHaloColor to a constant value should update icon-halo-color."); XCTAssertEqualObjects(layer.iconHaloColor, styleValue, @"iconHaloColor should round-trip constant values."); - + styleValue = [MGLStyleValue<MGLColor *> valueWithStops:@{ @18: styleValue, }]; @@ -1311,20 +1311,20 @@ @"Setting iconHaloColor to a function should update icon-halo-color."); XCTAssertEqualObjects(layer.iconHaloColor, styleValue, @"iconHaloColor should round-trip functions."); - + layer.iconHaloColor = nil; XCTAssertTrue(rawLayer->getIconHaloColor().isUndefined(), @"Unsetting iconHaloColor should return icon-halo-color to the default value."); XCTAssertEqualObjects(layer.iconHaloColor, defaultStyleValue, @"iconHaloColor should return the default value after being unset."); } - + // icon-halo-width { XCTAssertTrue(rawLayer->getIconHaloWidth().isUndefined(), @"icon-halo-width should be unset initially."); MGLStyleValue<NSNumber *> *defaultStyleValue = layer.iconHaloWidth; - + MGLStyleValue<NSNumber *> *styleValue = [MGLStyleValue<NSNumber *> valueWithRawValue:@0xff]; layer.iconHaloWidth = styleValue; mbgl::style::PropertyValue<float> propertyValue = { 0xff }; @@ -1332,7 +1332,7 @@ @"Setting iconHaloWidth to a constant value should update icon-halo-width."); XCTAssertEqualObjects(layer.iconHaloWidth, styleValue, @"iconHaloWidth should round-trip constant values."); - + styleValue = [MGLStyleValue<NSNumber *> valueWithStops:@{ @18: styleValue, }]; @@ -1345,20 +1345,20 @@ @"Setting iconHaloWidth to a function should update icon-halo-width."); XCTAssertEqualObjects(layer.iconHaloWidth, styleValue, @"iconHaloWidth should round-trip functions."); - + layer.iconHaloWidth = nil; XCTAssertTrue(rawLayer->getIconHaloWidth().isUndefined(), @"Unsetting iconHaloWidth should return icon-halo-width to the default value."); XCTAssertEqualObjects(layer.iconHaloWidth, defaultStyleValue, @"iconHaloWidth should return the default value after being unset."); } - + // icon-opacity { XCTAssertTrue(rawLayer->getIconOpacity().isUndefined(), @"icon-opacity should be unset initially."); MGLStyleValue<NSNumber *> *defaultStyleValue = layer.iconOpacity; - + MGLStyleValue<NSNumber *> *styleValue = [MGLStyleValue<NSNumber *> valueWithRawValue:@0xff]; layer.iconOpacity = styleValue; mbgl::style::PropertyValue<float> propertyValue = { 0xff }; @@ -1366,7 +1366,7 @@ @"Setting iconOpacity to a constant value should update icon-opacity."); XCTAssertEqualObjects(layer.iconOpacity, styleValue, @"iconOpacity should round-trip constant values."); - + styleValue = [MGLStyleValue<NSNumber *> valueWithStops:@{ @18: styleValue, }]; @@ -1379,20 +1379,20 @@ @"Setting iconOpacity to a function should update icon-opacity."); XCTAssertEqualObjects(layer.iconOpacity, styleValue, @"iconOpacity should round-trip functions."); - + layer.iconOpacity = nil; XCTAssertTrue(rawLayer->getIconOpacity().isUndefined(), @"Unsetting iconOpacity should return icon-opacity to the default value."); XCTAssertEqualObjects(layer.iconOpacity, defaultStyleValue, @"iconOpacity should return the default value after being unset."); } - + // icon-translate { XCTAssertTrue(rawLayer->getIconTranslate().isUndefined(), @"icon-translate should be unset initially."); MGLStyleValue<NSValue *> *defaultStyleValue = layer.iconTranslation; - + MGLStyleValue<NSValue *> *styleValue = [MGLStyleValue<NSValue *> valueWithRawValue: #if TARGET_OS_IPHONE [NSValue valueWithCGVector:CGVectorMake(1, 1)] @@ -1406,7 +1406,7 @@ @"Setting iconTranslation to a constant value should update icon-translate."); XCTAssertEqualObjects(layer.iconTranslation, styleValue, @"iconTranslation should round-trip constant values."); - + styleValue = [MGLStyleValue<NSValue *> valueWithStops:@{ @18: styleValue, }]; @@ -1419,20 +1419,20 @@ @"Setting iconTranslation to a function should update icon-translate."); XCTAssertEqualObjects(layer.iconTranslation, styleValue, @"iconTranslation should round-trip functions."); - + layer.iconTranslation = nil; XCTAssertTrue(rawLayer->getIconTranslate().isUndefined(), @"Unsetting iconTranslation should return icon-translate to the default value."); XCTAssertEqualObjects(layer.iconTranslation, defaultStyleValue, @"iconTranslation should return the default value after being unset."); } - + // icon-translate-anchor { XCTAssertTrue(rawLayer->getIconTranslateAnchor().isUndefined(), @"icon-translate-anchor should be unset initially."); MGLStyleValue<NSValue *> *defaultStyleValue = layer.iconTranslationAnchor; - + MGLStyleValue<NSValue *> *styleValue = [MGLStyleValue<NSValue *> valueWithRawValue:[NSValue valueWithMGLIconTranslationAnchor:MGLIconTranslationAnchorViewport]]; layer.iconTranslationAnchor = styleValue; mbgl::style::PropertyValue<mbgl::style::TranslateAnchorType> propertyValue = { mbgl::style::TranslateAnchorType::Viewport }; @@ -1440,7 +1440,7 @@ @"Setting iconTranslationAnchor to a constant value should update icon-translate-anchor."); XCTAssertEqualObjects(layer.iconTranslationAnchor, styleValue, @"iconTranslationAnchor should round-trip constant values."); - + styleValue = [MGLStyleValue<NSValue *> valueWithStops:@{ @18: styleValue, }]; @@ -1453,20 +1453,20 @@ @"Setting iconTranslationAnchor to a function should update icon-translate-anchor."); XCTAssertEqualObjects(layer.iconTranslationAnchor, styleValue, @"iconTranslationAnchor should round-trip functions."); - + layer.iconTranslationAnchor = nil; XCTAssertTrue(rawLayer->getIconTranslateAnchor().isUndefined(), @"Unsetting iconTranslationAnchor should return icon-translate-anchor to the default value."); XCTAssertEqualObjects(layer.iconTranslationAnchor, defaultStyleValue, @"iconTranslationAnchor should return the default value after being unset."); } - + // text-color { XCTAssertTrue(rawLayer->getTextColor().isUndefined(), @"text-color should be unset initially."); MGLStyleValue<MGLColor *> *defaultStyleValue = layer.textColor; - + MGLStyleValue<MGLColor *> *styleValue = [MGLStyleValue<MGLColor *> valueWithRawValue:[MGLColor redColor]]; layer.textColor = styleValue; mbgl::style::PropertyValue<mbgl::Color> propertyValue = { { 1, 0, 0, 1 } }; @@ -1474,7 +1474,7 @@ @"Setting textColor to a constant value should update text-color."); XCTAssertEqualObjects(layer.textColor, styleValue, @"textColor should round-trip constant values."); - + styleValue = [MGLStyleValue<MGLColor *> valueWithStops:@{ @18: styleValue, }]; @@ -1487,20 +1487,20 @@ @"Setting textColor to a function should update text-color."); XCTAssertEqualObjects(layer.textColor, styleValue, @"textColor should round-trip functions."); - + layer.textColor = nil; XCTAssertTrue(rawLayer->getTextColor().isUndefined(), @"Unsetting textColor should return text-color to the default value."); XCTAssertEqualObjects(layer.textColor, defaultStyleValue, @"textColor should return the default value after being unset."); } - + // text-halo-blur { XCTAssertTrue(rawLayer->getTextHaloBlur().isUndefined(), @"text-halo-blur should be unset initially."); MGLStyleValue<NSNumber *> *defaultStyleValue = layer.textHaloBlur; - + MGLStyleValue<NSNumber *> *styleValue = [MGLStyleValue<NSNumber *> valueWithRawValue:@0xff]; layer.textHaloBlur = styleValue; mbgl::style::PropertyValue<float> propertyValue = { 0xff }; @@ -1508,7 +1508,7 @@ @"Setting textHaloBlur to a constant value should update text-halo-blur."); XCTAssertEqualObjects(layer.textHaloBlur, styleValue, @"textHaloBlur should round-trip constant values."); - + styleValue = [MGLStyleValue<NSNumber *> valueWithStops:@{ @18: styleValue, }]; @@ -1521,20 +1521,20 @@ @"Setting textHaloBlur to a function should update text-halo-blur."); XCTAssertEqualObjects(layer.textHaloBlur, styleValue, @"textHaloBlur should round-trip functions."); - + layer.textHaloBlur = nil; XCTAssertTrue(rawLayer->getTextHaloBlur().isUndefined(), @"Unsetting textHaloBlur should return text-halo-blur to the default value."); XCTAssertEqualObjects(layer.textHaloBlur, defaultStyleValue, @"textHaloBlur should return the default value after being unset."); } - + // text-halo-color { XCTAssertTrue(rawLayer->getTextHaloColor().isUndefined(), @"text-halo-color should be unset initially."); MGLStyleValue<MGLColor *> *defaultStyleValue = layer.textHaloColor; - + MGLStyleValue<MGLColor *> *styleValue = [MGLStyleValue<MGLColor *> valueWithRawValue:[MGLColor redColor]]; layer.textHaloColor = styleValue; mbgl::style::PropertyValue<mbgl::Color> propertyValue = { { 1, 0, 0, 1 } }; @@ -1542,7 +1542,7 @@ @"Setting textHaloColor to a constant value should update text-halo-color."); XCTAssertEqualObjects(layer.textHaloColor, styleValue, @"textHaloColor should round-trip constant values."); - + styleValue = [MGLStyleValue<MGLColor *> valueWithStops:@{ @18: styleValue, }]; @@ -1555,20 +1555,20 @@ @"Setting textHaloColor to a function should update text-halo-color."); XCTAssertEqualObjects(layer.textHaloColor, styleValue, @"textHaloColor should round-trip functions."); - + layer.textHaloColor = nil; XCTAssertTrue(rawLayer->getTextHaloColor().isUndefined(), @"Unsetting textHaloColor should return text-halo-color to the default value."); XCTAssertEqualObjects(layer.textHaloColor, defaultStyleValue, @"textHaloColor should return the default value after being unset."); } - + // text-halo-width { XCTAssertTrue(rawLayer->getTextHaloWidth().isUndefined(), @"text-halo-width should be unset initially."); MGLStyleValue<NSNumber *> *defaultStyleValue = layer.textHaloWidth; - + MGLStyleValue<NSNumber *> *styleValue = [MGLStyleValue<NSNumber *> valueWithRawValue:@0xff]; layer.textHaloWidth = styleValue; mbgl::style::PropertyValue<float> propertyValue = { 0xff }; @@ -1576,7 +1576,7 @@ @"Setting textHaloWidth to a constant value should update text-halo-width."); XCTAssertEqualObjects(layer.textHaloWidth, styleValue, @"textHaloWidth should round-trip constant values."); - + styleValue = [MGLStyleValue<NSNumber *> valueWithStops:@{ @18: styleValue, }]; @@ -1589,20 +1589,20 @@ @"Setting textHaloWidth to a function should update text-halo-width."); XCTAssertEqualObjects(layer.textHaloWidth, styleValue, @"textHaloWidth should round-trip functions."); - + layer.textHaloWidth = nil; XCTAssertTrue(rawLayer->getTextHaloWidth().isUndefined(), @"Unsetting textHaloWidth should return text-halo-width to the default value."); XCTAssertEqualObjects(layer.textHaloWidth, defaultStyleValue, @"textHaloWidth should return the default value after being unset."); } - + // text-opacity { XCTAssertTrue(rawLayer->getTextOpacity().isUndefined(), @"text-opacity should be unset initially."); MGLStyleValue<NSNumber *> *defaultStyleValue = layer.textOpacity; - + MGLStyleValue<NSNumber *> *styleValue = [MGLStyleValue<NSNumber *> valueWithRawValue:@0xff]; layer.textOpacity = styleValue; mbgl::style::PropertyValue<float> propertyValue = { 0xff }; @@ -1610,7 +1610,7 @@ @"Setting textOpacity to a constant value should update text-opacity."); XCTAssertEqualObjects(layer.textOpacity, styleValue, @"textOpacity should round-trip constant values."); - + styleValue = [MGLStyleValue<NSNumber *> valueWithStops:@{ @18: styleValue, }]; @@ -1623,20 +1623,20 @@ @"Setting textOpacity to a function should update text-opacity."); XCTAssertEqualObjects(layer.textOpacity, styleValue, @"textOpacity should round-trip functions."); - + layer.textOpacity = nil; XCTAssertTrue(rawLayer->getTextOpacity().isUndefined(), @"Unsetting textOpacity should return text-opacity to the default value."); XCTAssertEqualObjects(layer.textOpacity, defaultStyleValue, @"textOpacity should return the default value after being unset."); } - + // text-translate { XCTAssertTrue(rawLayer->getTextTranslate().isUndefined(), @"text-translate should be unset initially."); MGLStyleValue<NSValue *> *defaultStyleValue = layer.textTranslation; - + MGLStyleValue<NSValue *> *styleValue = [MGLStyleValue<NSValue *> valueWithRawValue: #if TARGET_OS_IPHONE [NSValue valueWithCGVector:CGVectorMake(1, 1)] @@ -1650,7 +1650,7 @@ @"Setting textTranslation to a constant value should update text-translate."); XCTAssertEqualObjects(layer.textTranslation, styleValue, @"textTranslation should round-trip constant values."); - + styleValue = [MGLStyleValue<NSValue *> valueWithStops:@{ @18: styleValue, }]; @@ -1663,20 +1663,20 @@ @"Setting textTranslation to a function should update text-translate."); XCTAssertEqualObjects(layer.textTranslation, styleValue, @"textTranslation should round-trip functions."); - + layer.textTranslation = nil; XCTAssertTrue(rawLayer->getTextTranslate().isUndefined(), @"Unsetting textTranslation should return text-translate to the default value."); XCTAssertEqualObjects(layer.textTranslation, defaultStyleValue, @"textTranslation should return the default value after being unset."); } - + // text-translate-anchor { XCTAssertTrue(rawLayer->getTextTranslateAnchor().isUndefined(), @"text-translate-anchor should be unset initially."); MGLStyleValue<NSValue *> *defaultStyleValue = layer.textTranslationAnchor; - + MGLStyleValue<NSValue *> *styleValue = [MGLStyleValue<NSValue *> valueWithRawValue:[NSValue valueWithMGLTextTranslationAnchor:MGLTextTranslationAnchorViewport]]; layer.textTranslationAnchor = styleValue; mbgl::style::PropertyValue<mbgl::style::TranslateAnchorType> propertyValue = { mbgl::style::TranslateAnchorType::Viewport }; @@ -1684,7 +1684,7 @@ @"Setting textTranslationAnchor to a constant value should update text-translate-anchor."); XCTAssertEqualObjects(layer.textTranslationAnchor, styleValue, @"textTranslationAnchor should round-trip constant values."); - + styleValue = [MGLStyleValue<NSValue *> valueWithStops:@{ @18: styleValue, }]; @@ -1697,7 +1697,7 @@ @"Setting textTranslationAnchor to a function should update text-translate-anchor."); XCTAssertEqualObjects(layer.textTranslationAnchor, styleValue, @"textTranslationAnchor should round-trip functions."); - + layer.textTranslationAnchor = nil; XCTAssertTrue(rawLayer->getTextTranslateAnchor().isUndefined(), @"Unsetting textTranslationAnchor should return text-translate-anchor to the default value."); diff --git a/platform/darwin/test/MGLTileSetTests.mm b/platform/darwin/test/MGLTileSetTests.mm index 06901a0e96..40eab5f974 100644 --- a/platform/darwin/test/MGLTileSetTests.mm +++ b/platform/darwin/test/MGLTileSetTests.mm @@ -15,40 +15,40 @@ // a tile set that provides an mbgl tile set NSArray *tileURLTemplates = @[@"tile.1", @"tile.2", @"tile.3"]; mbgl::Tileset tileSet = MGLTileSetFromTileURLTemplates(tileURLTemplates, nil); - + // has the correct URL templates XCTAssertEqual(tileSet.tiles.size(), 3); XCTAssertEqual(tileSet.tiles[0], "tile.1"); XCTAssertEqual(tileSet.tiles[1], "tile.2"); XCTAssertEqual(tileSet.tiles[2], "tile.3"); - + // has the default scheme XCTAssertEqual(tileSet.scheme, mbgl::Tileset::Scheme::XYZ); - + // when the tile set has no min or max zoom level set // the mbgl object has default values for min and max zoom level XCTAssertEqual(tileSet.zoomRange.min, 0); XCTAssertEqual(tileSet.zoomRange.max, 22); - + // when the tile set has min and/or max zoom level set tileSet = MGLTileSetFromTileURLTemplates(@[@"tile.1"], @{ MGLTileSourceOptionMinimumZoomLevel: @1, MGLTileSourceOptionMaximumZoomLevel: @2, }); - + // the mbgl object reflects the set values for min and max zoom level XCTAssertEqual(tileSet.zoomRange.min, 1); XCTAssertEqual(tileSet.zoomRange.max, 2); - + // when the tile set has an attribution NSString *attribution = @"my tileset © ©️🎈"; tileSet = MGLTileSetFromTileURLTemplates(tileURLTemplates, @{ MGLTileSourceOptionAttributionHTMLString: attribution, }); - + // the attribution is reflected by the mbgl tileset XCTAssertEqual(tileSet.attribution, attribution.UTF8String); - + // when the tile set has attribution infos MGLAttributionInfo *mapboxInfo = [[MGLAttributionInfo alloc] initWithTitle:[[NSAttributedString alloc] initWithString:@"Mapbox"] URL:[NSURL URLWithString:@"https://www.mapbox.com/"]]; @@ -59,7 +59,7 @@ tileSet = MGLTileSetFromTileURLTemplates(tileURLTemplates, @{ MGLTileSourceOptionAttributionInfos: @[mapboxInfo, glInfo], }); - + // the attribution is reflected by the mbgl tileset #if TARGET_OS_IPHONE NSString *html = (@"<font style=\"font-family: 'Helvetica'; font-weight: normal; font-style: normal; font-size: 12.00pt\">" @@ -71,21 +71,21 @@ @"<font face=\"Helvetica\" size=\"3\" style=\"font: 12.0px Helvetica; background-color: #ff2600\">GL</font>\n"); #endif XCTAssertEqualObjects(@(tileSet.attribution.c_str()), html); - + // when the tile coordinate system is changed using an NSNumber tileSet = MGLTileSetFromTileURLTemplates(tileURLTemplates, @{ MGLTileSourceOptionTileCoordinateSystem: @(MGLTileCoordinateSystemTMS), }); - + // the scheme is reflected by the mbgl tileset XCTAssertEqual(tileSet.scheme, mbgl::Tileset::Scheme::TMS); - + // when the tile coordinate system is changed using an NSValue MGLTileCoordinateSystem tms = MGLTileCoordinateSystemTMS; tileSet = MGLTileSetFromTileURLTemplates(tileURLTemplates, @{ MGLTileSourceOptionTileCoordinateSystem: [NSValue value:&tms withObjCType:@encode(MGLTileCoordinateSystem)], }); - + // the scheme is reflected by the mbgl tileset XCTAssertEqual(tileSet.scheme, mbgl::Tileset::Scheme::TMS); } diff --git a/platform/default/bidi.cpp b/platform/default/bidi.cpp index 25b4dbe3a7..eb4e658733 100644 --- a/platform/default/bidi.cpp +++ b/platform/default/bidi.cpp @@ -18,7 +18,7 @@ public: UBiDi* bidiText = nullptr; UBiDi* bidiLine = nullptr; }; - + BiDi::BiDi() : impl(std::make_unique<BiDiImpl>()) {} BiDi::~BiDi() = default; diff --git a/platform/default/default_file_source.cpp b/platform/default/default_file_source.cpp index c4222b5a12..894ec65a5e 100644 --- a/platform/default/default_file_source.cpp +++ b/platform/default/default_file_source.cpp @@ -29,11 +29,11 @@ public: Impl(const std::string& cachePath, uint64_t maximumCacheSize) : offlineDatabase(cachePath, maximumCacheSize) { } - + void setAPIBaseURL(const std::string& url) { onlineFileSource.setAPIBaseURL(url); } - + std::string getAPIBaseURL() const{ return onlineFileSource.getAPIBaseURL(); } @@ -63,7 +63,7 @@ public: callback(std::current_exception(), {}); } } - + void updateMetadata(const int64_t regionID, const OfflineRegionMetadata& metadata, std::function<void (std::exception_ptr, optional<OfflineRegionMetadata>)> callback) { @@ -174,11 +174,11 @@ DefaultFileSource::~DefaultFileSource() = default; void DefaultFileSource::setAPIBaseURL(const std::string& baseURL) { thread->invokeSync(&Impl::setAPIBaseURL, baseURL); } - + std::string DefaultFileSource::getAPIBaseURL() const { return thread->invokeSync(&Impl::getAPIBaseURL); } - + void DefaultFileSource::setAccessToken(const std::string& accessToken) { thread->invokeSync(&Impl::setAccessToken, accessToken); } diff --git a/platform/default/jpeg_reader.cpp b/platform/default/jpeg_reader.cpp index 78c74f2fd7..c5e9d880c0 100644 --- a/platform/default/jpeg_reader.cpp +++ b/platform/default/jpeg_reader.cpp @@ -35,7 +35,7 @@ static boolean fill_input_buffer(j_decompress_ptr cinfo) { } static void skip(j_decompress_ptr cinfo, long count) { - if (count <= 0) return; //A zero or negative skip count should be treated as a no-op. + if (count <= 0) return; // A zero or negative skip count should be treated as a no-op. jpeg_stream_wrapper* wrap = reinterpret_cast<jpeg_stream_wrapper*>(cinfo->src); if (wrap->manager.bytes_in_buffer > 0 && count < static_cast<long>(wrap->manager.bytes_in_buffer)) @@ -48,7 +48,7 @@ static void skip(j_decompress_ptr cinfo, long count) { wrap->stream->seekg(count - wrap->manager.bytes_in_buffer, std::ios_base::cur); // trigger buffer fill wrap->manager.next_input_byte = nullptr; - wrap->manager.bytes_in_buffer = 0; //bytes_in_buffer may be zero on return. + wrap->manager.bytes_in_buffer = 0; // bytes_in_buffer may be zero on return. } } diff --git a/platform/default/local_file_source.cpp b/platform/default/local_file_source.cpp index 5686b453dc..93b42f5fa0 100644 --- a/platform/default/local_file_source.cpp +++ b/platform/default/local_file_source.cpp @@ -14,7 +14,7 @@ namespace { const char* protocol = "file://"; const std::size_t protocolLength = 7; - + } // namespace namespace mbgl { @@ -22,7 +22,7 @@ namespace mbgl { class LocalFileSource::Impl { public: void request(const std::string& url, FileSource::Callback callback) { - //Cut off the protocol + // Cut off the protocol std::string path = mbgl::util::percentDecode(url.substr(protocolLength)); Response response; @@ -58,7 +58,7 @@ LocalFileSource::~LocalFileSource() = default; std::unique_ptr<AsyncRequest> LocalFileSource::request(const Resource& resource, Callback callback) { return thread->invokeWithCallback(&Impl::request, resource.url, callback); } - + bool LocalFileSource::acceptsURL(const std::string& url) { return url.compare(0, protocolLength, protocol) == 0; } diff --git a/platform/default/mbgl/storage/offline_database.cpp b/platform/default/mbgl/storage/offline_database.cpp index 9f531bcac4..02736f10a4 100644 --- a/platform/default/mbgl/storage/offline_database.cpp +++ b/platform/default/mbgl/storage/offline_database.cpp @@ -578,7 +578,7 @@ OfflineRegionMetadata OfflineDatabase::updateMetadata(const int64_t regionID, co stmt->bindBlob(1, metadata); stmt->bind(2, regionID); stmt->run(); - + return metadata; } @@ -815,7 +815,7 @@ bool OfflineDatabase::evict(uint64_t neededFreeSize) { return false; } Timestamp accessed = accessedStmt->get<Timestamp>(0); - + // clang-format off Statement stmt1 = getStatement( "DELETE FROM resources " diff --git a/platform/default/mbgl/storage/offline_database.hpp b/platform/default/mbgl/storage/offline_database.hpp index 875677f7cf..57ffcee4eb 100644 --- a/platform/default/mbgl/storage/offline_database.hpp +++ b/platform/default/mbgl/storage/offline_database.hpp @@ -41,7 +41,7 @@ public: const OfflineRegionMetadata&); OfflineRegionMetadata updateMetadata(const int64_t regionID, const OfflineRegionMetadata&); - + void deleteRegion(OfflineRegion&&); // Return value is (response, stored size) diff --git a/platform/default/mbgl/storage/offline_download.cpp b/platform/default/mbgl/storage/offline_download.cpp index 3edc75845c..c8aa98d874 100644 --- a/platform/default/mbgl/storage/offline_download.cpp +++ b/platform/default/mbgl/storage/offline_download.cpp @@ -252,7 +252,7 @@ void OfflineDownload::ensureResource(const Resource& resource, auto workRequestsIt = requests.insert(requests.begin(), nullptr); *workRequestsIt = util::RunLoop::Get()->invokeCancellable([=]() { requests.erase(workRequestsIt); - + auto getResourceSizeInDatabase = [&] () -> optional<int64_t> { if (!callback) { return offlineDatabase.hasRegionResource(id, resource); @@ -264,7 +264,7 @@ void OfflineDownload::ensureResource(const Resource& resource, callback(response->first); return response->second; }; - + optional<int64_t> offlineResponse = getResourceSizeInDatabase(); if (offlineResponse) { status.completedResourceCount++; diff --git a/platform/default/mbgl/storage/offline_download.hpp b/platform/default/mbgl/storage/offline_download.hpp index f29a053a87..c978ded931 100644 --- a/platform/default/mbgl/storage/offline_download.hpp +++ b/platform/default/mbgl/storage/offline_download.hpp @@ -47,7 +47,7 @@ private: */ void ensureResource(const Resource&, std::function<void (Response)> = {}); bool checkTileCountLimit(const Resource& resource); - + int64_t id; OfflineRegionDefinition definition; OfflineDatabase& offlineDatabase; diff --git a/platform/default/online_file_source.cpp b/platform/default/online_file_source.cpp index 0f2bc5ff56..33168b7973 100644 --- a/platform/default/online_file_source.cpp +++ b/platform/default/online_file_source.cpp @@ -122,11 +122,11 @@ public: activateRequest(request); assert(pendingRequestsMap.size() == pendingRequestsList.size()); } - + bool isPending(OnlineFileRequest* request) { return pendingRequestsMap.find(request) != pendingRequestsMap.end(); } - + bool isActive(OnlineFileRequest* request) { return activeRequests.find(request) != activeRequests.end(); } diff --git a/platform/glfw/glfw_view.hpp b/platform/glfw/glfw_view.hpp index 672fa2e13c..84c8319594 100644 --- a/platform/glfw/glfw_view.hpp +++ b/platform/glfw/glfw_view.hpp @@ -54,7 +54,7 @@ private: // Internal void report(float duration); - + void setMapChangeCallback(std::function<void(mbgl::MapChange)> callback); void notifyMapChange(mbgl::MapChange change) override; diff --git a/platform/ios/app/MBXAnnotationView.m b/platform/ios/app/MBXAnnotationView.m index 61f9b1c047..5b8011c55e 100644 --- a/platform/ios/app/MBXAnnotationView.m +++ b/platform/ios/app/MBXAnnotationView.m @@ -7,7 +7,7 @@ - (void)layoutSubviews { [super layoutSubviews]; - + self.layer.borderColor = [UIColor blueColor].CGColor; self.layer.borderWidth = 1; self.layer.cornerRadius = 2; @@ -16,7 +16,7 @@ - (void)setSelected:(BOOL)selected animated:(BOOL)animated { [super setSelected:selected animated:animated]; - + self.layer.borderColor = selected ? [UIColor blackColor].CGColor : [UIColor whiteColor].CGColor; self.layer.borderWidth = selected ? 2.0 : 0; } @@ -24,7 +24,7 @@ - (void)setDragState:(MGLAnnotationViewDragState)dragState animated:(BOOL)animated { [super setDragState:dragState animated:NO]; - + switch (dragState) { case MGLAnnotationViewDragStateNone: break; @@ -46,7 +46,7 @@ break; } } - + } - (nullable id<CAAction>)actionForLayer:(CALayer *)layer forKey:(NSString *)event diff --git a/platform/ios/app/MBXCustomCalloutView.m b/platform/ios/app/MBXCustomCalloutView.m index e46b727d84..13564c5cbf 100644 --- a/platform/ios/app/MBXCustomCalloutView.m +++ b/platform/ios/app/MBXCustomCalloutView.m @@ -31,7 +31,7 @@ static CGFloat const tipWidth = 10.0; self.backgroundColor = [UIColor clearColor]; _mainLabel = [[UILabel alloc] initWithFrame: CGRectZero]; _mainLabel.backgroundColor = [UIColor clearColor]; - + [self addSubview: _mainLabel]; } return self; @@ -46,7 +46,7 @@ static CGFloat const tipWidth = 10.0; { [self.delegate performSelector:@selector(calloutViewWillAppear:) withObject:self]; } - + [view addSubview:self]; // prepare title label if ([self.representedObject respondsToSelector:@selector(title)]) @@ -61,7 +61,7 @@ static CGFloat const tipWidth = 10.0; CGFloat frameOriginY = rect.origin.y - frameHeight; self.frame = CGRectMake(frameOriginX, frameOriginY, frameWidth, frameHeight); - + if ([self.delegate respondsToSelector:@selector(calloutViewDidAppear:)]) { [self.delegate performSelector:@selector(calloutViewDidAppear:) withObject:self]; @@ -84,14 +84,14 @@ static CGFloat const tipWidth = 10.0; - (void)drawRect:(CGRect)rect { UIColor *fillColor = [UIColor colorWithWhite:0.7 alpha:1.0]; - + CGFloat tipLeft = rect.origin.x + (rect.size.width / 2.0) - (tipWidth / 2.0); CGPoint tipBottom = CGPointMake(rect.origin.x + (rect.size.width / 2.0), rect.origin.y +rect.size.height); CGFloat heightWithoutTip = rect.size.height - tipHeight; - + // draw the white background with tip CGContextRef ctxt = UIGraphicsGetCurrentContext(); - + CGMutablePathRef tipPath = CGPathCreateMutable(); CGPathMoveToPoint(tipPath, NULL, 0, 0); CGPathAddLineToPoint(tipPath, NULL, 0, heightWithoutTip); @@ -101,7 +101,7 @@ static CGFloat const tipWidth = 10.0; CGPathAddLineToPoint(tipPath, NULL, CGRectGetWidth(rect), heightWithoutTip); CGPathAddLineToPoint(tipPath, NULL, CGRectGetWidth(rect), 0); CGPathCloseSubpath(tipPath); - + [fillColor setFill]; CGContextAddPath(ctxt, tipPath); CGContextFillPath(ctxt); diff --git a/platform/ios/app/MBXOfflinePacksTableViewController.m b/platform/ios/app/MBXOfflinePacksTableViewController.m index 7bceec7ef7..26a15a0b95 100644 --- a/platform/ios/app/MBXOfflinePacksTableViewController.m +++ b/platform/ios/app/MBXOfflinePacksTableViewController.m @@ -33,7 +33,7 @@ static NSString * const MBXOfflinePacksTableViewActiveCellReuseIdentifier = @"Ac - (void)viewDidLoad { [super viewDidLoad]; - + [[MGLOfflineStorage sharedOfflineStorage] addObserver:self forKeyPath:@"packs" options:NSKeyValueObservingOptionInitial context:NULL]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(offlinePackProgressDidChange:) name:MGLOfflinePackProgressChangedNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(offlinePackDidReceiveError:) name:MGLOfflinePackErrorNotification object:nil]; @@ -60,24 +60,24 @@ static NSString * const MBXOfflinePacksTableViewActiveCellReuseIdentifier = @"Ac case NSKeyValueChangeInsertion: [self.tableView insertRowsAtIndexPaths:indexPaths withRowAnimation:UITableViewRowAnimationAutomatic]; break; - + case NSKeyValueChangeRemoval: [self.tableView deleteRowsAtIndexPaths:indexPaths withRowAnimation:UITableViewRowAnimationAutomatic]; break; - + case NSKeyValueChangeReplacement: [self.tableView reloadRowsAtIndexPaths:indexPaths withRowAnimation:UITableViewRowAnimationAutomatic]; break; - + default: [self.tableView reloadData]; - + for (MGLOfflinePack *pack in [MGLOfflineStorage sharedOfflineStorage].packs) { if (pack.state == MGLOfflinePackStateUnknown) { [pack requestProgress]; } } - + break; } } else { @@ -91,22 +91,22 @@ static NSString * const MBXOfflinePacksTableViewActiveCellReuseIdentifier = @"Ac textField.placeholder = [NSString stringWithFormat:@"%@", MGLStringFromCoordinateBounds(self.mapView.visibleCoordinateBounds)]; }]; [alertController addAction:[UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:nil]]; - + UIAlertAction *downloadAction = [UIAlertAction actionWithTitle:@"Download" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) { MGLMapView *mapView = self.mapView; NSAssert(mapView, @"No map view to get the current region from."); - + UITextField *nameField = alertController.textFields.firstObject; NSString *name = nameField.text; if (!name.length) { name = nameField.placeholder; } - + MGLTilePyramidOfflineRegion *region = [[MGLTilePyramidOfflineRegion alloc] initWithStyleURL:mapView.styleURL bounds:mapView.visibleCoordinateBounds fromZoomLevel:mapView.zoomLevel toZoomLevel:mapView.maximumZoomLevel]; NSData *context = [NSKeyedArchiver archivedDataWithRootObject:@{ MBXOfflinePackContextNameKey: name, }]; - + [[MGLOfflineStorage sharedOfflineStorage] addPackForRegion:region withContext:context completionHandler:^(MGLOfflinePack *pack, NSError *error) { if (error) { NSString *message = [NSString stringWithFormat:@"Mapbox GL was unable to add the offline pack “%@”.", name]; @@ -122,7 +122,7 @@ static NSString * const MBXOfflinePacksTableViewActiveCellReuseIdentifier = @"Ac if ([alertController respondsToSelector:@selector(setPreferredAction:)]) { alertController.preferredAction = downloadAction; } - + [self presentViewController:alertController animated:YES completion:nil]; } @@ -134,11 +134,11 @@ static NSString * const MBXOfflinePacksTableViewActiveCellReuseIdentifier = @"Ac - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { MGLOfflinePack *pack = [MGLOfflineStorage sharedOfflineStorage].packs[indexPath.row]; - + NSString *reuseIdentifier = pack.state == MGLOfflinePackStateActive ? MBXOfflinePacksTableViewActiveCellReuseIdentifier : MBXOfflinePacksTableViewInactiveCellReuseIdentifier; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:reuseIdentifier forIndexPath:indexPath]; [self updateTableViewCell:cell atIndexPath:indexPath forPack:pack]; - + return cell; } @@ -156,17 +156,17 @@ static NSString * const MBXOfflinePacksTableViewActiveCellReuseIdentifier = @"Ac case MGLOfflinePackStateUnknown: statusString = @"Calculating progress…"; break; - + case MGLOfflinePackStateInactive: statusString = [NSString stringWithFormat:@"%@ of %@ resources (%@)", completedString, expectedString, byteCountString]; break; - + case MGLOfflinePackStateComplete: statusString = [NSString stringWithFormat:@"%@ resources (%@)", completedString, byteCountString]; break; - + case MGLOfflinePackStateActive: if (progress.countOfResourcesExpected) { completedString = [NSNumberFormatter localizedStringFromNumber:@(progress.countOfResourcesCompleted + 1) @@ -178,7 +178,7 @@ static NSString * const MBXOfflinePacksTableViewActiveCellReuseIdentifier = @"Ac statusString = [NSString stringWithFormat:@"Downloading %@ of %@ resources (%@ so far)…", completedString, expectedString, byteCountString]; break; - + case MGLOfflinePackStateInvalid: NSAssert(NO, @"Invalid offline pack at index path %@", indexPath); break; @@ -197,27 +197,27 @@ static NSString * const MBXOfflinePacksTableViewActiveCellReuseIdentifier = @"Ac - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { [tableView deselectRowAtIndexPath:indexPath animated:YES]; - + MGLOfflinePack *pack = [MGLOfflineStorage sharedOfflineStorage].packs[indexPath.row]; switch (pack.state) { case MGLOfflinePackStateUnknown: break; - + case MGLOfflinePackStateComplete: if ([pack.region respondsToSelector:@selector(applyToMapView:)]) { [pack.region performSelector:@selector(applyToMapView:) withObject:self.mapView]; } [self performSegueWithIdentifier:@"ReturnToMap" sender:self]; break; - + case MGLOfflinePackStateInactive: [pack resume]; break; - + case MGLOfflinePackStateActive: [pack suspend]; break; - + case MGLOfflinePackStateInvalid: NSAssert(NO, @"Invalid offline pack at index path %@", indexPath); break; @@ -229,12 +229,12 @@ static NSString * const MBXOfflinePacksTableViewActiveCellReuseIdentifier = @"Ac - (void)offlinePackProgressDidChange:(NSNotification *)notification { MGLOfflinePack *pack = notification.object; NSAssert([pack isKindOfClass:[MGLOfflinePack class]], @"MGLOfflineStorage notification has a non-pack object."); - + NSUInteger index = [[MGLOfflineStorage sharedOfflineStorage].packs indexOfObject:pack]; if (index == NSNotFound) { return; } - + NSIndexPath *indexPath = [NSIndexPath indexPathForRow:index inSection:0]; UITableViewCell *cell = [self.tableView cellForRowAtIndexPath:indexPath]; [self updateTableViewCell:cell atIndexPath:indexPath forPack:pack]; @@ -243,10 +243,10 @@ static NSString * const MBXOfflinePacksTableViewActiveCellReuseIdentifier = @"Ac - (void)offlinePackDidReceiveError:(NSNotification *)notification { MGLOfflinePack *pack = notification.object; NSAssert([pack isKindOfClass:[MGLOfflinePack class]], @"MGLOfflineStorage notification has a non-pack object."); - + NSError *error = notification.userInfo[MGLOfflinePackUserInfoKeyError]; NSAssert([error isKindOfClass:[NSError class]], @"MGLOfflineStorage notification has a non-error error."); - + NSString *message = [NSString stringWithFormat:@"Mapbox GL encountered an error while downloading the offline pack “%@”: %@", pack.name, error.localizedFailureReason]; if (error.code == MGLErrorCodeConnectionFailed) { NSLog(@"%@", message); @@ -260,7 +260,7 @@ static NSString * const MBXOfflinePacksTableViewActiveCellReuseIdentifier = @"Ac - (void)offlinePackDidReceiveMaximumAllowedMapboxTiles:(NSNotification *)notification { MGLOfflinePack *pack = notification.object; NSAssert([pack isKindOfClass:[MGLOfflinePack class]], @"MGLOfflineStorage notification has a non-pack object."); - + uint64_t maximumCount = [notification.userInfo[MGLOfflinePackUserInfoKeyMaximumCount] unsignedLongLongValue]; NSLog(@"Offline pack “%@” reached limit of %llu tiles.", pack.name, maximumCount); } diff --git a/platform/ios/app/MBXUserLocationAnnotationView.m b/platform/ios/app/MBXUserLocationAnnotationView.m index a0347a174f..675a01930a 100644 --- a/platform/ios/app/MBXUserLocationAnnotationView.m +++ b/platform/ios/app/MBXUserLocationAnnotationView.m @@ -35,7 +35,7 @@ const CGFloat MBXUserLocationDotSize = 10; - (void)updateFrameWithSize:(CGSize)size { if (CGSizeEqualToSize(self.frame.size, size)) return; - + // Update frame size, keeping the existing center point. CGRect newFrame = self.frame; CGPoint oldCenter = self.center; @@ -59,23 +59,23 @@ const CGFloat MBXUserLocationDotSize = 10; { // Accuracy CGFloat accuracy = self.accuracyInPoints; - + CGFloat center = self.bounds.size.width / 2.0 - accuracy / 2.0; UIBezierPath *accuracyPath = [UIBezierPath bezierPathWithOvalInRect:CGRectMake(center, center, accuracy, accuracy)]; UIColor *accuracyColor = [UIColor colorWithRed:1 green:0 blue:0 alpha:.4]; [accuracyColor setFill]; [accuracyPath fill]; - + // Dot center = self.bounds.size.width / 2.0 - MBXUserLocationDotSize / 2.0; UIBezierPath *ovalPath = [UIBezierPath bezierPathWithOvalInRect: CGRectMake(center, center, MBXUserLocationDotSize, MBXUserLocationDotSize)]; [UIColor.greenColor setFill]; [ovalPath fill]; - + [UIColor.blackColor setStroke]; ovalPath.lineWidth = 1; [ovalPath stroke]; - + // Accuracy text UIFont *font = [UIFont systemFontOfSize:11]; [[NSString stringWithFormat:@"%.0f", accuracy] @@ -89,7 +89,7 @@ const CGFloat MBXUserLocationDotSize = 10; UIColor* fillColor = [UIColor colorWithRed: 0 green: 0 blue: 0 alpha: 1]; UIColor* strokeColor = [UIColor colorWithRed: 0.592 green: 0.592 blue: 0.592 alpha: 1]; UIColor* fillColor2 = [UIColor colorWithRed: 1 green: 1 blue: 1 alpha: 1]; - + UIBezierPath* bezier2Path = [UIBezierPath bezierPath]; [bezier2Path moveToPoint: CGPointMake(30, 7.86)]; [bezier2Path addLineToPoint: CGPointMake(30, 52.66)]; @@ -98,10 +98,10 @@ const CGFloat MBXUserLocationDotSize = 10; [bezier2Path addCurveToPoint: CGPointMake(30, 7.86) controlPoint1: CGPointMake(-0, -2.17) controlPoint2: CGPointMake(30, -3.05)]; [bezier2Path closePath]; bezier2Path.usesEvenOddFillRule = YES; - + [fillColor setFill]; [bezier2Path fill]; - + UIBezierPath* bezier3Path = [UIBezierPath bezierPath]; [bezier3Path moveToPoint: CGPointMake(30, 7.86)]; [bezier3Path addLineToPoint: CGPointMake(30, 52.66)]; @@ -112,7 +112,7 @@ const CGFloat MBXUserLocationDotSize = 10; [strokeColor setStroke]; bezier3Path.lineWidth = 1; [bezier3Path stroke]; - + UIBezierPath* bezier4Path = [UIBezierPath bezierPath]; [bezier4Path moveToPoint: CGPointMake(15.56, 4.26)]; [bezier4Path addCurveToPoint: CGPointMake(26, 6) controlPoint1: CGPointMake(21, 4.26) controlPoint2: CGPointMake(26, 6)]; @@ -123,10 +123,10 @@ const CGFloat MBXUserLocationDotSize = 10; [bezier4Path addCurveToPoint: CGPointMake(15.56, 4.26) controlPoint1: CGPointMake(4, 6) controlPoint2: CGPointMake(10.12, 4.26)]; [bezier4Path closePath]; bezier4Path.usesEvenOddFillRule = YES; - + [fillColor2 setFill]; [bezier4Path fill]; - + UIBezierPath* rectanglePath = [UIBezierPath bezierPath]; [rectanglePath moveToPoint: CGPointMake(25, 46)]; [rectanglePath addCurveToPoint: CGPointMake(21, 55) controlPoint1: CGPointMake(31, 46) controlPoint2: CGPointMake(28.5, 55)]; @@ -136,11 +136,11 @@ const CGFloat MBXUserLocationDotSize = 10; [rectanglePath closePath]; [UIColor.whiteColor setFill]; [rectanglePath fill]; - + UIBezierPath* bezierPath = [UIBezierPath bezierPath]; [UIColor.whiteColor setFill]; [bezierPath fill]; - + UIBezierPath* rectangle2Path = [UIBezierPath bezierPath]; [rectangle2Path moveToPoint: CGPointMake(2, 35)]; [rectangle2Path addCurveToPoint: CGPointMake(4.36, 35) controlPoint1: CGPointMake(2, 39) controlPoint2: CGPointMake(4.36, 35)]; @@ -150,7 +150,7 @@ const CGFloat MBXUserLocationDotSize = 10; [rectangle2Path closePath]; [UIColor.whiteColor setFill]; [rectangle2Path fill]; - + UIBezierPath* rectangle3Path = [UIBezierPath bezierPath]; [rectangle3Path moveToPoint: CGPointMake(28, 35)]; [rectangle3Path addCurveToPoint: CGPointMake(25.64, 35) controlPoint1: CGPointMake(28, 39) controlPoint2: CGPointMake(25.64, 35)]; diff --git a/platform/ios/app/MBXViewController.m b/platform/ios/app/MBXViewController.m index 63cde71f27..56290d022d 100644 --- a/platform/ios/app/MBXViewController.m +++ b/platform/ios/app/MBXViewController.m @@ -146,7 +146,7 @@ typedef NS_ENUM(NSInteger, MBXSettingsMiscellaneousRows) { - (void)viewDidLoad { [super viewDidLoad]; - + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(saveState:) name:UIApplicationDidEnterBackgroundNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(restoreState:) name:UIApplicationWillEnterForegroundNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(saveState:) name:UIApplicationWillTerminateNotification object:nil]; @@ -170,7 +170,7 @@ typedef NS_ENUM(NSInteger, MBXSettingsMiscellaneousRows) { textField.autocorrectionType = UITextAutocorrectionTypeNo; textField.autocapitalizationType = UITextAutocapitalizationTypeNone; }]; - + [alertController addAction:[UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:nil]]; UIAlertAction *OKAction = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { @@ -178,13 +178,13 @@ typedef NS_ENUM(NSInteger, MBXSettingsMiscellaneousRows) { NSString *accessToken = textField.text; [[NSUserDefaults standardUserDefaults] setObject:accessToken forKey:MBXMapboxAccessTokenDefaultsKey]; [MGLAccountManager setAccessToken:accessToken]; - + self.styleIndex = -1; [self cycleStyles:self]; [self.mapView reloadStyle:self]; }]; [alertController addAction:OKAction]; - + if ([alertController respondsToSelector:@selector(setPreferredAction:)]) { alertController.preferredAction = OKAction; @@ -717,7 +717,7 @@ typedef NS_ENUM(NSInteger, MBXSettingsMiscellaneousRows) { firstAnnotation.title = @"Open anchored to annotation"; firstAnnotation.anchoredToAnnotation = YES; firstAnnotation.dismissesAutomatically = NO; - + MBXCustomCalloutAnnotation *secondAnnotation = [[MBXCustomCalloutAnnotation alloc] init]; secondAnnotation.coordinate = CLLocationCoordinate2DMake(48.8543940, 2.3775439); secondAnnotation.title = @"Open not anchored to annotation"; @@ -729,10 +729,10 @@ typedef NS_ENUM(NSInteger, MBXSettingsMiscellaneousRows) { thirdAnnotation.title = @"Dismisses automatically"; thirdAnnotation.anchoredToAnnotation = YES; thirdAnnotation.dismissesAutomatically = YES; - + NSArray *annotations = @[firstAnnotation, secondAnnotation, thirdAnnotation]; [self.mapView addAnnotations:annotations]; - + [self.mapView showAnnotations:annotations animated:YES]; } @@ -808,7 +808,7 @@ typedef NS_ENUM(NSInteger, MBXSettingsMiscellaneousRows) { MGLFillStyleLayer *fillLayer = [[MGLFillStyleLayer alloc] initWithIdentifier:@"test" source:source]; fillLayer.fillColor = [MGLStyleValue<UIColor *> valueWithRawValue:[UIColor purpleColor]]; [self.mapView.style addLayer:fillLayer]; - + } - (void)styleSymbolLayer @@ -914,27 +914,27 @@ typedef NS_ENUM(NSInteger, MBXSettingsMiscellaneousRows) { { CGRect queryRect = CGRectInset(self.mapView.bounds, 100, 200); NSArray *visibleFeatures = [self.mapView visibleFeaturesInRect:queryRect]; - + NSString *querySourceID = @"query-source-id"; NSString *queryLayerID = @"query-layer-id"; - + // RTE if you don't remove the layer first // RTE if you pass a nill layer to remove layer MGLStyleLayer *layer = [self.mapView.style layerWithIdentifier:queryLayerID]; if (layer) { [self.mapView.style removeLayer:layer]; } - + // RTE if you pass a nill source to remove source MGLSource *source = [self.mapView.style sourceWithIdentifier:querySourceID]; if (source) { [self.mapView.style removeSource:source]; } - + dispatch_async(dispatch_get_main_queue(), ^{ MGLShapeSource *source = [[MGLShapeSource alloc] initWithIdentifier:querySourceID features:visibleFeatures options:nil]; [self.mapView.style addSource:source]; - + MGLFillStyleLayer *fillLayer = [[MGLFillStyleLayer alloc] initWithIdentifier:queryLayerID source:source]; fillLayer.fillColor = [MGLStyleConstantValue<UIColor *> valueWithRawValue:[UIColor blueColor]]; fillLayer.fillOpacity = [MGLStyleConstantValue<NSNumber *> valueWithRawValue:@0.5]; @@ -946,7 +946,7 @@ typedef NS_ENUM(NSInteger, MBXSettingsMiscellaneousRows) { { self.mapView.zoomLevel = 10; self.mapView.centerCoordinate = CLLocationCoordinate2DMake(51.068585180672635, -114.06074523925781); - + CLLocationCoordinate2D leafCoords[] = { {50.9683733218221,-114.07035827636719}, {51.02325750523972,-114.06967163085938}, @@ -980,14 +980,14 @@ typedef NS_ENUM(NSInteger, MBXSettingsMiscellaneousRows) { {50.9683733218221,-114.07035827636719}, }; NSUInteger coordsCount = sizeof(leafCoords) / sizeof(leafCoords[0]); - + MGLPolygonFeature *feature = [MGLPolygonFeature polygonWithCoordinates:leafCoords count:coordsCount]; feature.identifier = @"leaf-feature"; feature.attributes = @{@"color": @"red"}; MGLShapeSource *source = [[MGLShapeSource alloc] initWithIdentifier:@"leaf-source" shape:feature options:nil]; [self.mapView.style addSource:source]; - + MGLFillStyleLayer *layer = [[MGLFillStyleLayer alloc] initWithIdentifier:@"leaf-fill-layer" source:source]; layer.predicate = [NSPredicate predicateWithFormat:@"color = 'red'"]; MGLStyleValue *fillColor = [MGLStyleValue<UIColor *> valueWithRawValue:[UIColor redColor]]; @@ -1026,17 +1026,17 @@ typedef NS_ENUM(NSInteger, MBXSettingsMiscellaneousRows) { - (void)updateShapeSourceData { [self.mapView setCenterCoordinate:CLLocationCoordinate2DMake(40.329795743702064, -107.75390625) zoomLevel:11 animated:NO]; - + NSString *geoJSON = @"{\"type\": \"FeatureCollection\",\"features\": [{\"type\": \"Feature\",\"properties\": {},\"geometry\": {\"type\": \"LineString\",\"coordinates\": [[-107.75390625,40.329795743702064],[-104.34814453125,37.64903402157866]]}}]}"; - + NSData *data = [geoJSON dataUsingEncoding:NSUTF8StringEncoding]; MGLShape *shape = [MGLShape shapeWithData:data encoding:NSUTF8StringEncoding error:NULL]; MGLShapeSource *source = [[MGLShapeSource alloc] initWithIdentifier:@"mutable-data-source-id" shape:shape options:nil]; [self.mapView.style addSource:source]; - + MGLLineStyleLayer *layer = [[MGLLineStyleLayer alloc] initWithIdentifier:@"mutable-data-layer-id" source:source]; [self.mapView.style addLayer:layer]; - + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ NSString *geoJSON = @"{\"type\": \"FeatureCollection\",\"features\": [{\"type\": \"Feature\",\"properties\": {},\"geometry\": {\"type\": \"LineString\",\"coordinates\": [[-107.75390625,40.329795743702064],[-109.34814453125,37.64903402157866]]}}]}"; NSData *data = [geoJSON dataUsingEncoding:NSUTF8StringEncoding]; @@ -1048,21 +1048,21 @@ typedef NS_ENUM(NSInteger, MBXSettingsMiscellaneousRows) { - (void)updateShapeSourceURL { [self.mapView setCenterCoordinate:CLLocationCoordinate2DMake(48.668731, -122.857151) zoomLevel:11 animated:NO]; - + NSString *filePath = [[NSBundle bundleForClass:self.class] pathForResource:@"polyline" ofType:@"geojson"]; NSURL *geoJSONURL = [NSURL fileURLWithPath:filePath]; MGLShapeSource *source = [[MGLShapeSource alloc] initWithIdentifier:@"mutable-data-source-url-id" URL:geoJSONURL options:nil]; [self.mapView.style addSource:source]; - + MGLLineStyleLayer *layer = [[MGLLineStyleLayer alloc] initWithIdentifier:@"mutable-data-layer-url-id" source:source]; [self.mapView.style addLayer:layer]; - + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ [self.mapView setCenterCoordinate:CLLocationCoordinate2DMake(41.563986787078704, -75.04843935793578) zoomLevel:8 animated:NO]; - + NSString *filePath = [[NSBundle bundleForClass:self.class] pathForResource:@"threestates" ofType:@"geojson"]; NSURL *geoJSONURL = [NSURL fileURLWithPath:filePath]; - + source.URL = geoJSONURL; }); } @@ -1070,7 +1070,7 @@ typedef NS_ENUM(NSInteger, MBXSettingsMiscellaneousRows) { - (void)updateShapeSourceFeatures { [self.mapView setCenterCoordinate:CLLocationCoordinate2DMake(-41.1520, 288.6592) zoomLevel:10 animated:NO]; - + CLLocationCoordinate2D smallBox[] = { {-41.14763798539186, 288.68019104003906}, {-41.140915920129665, 288.68019104003906}, @@ -1078,7 +1078,7 @@ typedef NS_ENUM(NSInteger, MBXSettingsMiscellaneousRows) { {-41.14763798539186, 288.6887741088867}, {-41.14763798539186, 288.68019104003906} }; - + CLLocationCoordinate2D largeBox[] = { {-41.17710352162799, 288.67298126220703}, {-41.13962313627545, 288.67298126220703}, @@ -1086,7 +1086,7 @@ typedef NS_ENUM(NSInteger, MBXSettingsMiscellaneousRows) { {-41.17710352162799, 288.7261962890625}, {-41.17710352162799, 288.67298126220703} }; - + MGLPolygonFeature *smallBoxFeature = [MGLPolygonFeature polygonWithCoordinates:smallBox count:sizeof(smallBox)/sizeof(smallBox[0])]; MGLPolygonFeature *largeBoxFeature = [MGLPolygonFeature polygonWithCoordinates:largeBox count:sizeof(largeBox)/sizeof(largeBox[0])]; @@ -1094,12 +1094,12 @@ typedef NS_ENUM(NSInteger, MBXSettingsMiscellaneousRows) { shape:smallBoxFeature options:nil]; [self.mapView.style addSource:source]; - + MGLFillStyleLayer *layer = [[MGLFillStyleLayer alloc] initWithIdentifier:@"mutable-data-layer-features-id" source:source]; MGLStyleValue *fillColor = [MGLStyleValue<UIColor *> valueWithRawValue:[UIColor redColor]]; layer.fillColor = fillColor; [self.mapView.style addLayer:layer]; - + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ source.shape = largeBoxFeature; }); @@ -1117,7 +1117,7 @@ typedef NS_ENUM(NSInteger, MBXSettingsMiscellaneousRows) { MGLPointCollectionFeature *feature = [MGLPointCollectionFeature pointCollectionWithCoordinates:coordinates count:4]; MGLShapeSource *source = [[MGLShapeSource alloc] initWithIdentifier:@"wiggle-source" shape:feature options:nil]; [self.mapView.style addSource:source]; - + MGLCircleStyleLayer *layer = [[MGLCircleStyleLayer alloc] initWithIdentifier:@"wiggle-layer" source:source]; [self.mapView.style addLayer:layer]; } @@ -1127,11 +1127,11 @@ typedef NS_ENUM(NSInteger, MBXSettingsMiscellaneousRows) { NSURL *url = [[NSURL alloc] initWithString:@"mapbox://mapbox.mapbox-terrain-v2"]; MGLVectorSource *vectorSource = [[MGLVectorSource alloc] initWithIdentifier:@"style-vector-source-id" configurationURL:url]; [self.mapView.style addSource:vectorSource]; - + MGLBackgroundStyleLayer *backgroundLayer = [[MGLBackgroundStyleLayer alloc] initWithIdentifier:@"style-vector-background-layer-id"]; backgroundLayer.backgroundColor = [MGLStyleValue<UIColor *> valueWithRawValue:[UIColor blackColor]]; [self.mapView.style addLayer:backgroundLayer]; - + MGLLineStyleLayer *lineLayer = [[MGLLineStyleLayer alloc] initWithIdentifier:@"style-vector-line-layer-id" source:vectorSource]; lineLayer.sourceLayerIdentifier = @"contour"; NSUInteger lineJoinValue = MGLLineJoinRound; @@ -1151,7 +1151,7 @@ typedef NS_ENUM(NSInteger, MBXSettingsMiscellaneousRows) { MGLTileSourceOptionTileSize: @256, }]; [self.mapView.style addSource:rasterSource]; - + MGLRasterStyleLayer *rasterLayer = [[MGLRasterStyleLayer alloc] initWithIdentifier:@"style-raster-layer-id" source:rasterSource]; [self.mapView.style addLayer:rasterLayer]; } @@ -1309,7 +1309,7 @@ typedef NS_ENUM(NSInteger, MBXSettingsMiscellaneousRows) { } else { message = [NSString stringWithFormat:@"There are %@ visible annotations.", visibleAnnotationCount]; } - + UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"Visible Annotations" message:message preferredStyle:UIAlertControllerStyleAlert]; [alertController addAction:[UIAlertAction actionWithTitle:@"Ok" style:UIAlertActionStyleCancel handler:nil]]; [self presentViewController:alertController animated:YES completion:nil]; @@ -1360,7 +1360,7 @@ typedef NS_ENUM(NSInteger, MBXSettingsMiscellaneousRows) { title = [feature attributeForKey:@"name_en"] ?: [feature attributeForKey:@"name"]; } } - + MBXDroppedPinAnnotation *pin = [[MBXDroppedPinAnnotation alloc] init]; pin.coordinate = [self.mapView convertPoint:point toCoordinateFromView:self.mapView]; @@ -1375,7 +1375,7 @@ typedef NS_ENUM(NSInteger, MBXSettingsMiscellaneousRows) { { static NSArray *styleNames; static NSArray *styleURLs; - + static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ styleNames = @[ @@ -1395,7 +1395,7 @@ typedef NS_ENUM(NSInteger, MBXSettingsMiscellaneousRows) { [MGLStyle satelliteStreetsStyleURLWithVersion:MGLStyleDefaultVersion], ]; NSAssert(styleNames.count == styleURLs.count, @"Style names and URLs don’t match."); - + // Make sure defaultStyleURLs is up-to-date. unsigned numMethods = 0; Method *methods = class_copyMethodList(object_getClass([MGLStyle class]), &numMethods); @@ -1414,11 +1414,11 @@ typedef NS_ENUM(NSInteger, MBXSettingsMiscellaneousRows) { @"MGLStyle provides %u default styles but iosapp only knows about %lu of them.", numStyleURLMethods, (unsigned long)styleNames.count); }); - + self.styleIndex = (self.styleIndex + 1) % styleNames.count; self.mapView.styleURL = styleURLs[self.styleIndex]; - + UIButton *titleButton = (UIButton *)self.navigationItem.titleView; [titleButton setTitle:styleNames[self.styleIndex] forState:UIControlStateNormal]; } @@ -1469,7 +1469,7 @@ typedef NS_ENUM(NSInteger, MBXSettingsMiscellaneousRows) { { return nil; } - + MBXAnnotationView *annotationView = (MBXAnnotationView *)[mapView dequeueReusableAnnotationViewWithIdentifier:MBXViewControllerAnnotationViewReuseIdentifer]; if (!annotationView) { @@ -1482,7 +1482,7 @@ typedef NS_ENUM(NSInteger, MBXSettingsMiscellaneousRows) { // Comment out the pin dropping functionality in the handleLongPress: // method in this class to make draggable annotation views play nice. annotationView.draggable = YES; - + // Uncomment to force annotation view to maintain a constant size when // the map is tilted. By default, annotation views will shrink and grow // as they move towards and away from the horizon. Relatedly, annotations diff --git a/platform/ios/benchmark/MBXBenchViewController.mm b/platform/ios/benchmark/MBXBenchViewController.mm index 4f26d0cb1d..d4629e2521 100644 --- a/platform/ios/benchmark/MBXBenchViewController.mm +++ b/platform/ios/benchmark/MBXBenchViewController.mm @@ -52,7 +52,7 @@ - (void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; - + if ([MGLAccountManager accessToken].length) { [self startBenchmarkIteration]; } else { @@ -62,7 +62,7 @@ textField.autocorrectionType = UITextAutocorrectionTypeNo; textField.autocapitalizationType = UITextAutocapitalizationTypeNone; }]; - + [alertController addAction:[UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) { [self startBenchmarkIteration]; }]]; @@ -72,11 +72,11 @@ [[NSUserDefaults standardUserDefaults] setObject:accessToken forKey:MBXMapboxAccessTokenDefaultsKey]; [MGLAccountManager setAccessToken:accessToken]; [self.mapView reloadStyle:self]; - + [self startBenchmarkIteration]; }]; [alertController addAction:OKAction]; - + if ([alertController respondsToSelector:@selector(setPreferredAction:)]) { alertController.preferredAction = OKAction; } diff --git a/platform/ios/scripts/deploy-packages.sh b/platform/ios/scripts/deploy-packages.sh index 2265afdba6..479803aa05 100755 --- a/platform/ios/scripts/deploy-packages.sh +++ b/platform/ios/scripts/deploy-packages.sh @@ -9,7 +9,7 @@ set -u # GITHUB_RELEASE=true: Upload to github # BINARY_DIRECTORY=build/ios/deploy: Directory in which to save test packages -# environment variables and dependencies: +# environment variables and dependencies: # - You must run "mbx auth ..." before running # - Set GITHUB_TOKEN to a GitHub API access token in your environment to use GITHUB_RELEASE # - "wget" is required for downloading the zip files from s3 @@ -20,21 +20,21 @@ function finish { >&2 echo -en "\033[0m"; } trap finish EXIT buildPackageStyle() { - local package=$1 style="" + local package=$1 style="" if [[ ${#} -eq 2 ]]; then style="$2" - fi + fi step "Building: make ${package} ${style}" make ${package} step "Publishing ${package} with ${style}" local file_name="" - if [ -z ${style} ] + if [ -z ${style} ] then ./platform/ios/scripts/publish.sh "${PUBLISH_VERSION}" - file_name=mapbox-ios-sdk-${PUBLISH_VERSION}.zip + file_name=mapbox-ios-sdk-${PUBLISH_VERSION}.zip else ./platform/ios/scripts/publish.sh "${PUBLISH_VERSION}" ${style} - file_name=mapbox-ios-sdk-${PUBLISH_VERSION}-${style}.zip + file_name=mapbox-ios-sdk-${PUBLISH_VERSION}-${style}.zip fi step "Downloading ${file_name} from s3 to ${BINARY_DIRECTORY}" wget -O ${BINARY_DIRECTORY}/${file_name} http://mapbox.s3.amazonaws.com/mapbox-gl-native/ios/builds/${file_name} diff --git a/platform/ios/scripts/package.sh b/platform/ios/scripts/package.sh index 796de17146..0ad7bb93d8 100755 --- a/platform/ios/scripts/package.sh +++ b/platform/ios/scripts/package.sh @@ -118,7 +118,7 @@ if [[ ${BUILD_FOR_DEVICE} == true ]]; then ${LIBS[@]/#/${PRODUCTS}/${BUILDTYPE}-iphoneos/lib} \ ${LIBS[@]/#/${PRODUCTS}/${BUILDTYPE}-iphonesimulator/lib} \ `find mason_packages/ios-${IOS_SDK_VERSION} -type f -name libgeojson.a` - + cp -rv ${PRODUCTS}/${BUILDTYPE}-iphoneos/${NAME}.bundle ${STATIC_BUNDLE_DIR} fi @@ -158,7 +158,7 @@ else -o ${OUTPUT}/static/${NAME}.framework/${NAME} \ ${LIBS[@]/#/${PRODUCTS}/${BUILDTYPE}-iphonesimulator/lib} \ `find mason_packages/ios-${IOS_SDK_VERSION} -type f -name libgeojson.a` - + cp -rv ${PRODUCTS}/${BUILDTYPE}-iphonesimulator/${NAME}.bundle ${STATIC_BUNDLE_DIR} fi @@ -222,7 +222,7 @@ function create_podspec { if [[ ${1} == "static" ]]; then awk '/Pod::Spec.new/,/m.platform/' ${INPUT_PODSPEC} > ${OUTPUT_PODSPEC} cat platform/ios/${NAME}-iOS-SDK-static-part.podspec >> ${OUTPUT_PODSPEC} - sed -i '' "s/.*:http.*/${POD_SOURCE_PATH}/" ${OUTPUT_PODSPEC} + sed -i '' "s/.*:http.*/${POD_SOURCE_PATH}/" ${OUTPUT_PODSPEC} fi cp -pv LICENSE.md ${OUTPUT}/${1}/ } diff --git a/platform/ios/scripts/release-fabric.sh b/platform/ios/scripts/release-fabric.sh index 6f05e2886e..a523705b7b 100755 --- a/platform/ios/scripts/release-fabric.sh +++ b/platform/ios/scripts/release-fabric.sh @@ -15,7 +15,7 @@ echo "Downloading ${FILE_NAME}:" wget -P ${BINARY_DIRECTORY} http://mapbox.s3.amazonaws.com/mapbox-gl-native/ios/builds/${FILE_NAME} echo "Extracting ${ZIP_ARCHIVE_PATH} to ${BINARY_DIRECTORY}/${ZIP_OUTPUT}" -unzip -q ${ZIP_ARCHIVE_PATH} -d ${BINARY_DIRECTORY}/${ZIP_OUTPUT} +unzip -q ${ZIP_ARCHIVE_PATH} -d ${BINARY_DIRECTORY}/${ZIP_OUTPUT} ditto ${BINARY_DIRECTORY}/${ZIP_OUTPUT}/static/Mapbox.framework ${BINARY_DIRECTORY}/Mapbox.framework echo "Zipping framework:" @@ -25,7 +25,7 @@ cd $OLDPWD echo "Validating framework:" ./validate-fabric-zip.sh ${BINARY_DIRECTORY}/Mapbox.framework.zip - + echo "Uploading ${BINARY_DIRECTORY}/Mapbox.framework.zip to https://kits.fabric.io/manage-api/v1/kit-releases/ios/$BUNDLE_ID/$PUBLISH_VERSION with key ${FABRIC_KIT_API_KEY}" curl --fail -v -X PUT -H "X-FabricKits-ApiKey: ${FABRIC_KIT_API_KEY}" \ -F "release_artifact=@${BINARY_DIRECTORY}/Mapbox.framework.zip;type=application/octet-stream" \ diff --git a/platform/ios/scripts/validate-fabric-zip.sh b/platform/ios/scripts/validate-fabric-zip.sh index 7cc772d70c..2cd1e90ee7 100755 --- a/platform/ios/scripts/validate-fabric-zip.sh +++ b/platform/ios/scripts/validate-fabric-zip.sh @@ -12,7 +12,7 @@ set -e if [ ! -f "$1" ]; then printf "No file found at ${1}\n" - printf "Usage: $ ./validate_zip.sh <path to zip>\n"; exit 1; + printf "Usage: $ ./validate_zip.sh <path to zip>\n"; exit 1; fi function verifyFramework() { @@ -32,14 +32,14 @@ function verifyFramework() { printf "$FRAMEWORK_NAME contains modulemap: ✓\n" # Verify there is a modulemap so Swift can use the framework - if grep -q "link" "$MODULE_MAP"; then + if grep -q "link" "$MODULE_MAP"; then printf "$FRAMEWORK_NAME modulemap contains dependent system frameworks ✓\n" else printf "Warning: ${FRAMEWORK_NAME} does not list any system library dependencies. Double check all dependent frameworks and libraries are listed. \n"; fi # Verify there is at least one header listed in the module map - if grep -q ".*.h" "$MODULE_MAP"; then + if grep -q ".*.h" "$MODULE_MAP"; then printf "$FRAMEWORK_NAME modulemap contains headers ✓\n"; else printf "Error: ${FRAMEWORK_NAME} does not list any headers in the modulemap\n"; @@ -47,7 +47,7 @@ function verifyFramework() { fi # Verify there is at least a headers folder - if [[ ! -d "$HEADER_PATH" ]]; then + if [[ ! -d "$HEADER_PATH" ]]; then printf "ERROR: Headers not not found in ${FRAMEWORK_NAME}\n"; exit 5; fi @@ -55,7 +55,7 @@ function verifyFramework() { # Verify the static lib at least has simulator and the two common ARM architectures local PRESENT_ARCHITECTURES=$( xcrun lipo -info "${BINARY_PATH}" ) for arch in "armv7" "arm64" "i386" "x86_64"; do - if [[ ! $PRESENT_ARCHITECTURES == *$arch* ]]; then + if [[ ! $PRESENT_ARCHITECTURES == *$arch* ]]; then printf "ERROR: Architecture ${arch} not found in ${FRAMEWORK_NAME}\n"; exit 6; fi @@ -69,7 +69,7 @@ function verifyFramework() { if [[ ! $SYMBOLS == *"LLVM"* ]]; then printf "ERROR: Bitcode segments not found in ${FRAMEWORK_NAME}. Users will fail to archive their builds \n"; exit 7; - fi + fi done printf "$FRAMEWORK_NAME contains bitcode: ✓\n" @@ -82,19 +82,19 @@ function verifyFramework() { printf "$FRAMEWORK_NAME contains Info.plist: ✓\n" # Verify there is a bundle identifier in Info.plist - # And verify it does not contain any vestigial string templating + # And verify it does not contain any vestigial string templating local BUNDLE_NAME=$(/usr/libexec/PlistBuddy -c "Print :CFBundleIdentifier" "${PLIST_PATH}") if [[ -z "$BUNDLE_NAME" ]]; then printf "ERROR: Info.plist not found in $FRAMEWORK_NAME or CFBundleIdentifier not set\n"; exit 9; - elif [[ "$BUNDLE_NAME" == *"$"* ]]; then + elif [[ "$BUNDLE_NAME" == *"$"* ]]; then printf "ERROR: CFBundleIdentifier is invalid: $BUNDLE_NAME\n"; exit 10; else printf "$FRAMEWORK_NAME has bundle: $BUNDLE_NAME ✓\n" fi - # Verify there is a bundle version in the Info.plist + # Verify there is a bundle version in the Info.plist local BUNDLE_VERSION=$(/usr/libexec/PlistBuddy -c "Print :CFBundleShortVersionString" "${PLIST_PATH}") if [[ -z "$BUNDLE_VERSION" ]]; then printf "ERROR: No CFBundleShortVersionString found in $FRAMEWORK_NAME\n"; @@ -119,7 +119,7 @@ printf "Scanning for frameworks...\n" FRAMEWORKS=( $(find "$TEMP_DIR" -name "*.framework" -maxdepth 1) ) if [ -z "$FRAMEWORKS" ]; then printf "ERROR: No frameworks found at the top level within the zip archive."; - exit 2; + exit 2; fi # Verify each framework found individually diff --git a/platform/ios/src/MGLAPIClient.m b/platform/ios/src/MGLAPIClient.m index 5e8ee5fe1d..22ee5c55f5 100644 --- a/platform/ios/src/MGLAPIClient.m +++ b/platform/ios/src/MGLAPIClient.m @@ -75,22 +75,22 @@ static NSString * const MGLAPIClientHTTPMethodPost = @"POST"; [request setValue:self.userAgent forHTTPHeaderField:MGLAPIClientHeaderFieldUserAgentKey]; [request setValue:MGLAPIClientHeaderFieldContentTypeValue forHTTPHeaderField:MGLAPIClientHeaderFieldContentTypeKey]; [request setHTTPMethod:MGLAPIClientHTTPMethodPost]; - + NSData *jsonData = [self serializedDataForEvents:events]; - + // Compressing less than 3 events can have a negative impact on the size. if (events.count > 2) { NSData *compressedData = [jsonData mgl_compressedData]; [request setValue:@"deflate" forHTTPHeaderField:MGLAPIClientHeaderFieldContentEncodingKey]; [request setHTTPBody:compressedData]; } - + // Set JSON data if events.count were less than 3 or something went wrong with compressing HTTP body data. if (!request.HTTPBody) { [request setValue:nil forHTTPHeaderField:MGLAPIClientHeaderFieldContentEncodingKey]; [request setHTTPBody:jsonData]; } - + return [request copy]; } @@ -143,10 +143,10 @@ static NSString * const MGLAPIClientHTTPMethodPost = @"POST"; - (void)URLSession:(NSURLSession *)session didReceiveChallenge:(NSURLAuthenticationChallenge *)challenge completionHandler:(void (^) (NSURLSessionAuthChallengeDisposition disposition, NSURLCredential *credential))completionHandler { if([challenge.protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust]) { - + SecTrustRef serverTrust = [[challenge protectionSpace] serverTrust]; SecTrustResultType trustResult; - + // Validate the certificate chain with the device's trust store anyway // This *might* give use revocation checking SecTrustEvaluate(serverTrust, &trustResult); @@ -154,13 +154,13 @@ static NSString * const MGLAPIClientHTTPMethodPost = @"POST"; { // Look for a pinned certificate in the server's certificate chain long numKeys = SecTrustGetCertificateCount(serverTrust); - + BOOL found = NO; // Try GeoTrust Cert First for (int lc = 0; lc < numKeys; lc++) { SecCertificateRef certificate = SecTrustGetCertificateAtIndex(serverTrust, lc); NSData *remoteCertificateData = CFBridgingRelease(SecCertificateCopyData(certificate)); - + // Compare Remote Key With Local Version if ([remoteCertificateData isEqualToData:_geoTrustCert]) { // Found the certificate; continue connecting @@ -169,13 +169,13 @@ static NSString * const MGLAPIClientHTTPMethodPost = @"POST"; break; } } - + if (!found) { // Fallback to Digicert Cert for (int lc = 0; lc < numKeys; lc++) { SecCertificateRef certificate = SecTrustGetCertificateAtIndex(serverTrust, lc); NSData *remoteCertificateData = CFBridgingRelease(SecCertificateCopyData(certificate)); - + // Compare Remote Key With Local Version if ([remoteCertificateData isEqualToData:_digicertCert]) { // Found the certificate; continue connecting @@ -184,13 +184,13 @@ static NSString * const MGLAPIClientHTTPMethodPost = @"POST"; break; } } - + if (!found && _usesTestServer) { // See if this is test server for (int lc = 0; lc < numKeys; lc++) { SecCertificateRef certificate = SecTrustGetCertificateAtIndex(serverTrust, lc); NSData *remoteCertificateData = CFBridgingRelease(SecCertificateCopyData(certificate)); - + // Compare Remote Key With Local Version if ([remoteCertificateData isEqualToData:_testServerCert]) { // Found the certificate; continue connecting @@ -200,7 +200,7 @@ static NSString * const MGLAPIClientHTTPMethodPost = @"POST"; } } } - + if (!found) { // The certificate wasn't found in GeoTrust nor Digicert. Cancel the connection. completionHandler(NSURLSessionAuthChallengeCancelAuthenticationChallenge, [NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust]); diff --git a/platform/ios/src/MGLAnnotationImage.h b/platform/ios/src/MGLAnnotationImage.h index 95bce21f51..fbeee18624 100644 --- a/platform/ios/src/MGLAnnotationImage.h +++ b/platform/ios/src/MGLAnnotationImage.h @@ -14,7 +14,7 @@ NS_ASSUME_NONNULL_BEGIN /** Initializes and returns a new annotation image object. - + @param image The image to be displayed for the annotation. @param reuseIdentifier The string that identifies that this annotation image is reusable. @@ -30,11 +30,11 @@ NS_ASSUME_NONNULL_BEGIN /** The string that identifies that this annotation image is reusable. (read-only) - + You specify the reuse identifier when you create the image object. You use this type later to retrieve an annotation image object that was created previously but which is currently unused because its annotation is not on screen. - + If you define distinctly different types of annotations (with distinctly different annotation images to go with them), you can differentiate between the annotation types by specifying different reuse identifiers for each one. @@ -43,8 +43,8 @@ NS_ASSUME_NONNULL_BEGIN /** A Boolean value indicating whether the annotation is enabled. - - The default value of this property is `YES`. If the value of this property is + + The default value of this property is `YES`. If the value of this property is `NO`, the annotation image ignores touch events and cannot be selected. */ @property (nonatomic, getter=isEnabled) BOOL enabled; diff --git a/platform/ios/src/MGLAnnotationImage.m b/platform/ios/src/MGLAnnotationImage.m index 9c9c175ab9..3b89b19bd8 100644 --- a/platform/ios/src/MGLAnnotationImage.m +++ b/platform/ios/src/MGLAnnotationImage.m @@ -52,9 +52,9 @@ - (BOOL)isEqual:(id)other { if (self == other) return YES; if (![other isKindOfClass:[MGLAnnotationImage class]]) return NO; - + MGLAnnotationImage *otherAnnotationImage = other; - + return ((!_reuseIdentifier && !otherAnnotationImage.reuseIdentifier) || [_reuseIdentifier isEqualToString:otherAnnotationImage.reuseIdentifier]) && _enabled == otherAnnotationImage.enabled diff --git a/platform/ios/src/MGLAnnotationView.h b/platform/ios/src/MGLAnnotationView.h index d159976a4c..532483350a 100644 --- a/platform/ios/src/MGLAnnotationView.h +++ b/platform/ios/src/MGLAnnotationView.h @@ -12,7 +12,7 @@ typedef NS_ENUM(NSUInteger, MGLAnnotationViewDragState) { MGLAnnotationViewDragStateNone = 0, /** An action occurred that indicated the view should begin dragging. - + The map view automatically moves draggable annotation views to this state in response to the dragging the view after pressing and holding on it. */ @@ -29,7 +29,7 @@ typedef NS_ENUM(NSUInteger, MGLAnnotationViewDragState) { MGLAnnotationViewDragStateCanceling, /** An action occurred that indicated the view was dropped by the user. - + The map view automatically moves annotation views to this state in response to the user lifting their finger at the end of a drag gesture. */ @@ -44,7 +44,7 @@ typedef NS_ENUM(NSUInteger, MGLAnnotationViewDragState) { delegate to a corresponding annotation view. If an annotation view is created with a reuse identifier, the map view may recycle the view when it goes offscreen. - + Annotation views are compatible with UIKit, Core Animation, and other Cocoa Touch frameworks. On the other hand, if you do not need animation or interactivity such as dragging, you can use an `MGLAnnotationImage` instead to @@ -56,14 +56,14 @@ typedef NS_ENUM(NSUInteger, MGLAnnotationViewDragState) { /** Initializes and returns a new annotation view object. - + The reuse identifier provides a way for you to improve performance by recycling annotation views as they enter and leave the map’s viewport. As an annotation leaves the viewport, the map view moves its associated view to a reuse queue. When a new annotation becomes visible, you can request a view for that annotation by passing the appropriate reuse identifier string to the `-[MGLMapView dequeueReusableAnnotationViewWithIdentifier:]` method. - + @param reuseIdentifier A unique string identifier for this view that allows you to reuse this view with multiple similar annotations. You can set this parameter to `nil` if you don’t intend to reuse the view, but it is a good @@ -75,7 +75,7 @@ typedef NS_ENUM(NSUInteger, MGLAnnotationViewDragState) { /** Called when the view is removed from the reuse queue. - + The default implementation of this method does nothing. You can override it in your custom annotation view implementation to put the view in a known state before it is returned to your map view delegate. @@ -84,7 +84,7 @@ typedef NS_ENUM(NSUInteger, MGLAnnotationViewDragState) { /** The annotation object currently associated with the view. - + You should not change the value of this property directly. This property contains a non-`nil` value while the annotation view is visible on the map. If the view is queued, waiting to be reused, the value is `nil`. @@ -93,11 +93,11 @@ typedef NS_ENUM(NSUInteger, MGLAnnotationViewDragState) { /** The string that identifies that this annotation view is reusable. - + You specify the reuse identifier when you create the view. You use the identifier later to retrieve an annotation view that was created previously but which is currently unused because its annotation is not on-screen. - + If you define distinctly different types of annotations (with distinctly different annotation views to go with them), you can differentiate between the annotation types by specifying different reuse identifiers for each one. @@ -108,14 +108,14 @@ typedef NS_ENUM(NSUInteger, MGLAnnotationViewDragState) { /** The offset, measured in points, at which to place the center of the view. - + By default, the center point of an annotation view is placed at the geographic coordinate point of the associated annotation. If you do not want the view to be centered, you can use this property to reposition the view. The offset’s `dx` and `dy` values are measured in points. Positive offset values move the annotation view down and to the right, while negative values move it up and to the left. - + Set the offset if the annotation view’s visual center point is somewhere other than the logical center of the view. For example, the view may contain an image that depicts a downward-pointing pushpin or thumbtack, with the tip positioned @@ -128,14 +128,14 @@ typedef NS_ENUM(NSUInteger, MGLAnnotationViewDragState) { A Boolean value that determines whether the annotation view grows and shrinks as the distance between the viewpoint and the annotation view changes on a tilted map. - + When the value of this property is `YES` and the map is tilted, the annotation view appears smaller if it is towards the top of the view (closer to the horizon) and larger if it is towards the bottom of the view (closer to the viewpoint). This is also the behavior of `MGLAnnotationImage` objects. When the value of this property is `NO` or the map’s pitch is zero, the annotation view remains the same size regardless of its position on-screen. - + The default value of this property is `YES`. Set this property to `NO` if the view’s legibility is important. */ @@ -145,15 +145,15 @@ typedef NS_ENUM(NSUInteger, MGLAnnotationViewDragState) { /** A Boolean value indicating whether the annotation view is currently selected. - + You should not set the value of this property directly. If the property is set to `YES`, the annotation view is displaying a callout. - + By default, this property is set to `NO` and becomes `YES` when the user taps the view. Selecting another annotation, whether it is associated with an `MGLAnnotationView` or `MGLAnnotationImage` object, deselects any currently selected view. - + Setting this property changes the view’s appearance to reflect the new value immediately. If you want the change to be animated, use the `-setSelected:animated:` method instead. @@ -162,12 +162,12 @@ typedef NS_ENUM(NSUInteger, MGLAnnotationViewDragState) { /** Sets the selection state of the annotation view with an optional animation. - + You should not call this method directly. A map view calls this method in response to user interactions with the annotation. Subclasses may override this method in order to customize the appearance of the view depending on its selection state. - + @param selected `YES` if the view should display itself as selected; `NO` if it should display itself as unselected. @param animated `YES` if the change in selection state is animated; `NO` if the @@ -177,7 +177,7 @@ typedef NS_ENUM(NSUInteger, MGLAnnotationViewDragState) { /* A Boolean value indicating whether the annotation is enabled. - + The default value of this property is `YES`. If the value of this property is `NO`, the annotation view ignores touch events and cannot be selected. Subclasses may also customize the appearance of the view depending on its @@ -189,12 +189,12 @@ typedef NS_ENUM(NSUInteger, MGLAnnotationViewDragState) { /** A Boolean value indicating whether the annotation view is draggable. - + If this property is set to `YES`, the user can drag the annotation after pressing and holding the view, and the associated annotation object must also implement the `-setCoordinate:` method. The default value of this property is `NO`. - + Setting this property to `YES` lets the map view know that the annotation is always draggable. In other words, you cannot conditionalize drag operations by attempting to stop an operation that has already been initiated; doing so can @@ -205,7 +205,7 @@ typedef NS_ENUM(NSUInteger, MGLAnnotationViewDragState) { /** The current drag state of the annotation view. - + All states are handled automatically when the `draggable` property is set to `YES`. To perform a custom animation in response to a change to this property, override the `-setDragState:animated:` method. @@ -214,7 +214,7 @@ typedef NS_ENUM(NSUInteger, MGLAnnotationViewDragState) { /** Sets the current drag state for the annotation view. - + You can override this method to animate a custom annotation view as the user drags it. As the system detects user actions that would indicate a drag, it calls this method to update the drag state. diff --git a/platform/ios/src/MGLAnnotationView.mm b/platform/ios/src/MGLAnnotationView.mm index d2243bdf23..5b105cde72 100644 --- a/platform/ios/src/MGLAnnotationView.mm +++ b/platform/ios/src/MGLAnnotationView.mm @@ -96,7 +96,7 @@ { center.x += _centerOffset.dx; center.y += _centerOffset.dy; - + super.center = center; [self updateScaleTransformForViewingDistance]; } @@ -122,14 +122,14 @@ // or 75%. The range goes from a maximum of 100% to 0% as the view moves from the top to the bottom // along the y axis of its superview. CGFloat maxScaleReduction = 1.0 - self.center.y / superviewHeight; - + // The pitch intensity represents how much the map view is actually pitched compared to // what is possible. The value will range from 0% (not pitched at all) to 100% (pitched as much // as the map view will allow). The map view's maximum pitch is defined in `mbgl::util::PITCH_MAX`. // Since it is possible for the map view to report a pitch less than 0 due to the nature of // how the gesture information is captured, the value is guarded with MAX. CGFloat pitchIntensity = MAX(self.mapView.camera.pitch, 0) / MGLDegreesFromRadians(mbgl::util::PITCH_MAX); - + // The pitch adjusted scale is the inverse proportion of the maximum possible scale reduction // multiplied by the pitch intensity. For example, if the maximum scale reduction is 75% and the // map view is 50% pitched then the annotation view should be reduced by 37.5% (.75 * .5). The @@ -154,7 +154,7 @@ [self willChangeValueForKey:@"draggable"]; _draggable = draggable; [self didChangeValueForKey:@"draggable"]; - + if (draggable) { [self enableDrag]; @@ -174,7 +174,7 @@ [self addGestureRecognizer:recognizer]; _longPressRecognizer = recognizer; } - + if (!_panGestureRecognizer) { UIPanGestureRecognizer *recognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(handlePan:)]; @@ -232,7 +232,7 @@ [self willChangeValueForKey:@"dragState"]; _dragState = dragState; [self didChangeValueForKey:@"dragState"]; - + if (dragState == MGLAnnotationViewDragStateStarting) { [self.mapView.calloutViewForSelectedAnnotation dismissCalloutAnimated:animated]; @@ -260,7 +260,7 @@ - (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer { BOOL isDragging = self.dragState == MGLAnnotationViewDragStateDragging; - + if (gestureRecognizer == _panGestureRecognizer && !(isDragging)) { return NO; diff --git a/platform/ios/src/MGLCalloutView.h b/platform/ios/src/MGLCalloutView.h index 4dc9a25be4..0481a39680 100644 --- a/platform/ios/src/MGLCalloutView.h +++ b/platform/ios/src/MGLCalloutView.h @@ -79,7 +79,7 @@ NS_ASSUME_NONNULL_BEGIN Returns a Boolean value indicating whether the entire callout view “highlights” when tapped. The default value is `YES`, which means the callout view highlights when tapped. - + The return value of this method is ignored unless the delegate also responds to the `-calloutViewTapped` method. */ diff --git a/platform/ios/src/MGLCompactCalloutView.m b/platform/ios/src/MGLCompactCalloutView.m index 3d2118ca38..e499b7832f 100644 --- a/platform/ios/src/MGLCompactCalloutView.m +++ b/platform/ios/src/MGLCompactCalloutView.m @@ -25,7 +25,7 @@ - (void)setRepresentedObject:(id <MGLAnnotation>)representedObject { _representedObject = representedObject; - + if ([representedObject respondsToSelector:@selector(title)]) { self.title = representedObject.title; diff --git a/platform/ios/src/MGLFaux3DUserLocationAnnotationView.m b/platform/ios/src/MGLFaux3DUserLocationAnnotationView.m index d47722819e..6db9c0db10 100644 --- a/platform/ios/src/MGLFaux3DUserLocationAnnotationView.m +++ b/platform/ios/src/MGLFaux3DUserLocationAnnotationView.m @@ -224,21 +224,21 @@ const CGFloat MGLUserLocationAnnotationArrowSize = MGLUserLocationAnnotationPuck [self updateFrameWithSize:MGLUserLocationAnnotationDotSize]; } - + BOOL showHeadingIndicator = self.mapView.userTrackingMode == MGLUserTrackingModeFollowWithHeading; - + // update heading indicator // if (showHeadingIndicator) { _headingIndicatorLayer.hidden = NO; - + // heading indicator (tinted, semi-circle) // if ( ! _headingIndicatorLayer && self.userLocation.heading.headingAccuracy) { CGFloat headingIndicatorSize = MGLUserLocationAnnotationHaloSize; - + _headingIndicatorLayer = [CALayer layer]; _headingIndicatorLayer.bounds = CGRectMake(0, 0, headingIndicatorSize, headingIndicatorSize); _headingIndicatorLayer.position = CGPointMake(super.bounds.size.width / 2.0, super.bounds.size.height / 2.0); @@ -249,10 +249,10 @@ const CGFloat MGLUserLocationAnnotationArrowSize = MGLUserLocationAnnotationPuck _headingIndicatorLayer.shouldRasterize = YES; _headingIndicatorLayer.rasterizationScale = [UIScreen mainScreen].scale; _headingIndicatorLayer.drawsAsynchronously = YES; - + [self.layer insertSublayer:_headingIndicatorLayer below:_dotBorderLayer]; } - + // heading indicator accuracy mask (fan-shaped) // if ( ! _headingIndicatorMaskLayer && self.userLocation.heading.headingAccuracy) @@ -260,21 +260,21 @@ const CGFloat MGLUserLocationAnnotationArrowSize = MGLUserLocationAnnotationPuck _headingIndicatorMaskLayer = [CAShapeLayer layer]; _headingIndicatorMaskLayer.frame = _headingIndicatorLayer.bounds; _headingIndicatorMaskLayer.path = [[self headingIndicatorClippingMask] CGPath]; - + // apply the mask to the halo-radius-sized gradient layer _headingIndicatorLayer.mask = _headingIndicatorMaskLayer; - + _oldHeadingAccuracy = self.userLocation.heading.headingAccuracy; - + } else if (_oldHeadingAccuracy != self.userLocation.heading.headingAccuracy) { // recalculate the clipping mask based on updated accuracy _headingIndicatorMaskLayer.path = [[self headingIndicatorClippingMask] CGPath]; - + _oldHeadingAccuracy = self.userLocation.heading.headingAccuracy; } - + if (self.userLocation.heading.trueHeading >= 0) { _headingIndicatorLayer.affineTransform = CGAffineTransformRotate(CGAffineTransformIdentity, -MGLRadiansFromDegrees(self.mapView.direction - self.userLocation.heading.trueHeading)); @@ -294,7 +294,7 @@ const CGFloat MGLUserLocationAnnotationArrowSize = MGLUserLocationAnnotationPuck if (_accuracyRingLayer && (_oldZoom != self.mapView.zoomLevel || _oldHorizontalAccuracy != self.userLocation.location.horizontalAccuracy)) { CGFloat accuracyRingSize = [self calculateAccuracyRingSize]; - + // only show the accuracy ring if it won't be obscured by the location dot if (accuracyRingSize > MGLUserLocationAnnotationDotSize + 15) { @@ -341,7 +341,7 @@ const CGFloat MGLUserLocationAnnotationArrowSize = MGLUserLocationAnnotationPuck _accuracyRingLayer.opacity = 0.1; _accuracyRingLayer.shouldRasterize = NO; _accuracyRingLayer.allowsGroupOpacity = NO; - + [self.layer addSublayer:_accuracyRingLayer]; } @@ -396,7 +396,7 @@ const CGFloat MGLUserLocationAnnotationArrowSize = MGLUserLocationAnnotationPuck [self.layer addSublayer:_dotBorderLayer]; } - + // inner dot (pulsing, tinted) // if ( ! _dotLayer) diff --git a/platform/ios/src/MGLLocationManager.m b/platform/ios/src/MGLLocationManager.m index 7a9faf5c8d..d9c3d0e124 100644 --- a/platform/ios/src/MGLLocationManager.m +++ b/platform/ios/src/MGLLocationManager.m @@ -32,7 +32,7 @@ static NSString * const MGLLocationManagerRegionIdentifier = @"MGLLocationManage if ([self isUpdatingLocation]) { return; } - + [self configurePassiveStandardLocationManager]; [self startLocationServices]; } @@ -78,7 +78,7 @@ static NSString * const MGLLocationManagerRegionIdentifier = @"MGLLocationManage self.standardLocationManager.allowsBackgroundLocationUpdates = YES; } } - + [self.standardLocationManager startUpdatingLocation]; self.updatingLocation = YES; if ([self.delegate respondsToSelector:@selector(locationManagerDidStartLocationUpdates:)]) { @@ -91,13 +91,13 @@ static NSString * const MGLLocationManagerRegionIdentifier = @"MGLLocationManage if (self.backgroundLocationServiceTimeoutAllowedDate == nil) { return; } - + if ([UIApplication sharedApplication].applicationState == UIApplicationStateActive || [UIApplication sharedApplication].applicationState == UIApplicationStateInactive ) { [self startBackgroundTimeoutTimer]; return; } - + NSTimeInterval timeIntervalSinceTimeoutAllowed = [[NSDate date] timeIntervalSinceDate:self.backgroundLocationServiceTimeoutAllowedDate]; if (timeIntervalSinceTimeoutAllowed > 0) { [self.standardLocationManager stopUpdatingLocation]; diff --git a/platform/ios/src/MGLMapView.h b/platform/ios/src/MGLMapView.h index 1f2031e055..f1670ec49f 100644 --- a/platform/ios/src/MGLMapView.h +++ b/platform/ios/src/MGLMapView.h @@ -47,11 +47,11 @@ typedef NS_ENUM(NSUInteger, MGLAnnotationVerticalAlignment) { /** An interactive, customizable map view with an interface similar to the one provided by Apple’s MapKit. - + Using `MGLMapView`, you can embed the map inside a view, allow users to manipulate it with standard gestures, animate the map between different viewpoints, and present information in the form of annotations and overlays. - + The map view loads scalable vector tiles that conform to the <a href="https://github.com/mapbox/vector-tile-spec">Mapbox Vector Tile Specification</a>. It styles them with a style that conforms to the @@ -59,26 +59,26 @@ typedef NS_ENUM(NSUInteger, MGLAnnotationVerticalAlignment) { Such styles can be designed in <a href="https://www.mapbox.com/studio/">Mapbox Studio</a> and hosted on mapbox.com. - + A collection of Mapbox-hosted styles is available through the `MGLStyle` class. These basic styles use <a href="https://www.mapbox.com/developers/vector-tiles/mapbox-streets">Mapbox Streets</a> or <a href="https://www.mapbox.com/satellite/">Mapbox Satellite</a> data sources, but you can specify a custom style that makes use of your own data. - + Mapbox-hosted vector tiles and styles require an API access token, which you can obtain from the <a href="https://www.mapbox.com/studio/account/tokens/">Mapbox account page</a>. Access tokens associate requests to Mapbox’s vector tile and style APIs with your Mapbox account. They also deter other developers from using your styles without your permission. - + Adding your own gesture recognizer to `MGLMapView` will block the corresponding gesture recognizer built into `MGLMapView`. To avoid conflicts, define which gesture takes precedence. For example, you can create your own `UITapGestureRecognizer` that will be invoked only if the default `MGLMapView` tap gesture fails: - + ```swift let mapTapGestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(myCustomFunction)) for recognizer in mapView.gestureRecognizers! where recognizer is UITapGestureRecognizer { @@ -86,7 +86,7 @@ typedef NS_ENUM(NSUInteger, MGLAnnotationVerticalAlignment) { } mapView.addGestureRecognizer(mapTapGestureRecognizer) ``` - + @note You are responsible for getting permission to use the map data and for ensuring that your use adheres to the relevant terms of use. @@ -99,7 +99,7 @@ IB_DESIGNABLE /** Initializes and returns a newly allocated map view with the specified frame and the default style. - + @param frame The frame for the view, measured in points. @return An initialized map view. */ @@ -108,7 +108,7 @@ IB_DESIGNABLE /** Initializes and returns a newly allocated map view with the specified frame and style URL. - + @param frame The frame for the view, measured in points. @param styleURL URL of the map style to display. The URL may be a full HTTP or HTTPS URL, a Mapbox URL indicating the style’s map ID @@ -122,7 +122,7 @@ IB_DESIGNABLE /** The receiver’s delegate. - + A map view sends messages to its delegate to notify it of changes to its contents or the viewpoint. The delegate also provides information about annotations displayed on the map, such as the styles to apply to individual @@ -134,17 +134,17 @@ IB_DESIGNABLE /** The style currently displayed in the receiver. - + Unlike the `styleURL` property, this property is set to an object that allows you to manipulate every aspect of the style locally. - + If the style is loading, this property is set to `nil` until the style finishes loading. If the style has failed to load, this property is set to `nil`. Because the style loads asynchronously, you should manipulate it in the `-[MGLMapViewDelegate mapView:didFinishLoadingStyle:]` or `-[MGLMapViewDelegate mapViewDidFinishLoadingMap:]` method. It is not possible to manipulate the style before it has finished loading. - + @note The default styles provided by Mapbox contain sources and layers with identifiers that will change over time. Applications that use APIs that manipulate a style's sources and layers must first set the style URL to an @@ -156,7 +156,7 @@ IB_DESIGNABLE /** URLs of the styles bundled with the library. - + @deprecated Call the relevant class method of `MGLStyle` for the URL of a particular default style. */ @@ -164,14 +164,14 @@ IB_DESIGNABLE /** URL of the style currently displayed in the receiver. - + The URL may be a full HTTP or HTTPS URL, a Mapbox URL indicating the style’s map ID (`mapbox://styles/{user}/{style}`), or a path to a local file relative to the application’s resource path. - + If you set this property to `nil`, the receiver will use the default style and this property will automatically be set to that style’s URL. - + If you want to modify the current style without replacing it outright, or if you want to introspect individual style attributes, use the `style` property. */ @@ -179,12 +179,12 @@ IB_DESIGNABLE /** Reloads the style. - + You do not normally need to call this method. The map view automatically responds to changes in network connectivity by reloading the style. You may need to call this method if you change the access token after a style has loaded but before loading a style associated with a different Mapbox account. - + This method does not bust the cache. Even if the style has recently changed on the server, calling this method does not necessarily ensure that the map view reflects those changes. @@ -199,7 +199,7 @@ IB_DESIGNABLE /** The Mapbox logo, positioned in the lower-left corner. - + @note The Mapbox terms of service, which governs the use of Mapbox-hosted vector tiles and styles, <a href="https://www.mapbox.com/help/mapbox-logo/">requires</a> most Mapbox @@ -208,10 +208,10 @@ IB_DESIGNABLE */ @property (nonatomic, readonly) UIImageView *logoView; -/** +/** A view showing legally required copyright notices and telemetry settings, positioned at the bottom-right of the map view. - + @note The Mapbox terms of service, which governs the use of Mapbox-hosted vector tiles and styles, <a href="https://www.mapbox.com/help/attribution/">requires</a> these @@ -242,16 +242,16 @@ IB_DESIGNABLE /** A Boolean value indicating whether the map may display the user location. - + Setting this property to `YES` causes the map view to use the Core Location framework to find the current location. As long as this property is `YES`, the map view continues to track the user’s location and update it periodically. - + This property does not indicate whether the user’s position is actually visible on the map, only whether the map view is allowed to display it. To determine whether the user’s position is visible, use the `userLocationVisible` property. The default value of this property is `NO`. - + On iOS 8 and above, your app must specify a value for `NSLocationWhenInUseUsageDescription` or `NSLocationAlwaysUsageDescription` in its `Info.plist` to satisfy the requirements of the underlying Core Location @@ -259,10 +259,10 @@ IB_DESIGNABLE */ @property (nonatomic, assign) BOOL showsUserLocation; -/** +/** A Boolean value indicating whether the device’s current location is visible in the map view. - + Use `showsUserLocation` to control the visibility of the on-screen user location annotation. */ @@ -273,10 +273,10 @@ IB_DESIGNABLE */ @property (nonatomic, readonly, nullable) MGLUserLocation *userLocation; -/** +/** The mode used to track the user location. The default value is `MGLUserTrackingModeNone`. - + Changing the value of this property updates the map view with an animated transition. If you don’t want to animate the change, use the `-setUserTrackingMode:animated:` method instead. @@ -285,7 +285,7 @@ IB_DESIGNABLE /** Sets the mode used to track the user location, with an optional transition. - + @param mode The mode used to track the user location. @param animated If `YES`, there is an animated transition from the current viewport to a viewport that results from the change to `mode`. If `NO`, the @@ -298,7 +298,7 @@ IB_DESIGNABLE /** The vertical alignment of the user location annotation within the receiver. The default value is `MGLAnnotationVerticalAlignmentCenter`. - + Changing the value of this property updates the map view with an animated transition. If you don’t want to animate the change, use the `-setUserLocationVerticalAlignment:animated:` method instead. @@ -308,7 +308,7 @@ IB_DESIGNABLE /** Sets the vertical alignment of the user location annotation within the receiver, with an optional transition. - + @param alignment The vertical alignment of the user location annotation. @param animated If `YES`, the user location annotation animates to its new position within the map view. If `NO`, the user location annotation @@ -325,17 +325,17 @@ IB_DESIGNABLE /** The geographic coordinate that is the subject of observation as the user location is being tracked. - + By default, this property is set to an invalid coordinate, indicating that there is no target. In course tracking mode, the target forms one of two foci in the viewport, the other being the user location annotation. Typically, this property is set to a destination or waypoint in a real-time navigation scene. As the user annotation moves toward the target, the map automatically zooms in to fit both foci optimally within the viewport. - + This property has no effect if the `userTrackingMode` property is set to a value other than `MGLUserTrackingModeFollowWithCourse`. - + Changing the value of this property updates the map view with an animated transition. If you don’t want to animate the change, use the `-setTargetCoordinate:animated:` method instead. @@ -345,17 +345,17 @@ IB_DESIGNABLE /** Sets the geographic coordinate that is the subject of observation as the user location is being tracked, with an optional transition animation. - + By default, the target coordinate is set to an invalid coordinate, indicating that there is no target. In course tracking mode, the target forms one of two foci in the viewport, the other being the user location annotation. Typically, the target is set to a destination or waypoint in a real-time navigation scene. As the user annotation moves toward the target, the map automatically zooms in to fit both foci optimally within the viewport. - + This method has no effect if the `userTrackingMode` property is set to a value other than `MGLUserTrackingModeFollowWithCourse`. - + @param targetCoordinate The target coordinate to fit within the viewport. @param animated If `YES`, the map animates to fit the target within the map view. If `NO`, the map fits the target instantaneously. @@ -367,11 +367,11 @@ IB_DESIGNABLE /** A Boolean value that determines whether the user may zoom the map in and out, changing the zoom level. - + When this property is set to `YES`, the default, the user may zoom the map in and out by pinching two fingers or by double tapping, holding, and moving the finger up and down. - + This property controls only user interactions with the map. If you set the value of this property to `NO`, you may still change the map zoom programmatically. @@ -381,10 +381,10 @@ IB_DESIGNABLE /** A Boolean value that determines whether the user may scroll around the map, changing the center coordinate. - + When this property is set to `YES`, the default, the user may scroll the map by dragging or swiping with one finger. - + This property controls only user interactions with the map. If you set the value of this property to `NO`, you may still change the map location programmatically. @@ -394,10 +394,10 @@ IB_DESIGNABLE /** A Boolean value that determines whether the user may rotate the map, changing the direction. - + When this property is set to `YES`, the default, the user may rotate the map by moving two fingers in a circular motion. - + This property controls only user interactions with the map. If you set the value of this property to `NO`, you may still rotate the map programmatically. @@ -407,14 +407,14 @@ IB_DESIGNABLE /** A Boolean value that determines whether the user may change the pitch (tilt) of the map. - + When this property is set to `YES`, the default, the user may tilt the map by vertically dragging two fingers. - + This property controls only user interactions with the map. If you set the value of this property to `NO`, you may still change the pitch of the map programmatically. - + The default value of this property is `YES`. */ @property(nonatomic, getter=isPitchEnabled) BOOL pitchEnabled; @@ -434,10 +434,10 @@ IB_DESIGNABLE /** The geographic coordinate at the center of the map view. - + Changing the value of this property centers the map on the new coordinate without changing the current zoom level. - + Changing the value of this property updates the map view immediately. If you want to animate the change, use the `-setCenterCoordinate:animated:` method instead. @@ -446,10 +446,10 @@ IB_DESIGNABLE /** Changes the center coordinate of the map and optionally animates the change. - + Changing the center coordinate centers the map on the new coordinate without changing the current zoom level. - + @param coordinate The new center coordinate for the map. @param animated Specify `YES` if you want the map view to scroll to the new location or `NO` if you want the map to display the new location @@ -460,7 +460,7 @@ IB_DESIGNABLE /** Changes the center coordinate and zoom level of the map and optionally animates the change. - + @param centerCoordinate The new center coordinate for the map. @param zoomLevel The new zoom level for the map. @param animated Specify `YES` if you want the map view to animate scrolling and @@ -472,7 +472,7 @@ IB_DESIGNABLE /** Changes the center coordinate, zoom level, and direction of the map and optionally animates the change. - + @param centerCoordinate The new center coordinate for the map. @param zoomLevel The new zoom level for the map. @param direction The new direction for the map, measured in degrees relative to @@ -486,7 +486,7 @@ IB_DESIGNABLE /** Changes the center coordinate, zoom level, and direction of the map, calling a completion handler at the end of an optional animation. - + @param centerCoordinate The new center coordinate for the map. @param zoomLevel The new zoom level for the map. @param direction The new direction for the map, measured in degrees relative to @@ -499,13 +499,13 @@ IB_DESIGNABLE - (void)setCenterCoordinate:(CLLocationCoordinate2D)centerCoordinate zoomLevel:(double)zoomLevel direction:(CLLocationDirection)direction animated:(BOOL)animated completionHandler:(nullable void (^)(void))completion; /** The zoom level of the receiver. - + In addition to affecting the visual size and detail of features on the map, the zoom level affects the size of the vector tiles that are loaded. At zoom level 0, each tile covers the entire world map; at zoom level 1, it covers ¼ of the world; at zoom level 2, <sup>1</sup>⁄<sub>16</sub> of the world, and so on. - + Changing the value of this property updates the map view immediately. If you want to animate the change, use the `-setZoomLevel:animated:` method instead. */ @@ -513,10 +513,10 @@ IB_DESIGNABLE /** Changes the zoom level of the map and optionally animates the change. - + Changing the zoom level scales the map without changing the current center coordinate. - + @param zoomLevel The new zoom level for the map. @param animated Specify `YES` if you want the map view to animate the change to the new zoom level or `NO` if you want the map to display the new @@ -550,11 +550,11 @@ IB_DESIGNABLE /** The heading of the map, measured in degrees clockwise from true north. - + The value `0` means that the top edge of the map view corresponds to true north. The value `90` means the top of the map is pointing due east. The value `180` means the top of the map points due south, and so on. - + Changing the value of this property updates the map view immediately. If you want to animate the change, use the `-setDirection:animated:` method instead. */ @@ -562,13 +562,13 @@ IB_DESIGNABLE /** Changes the heading of the map and optionally animates the change. - + @param direction The heading of the map, measured in degrees clockwise from true north. @param animated Specify `YES` if you want the map view to animate the change to the new heading or `NO` if you want the map to display the new heading immediately. - + Changing the heading rotates the map without changing the current center coordinate or zoom level. */ @@ -581,7 +581,7 @@ IB_DESIGNABLE /** Resets the map to the current style’s default viewport. - + If the style doesn’t specify a default viewport, the map resets to a minimum zoom level, a center coordinate of (0, 0), and a northern heading. */ @@ -589,7 +589,7 @@ IB_DESIGNABLE /** The coordinate bounds visible in the receiver’s viewport. - + Changing the value of this property updates the receiver immediately. If you want to animate the change, call `-setVisibleCoordinateBounds:animated:` instead. @@ -599,7 +599,7 @@ IB_DESIGNABLE /** Changes the receiver’s viewport to fit the given coordinate bounds, optionally animating the change. - + @param bounds The bounds that the viewport will show in its entirety. @param animated Specify `YES` to animate the change by smoothly scrolling and zooming or `NO` to immediately display the given bounds. @@ -609,7 +609,7 @@ IB_DESIGNABLE /** Changes the receiver’s viewport to fit the given coordinate bounds and optionally some additional padding on each side. - + @param bounds The bounds that the viewport will show in its entirety. @param insets The minimum padding (in screen points) that will be visible around the given coordinate bounds. @@ -621,7 +621,7 @@ IB_DESIGNABLE /** Changes the receiver’s viewport to fit all of the given coordinates and optionally some additional padding on each side. - + @param coordinates The coordinates that the viewport will show. @param count The number of coordinates. This number must not be greater than the number of elements in `coordinates`. @@ -635,7 +635,7 @@ IB_DESIGNABLE /** Changes the receiver’s viewport to fit all of the given coordinates and optionally some additional padding on each side. - + @param coordinates The coordinates that the viewport will show. @param count The number of coordinates. This number must not be greater than the number of elements in `coordinates`. @@ -686,7 +686,7 @@ IB_DESIGNABLE /** Moves the viewpoint to a different location with respect to the map with an optional transition animation. - + @param camera The new viewpoint. @param animated Specify `YES` if you want the map view to animate the change to the new viewpoint or `NO` if you want the map to display the new viewpoint @@ -697,7 +697,7 @@ IB_DESIGNABLE /** 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 @@ -711,7 +711,7 @@ IB_DESIGNABLE /** 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 @@ -727,10 +727,10 @@ IB_DESIGNABLE 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 path. - + The transition animation seamlessly incorporates zooming and panning to help the user find his or her bearings even after traversing a great distance. - + @param camera The new viewpoint. @param completion The block to execute after the animation finishes. */ @@ -739,10 +739,10 @@ IB_DESIGNABLE /** Moves the viewpoint to a different location using a transition animation that evokes powered flight and an optional transition duration. - + The transition animation seamlessly incorporates zooming and panning to help the user find his or her bearings even after traversing a great distance. - + @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 @@ -755,10 +755,10 @@ IB_DESIGNABLE /** Moves the viewpoint to a different location using a transition animation that evokes powered flight and an optional transition duration and peak altitude. - + The transition animation seamlessly incorporates zooming and panning to help the user find his or her bearings even after traversing a great distance. - + @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 @@ -774,7 +774,7 @@ IB_DESIGNABLE /** Returns the camera that best fits the given coordinate bounds. - + @param bounds The coordinate bounds to fit to the receiver’s viewport. @return A camera object centered on the same location as the coordinate bounds with zoom level as high (close to the ground) as possible while still @@ -786,7 +786,7 @@ IB_DESIGNABLE /** Returns the camera that best fits the given coordinate bounds, optionally with some additional padding on each side. - + @param bounds The coordinate bounds to fit to the receiver’s viewport. @param insets The minimum padding (in screen points) that would be visible around the returned camera object if it were set as the receiver’s camera. @@ -800,17 +800,17 @@ IB_DESIGNABLE /** Returns the point in this view’s coordinate system on which to "anchor" in response to a user-initiated gesture. - + For example, a pinch-to-zoom gesture would anchor the map at the midpoint of the pinch. - + If the `userTrackingMode` property is not `MGLUserTrackingModeNone`, the user annotation is used as the anchor point. - + Subclasses may override this method to provide specialized behavior - for example, anchoring on the map’s center point to provide a "locked" zooming mode. - + @param gesture An anchorable user gesture. @return The point on which to anchor in response to the gesture. */ @@ -819,17 +819,17 @@ IB_DESIGNABLE /** The distance from the edges of the map view’s frame to the edges of the map view’s logical viewport. - + When the value of this property is equal to `UIEdgeInsetsZero`, viewport properties such as `centerCoordinate` assume a viewport that matches the map view’s frame. Otherwise, those properties are inset, excluding part of the frame from the viewport. For instance, if the only the top edge is inset, the map center is effectively shifted downward. - + When the map view’s superview is an instance of `UIViewController` whose `automaticallyAdjustsScrollViewInsets` property is `YES`, the value of this property may be overridden at any time. - + Changing the value of this property updates the map view immediately. If you want to animate the change, use the `-setContentInset:animated:` method instead. @@ -839,17 +839,17 @@ IB_DESIGNABLE /** Sets the distance from the edges of the map view’s frame to the edges of the map view’s logical viewport with an optional transition animation. - + When the value of this property is equal to `UIEdgeInsetsZero`, viewport properties such as `centerCoordinate` assume a viewport that matches the map view’s frame. Otherwise, those properties are inset, excluding part of the frame from the viewport. For instance, if the only the top edge is inset, the map center is effectively shifted downward. - + When the map view’s superview is an instance of `UIViewController` whose `automaticallyAdjustsScrollViewInsets` property is `YES`, the value of this property may be overridden at any time. - + @param contentInset The new values to inset the content by. @param animated Specify `YES` if you want the map view to animate the change to the content inset or `NO` if you want the map to inset the content @@ -862,7 +862,7 @@ IB_DESIGNABLE /** Converts a point in the given view’s coordinate system to a geographic coordinate. - + @param point The point to convert. @param view The view in whose coordinate system the point is expressed. @return The geographic coordinate at the given point. @@ -872,7 +872,7 @@ IB_DESIGNABLE /** Converts a geographic coordinate to a point in the given view’s coordinate system. - + @param coordinate The geographic coordinate to convert. @param view The view in whose coordinate system the returned point should be expressed. If this parameter is `nil`, the returned point is expressed @@ -886,7 +886,7 @@ IB_DESIGNABLE /** Converts a rectangle in the given view’s coordinate system to a geographic bounding box. - + @param rect The rectangle to convert. @param view The view in whose coordinate system the rectangle is expressed. @return The geographic bounding box coextensive with the given rectangle. @@ -896,7 +896,7 @@ IB_DESIGNABLE /** Converts a geographic bounding box to a rectangle in the given view’s coordinate system. - + @param bounds The geographic bounding box to convert. @param view The view in whose coordinate system the returned rectangle should be expressed. If this parameter is `nil`, the returned rectangle is @@ -908,11 +908,11 @@ IB_DESIGNABLE /** Returns the distance spanned by one point in the map view’s coordinate system at the given latitude and current zoom level. - + The distance between points decreases as the latitude approaches the poles. This relationship parallels the relationship between longitudinal coordinates at different latitudes. - + @param latitude The latitude of the geographic coordinate represented by the point. @return The distance in meters spanned by a single point. @@ -925,7 +925,7 @@ IB_DESIGNABLE /** The complete list of annotations associated with the receiver. (read-only) - + The objects in this array must adopt the `MGLAnnotation` protocol. If no annotations are associated with the map view, the value of this property is `nil`. @@ -933,9 +933,9 @@ IB_DESIGNABLE @property (nonatomic, readonly, nullable) NS_ARRAY_OF(id <MGLAnnotation>) *annotations; /** - The complete list of annotations associated with the receiver that are + The complete list of annotations associated with the receiver that are currently visible. - + The objects in this array must adopt the `MGLAnnotation` protocol. If no annotations are associated with the map view or if no annotations associated with the map view are currently visible, the value of this property is `nil`. @@ -944,12 +944,12 @@ IB_DESIGNABLE /** Adds an annotation to the map view. - - @note `MGLMultiPolyline`, `MGLMultiPolygon`, `MGLShapeCollection`, and - `MGLPointCollection` objects cannot be added to the map view at this time. - Any multipoint, multipolyline, multipolygon, shape or point collection + + @note `MGLMultiPolyline`, `MGLMultiPolygon`, `MGLShapeCollection`, and + `MGLPointCollection` objects cannot be added to the map view at this time. + Any multipoint, multipolyline, multipolygon, shape or point collection object that is specified is silently ignored. - + @param annotation The annotation object to add to the receiver. This object must conform to the `MGLAnnotation` protocol. The map view retains the annotation object. */ @@ -957,13 +957,13 @@ IB_DESIGNABLE /** Adds an array of annotations to the map view. - + @note `MGLMultiPolyline`, `MGLMultiPolygon`, and `MGLShapeCollection` objects cannot be added to the map view at this time. Nor can `MGLMultiPoint` objects that are not instances of `MGLPolyline` or `MGLPolygon`. Any multipoint, multipolyline, multipolygon, or shape collection objects that are specified are silently ignored. - + @param annotations An array of annotation objects. Each object in the array must conform to the `MGLAnnotation` protocol. The map view retains each individual annotation object. @@ -972,11 +972,11 @@ IB_DESIGNABLE /** Removes an annotation from the map view, deselecting it if it is selected. - + Removing an annotation object dissociates it from the map view entirely, preventing it from being displayed on the map. Thus you would typically call this method only when you want to hide or delete a given annotation. - + @param annotation The annotation object to remove. This object must conform to the `MGLAnnotation` protocol */ @@ -985,11 +985,11 @@ IB_DESIGNABLE /** Removes an array of annotations from the map view, deselecting any selected annotations in the array. - + Removing annotation objects dissociates them from the map view entirely, preventing them from being displayed on the map. Thus you would typically call this method only when you want to hide or delete the given annotations. - + @param annotations The array of annotation objects to remove. Objects in the array must conform to the `MGLAnnotation` protocol. */ @@ -998,20 +998,20 @@ IB_DESIGNABLE /** Returns an `MGLAnnotationView` if the given annotation is currently associated with a view, otherwise nil. - - @param annotation The annotation associated with the view. + + @param annotation The annotation associated with the view. Annotation must conform to the `MGLAnnotation` protocol. */ - (nullable MGLAnnotationView *)viewForAnnotation:(id <MGLAnnotation>)annotation; /** Returns a reusable annotation image object associated with its identifier. - + For performance reasons, you should generally reuse `MGLAnnotationImage` objects for identical-looking annotations in your map views. Dequeueing saves time and memory during performance-critical operations such as scrolling. - + @param identifier A string identifying the annotation image to be reused. This string is the same one you specify when initially returning the annotation image object using the `-mapView:imageForAnnotation:` method. @@ -1022,12 +1022,12 @@ IB_DESIGNABLE /** Returns a reusable annotation view object associated with its identifier. - + For performance reasons, you should generally reuse `MGLAnnotationView` objects for identical-looking annotations in your map views. Dequeueing saves time and memory during performance-critical operations such as scrolling. - + @param identifier A string identifying the annotation view to be reused. This string is the same one you specify when initially returning the annotation view object using the `-mapView:viewForAnnotation:` method. @@ -1037,12 +1037,12 @@ IB_DESIGNABLE - (nullable __kindof MGLAnnotationView *)dequeueReusableAnnotationViewWithIdentifier:(NSString *)identifier; /** - Returns the list of annotations associated with the receiver that intersect with + Returns the list of annotations associated with the receiver that intersect with the given rectangle. - + @param rect A rectangle expressed in the map view’s coordinate system. @return An array of objects that adopt the `MGLAnnotation` protocol or `nil` if - no annotations associated with the map view are currently visible in the + no annotations associated with the map view are currently visible in the rectangle. */ - (nullable NS_ARRAY_OF(id <MGLAnnotation>) *)visibleAnnotationsInRect:(CGRect)rect; @@ -1051,7 +1051,7 @@ IB_DESIGNABLE /** The currently selected annotations. - + Assigning a new array to this property selects only the first annotation in the array. */ @@ -1059,10 +1059,10 @@ IB_DESIGNABLE /** Selects an annotation and displays a callout view for it. - + If the given annotation is not visible within the current viewport, this method has no effect. - + @param annotation The annotation object to select. @param animated If `YES`, the callout view is animated into position. */ @@ -1070,7 +1070,7 @@ IB_DESIGNABLE /** Deselects an annotation and hides its callout view. - + @param annotation The annotation object to deselect. @param animated If `YES`, the callout view is animated offscreen. */ @@ -1080,18 +1080,18 @@ IB_DESIGNABLE /** Adds a single overlay object to the map. - + To remove an overlay from a map, use the `-removeOverlay:` method. - + @param overlay The overlay object to add. This object must conform to the `MGLOverlay` protocol. */ - (void)addOverlay:(id <MGLOverlay>)overlay; /** Adds an array of overlay objects to the map. - + To remove multiple overlays from a map, use the `-removeOverlays:` method. - + @param overlays An array of objects, each of which must conform to the `MGLOverlay` protocol. */ @@ -1099,19 +1099,19 @@ IB_DESIGNABLE /** Removes a single overlay object from the map. - + If the specified overlay is not currently associated with the map view, this method does nothing. - + @param overlay The overlay object to remove. */ - (void)removeOverlay:(id <MGLOverlay>)overlay; /** Removes one or more overlay objects from the map. - + If a given overlay object is not associated with the map view, it is ignored. - + @param overlays An array of objects, each of which conforms to the `MGLOverlay` protocol. */ @@ -1121,12 +1121,12 @@ IB_DESIGNABLE /** Returns an array of rendered map features that intersect with a given point. - + This method may return features from any of the map’s style layers. To restrict the search to a particular layer or layers, use the `-visibleFeaturesAtPoint:inStyleLayersWithIdentifiers:` method. For more information about searching for map features, see that method’s documentation. - + @param point A point expressed in the map view’s coordinate system. @return An array of objects conforming to the `MGLFeature` protocol that represent features in the sources used by the current style. @@ -1136,13 +1136,13 @@ IB_DESIGNABLE /** Returns an array of rendered map features that intersect with a given point, restricted to the given style layers. - + Each object in the returned array represents a feature rendered by the current style and provides access to attributes specified by the relevant <a href="https://www.mapbox.com/mapbox-gl-style-spec/#sources">tile sources</a>. The returned array includes features specified in vector and GeoJSON tile sources but does not include anything from raster, image, or video sources. - + Only visible features are returned. For example, suppose the current style uses the <a href="https://www.mapbox.com/vector-tiles/mapbox-streets/">Mapbox Streets source</a>, @@ -1155,22 +1155,22 @@ IB_DESIGNABLE other attributes). The dictionary contains only the attributes provided by the tile source; it does not include computed attribute values or rules about how the feature is rendered by the current style. - + The returned array is sorted by z-order, starting with the topmost rendered feature and ending with the bottommost rendered feature. A feature that is rendered multiple times due to wrapping across the antimeridian at low zoom levels is included only once, subject to the caveat that follows. - + Features come from tiled vector data or GeoJSON data that is converted to tiles internally, so feature geometries are clipped at tile boundaries and features may appear duplicated across tiles. For example, suppose the specified point lies along a road that spans the screen. The resulting array includes those parts of the road that lie within the map tile that contain the specified point, even if the road extends into other tiles. - + To find out the layer names in a particular style, view the style in <a href="https://www.mapbox.com/studio/">Mapbox Studio</a>. - + @note Layer identifiers are not guaranteed to exist across styles or different versions of the same style. Applications that use this API must first set the style URL to an explicitly versioned style using a convenience method like @@ -1178,7 +1178,7 @@ IB_DESIGNABLE inspectable in Interface Builder, or a manually constructed `NSURL`. This approach also avoids layer identifer name changes that will occur in the default style’s layers over time. - + @param point A point expressed in the map view’s coordinate system. @param styleLayerIdentifiers A set of strings that correspond to the names of layers defined in the current style. Only the features contained in these @@ -1191,12 +1191,12 @@ IB_DESIGNABLE /** Returns an array of rendered map features that intersect with the given rectangle. - + This method may return features from any of the map’s style layers. To restrict the search to a particular layer or layers, use the `-visibleFeaturesAtPoint:inStyleLayersWithIdentifiers:` method. For more information about searching for map features, see that method’s documentation. - + @param rect A rectangle expressed in the map view’s coordinate system. @return An array of objects conforming to the `MGLFeature` protocol that represent features in the sources used by the current style. @@ -1206,13 +1206,13 @@ IB_DESIGNABLE /** Returns an array of rendered map features that intersect with the given rectangle, restricted to the given style layers. - + Each object in the returned array represents a feature rendered by the current style and provides access to attributes specified by the relevant <a href="https://www.mapbox.com/mapbox-gl-style-spec/#sources">tile sources</a>. The returned array includes features specified in vector and GeoJSON tile sources but does not include anything from raster, image, or video sources. - + Only visible features are returned. For example, suppose the current style uses the <a href="https://www.mapbox.com/vector-tiles/mapbox-streets/">Mapbox Streets source</a>, @@ -1225,12 +1225,12 @@ IB_DESIGNABLE dictionary contains only the attributes provided by the tile source; it does not include computed attribute values or rules about how the feature is rendered by the current style. - + The returned array is sorted by z-order, starting with the topmost rendered feature and ending with the bottommost rendered feature. A feature that is rendered multiple times due to wrapping across the antimeridian at low zoom levels is included only once, subject to the caveat that follows. - + Features come from tiled vector data or GeoJSON data that is converted to tiles internally, so feature geometries are clipped at tile boundaries and features may appear duplicated across tiles. For example, suppose the specified @@ -1238,10 +1238,10 @@ IB_DESIGNABLE includes those parts of the road that lie within the map tiles covering the specified rectangle, even if the road extends into other tiles. The portion of the road within each map tile is included individually. - + To find out the layer names in a particular style, view the style in <a href="https://www.mapbox.com/studio/">Mapbox Studio</a>. - + @note Layer identifiers are not guaranteed to exist across styles or different versions of the same style. Applications that use this API must first set the style URL to an explicitly versioned style using a convenience method like @@ -1249,7 +1249,7 @@ IB_DESIGNABLE inspectable in Interface Builder, or a manually constructed `NSURL`. This approach also avoids layer identifer name changes that will occur in the default style’s layers over time. - + @param rect A rectangle expressed in the map view’s coordinate system. @param styleLayerIdentifiers A set of strings that correspond to the names of layers defined in the current style. Only the features contained in these @@ -1263,7 +1263,7 @@ IB_DESIGNABLE /** The options that determine which debugging aids are shown on the map. - + These options are all disabled by default and should remain disabled in released software for performance and aesthetic reasons. */ diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm index 04e9e9bb4b..35ad583081 100644 --- a/platform/ios/src/MGLMapView.mm +++ b/platform/ios/src/MGLMapView.mm @@ -99,7 +99,7 @@ const double MGLMinimumZoomLevelForUserTracking = 10.5; /// Initial zoom level when entering user tracking mode from a low zoom level. const double MGLDefaultZoomLevelForUserTracking = 14.0; -const NSUInteger MGLTargetFrameInterval = 1; //Target FPS will be 60 divided by this value +const NSUInteger MGLTargetFrameInterval = 1; // Target FPS will be 60 divided by this value /// Tolerance for snapping to true north, measured in degrees in either direction. const CLLocationDirection MGLToleranceForSnappingToNorth = 7; @@ -277,7 +277,7 @@ public: MGLAnnotationTagContextMap _annotationContextsByAnnotationTag; MGLAnnotationObjectTagMap _annotationTagsByAnnotation; - + /// Tag of the selected annotation. If the user location annotation is selected, this ivar is set to `MGLAnnotationTagNotFound`. MGLAnnotationTag _selectedAnnotationTag; @@ -312,7 +312,7 @@ public: BOOL _delegateHasLineWidthsForShapeAnnotations; MGLCompassDirectionFormatter *_accessibilityCompassFormatter; - + NS_ARRAY_OF(MGLAttributionInfo *) *_attributionInfos; } @@ -368,7 +368,7 @@ public: - (void)setStyleURL:(nullable NSURL *)styleURL { if (_isTargetingInterfaceBuilder) return; - + if ( ! styleURL) { styleURL = [MGLStyle streetsStyleURLWithVersion:MGLStyleDefaultVersion]; @@ -1435,9 +1435,9 @@ public: /** Returns the annotation that would be selected by a tap gesture recognizer. - + This is used when a gesture is recognized, and to check if the gesture should be recognized. - + @param singleTap An in progress tap gesture recognizer. @param persist True to remember the cycleable set of annotations. @see annotationTagAtPoint:persistingResults */ @@ -1457,9 +1457,9 @@ public: // Get the tap point within the custom hit test layer. tapPointForUserLocation = [singleTap locationInView:self.userLocationAnnotationView]; } - + CALayer *hitLayer = [self.userLocationAnnotationView.hitTestLayer hitTest:tapPointForUserLocation]; - + if (hitLayer) { if ( ! _userLocationAnnotationIsSelected) @@ -1469,7 +1469,7 @@ public: return nil; } } - + // Handle the case of an offset annotation view by converting the tap point to be the geo location // of the annotation itself that the view represents for (MGLAnnotationView *view in self.annotationContainerView.annotationViews) @@ -1481,7 +1481,7 @@ public: } } } - + MGLAnnotationTag hitAnnotationTag = [self annotationTagAtPoint:tapPoint persistingResults:persist]; if (hitAnnotationTag != MGLAnnotationTagNotFound) { @@ -1492,7 +1492,7 @@ public: return annotation; } } - + return nil; } @@ -1653,7 +1653,7 @@ public: } else if (gestureRecognizer == _singleTapGestureRecognizer) { - //Gesture will be recognized if it could deselect an annotation + // Gesture will be recognized if it could deselect an annotation if(!self.selectedAnnotation) { id<MGLAnnotation>annotation = [self annotationForGestureRecognizer:(UITapGestureRecognizer*)gestureRecognizer persistingResults:NO]; @@ -1738,16 +1738,16 @@ public: cancelButtonTitle:NSLocalizedStringWithDefaultValue(@"CANCEL", nil, nil, @"Cancel", @"") destructiveButtonTitle:nil otherButtonTitles:nil]; - + _attributionInfos = [self.style attributionInfosWithFontSize:[UIFont buttonFontSize] linkColor:nil]; for (MGLAttributionInfo *info in _attributionInfos) { NSString *title = [info.title.string mgl_titleCasedStringWithLocale:[NSLocale currentLocale]]; [self.attributionSheet addButtonWithTitle:title]; } - + [self.attributionSheet addButtonWithTitle:NSLocalizedStringWithDefaultValue(@"TELEMETRY_NAME", nil, nil, @"Mapbox Telemetry", @"Action in attribution sheet")]; - + [self.attributionSheet showFromRect:self.attributionButton.frame inView:self animated:YES]; } @@ -2859,12 +2859,12 @@ public: { return nil; } - + std::vector<MGLAnnotationTag> annotationTags = [self annotationTagsInRect:rect]; if (annotationTags.size()) { NSMutableArray *annotations = [NSMutableArray arrayWithCapacity:annotationTags.size()]; - + for (auto const& annotationTag: annotationTags) { if (!_annotationContextsByAnnotationTag.count(annotationTag)) @@ -2874,10 +2874,10 @@ public: MGLAnnotationContext annotationContext = _annotationContextsByAnnotationTag.at(annotationTag); [annotations addObject:annotationContext.annotation]; } - + return [annotations copy]; } - + return nil; } @@ -2901,7 +2901,7 @@ public: { return MGLAnnotationTagNotFound; } - + return _annotationTagsByAnnotation.at(annotation); } @@ -4577,14 +4577,14 @@ public: MGLAnnotationTag tag = [self annotationTagForAnnotation:self.selectedAnnotation]; MGLAnnotationContext &annotationContext = _annotationContextsByAnnotationTag.at(tag); MGLAnnotationView *annotationView = annotationContext.annotationView; - + CGRect rect = [self positioningRectForCalloutForAnnotationWithTag:tag]; - + if (annotationView) { rect = annotationView.frame; } - + if ( ! CGRectIntersectsRect(rect, self.frame)) { [self deselectAnnotation:self.selectedAnnotation animated:NO]; } @@ -4733,11 +4733,11 @@ public: CGFloat widthAdjustment = self.camera.pitch > 0.0 ? 0.0 : -_largestAnnotationViewSize.width * 2.0; CGFloat heightAdjustment = self.camera.pitch > 0.0 ? 0.0 : -_largestAnnotationViewSize.height * 2.0; CGRect viewPort = CGRectInset(self.bounds, widthAdjustment, heightAdjustment); - + NSArray *visibleAnnotations = [self visibleAnnotationsInRect:viewPort]; NSMutableArray *offscreenAnnotations = [self.annotations mutableCopy]; [offscreenAnnotations removeObjectsInArray:visibleAnnotations]; - + // Update the center of visible annotation views for (id<MGLAnnotation> annotation in visibleAnnotations) { @@ -4792,7 +4792,7 @@ public: NSAssert(annotationTag != MGLAnnotationTagNotFound, @"-visibleAnnotationsInRect: returned unrecognized annotation"); MGLAnnotationContext &annotationContext = _annotationContextsByAnnotationTag.at(annotationTag); UIView *annotationView = annotationContext.annotationView; - + if (annotationView) { CLLocationCoordinate2D coordinate = annotation.coordinate; @@ -4827,27 +4827,27 @@ public: { UIView <MGLCalloutView> *calloutView = self.calloutViewForSelectedAnnotation; id <MGLAnnotation> annotation = calloutView.representedObject; - + BOOL isAnchoredToAnnotation = (calloutView && annotation && [calloutView respondsToSelector:@selector(isAnchoredToAnnotation)] && calloutView.isAnchoredToAnnotation); - + if (isAnchoredToAnnotation) { MGLAnnotationTag tag = [self annotationTagForAnnotation:annotation]; MGLAnnotationContext &annotationContext = _annotationContextsByAnnotationTag.at(tag); MGLAnnotationView *annotationView = annotationContext.annotationView; - + CGRect rect = [self positioningRectForCalloutForAnnotationWithTag:tag]; - + if (annotationView) { rect = annotationView.frame; } - + CGPoint point = CGPointMake(CGRectGetMidX(rect), CGRectGetMinY(rect)); - + if ( ! CGPointEqualToPoint(calloutView.center, point)) { calloutView.center = point; } diff --git a/platform/ios/src/MGLMapViewDelegate.h b/platform/ios/src/MGLMapViewDelegate.h index 09e2465a28..8a57e15f7a 100644 --- a/platform/ios/src/MGLMapViewDelegate.h +++ b/platform/ios/src/MGLMapViewDelegate.h @@ -24,10 +24,10 @@ NS_ASSUME_NONNULL_BEGIN /** Tells the delegate that the viewpoint depicted by the map view is about to change. - + This method is called whenever the currently displayed map camera will start changing for any reason. - + @param mapView The map view whose viewpoint will change. @param animated Whether the change will cause an animated effect on the map. */ @@ -35,14 +35,14 @@ NS_ASSUME_NONNULL_BEGIN /** Tells the delegate that the viewpoint depicted by the map view is changing. - + This method is called as the currently displayed map camera changes as part of an animation, whether due to a user gesture or due to a call to a method such as `-[MGLMapView setCamera:animated:]`. During the animation, this method may be called many times to report updates to the viewpoint. Therefore, your implementation of this method should be as lightweight as possible to avoid affecting performance. - + @param mapView The map view whose viewpoint is changing. */ - (void)mapViewRegionIsChanging:(MGLMapView *)mapView; @@ -50,10 +50,10 @@ NS_ASSUME_NONNULL_BEGIN /** Tells the delegate that the viewpoint depicted by the map view has finished changing. - + This method is called whenever the currently displayed map camera has finished changing, after any calls to `-mapViewRegionIsChanging:` due to animation. - + @param mapView The map view whose viewpoint has changed. @param animated Whether the change caused an animated effect on the map. */ @@ -63,20 +63,20 @@ NS_ASSUME_NONNULL_BEGIN /** Tells the delegate that the map view will begin to load. - + This method is called whenever the map view starts loading, including when a new style has been set and the map must reload. - + @param mapView The map view that is starting to load. */ - (void)mapViewWillStartLoadingMap:(MGLMapView *)mapView; /** Tells the delegate that the map view has finished loading. - + This method is called whenever the map view finishes loading, either after the initial load or after a style change has forced a reload. - + @param mapView The map view that has finished loading. */ - (void)mapViewDidFinishLoadingMap:(MGLMapView *)mapView; @@ -84,11 +84,11 @@ NS_ASSUME_NONNULL_BEGIN /** Tells the delegate that the map view was unable to load data needed for displaying the map. - + This method may be called for a variety of reasons, including a network connection failure or a failure to fetch the style from the server. You can use the given error message to notify the user that map data is unavailable. - + @param mapView The map view that is unable to load the data. @param error The reason the data could not be loaded. */ @@ -102,39 +102,39 @@ NS_ASSUME_NONNULL_BEGIN /** Tells the delegate that the map view is about to redraw. - + This method is called any time the map view needs to redraw due to a change in the viewpoint or style property transition. This method may be called very frequently, even moreso than `-mapViewRegionIsChanging:`. Therefore, your implementation of this method should be as lightweight as possible to avoid affecting performance. - + @param mapView The map view that is about to redraw. */ - (void)mapViewWillStartRenderingFrame:(MGLMapView *)mapView; /** Tells the delegate that the map view has just redrawn. - + This method is called any time the map view needs to redraw due to a change in the viewpoint or style property transition. This method may be called very frequently, even moreso than `-mapViewRegionIsChanging:`. Therefore, your implementation of this method should be as lightweight as possible to avoid affecting performance. - + @param mapView The map view that has just redrawn. */ - (void)mapViewDidFinishRenderingFrame:(MGLMapView *)mapView fullyRendered:(BOOL)fullyRendered; /** Tells the delegate that the map has just finished loading a style. - + This method is called during the initialization of the map view and after any subsequent loading of a new style. This method is called between the `-mapViewWillStartRenderingMap:` and `-mapViewDidFinishRenderingMap:` delegate methods. Changes to sources or layers of the current style do not cause this method to be called. - + This method is the earliest opportunity to modify the layout or appearance of the current style before the map view is displayed to the user. @@ -147,37 +147,37 @@ NS_ASSUME_NONNULL_BEGIN /** Tells the delegate that the map view will begin tracking the user’s location. - + This method is called when the value of the `showsUserLocation` property changes to `YES`. - + @param mapView The map view that is tracking the user’s location. */ - (void)mapViewWillStartLocatingUser:(MGLMapView *)mapView; /** Tells the delegate that the map view has stopped tracking the user’s location. - + This method is called when the value of the `showsUserLocation` property changes to `NO`. - + @param mapView The map view that is tracking the user’s location. */ - (void)mapViewDidStopLocatingUser:(MGLMapView *)mapView; /** Tells the delegate that the location of the user was updated. - + While the `showsUserLocation` property is set to `YES`, this method is called whenever a new location update is received by the map view. This method is also called if the map view’s user tracking mode is set to `MGLUserTrackingModeFollowWithHeading` and the heading changes, or if it is set to `MGLUserTrackingModeFollowWithCourse` and the course changes. - + This method is not called if the application is currently running in the background. If you want to receive location updates while running in the background, you must use the Core Location framework. - + @param mapView The map view that is tracking the user’s location. @param userLocation The location object representing the user’s latest location. This property may be `nil`. @@ -186,7 +186,7 @@ NS_ASSUME_NONNULL_BEGIN /** Tells the delegate that an attempt to locate the user’s position failed. - + @param mapView The map view that is tracking the user’s location. @param error An error object containing the reason why location tracking failed. @@ -195,10 +195,10 @@ NS_ASSUME_NONNULL_BEGIN /** Tells the delegate that the map view’s user tracking mode has changed. - + This method is called after the map view asynchronously changes to reflect the new user tracking mode, for example by beginning to zoom or rotate. - + @param mapView The map view that changed its tracking mode. @param mode The new tracking mode. @param animated Whether the change caused an animated effect on the map. @@ -210,16 +210,16 @@ NS_ASSUME_NONNULL_BEGIN /** Returns an annotation image object to mark the given point annotation object on the map. - + Implement this method to mark a point annotation with a static image. If you want to mark a particular point annotation with an annotation view instead, omit this method or have it return `nil` for that annotation, then implement `-mapView:viewForAnnotation:`. - + Static annotation images use less memory and draw more quickly than annotation views. On the other hand, annotation views are compatible with UIKit, Core Animation, and other Cocoa Touch frameworks. - + @param mapView The map view that requested the annotation image. @param annotation The object representing the annotation that is about to be displayed. @@ -233,7 +233,7 @@ NS_ASSUME_NONNULL_BEGIN A value of `0.0` results in a completely transparent shape. A value of `1.0`, the default, results in a completely opaque shape. - + This method sets the opacity of an entire shape, inclusive of its stroke and fill. To independently set the values for stroke or fill, specify an alpha component in the color returned by `-mapView:strokeColorForShapeAnnotation:` or @@ -247,13 +247,13 @@ NS_ASSUME_NONNULL_BEGIN /** Returns the color to use when rendering the outline of a shape annotation. - + The default stroke color is the map view’s tint color. If a pattern color is specified, the result is undefined. - + Opacity may be set by specifying an alpha component. The default alpha value is `1.0` and results in a completely opaque stroke. - + @param mapView The map view rendering the shape annotation. @param annotation The annotation being rendered. @return A color to use for the shape outline. @@ -262,13 +262,13 @@ NS_ASSUME_NONNULL_BEGIN /** Returns the color to use when rendering the fill of a polygon annotation. - + The default fill color is the map view’s tint color. If a pattern color is specified, the result is undefined. - + Opacity may be set by specifying an alpha component. The default alpha value is `1.0` and results in a completely opaque shape. - + @param mapView The map view rendering the polygon annotation. @param annotation The annotation being rendered. @return The polygon’s interior fill color. @@ -278,9 +278,9 @@ NS_ASSUME_NONNULL_BEGIN /** Returns the line width in points to use when rendering the outline of a polyline annotation. - + By default, the polyline is outlined with a line `3.0` points wide. - + @param mapView The map view rendering the polygon annotation. @param annotation The annotation being rendered. @return A line width for the polyline, measured in points. @@ -291,16 +291,16 @@ NS_ASSUME_NONNULL_BEGIN /** Returns a view object to mark the given point annotation object on the map. - + Implement this method to mark a point annotation with a view object. If you want to mark a particular point annotation with a static image instead, omit this method or have it return `nil` for that annotation, then implement `-mapView:imageForAnnotation:` instead. - + Annotation views are compatible with UIKit, Core Animation, and other Cocoa Touch frameworks. On the other hand, static annotation images use less memory and draw more quickly than annotation views. - + The user location annotation view can also be customized via this method. When `annotation` is an instance of `MGLUserLocation` (or equal to the map view’s `userLocation` property), return an instance of `MGLUserLocationAnnotationView` @@ -317,10 +317,10 @@ NS_ASSUME_NONNULL_BEGIN /** Tells the delegate that one or more annotation views have been added and positioned on the map. - + This method is called just after the views are added to the map. You can implement this method to animate the addition of the annotation views. - + @param mapView The map view to which the annotation views were added. @param annotationViews An array of `MGLAnnotationView` objects representing the views that were added. @@ -331,13 +331,13 @@ NS_ASSUME_NONNULL_BEGIN /** Tells the delegate that one of its annotations was selected. - + You can use this method to track changes in the selection state of annotations. - + If the annotation is associated with an annotation view, you can also implement `-mapView:didSelectAnnotationView:`, which is called immediately after this method is called. - + @param mapView The map view containing the annotation. @param annotation The annotation that was selected. */ @@ -345,13 +345,13 @@ NS_ASSUME_NONNULL_BEGIN /** Tells the delegate that one of its annotations was deselected. - + You can use this method to track changes in the selection state of annotations. - + If the annotation is associated with an annotation view, you can also implement `-mapView:didDeselectAnnotationView:`, which is called immediately after this method is called. - + @param mapView The map view containing the annotation. @param annotation The annotation that was deselected. */ @@ -359,15 +359,15 @@ NS_ASSUME_NONNULL_BEGIN /** Tells the delegate that one of its annotation views was selected. - + You can use this method to track changes in the selection state of annotation views. - + This method is only called for annotation views. To track changes in the selection state of all annotations, including those associated with static annotation images, implement `-mapView:didSelectAnnotation:`, which is called immediately before this method is called. - + @param mapView The map view containing the annotation. @param annotationView The annotation view that was selected. */ @@ -375,15 +375,15 @@ NS_ASSUME_NONNULL_BEGIN /** Tells the delegate that one of its annotation views was deselected. - + You can use this method to track changes in the selection state of annotation views. - + This method is only called for annotation views. To track changes in the selection state of all annotations, including those associated with static annotation images, implement `-mapView:didDeselectAnnotation:`, which is called immediately before this method is called. - + @param mapView The map view containing the annotation. @param annotationView The annotation view that was deselected. */ @@ -394,10 +394,10 @@ NS_ASSUME_NONNULL_BEGIN /** Returns a Boolean value indicating whether the annotation is able to display extra information in a callout bubble. - + This method is called after an annotation is selected, before any callout is displayed for the annotation. - + If the return value is `YES`, a callout view is shown when the user taps on an annotation, selecting it. The default callout displays the annotation’s title and subtitle. You can add accessory views to either end of the callout by @@ -405,11 +405,11 @@ NS_ASSUME_NONNULL_BEGIN `-mapView:rightCalloutAccessoryViewForAnnotation:` methods. You can further customize the callout’s contents by implementing the `-mapView:calloutViewForAnnotation:` method. - + If the return value is `NO`, or if this method is absent from the delegate, or if the annotation lacks a title, the annotation will not show a callout even when selected. - + @param mapView The map view that has selected the annotation. @param annotation The object representing the annotation. @return A Boolean value indicating whether the annotation should show a @@ -419,14 +419,14 @@ NS_ASSUME_NONNULL_BEGIN /** Returns a callout view to display for the given annotation. - + If this method is present in the delegate, it must return a new instance of a view dedicated to display the callout. The returned view will be configured by the map view. - + If this method is absent from the delegate, or if it returns `nil`, a standard, two-line, bubble-like callout view is displayed by default. - + @param mapView The map view that requested the callout view. @param annotation The object representing the annotation. @return A view conforming to the `MGLCalloutView` protocol, or `nil` to use the @@ -436,24 +436,24 @@ NS_ASSUME_NONNULL_BEGIN /** Returns the view to display on the left side of the standard callout bubble. - + The left callout view is typically used to convey information about the annotation or to link to custom information provided by your application. - + If the view you specify is a descendant of the `UIControl` class, you can use the map view’s delegate to receive notifications when your control is tapped, by implementing the `-mapView:annotation:calloutAccessoryControlTapped:` method. If the view you specify does not descend from `UIControl`, your view is responsible for handling any touch events within its bounds. - + If this method is absent from the delegate, or if it returns `nil`, the standard callout view has no accessory view on its left side. The return value of this method is ignored if `-mapView:calloutViewForAnnotation:` is present in the delegate. - + To display a view on the callout’s right side, implement the `-mapView:rightCalloutAccessoryViewForAnnotation:` method. - + @param mapView The map view presenting the annotation callout. @param annotation The object representing the annotation with the callout. @return The accessory view to display. @@ -462,24 +462,24 @@ NS_ASSUME_NONNULL_BEGIN /** Returns the view to display on the right side of the standard callout bubble. - + The right callout view is typically used to convey information about the annotation or to link to custom information provided by your application. - + If the view you specify is a descendant of the `UIControl` class, you can use the map view’s delegate to receive notifications when your control is tapped, by implementing the `-mapView:annotation:calloutAccessoryControlTapped:` method. If the view you specify does not descend from `UIControl`, your view is responsible for handling any touch events within its bounds. - + If this method is absent from the delegate, or if it returns `nil`, the standard callout view has no accessory view on its right side. The return value of this method is ignored if `-mapView:calloutViewForAnnotation:` is present in the delegate. - + To display a view on the callout’s left side, implement the `-mapView:leftCalloutAccessoryViewForAnnotation:` method. - + @param mapView The map view presenting the annotation callout. @param annotation The object representing the annotation with the callout. @return The accessory view to display. @@ -489,7 +489,7 @@ NS_ASSUME_NONNULL_BEGIN /** Tells the delegate that the user tapped one of the accessory controls in the annotation’s callout view. - + In a standard callout view, accessory views contain custom content and are positioned on either side of the annotation title text. If an accessory view you specify is a descendant of the `UIControl` class, the map view calls this @@ -498,13 +498,13 @@ NS_ASSUME_NONNULL_BEGIN For example, if your control displays additional information about the annotation, you could use this method to present a modal panel with that information. - + If your custom accessory views are not descendants of the `UIControl` class, the map view does not call this method. If the annotation has a custom callout view via the `-mapView:calloutViewForAnnotation:` method, you can specify the custom accessory views using the `MGLCalloutView` protocol’s `leftAccessoryView` and `rightAccessoryView` properties. - + @param mapView The map view containing the specified annotation. @param annotation The annotation whose accessory view was tapped. @param control The control that was tapped. @@ -513,17 +513,17 @@ NS_ASSUME_NONNULL_BEGIN /** Tells the delegate that the user tapped on an annotation’s callout view. - + This method is called when the user taps on the body of the callout view, as opposed to the callout’s left or right accessory view. If the annotation has a custom callout view via the `-mapView:calloutViewForAnnotation:` method, this method is only called whenever the callout view calls its delegate’s `-[MGLCalloutViewDelegate calloutViewTapped:]` method. - + If this method is present on the delegate, the standard callout view’s body momentarily highlights when the user taps it, whether or not this method does anything in response to the tap. - + @param mapView The map view containing the specified annotation. @param annotation The annotation whose callout was tapped. */ diff --git a/platform/ios/src/MGLMapboxEvents.m b/platform/ios/src/MGLMapboxEvents.m index 744b80047b..7b28ccf1a8 100644 --- a/platform/ios/src/MGLMapboxEvents.m +++ b/platform/ios/src/MGLMapboxEvents.m @@ -94,12 +94,12 @@ const NSTimeInterval MGLFlushInterval = 180; - (NSString *)sysInfoByName:(char *)typeSpecifier { size_t size; sysctlbyname(typeSpecifier, NULL, &size, NULL, 0); - + char *answer = malloc(size); sysctlbyname(typeSpecifier, answer, &size, NULL, 0); - + NSString *results = [NSString stringWithCString:answer encoding: NSUTF8StringEncoding]; - + free(answer); return results; } @@ -180,11 +180,11 @@ const NSTimeInterval MGLFlushInterval = 180; // Events Control _eventQueue = [[NSMutableArray alloc] init]; - + // Setup Date Format _rfc3339DateFormatter = [[NSDateFormatter alloc] init]; NSLocale *enUSPOSIXLocale = [[NSLocale alloc] initWithLocaleIdentifier:@"en_US_POSIX"]; - + [_rfc3339DateFormatter setLocale:enUSPOSIXLocale]; [_rfc3339DateFormatter setDateFormat:@"yyyy'-'MM'-'dd'T'HH':'mm':'ssZ"]; // Clear Any System TimeZone Cache @@ -201,10 +201,10 @@ const NSTimeInterval MGLFlushInterval = 180; } else { self.canEnableDebugLogging = YES; } - + // Watch for changes to telemetry settings by the user [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(userDefaultsDidChange:) name:NSUserDefaultsDidChangeNotification object:nil]; - + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(pauseOrResumeMetricsCollectionIfRequired) name:UIApplicationDidEnterBackgroundNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(pauseOrResumeMetricsCollectionIfRequired) name:UIApplicationDidBecomeActiveNotification object:nil]; @@ -256,11 +256,11 @@ const NSTimeInterval MGLFlushInterval = 180; - (void)pauseOrResumeMetricsCollectionIfRequired { UIApplication *application = [UIApplication sharedApplication]; - + // Prevent blue status bar when host app has `when in use` permission only and it is not in foreground if ([CLLocationManager authorizationStatus] == kCLAuthorizationStatusAuthorizedWhenInUse && application.applicationState == UIApplicationStateBackground) { - + if (_backgroundTaskIdentifier == UIBackgroundTaskInvalid) { _backgroundTaskIdentifier = [application beginBackgroundTaskWithExpirationHandler:^{ [application endBackgroundTask:_backgroundTaskIdentifier]; @@ -268,11 +268,11 @@ const NSTimeInterval MGLFlushInterval = 180; }]; [self flush]; } - + [self pauseMetricsCollection]; return; } - + // Toggle pause based on current pause state, user opt-out state, and low-power state. BOOL enabled = [[self class] isEnabled]; if (self.paused && enabled) { @@ -287,13 +287,13 @@ const NSTimeInterval MGLFlushInterval = 180; if (self.paused) { return; } - + self.paused = YES; [self.timer invalidate]; self.timer = nil; [self.eventQueue removeAllObjects]; self.data = nil; - + [self.locationManager stopUpdatingLocation]; } @@ -304,7 +304,7 @@ const NSTimeInterval MGLFlushInterval = 180; self.paused = NO; self.data = [[MGLMapboxEventsData alloc] init]; - + [self.locationManager startUpdatingLocation]; } @@ -316,24 +316,24 @@ const NSTimeInterval MGLFlushInterval = 180; if ([MGLAccountManager accessToken] == nil) { return; } - + if ([self.eventQueue count] <= 1) { [self.eventQueue removeAllObjects]; [[UIApplication sharedApplication] endBackgroundTask:_backgroundTaskIdentifier]; _backgroundTaskIdentifier = UIBackgroundTaskInvalid; return; } - + NSArray *events = [NSArray arrayWithArray:self.eventQueue]; [self.eventQueue removeAllObjects]; - + [self postEvents:events]; - + if (self.timer) { [self.timer invalidate]; self.timer = nil; } - + [self pushDebugEvent:MGLEventTypeLocalDebug withAttributes:@{MGLEventKeyLocalDebugDescription:@"flush"}]; } @@ -341,21 +341,21 @@ const NSTimeInterval MGLFlushInterval = 180; if (self.nextTurnstileSendDate && [[NSDate date] timeIntervalSinceDate:self.nextTurnstileSendDate] < 0) { return; } - + NSString *vendorID = [[[UIDevice currentDevice] identifierForVendor] UUIDString]; if (!vendorID) { return; } - + NSDictionary *turnstileEventAttributes = @{MGLEventKeyEvent: MGLEventTypeAppUserTurnstile, MGLEventKeyCreated: [self.rfc3339DateFormatter stringFromDate:[NSDate date]], MGLEventKeyVendorID: vendorID, MGLEventKeyEnabledTelemetry: @([[self class] isEnabled])}; - + if ([MGLAccountManager accessToken] == nil) { return; } - + __weak __typeof__(self) weakSelf = self; [self.apiClient postEvent:turnstileEventAttributes completionHandler:^(NSError * _Nullable error) { __strong __typeof__(weakSelf) strongSelf = weakSelf; @@ -375,7 +375,7 @@ const NSTimeInterval MGLFlushInterval = 180; NSDateComponents *dayComponent = [[NSDateComponents alloc] init]; dayComponent.day = 1; NSDate *sometimeTomorrow = [calendar dateByAddingComponents:dayComponent toDate:[NSDate date] options:0]; - + // Find the start of tomorrow and use that as the next turnstile send date. The effect of this is that // turnstile events can be sent as much as once per calendar day and always at the start of a session // when a map load happens. @@ -392,15 +392,15 @@ const NSTimeInterval MGLFlushInterval = 180; if (!event) { return; } - + if ([event isEqualToString:MGLEventTypeMapLoad]) { [self pushTurnstileEvent]; } - + if (self.paused) { return; } - + MGLMapboxEventAttributes *fullyFormedEvent = [self fullyFormedEventForEvent:event withAttributes:attributeDictionary]; if (fullyFormedEvent) { [self.eventQueue addObject:fullyFormedEvent]; @@ -497,7 +497,7 @@ const NSTimeInterval MGLFlushInterval = 180; if (self.paused) { return; } - + __weak __typeof__(self) weakSelf = self; dispatch_async(self.serialQueue, ^{ __strong __typeof__(weakSelf) strongSelf = weakSelf; @@ -553,7 +553,7 @@ const NSTimeInterval MGLFlushInterval = 180; result = @"Default - Unknown"; break; } - + return result; } @@ -572,9 +572,9 @@ const NSTimeInterval MGLFlushInterval = 180; - (NSInteger)contentSizeScale { NSInteger result = -9999; - + NSString *sc = [UIApplication sharedApplication].preferredContentSizeCategory; - + if ([sc isEqualToString:UIContentSizeCategoryExtraSmall]) { result = -3; } else if ([sc isEqualToString:UIContentSizeCategorySmall]) { @@ -600,7 +600,7 @@ const NSTimeInterval MGLFlushInterval = 180; } else if ([sc isEqualToString:UIContentSizeCategoryAccessibilityExtraExtraExtraLarge]) { result = 13; } - + return result; } @@ -675,18 +675,18 @@ const NSTimeInterval MGLFlushInterval = 180; if (![self debugLoggingEnabled]) { return; } - + if (!event) { return; } - + MGLMutableMapboxEventAttributes *evt = [MGLMutableMapboxEventAttributes dictionaryWithDictionary:attributeDictionary]; [evt setObject:event forKey:@"event"]; [evt setObject:[self.rfc3339DateFormatter stringFromDate:[NSDate date]] forKey:@"created"]; [evt setValue:[self applicationState] forKey:@"applicationState"]; [evt setValue:@([[self class] isEnabled]) forKey:@"telemetryEnabled"]; [evt setObject:self.instanceID forKey:@"instance"]; - + MGLMapboxEventAttributes *finalEvent = [NSDictionary dictionaryWithDictionary:evt]; [self writeEventToLocalDebugLog:finalEvent]; } @@ -713,12 +713,12 @@ const NSTimeInterval MGLFlushInterval = 180; dispatch_async(self.debugLogSerialQueue, ^{ if ([NSJSONSerialization isValidJSONObject:event]) { NSData *jsonData = [NSJSONSerialization dataWithJSONObject:event options:NSJSONWritingPrettyPrinted error:nil]; - + NSString *jsonString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding]; jsonString = [jsonString stringByAppendingString:@",\n"]; - + NSString *logFilePath = [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) firstObject] stringByAppendingPathComponent:[NSString stringWithFormat:@"telemetry_log-%@.json", self.dateForDebugLogFile]]; - + NSFileManager *fileManager = [[NSFileManager alloc] init]; if ([fileManager fileExistsAtPath:logFilePath]) { NSFileHandle *fileHandle = [NSFileHandle fileHandleForWritingAtPath:logFilePath]; @@ -780,7 +780,7 @@ const NSTimeInterval MGLFlushInterval = 180; if (mobileProvision[@"ProvisionedDevices"] && [mobileProvision[@"ProvisionedDevices"] count]) { return NO; // development or ad-hoc } - + return YES; // expected development/enterprise/ad-hoc entitlements not found #endif } diff --git a/platform/ios/src/MGLUserLocation.h b/platform/ios/src/MGLUserLocation.h index 1a27d31dd4..c41c3ee7fd 100644 --- a/platform/ios/src/MGLUserLocation.h +++ b/platform/ios/src/MGLUserLocation.h @@ -23,7 +23,7 @@ NS_ASSUME_NONNULL_BEGIN */ @property (nonatomic, readonly, nullable) CLLocation *location; -/** +/** A Boolean value indicating whether the user’s location is currently being updated. (read-only) */ @@ -31,8 +31,8 @@ NS_ASSUME_NONNULL_BEGIN /** The heading of the user location. (read-only) - - This property is `nil` if the user location tracking mode is not + + This property is `nil` if the user location tracking mode is not `MGLUserTrackingModeFollowWithHeading`. */ @property (nonatomic, readonly, nullable) CLHeading *heading; diff --git a/platform/ios/src/MGLUserLocation.m b/platform/ios/src/MGLUserLocation.m index 97e3f740fc..1c9649c09e 100644 --- a/platform/ios/src/MGLUserLocation.m +++ b/platform/ios/src/MGLUserLocation.m @@ -48,7 +48,7 @@ NS_ASSUME_NONNULL_END - (BOOL)isEqual:(id)other { if (self == other) return YES; if (![other isKindOfClass:[MGLUserLocation class]]) return NO; - + MGLUserLocation *otherUserLocation = other; return ((!self.location && !otherUserLocation.location) || [self.location distanceFromLocation:otherUserLocation.location] == 0) && ((!self.title && !otherUserLocation.title) || [self.title isEqualToString:otherUserLocation.title]) diff --git a/platform/ios/src/MGLUserLocationAnnotationView.h b/platform/ios/src/MGLUserLocationAnnotationView.h index bef18e9544..4b36236b8d 100644 --- a/platform/ios/src/MGLUserLocationAnnotationView.h +++ b/platform/ios/src/MGLUserLocationAnnotationView.h @@ -13,14 +13,14 @@ NS_ASSUME_NONNULL_BEGIN /** Returns the associated map view. - + The value of this property is nil during initialization. */ @property (nonatomic, readonly, weak, nullable) MGLMapView *mapView; - + /** Returns the annotation object indicating the user’s current location. - + The value of this property is nil during initialization and while user tracking is inactive. */ @@ -28,7 +28,7 @@ NS_ASSUME_NONNULL_BEGIN /** Returns the layer that should be used for annotation selection hit testing. - + The default value of this property is the presentation layer of the view’s Core Animation layer. When subclassing, you may override this property to specify a different layer to be used for hit testing. This can be useful when you wish to diff --git a/platform/ios/src/MGLUserLocationAnnotationView.m b/platform/ios/src/MGLUserLocationAnnotationView.m index 3b8d976140..9795565050 100644 --- a/platform/ios/src/MGLUserLocationAnnotationView.m +++ b/platform/ios/src/MGLUserLocationAnnotationView.m @@ -22,12 +22,12 @@ { self = [super initWithFrame:frame]; if (self == nil) return nil; - + self.accessibilityTraits = UIAccessibilityTraitButton | UIAccessibilityTraitAdjustable | UIAccessibilityTraitUpdatesFrequently; - + _accessibilityCoordinateFormatter = [[MGLCoordinateFormatter alloc] init]; _accessibilityCoordinateFormatter.unitStyle = NSFormattingUnitStyleLong; - + return self; } @@ -57,13 +57,13 @@ { return self.userLocation.subtitle; } - + // Each arcminute of longitude is at most about 1 nmi, too small for low zoom levels. // Each arcsecond of longitude is at most about 30 m, too small for all but the very highest of zoom levels. double zoomLevel = self.mapView.zoomLevel; _accessibilityCoordinateFormatter.allowsMinutes = zoomLevel > 8; _accessibilityCoordinateFormatter.allowsSeconds = zoomLevel > 20; - + return [_accessibilityCoordinateFormatter stringFromCoordinate:self.mapView.centerCoordinate]; } diff --git a/platform/ios/test/MGLAnnotationViewTests.m b/platform/ios/test/MGLAnnotationViewTests.m index 59f6956a95..212de9a405 100644 --- a/platform/ios/test/MGLAnnotationViewTests.m +++ b/platform/ios/test/MGLAnnotationViewTests.m @@ -74,7 +74,7 @@ static NSString * const MGLTestAnnotationReuseIdentifer = @"MGLTestAnnotationReu XCTAssertTrue(testCalloutView.didCallDismissCalloutAnimated, @"callout view was not dismissed"); [_mapView removeAnnotation:_annotationView.annotation]; - + XCTAssert(_mapView.annotations.count == 0, @"number of annotations should be 0"); XCTAssertNil(_annotationView.annotation, @"annotation property should be nil"); } @@ -82,14 +82,14 @@ static NSString * const MGLTestAnnotationReuseIdentifer = @"MGLTestAnnotationReu - (MGLAnnotationView *)mapView:(MGLMapView *)mapView viewForAnnotation:(id<MGLAnnotation>)annotation { MGLAnnotationView *annotationView = [mapView dequeueReusableAnnotationViewWithIdentifier:MGLTestAnnotationReuseIdentifer]; - + if (!annotationView) { annotationView = [[MGLAnnotationView alloc] initWithReuseIdentifier:MGLTestAnnotationReuseIdentifer]; } - + _annotationView = annotationView; - + return annotationView; } diff --git a/platform/ios/test/MGLNSDataAdditionsTests.m b/platform/ios/test/MGLNSDataAdditionsTests.m index b01db25812..8d145be4a0 100644 --- a/platform/ios/test/MGLNSDataAdditionsTests.m +++ b/platform/ios/test/MGLNSDataAdditionsTests.m @@ -10,28 +10,28 @@ - (void)testCompressDecompress { NSArray *originalArray = [self mockDataWithCount:180]; - + NSData *originalData = [NSJSONSerialization dataWithJSONObject:originalArray options:0 error:nil]; - + NSData *compressedData = [originalData mgl_compressedData]; NSData *decompressedData = [compressedData mgl_decompressedData]; - + NSArray *decompressedArray = [NSJSONSerialization JSONObjectWithData:decompressedData options:0 error:nil]; - + XCTAssertTrue([originalArray isEqualToArray:decompressedArray], @"originalArray and decompressedArray should be equal"); } - (NSArray *)mockDataWithCount:(NSUInteger)count { NSMutableArray *array = [NSMutableArray array]; - + for (NSUInteger i=0;i<count;i++) { [array addObject:@{@"lat": @([self safeValueBetween:-90 and:90]), @"lng": @([self safeValueBetween:-180 and:180]), @"timestamp": @((floor([NSDate date].timeIntervalSince1970) * 100) / 100)}]; } - + return array; } diff --git a/platform/ios/test/MGLSourceTests.m b/platform/ios/test/MGLSourceTests.m index 90ec4e3a0b..2e4942cbe9 100644 --- a/platform/ios/test/MGLSourceTests.m +++ b/platform/ios/test/MGLSourceTests.m @@ -9,9 +9,9 @@ - (void)testDuplicateSources { MGLVectorSource *source1 = [[MGLVectorSource alloc] initWithIdentifier:@"my-source" URL:[NSURL URLWithString:@"mapbox://mapbox.mapbox-terrain-v2"]]; MGLVectorSource *source2 = [[MGLVectorSource alloc] initWithIdentifier:@"my-source" URL:[NSURL URLWithString:@"mapbox://mapbox.mapbox-terrain-v2"]]; - + [self.mapView.style addSource: source1]; - + @try { [self.mapView.style addSource: source2]; XCTFail(@"Should not have reached this point"); diff --git a/platform/ios/uitest/MapViewTests.m b/platform/ios/uitest/MapViewTests.m index 21310b47a6..3ed8c840f4 100644 --- a/platform/ios/uitest/MapViewTests.m +++ b/platform/ios/uitest/MapViewTests.m @@ -155,7 +155,7 @@ XCTAssertEqualObjects(MGLStringFromCoordinateBounds(initialBounds), MGLStringFromCoordinateBounds(tester.mapView.visibleCoordinateBounds), @"setting visible coordinate bounds to currently visible coordinate bounds should be a no-op"); - + // Roundtrip after zooming tester.mapView.zoomLevel -= 3; [tester.mapView setVisibleCoordinateBounds:initialBounds animated:NO]; @@ -171,7 +171,7 @@ @"after zooming in, setting visible coordinate bounds back to %@ should not leave them at %@", MGLStringFromCoordinateBounds(initialBounds), MGLStringFromCoordinateBounds(tester.mapView.visibleCoordinateBounds)); - + // Roundtrip after panning MGLCoordinateBounds offsetBounds = MGLCoordinateBoundsOffset(initialBounds, MGLCoordinateSpanMake(0, 30)); [tester.mapView setVisibleCoordinateBounds:offsetBounds animated:NO]; @@ -181,7 +181,7 @@ @"after panning 30° to the east, setting visible coordinate bounds back to %@ should not leave them at %@", MGLStringFromCoordinateBounds(initialBounds), MGLStringFromCoordinateBounds(tester.mapView.visibleCoordinateBounds)); - + // Inscribed shapes with rotation tester.mapView.direction = 45; // https://en.wikipedia.org/wiki/Boundary_Markers_of_the_Original_District_of_Columbia @@ -220,7 +220,7 @@ - (void)testSetCenterCancelsTransitions { XCTestExpectation *cameraIsInDCExpectation = [self expectationWithDescription:@"camera reset to DC"]; - + CLLocationCoordinate2D dc = CLLocationCoordinate2DMake(38.894368, -77.036487); CLLocationCoordinate2D dc_west = CLLocationCoordinate2DMake(38.894368, -77.076487); [tester.mapView setCenterCoordinate:dc animated:NO]; @@ -239,7 +239,7 @@ @"setting center coordinate should cancel transitions"); [cameraIsInDCExpectation fulfill]; }); - + [self waitForExpectationsWithTimeout:1.0 handler:nil]; } @@ -276,13 +276,13 @@ - (void)testRotateCounterclockwise { CLLocationDirection startAngle = tester.mapView.direction; - + XCTAssertNotEqual(startAngle, -45, @"start angle must not be destination angle"); - + [tester.mapView twoFingerRotateAtPoint:tester.mapView.center angle:-45]; - + XCTAssertGreaterThanOrEqual(fabs(startAngle - tester.mapView.direction), 20, @"rotating map should change angle"); @@ -419,20 +419,20 @@ - (void)testInsetMapView { [tester.viewController insetMapView]; [tester waitForAnimationsToFinish]; - + UIView *logoBug = (UIView *)[tester waitForViewWithAccessibilityLabel:@"Mapbox"]; UIView *attributionButton = (UIView *)[tester waitForViewWithAccessibilityLabel:@"About this map"]; - + CGRect mapViewFrame = [tester.mapView.superview convertRect:tester.mapView.frame toView:nil]; - + CGRect logoBugFrame = [logoBug.superview convertRect:logoBug.frame toView:nil]; XCTAssertTrue(CGRectIntersectsRect(logoBugFrame, mapViewFrame), @"logo bug should lie inside shrunken map view"); - + CGRect attributionButtonFrame = [attributionButton.superview convertRect:attributionButton.frame toView:nil]; XCTAssertTrue(CGRectIntersectsRect(attributionButtonFrame, mapViewFrame), @"attribution button should lie inside shrunken map view"); - + CGRect compassFrame = [tester.compass.superview convertRect:tester.compass.frame toView:nil]; XCTAssertTrue(CGRectIntersectsRect(compassFrame, mapViewFrame), @"compass should lie inside shrunken map view"); diff --git a/platform/ios/uitest/OCMock/OCMock/OCMArg.h b/platform/ios/uitest/OCMock/OCMock/OCMArg.h index d53437cb7d..2b5f9c7a4e 100644 --- a/platform/ios/uitest/OCMock/OCMock/OCMArg.h +++ b/platform/ios/uitest/OCMock/OCMock/OCMArg.h @@ -16,7 +16,7 @@ #import <Foundation/Foundation.h> -@interface OCMArg : NSObject +@interface OCMArg : NSObject // constraining arguments diff --git a/platform/ios/uitest/OCMock/OCMock/OCMConstraint.h b/platform/ios/uitest/OCMock/OCMock/OCMConstraint.h index 777966ab7d..25aa8bf497 100644 --- a/platform/ios/uitest/OCMock/OCMock/OCMConstraint.h +++ b/platform/ios/uitest/OCMock/OCMock/OCMConstraint.h @@ -17,7 +17,7 @@ #import <Foundation/Foundation.h> -@interface OCMConstraint : NSObject +@interface OCMConstraint : NSObject + (instancetype)constraint; - (BOOL)evaluate:(id)value; diff --git a/platform/ios/vendor/Fabric/Fabric+FABKits.h b/platform/ios/vendor/Fabric/Fabric+FABKits.h index 05e9630210..bb576ab061 100644 --- a/platform/ios/vendor/Fabric/Fabric+FABKits.h +++ b/platform/ios/vendor/Fabric/Fabric+FABKits.h @@ -15,7 +15,7 @@ * The configuration information is parsed from the application's Info.plist. This * method is primarily intended to be used by kits to retrieve their configuration. * - * @param kitClass The class of the kit whose configuration should be returned. + * @param kitClass The class of the kit whose configuration should be returned. * It should conform to the FABKit protocol. * * @return A dictionary containing kit specific configuration information or nil if none exists. diff --git a/platform/macos/app/AppDelegate.m b/platform/macos/app/AppDelegate.m index 44f87092c9..5b848cc79b 100644 --- a/platform/macos/app/AppDelegate.m +++ b/platform/macos/app/AppDelegate.m @@ -20,10 +20,10 @@ NSString * const MGLLastMapDebugMaskDefaultsKey = @"MGLLastMapDebugMask"; switch (self.state) { case MGLOfflinePackStateComplete: return [NSImage imageNamed:@"NSMenuOnStateTemplate"]; - + case MGLOfflinePackStateActive: return [NSImage imageNamed:@"NSFollowLinkFreestandingTemplate"]; - + default: return nil; } @@ -104,7 +104,7 @@ NSString * const MGLLastMapDebugMaskDefaultsKey = @"MGLLastMapDebugMask"; andSelector:@selector(handleGetURLEvent:withReplyEvent:) forEventClass:kInternetEventClass andEventID:kAEGetURL]; - + if (![[NSUserDefaults standardUserDefaults] boolForKey:@"NSQuitAlwaysKeepsWindows"]) { NSData *cameraData = [[NSUserDefaults standardUserDefaults] objectForKey:MGLLastMapCameraDefaultsKey]; if (cameraData) { @@ -130,7 +130,7 @@ NSString * const MGLLastMapDebugMaskDefaultsKey = @"MGLLastMapDebugMask"; [alert runModal]; [self showPreferences:nil]; } - + [self.offlinePacksArrayController bind:@"content" toObject:[MGLOfflineStorage sharedOfflineStorage] withKeyPath:@"packs" options:nil]; } @@ -148,7 +148,7 @@ NSString * const MGLLastMapDebugMaskDefaultsKey = @"MGLLastMapDebugMask"; [[NSUserDefaults standardUserDefaults] setInteger:mapView.debugMask forKey:MGLLastMapDebugMaskDefaultsKey]; } } - + [self.offlinePacksArrayController unbind:@"content"]; } @@ -164,16 +164,16 @@ NSString * const MGLLastMapDebugMaskDefaultsKey = @"MGLLastMapDebugMask"; params[parts[0]] = [parts[1] stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; } } - + MGLMapCamera *camera = [MGLMapCamera camera]; NSString *zoomLevelString = params[@"zoom"]; self.pendingZoomLevel = zoomLevelString.length ? zoomLevelString.doubleValue : -1; - + NSString *directionString = params[@"bearing"]; if (directionString.length) { camera.heading = directionString.doubleValue; } - + NSString *centerString = params[@"center"]; if (centerString) { NSArray *coordinateValues = [centerString componentsSeparatedByString:@","]; @@ -182,12 +182,12 @@ NSString * const MGLLastMapDebugMaskDefaultsKey = @"MGLLastMapDebugMask"; [coordinateValues[1] doubleValue]); } } - + NSString *pitchString = params[@"pitch"]; if (pitchString.length) { camera.pitch = pitchString.doubleValue; } - + self.pendingCamera = camera; [[NSDocumentController sharedDocumentController] openUntitledDocumentAndDisplay:YES error:NULL]; } @@ -196,7 +196,7 @@ NSString * const MGLLastMapDebugMaskDefaultsKey = @"MGLLastMapDebugMask"; - (IBAction)showOfflinePacksPanel:(id)sender { [self.offlinePacksPanel makeKeyAndOrderFront:sender]; - + for (MGLOfflinePack *pack in self.offlinePacksArrayController.arrangedObjects) { [pack requestProgress]; } @@ -226,15 +226,15 @@ NSString * const MGLLastMapDebugMaskDefaultsKey = @"MGLLastMapDebugMask"; } break; } - + case MGLOfflinePackStateInactive: [pack resume]; break; - + case MGLOfflinePackStateActive: [pack suspend]; break; - + default: break; } diff --git a/platform/macos/app/DroppedPinAnnotation.m b/platform/macos/app/DroppedPinAnnotation.m index 5b19fd7401..d7bd4068dc 100644 --- a/platform/macos/app/DroppedPinAnnotation.m +++ b/platform/macos/app/DroppedPinAnnotation.m @@ -11,7 +11,7 @@ static MGLCoordinateFormatter *DroppedPinCoordinateFormatter; NSTimer *_timer; NSTimeInterval _priorShownTimeInterval; NSDate *_dateShown; - + NSValueTransformer *_timeIntervalTransformer; } diff --git a/platform/macos/app/LimeGreenStyleLayer.m b/platform/macos/app/LimeGreenStyleLayer.m index 0d2e642db9..40c336cd98 100644 --- a/platform/macos/app/LimeGreenStyleLayer.m +++ b/platform/macos/app/LimeGreenStyleLayer.m @@ -14,11 +14,11 @@ - (void)didMoveToMapView:(MGLMapView *)mapView { static const GLchar *vertexShaderSource = "attribute vec2 a_pos; void main() { gl_Position = vec4(a_pos, 0, 1); }"; static const GLchar *fragmentShaderSource = "void main() { gl_FragColor = vec4(0, 1, 0, 1); }"; - + _program = glCreateProgram(); _vertexShader = glCreateShader(GL_VERTEX_SHADER); _fragmentShader = glCreateShader(GL_FRAGMENT_SHADER); - + glShaderSource(_vertexShader, 1, &vertexShaderSource, NULL); glCompileShader(_vertexShader); glAttachShader(_program, _vertexShader); @@ -27,7 +27,7 @@ glAttachShader(_program, _fragmentShader); glLinkProgram(_program); _aPos = glGetAttribLocation(_program, "a_pos"); - + GLfloat background[] = { -1,-1, 1,-1, -1,1, 1,1 }; glGenBuffers(1, &_buffer); glBindBuffer(GL_ARRAY_BUFFER, _buffer); @@ -48,7 +48,7 @@ if (!_program) { return; } - + glDeleteBuffers(1, &_buffer); glDetachShader(_program, _vertexShader); glDetachShader(_program, _fragmentShader); diff --git a/platform/macos/app/MGLVectorSource+MBXAdditions.m b/platform/macos/app/MGLVectorSource+MBXAdditions.m index f59b72aa9f..644b43a651 100644 --- a/platform/macos/app/MGLVectorSource+MBXAdditions.m +++ b/platform/macos/app/MGLVectorSource+MBXAdditions.m @@ -35,7 +35,7 @@ if (!self.mapboxStreets) { return @{}; } - + // Replace {name} and {name_*} with the matching localized name tag. NSString *localizedKey = preferredLanguage ? [NSString stringWithFormat:@"name_%@", preferredLanguage] : @"name"; NSMutableDictionary *localizedKeysByKey = [NSMutableDictionary dictionaryWithObject:localizedKey forKey:@"name"]; diff --git a/platform/macos/app/MapDocument.m b/platform/macos/app/MapDocument.m index 40fd9e4600..225bb4d3af 100644 --- a/platform/macos/app/MapDocument.m +++ b/platform/macos/app/MapDocument.m @@ -40,7 +40,7 @@ NS_ARRAY_OF(id <MGLAnnotation>) *MBXFlattenedShapes(NS_ARRAY_OF(id <MGLAnnotatio } else if ([shape isKindOfClass:[MGLShapeCollection class]]) { subshapes = MBXFlattenedShapes([(MGLShapeCollection *)shape shapes]); } - + if (subshapes) { [flattenedShapes addObjectsFromArray:subshapes]; } else { @@ -63,11 +63,11 @@ NS_ARRAY_OF(id <MGLAnnotation>) *MBXFlattenedShapes(NS_ARRAY_OF(id <MGLAnnotatio /// Style URL inherited from an existing document at the time this document /// was created. NSURL *_inheritedStyleURL; - + NSPoint _mouseLocationForMapViewContextMenu; NSUInteger _droppedPinCounter; NSNumberFormatter *_spellOutNumberFormatter; - + BOOL _isLocalizingLabels; BOOL _showsToolTipsOnDroppedPins; BOOL _randomizesCursorsOnDroppedPins; @@ -95,19 +95,19 @@ NS_ARRAY_OF(id <MGLAnnotation>) *MBXFlattenedShapes(NS_ARRAY_OF(id <MGLAnnotatio - (void)windowControllerDidLoadNib:(NSWindowController *)controller { [super windowControllerDidLoadNib:controller]; - + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(userDefaultsDidChange:) name:NSUserDefaultsDidChangeNotification object:nil]; - + _spellOutNumberFormatter = [[NSNumberFormatter alloc] init]; - + NSPressGestureRecognizer *pressGestureRecognizer = [[NSPressGestureRecognizer alloc] initWithTarget:self action:@selector(handlePressGesture:)]; [self.mapView addGestureRecognizer:pressGestureRecognizer]; - + [self.splitView setPosition:0 ofDividerAtIndex:0]; - + [self applyPendingState]; } @@ -263,7 +263,7 @@ NS_ARRAY_OF(id <MGLAnnotation>) *MBXFlattenedShapes(NS_ARRAY_OF(id <MGLAnnotatio [self.undoManager registerUndoWithTarget:self handler:^(MapDocument * _Nonnull target) { [target toggleStyleLayersAtArrangedObjectIndexes:indices]; }]; - + if (!self.undoManager.undoing) { NSString *actionName; if (indices.count == 1) { @@ -276,11 +276,11 @@ NS_ARRAY_OF(id <MGLAnnotation>) *MBXFlattenedShapes(NS_ARRAY_OF(id <MGLAnnotatio [self.undoManager setActionIsDiscardable:YES]; [self.undoManager setActionName:actionName]; } - + for (MGLStyleLayer *layer in layers) { layer.visible = !isVisible; } - + NSIndexSet *columnIndices = [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, 2)]; [self.styleLayersTableView reloadDataForRowIndexes:indices columnIndexes:columnIndices]; } @@ -298,7 +298,7 @@ NS_ARRAY_OF(id <MGLAnnotation>) *MBXFlattenedShapes(NS_ARRAY_OF(id <MGLAnnotatio [self.undoManager registerUndoWithTarget:self handler:^(id _Nonnull target) { [self deleteStyleLayersAtArrangedObjectIndexes:indices]; }]; - + if (!self.undoManager.undoing) { NSString *actionName; if (indices.count == 1) { @@ -309,7 +309,7 @@ NS_ARRAY_OF(id <MGLAnnotation>) *MBXFlattenedShapes(NS_ARRAY_OF(id <MGLAnnotatio } [self.undoManager setActionName:actionName]; } - + [self.styleLayersArrayController insertObjects:layers atArrangedObjectIndexes:indices]; } @@ -318,7 +318,7 @@ NS_ARRAY_OF(id <MGLAnnotation>) *MBXFlattenedShapes(NS_ARRAY_OF(id <MGLAnnotatio [self.undoManager registerUndoWithTarget:self handler:^(id _Nonnull target) { [self insertStyleLayers:layers atArrangedObjectIndexes:indices]; }]; - + if (!self.undoManager.undoing) { NSString *actionName; if (indices.count == 1) { @@ -329,7 +329,7 @@ NS_ARRAY_OF(id <MGLAnnotation>) *MBXFlattenedShapes(NS_ARRAY_OF(id <MGLAnnotatio } [self.undoManager setActionName:actionName]; } - + [self.styleLayersArrayController removeObjectsAtArrangedObjectIndexes:indices]; } @@ -346,17 +346,17 @@ NS_ARRAY_OF(id <MGLAnnotation>) *MBXFlattenedShapes(NS_ARRAY_OF(id <MGLAnnotatio 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) { @@ -369,7 +369,7 @@ NS_ARRAY_OF(id <MGLAnnotation>) *MBXFlattenedShapes(NS_ARRAY_OF(id <MGLAnnotatio }]; return localizedString; }; - + if ([layer.text isKindOfClass:[MGLStyleConstantValue class]]) { NSString *textField = [(MGLStyleConstantValue<NSString *> *)layer.text rawValue]; layer.text = [MGLStyleValue<NSString *> valueWithRawValue:stringByLocalizingString(textField)]; @@ -391,7 +391,7 @@ NS_ARRAY_OF(id <MGLAnnotation>) *MBXFlattenedShapes(NS_ARRAY_OF(id <MGLAnnotatio self.mapView.styleURL = _inheritedStyleURL; _inheritedStyleURL = nil; } - + AppDelegate *appDelegate = (AppDelegate *)NSApp.delegate; if (appDelegate.pendingStyleURL) { self.mapView.styleURL = appDelegate.pendingStyleURL; @@ -420,7 +420,7 @@ NS_ARRAY_OF(id <MGLAnnotation>) *MBXFlattenedShapes(NS_ARRAY_OF(id <MGLAnnotatio self.mapView.zoomLevel = MIN(appDelegate.pendingMaximumZoomLevel, self.mapView.zoomLevel); appDelegate.pendingMaximumZoomLevel = -1; } - + // Temporarily set the display name to the default center coordinate instead // of “Untitled” until the binding kicks in. NSValue *coordinateValue = [NSValue valueWithMGLCoordinate:self.mapView.centerCoordinate]; @@ -475,7 +475,7 @@ NS_ARRAY_OF(id <MGLAnnotation>) *MBXFlattenedShapes(NS_ARRAY_OF(id <MGLAnnotatio - (IBAction)dropManyPins:(id)sender { [self removeAllAnnotations:sender]; - + NSRect bounds = self.mapView.bounds; NSMutableArray *annotations = [NSMutableArray array]; for (CGFloat x = NSMinX(bounds); x < NSMaxX(bounds); x += arc4random_uniform(50)) { @@ -483,7 +483,7 @@ NS_ARRAY_OF(id <MGLAnnotation>) *MBXFlattenedShapes(NS_ARRAY_OF(id <MGLAnnotatio [annotations addObject:[self pinAtPoint:NSMakePoint(x, y)]]; } } - + [NSTimer scheduledTimerWithTimeInterval:1.0/60.0 target:self selector:@selector(dropOneOfManyPins:) @@ -518,7 +518,7 @@ NS_ARRAY_OF(id <MGLAnnotation>) *MBXFlattenedShapes(NS_ARRAY_OF(id <MGLAnnotatio - (IBAction)startWorldTour:(id)sender { _isTouringWorld = YES; - + [self removeAllAnnotations:sender]; NSUInteger numberOfAnnotations = sizeof(WorldTourDestinations) / sizeof(WorldTourDestinations[0]); NSMutableArray *annotations = [NSMutableArray arrayWithCapacity:numberOfAnnotations]; @@ -537,7 +537,7 @@ NS_ARRAY_OF(id <MGLAnnotation>) *MBXFlattenedShapes(NS_ARRAY_OF(id <MGLAnnotatio _isTouringWorld = NO; return; } - + [annotations removeObjectAtIndex:0]; MGLMapCamera *camera = [MGLMapCamera cameraLookingAtCenterCoordinate:nextAnnotation.coordinate fromDistance:0 @@ -612,11 +612,11 @@ NS_ARRAY_OF(id <MGLAnnotation>) *MBXFlattenedShapes(NS_ARRAY_OF(id <MGLAnnotatio [self.undoManager registerUndoWithTarget:self handler:^(id _Nonnull target) { [self removeCustomStyleLayer:sender]; }]; - + if (!self.undoManager.isUndoing) { [self.undoManager setActionName:@"Add Lime Green Layer"]; } - + LimeGreenStyleLayer *layer = [[LimeGreenStyleLayer alloc] initWithIdentifier:@"mbx-custom"]; MGLStyleLayer *houseNumberLayer = [self.mapView.style layerWithIdentifier:@"housenum-label"]; if (houseNumberLayer) { @@ -630,11 +630,11 @@ NS_ARRAY_OF(id <MGLAnnotation>) *MBXFlattenedShapes(NS_ARRAY_OF(id <MGLAnnotatio [self.undoManager registerUndoWithTarget:self handler:^(id _Nonnull target) { [self insertCustomStyleLayer:sender]; }]; - + if (!self.undoManager.isUndoing) { [self.undoManager setActionName:@"Delete Lime Green Layer"]; } - + MGLStyleLayer *layer = [self.mapView.style layerWithIdentifier:@"mbx-custom"]; [self.mapView.style removeLayer:layer]; } @@ -657,7 +657,7 @@ NS_ARRAY_OF(id <MGLAnnotation>) *MBXFlattenedShapes(NS_ARRAY_OF(id <MGLAnnotatio if ([namePrompt runModal] != NSAlertFirstButtonReturn) { return; } - + id <MGLOfflineRegion> region = [[MGLTilePyramidOfflineRegion alloc] initWithStyleURL:self.mapView.styleURL bounds:self.mapView.visibleCoordinateBounds fromZoomLevel:self.mapView.zoomLevel toZoomLevel:self.mapView.maximumZoomLevel]; NSData *context = [[NSValueTransformer valueTransformerForName:@"OfflinePackNameValueTransformer"] reverseTransformedValue:nameTextField.stringValue]; [[MGLOfflineStorage sharedOfflineStorage] addPackForRegion:region withContext:context completionHandler:^(MGLOfflinePack * _Nullable pack, NSError * _Nullable error) { @@ -687,27 +687,27 @@ NS_ARRAY_OF(id <MGLAnnotation>) *MBXFlattenedShapes(NS_ARRAY_OF(id <MGLAnnotatio self.mapView.style.transitionDelay = 1; MGLFillStyleLayer *fillStyleLayer = (MGLFillStyleLayer *)[self.mapView.style layerWithIdentifier:@"water"]; - + MGLStyleValue *colorFunction = [MGLStyleValue<NSColor *> valueWithStops:@{ @0.0: [MGLStyleValue<NSColor *> valueWithRawValue:[NSColor redColor]], @10.0: [MGLStyleValue<NSColor *> valueWithRawValue:[NSColor yellowColor]], @20.0: [MGLStyleValue<NSColor *> valueWithRawValue:[NSColor blackColor]], }]; fillStyleLayer.fillColor = colorFunction; - + NSString *filePath = [[NSBundle bundleForClass:self.class] pathForResource:@"amsterdam" ofType:@"geojson"]; NSURL *geoJSONURL = [NSURL fileURLWithPath:filePath]; MGLShapeSource *source = [[MGLShapeSource alloc] initWithIdentifier:@"ams" URL:geoJSONURL options:nil]; [self.mapView.style addSource:source]; - + MGLFillStyleLayer *fillLayer = [[MGLFillStyleLayer alloc] initWithIdentifier:@"test" source:source]; fillLayer.fillColor = [MGLStyleValue<NSColor *> valueWithRawValue:[NSColor greenColor]]; fillLayer.predicate = [NSPredicate predicateWithFormat:@"%K == %@", @"type", @"park"]; [self.mapView.style addLayer:fillLayer]; - + NSImage *image = [NSImage imageNamed:NSImageNameIChatTheaterTemplate]; [self.mapView.style setImage:image forName:NSImageNameIChatTheaterTemplate]; - + MGLSource *streetsSource = [self.mapView.style sourceWithIdentifier:@"composite"]; MGLSymbolStyleLayer *theaterLayer = [[MGLSymbolStyleLayer alloc] initWithIdentifier:@"theaters" source:streetsSource]; theaterLayer.sourceLayerIdentifier = @"poi_label"; @@ -740,7 +740,7 @@ NS_ARRAY_OF(id <MGLAnnotation>) *MBXFlattenedShapes(NS_ARRAY_OF(id <MGLAnnotatio title = [feature attributeForKey:@"name_en"] ?: [feature attributeForKey:@"name"]; } } - + DroppedPinAnnotation *annotation = [[DroppedPinAnnotation alloc] init]; annotation.coordinate = [self.mapView convertPoint:point toCoordinateFromView:self.mapView]; annotation.title = title ?: @"Dropped Pin"; @@ -949,7 +949,7 @@ NS_ARRAY_OF(id <MGLAnnotation>) *MBXFlattenedShapes(NS_ARRAY_OF(id <MGLAnnotatio if (![MGLAccountManager accessToken]) { return NSNotFound; } - + NSArray *styleURLs = @[ [MGLStyle streetsStyleURLWithVersion:MGLStyleDefaultVersion], [MGLStyle outdoorsStyleURLWithVersion:MGLStyleDefaultVersion], @@ -965,7 +965,7 @@ NS_ARRAY_OF(id <MGLAnnotation>) *MBXFlattenedShapes(NS_ARRAY_OF(id <MGLAnnotatio if (!self.mapView) { return NO; } - + SEL action = toolbarItem.action; if (action == @selector(showShareMenu:)) { [(NSButton *)toolbarItem.view sendActionOn:NSLeftMouseDownMask]; @@ -1003,14 +1003,14 @@ NS_ARRAY_OF(id <MGLAnnotation>) *MBXFlattenedShapes(NS_ARRAY_OF(id <MGLAnnotatio NSImage *browserIcon = [[NSWorkspace sharedWorkspace] iconForFile:browserURL.path]; NSString *browserName = [[NSFileManager defaultManager] displayNameAtPath:browserURL.path]; NSString *browserServiceName = [NSString stringWithFormat:@"Open in %@", browserName]; - + NSSharingService *browserService = [[NSSharingService alloc] initWithTitle:browserServiceName image:browserIcon alternateImage:nil handler:^{ [[NSWorkspace sharedWorkspace] openURL:self.shareURL]; }]; - + NSMutableArray *sharingServices = [proposedServices mutableCopy]; [sharingServices insertObject:browserService atIndex:0]; return sharingServices; diff --git a/platform/macos/app/OfflinePackNameValueTransformer.m b/platform/macos/app/OfflinePackNameValueTransformer.m index 2825e48ed3..d1b3c20ac1 100644 --- a/platform/macos/app/OfflinePackNameValueTransformer.m +++ b/platform/macos/app/OfflinePackNameValueTransformer.m @@ -14,7 +14,7 @@ static NSString * const MBXOfflinePackContextNameKey = @"Name"; - (NSString *)transformedValue:(NSData *)context { NSAssert([context isKindOfClass:[NSData class]], @"Context should be NSData."); - + NSDictionary *userInfo = [NSKeyedUnarchiver unarchiveObjectWithData:context]; NSAssert([userInfo isKindOfClass:[NSDictionary class]], @"Context of offline pack isn’t a dictionary."); NSString *name = userInfo[MBXOfflinePackContextNameKey]; @@ -24,7 +24,7 @@ static NSString * const MBXOfflinePackContextNameKey = @"Name"; - (NSData *)reverseTransformedValue:(NSString *)name { NSAssert([name isKindOfClass:[NSString class]], @"Name should be a string."); - + return [NSKeyedArchiver archivedDataWithRootObject:@{ MBXOfflinePackContextNameKey: name, }]; diff --git a/platform/macos/app/StyleLayerIconTransformer.m b/platform/macos/app/StyleLayerIconTransformer.m index 93f59abb3e..ff2b964b87 100644 --- a/platform/macos/app/StyleLayerIconTransformer.m +++ b/platform/macos/app/StyleLayerIconTransformer.m @@ -31,7 +31,7 @@ if ([layer isKindOfClass:[MGLSymbolStyleLayer class]]) { return [NSImage imageNamed:@"symbol"]; } - + return nil; } diff --git a/platform/macos/app/TimeIntervalTransformer.m b/platform/macos/app/TimeIntervalTransformer.m index 39177dc5bc..2c9cb6fc74 100644 --- a/platform/macos/app/TimeIntervalTransformer.m +++ b/platform/macos/app/TimeIntervalTransformer.m @@ -18,7 +18,7 @@ NSString *NumberAndUnitString(NSInteger quantity, NSString *singular, NSString * if (![value isKindOfClass:[NSValue class]]) { return nil; } - + NSTimeInterval timeInterval = [value doubleValue]; NSInteger seconds = floor(timeInterval); NSInteger minutes = floor(seconds / 60); @@ -29,7 +29,7 @@ NSString *NumberAndUnitString(NSInteger quantity, NSString *singular, NSString * hours -= days * 24; NSInteger weeks = floor(days) / 7; days -= weeks * 7; - + NSMutableArray *components = [NSMutableArray array]; if (seconds || timeInterval < 60) { [components addObject:NumberAndUnitString(seconds, @"second", @"seconds")]; @@ -46,7 +46,7 @@ NSString *NumberAndUnitString(NSInteger quantity, NSString *singular, NSString * if (weeks) { [components insertObject:NumberAndUnitString(weeks, @"week", @"weeks") atIndex:0]; } - + return [components componentsJoinedByString:@", "]; } diff --git a/platform/macos/scripts/deploy-packages.sh b/platform/macos/scripts/deploy-packages.sh index d0c545f8f5..8f61519244 100755 --- a/platform/macos/scripts/deploy-packages.sh +++ b/platform/macos/scripts/deploy-packages.sh @@ -9,7 +9,7 @@ set -u # GITHUB_RELEASE=true: Upload to github # BINARY_DIRECTORY=build/macos/deploy: Directory in which to save test packages -# environment variables and dependencies: +# environment variables and dependencies: # - You must run "mbx auth ..." before running # - Set GITHUB_TOKEN to a GitHub API access token in your environment to use GITHUB_RELEASE # - "wget" is required for downloading the zip files from s3 @@ -20,19 +20,19 @@ function finish { >&2 echo -en "\033[0m"; } trap finish EXIT buildPackageStyle() { - local package=$1 style="" + local package=$1 style="" if [[ ${#} -eq 2 ]]; then style="$2" - fi + fi step "Building: make ${package} ${style}" make ${package} step "Publishing ${package} with ${style}" local file_name="" - if [ -z ${style} ] + if [ -z ${style} ] then - file_name=mapbox-macos-sdk-${PUBLISH_VERSION}.zip + file_name=mapbox-macos-sdk-${PUBLISH_VERSION}.zip else - file_name=mapbox-macos-sdk-${PUBLISH_VERSION}-${style}.zip + file_name=mapbox-macos-sdk-${PUBLISH_VERSION}-${style}.zip fi step "Compressing ${file_name}…" cd build/macos/pkg @@ -98,7 +98,7 @@ step "Deploying version ${PUBLISH_VERSION}…" if [[ ${#} -eq 3 && $3 == "-g" ]]; then GITHUB_RELEASE=true fi - + make clean && make distclean mkdir -p ${BINARY_DIRECTORY} diff --git a/platform/macos/src/MGLAnnotationImage.h b/platform/macos/src/MGLAnnotationImage.h index 0f248c721c..d7336133d1 100644 --- a/platform/macos/src/MGLAnnotationImage.h +++ b/platform/macos/src/MGLAnnotationImage.h @@ -17,7 +17,7 @@ MGL_EXPORT /** Initializes and returns a new annotation image object. - + @param image The image to display for the annotation. @param reuseIdentifier The string that identifies this annotation image in the reuse queue. @@ -34,11 +34,11 @@ MGL_EXPORT /** The string that identifies this annotation image in the reuse queue. (read-only) - + You specify the reuse identifier when you create the image object. You use this type later to retrieve an annotation image object that was created previously but which is currently unused because its annotation is not on-screen. - + If you define distinctly different types of annotations (with distinctly different annotation images to go with them), you can differentiate between the annotation types by specifying different reuse identifiers for each one. @@ -47,7 +47,7 @@ MGL_EXPORT /** A Boolean value indicating whether the annotation is selectable. - + The default value of this property is `YES`. If the value of this property is `NO`, the annotation image ignores click events and cannot be selected. */ @@ -55,7 +55,7 @@ MGL_EXPORT /** The cursor that appears above any annotation using this annotation image. - + By default, this property is set to `nil`, representing the current cursor. */ @property (nonatomic, nullable) NSCursor *cursor; diff --git a/platform/macos/src/MGLAnnotationImage.m b/platform/macos/src/MGLAnnotationImage.m index d19dbe5dfc..8d715b427b 100644 --- a/platform/macos/src/MGLAnnotationImage.m +++ b/platform/macos/src/MGLAnnotationImage.m @@ -47,9 +47,9 @@ - (BOOL)isEqual:(id)other { if (self == other) return YES; if (![other isKindOfClass:[MGLAnnotationImage class]]) return NO; - + MGLAnnotationImage *otherAnnotationImage = other; - + return ((!_reuseIdentifier && !otherAnnotationImage.reuseIdentifier) || [_reuseIdentifier isEqualToString:otherAnnotationImage.reuseIdentifier]) && _selectable == otherAnnotationImage.selectable && ((!_cursor && !otherAnnotationImage.cursor) || [_cursor isEqual:otherAnnotationImage.cursor]) diff --git a/platform/macos/src/MGLAttributionButton.mm b/platform/macos/src/MGLAttributionButton.mm index ed8bb18a66..3df415f60d 100644 --- a/platform/macos/src/MGLAttributionButton.mm +++ b/platform/macos/src/MGLAttributionButton.mm @@ -10,25 +10,25 @@ if (self = [super initWithFrame:NSZeroRect]) { self.bordered = NO; self.bezelStyle = NSRegularSquareBezelStyle; - + // Extract any prefix consisting of intellectual property symbols. NSScanner *scanner = [NSScanner scannerWithString:info.title.string]; NSCharacterSet *symbolSet = [NSCharacterSet characterSetWithCharactersInString:@"©℗®℠™ &"]; NSString *symbol; [scanner scanCharactersFromSet:symbolSet intoString:&symbol]; - + // Remove the underline from the symbol for aesthetic reasons. NSMutableAttributedString *title = info.title.mutableCopy; [title removeAttribute:NSUnderlineStyleAttributeName range:NSMakeRange(0, symbol.length)]; - + self.attributedTitle = title; [self sizeToFit]; - + _URL = info.URL; if (_URL) { self.toolTip = _URL.absoluteString; } - + self.target = self; self.action = @selector(openURL:); } diff --git a/platform/macos/src/MGLMapView+IBAdditions.h b/platform/macos/src/MGLMapView+IBAdditions.h index 81f4506a57..8a4a90917b 100644 --- a/platform/macos/src/MGLMapView+IBAdditions.h +++ b/platform/macos/src/MGLMapView+IBAdditions.h @@ -20,7 +20,7 @@ NS_ASSUME_NONNULL_BEGIN // underscores for display. /** URL of the style currently displayed in the receiver. - + The URL may be a full HTTP or HTTPS URL, a Mapbox URL indicating the style’s map ID (`mapbox://styles/<user>/<style>`), or a path to a local file relative to the application’s resource path. Leave this field blank for the diff --git a/platform/macos/src/MGLMapView.h b/platform/macos/src/MGLMapView.h index 7440ffe793..49cfd18f37 100644 --- a/platform/macos/src/MGLMapView.h +++ b/platform/macos/src/MGLMapView.h @@ -19,11 +19,11 @@ NS_ASSUME_NONNULL_BEGIN /** An interactive, customizable map view with an interface similar to the one provided by Apple’s MapKit. - + Using `MGLMapView`, you can embed the map inside a view, allow users to manipulate it with standard gestures, animate the map between different viewpoints, and present information in the form of annotations and overlays. - + The map view loads scalable vector tiles that conform to the <a href="https://github.com/mapbox/vector-tile-spec">Mapbox Vector Tile Specification</a>. It styles them with a style that conforms to the @@ -31,27 +31,27 @@ NS_ASSUME_NONNULL_BEGIN Such styles can be designed in <a href="https://www.mapbox.com/studio/">Mapbox Studio</a> and hosted on mapbox.com. - + A collection of Mapbox-hosted styles is available through the `MGLStyle` class. These basic styles use <a href="https://www.mapbox.com/developers/vector-tiles/mapbox-streets">Mapbox Streets</a> or <a href="https://www.mapbox.com/satellite/">Mapbox Satellite</a> data sources, but you can specify a custom style that makes use of your own data. - + Mapbox-hosted vector tiles and styles require an API access token, which you can obtain from the <a href="https://www.mapbox.com/studio/account/tokens/">Mapbox account page</a>. Access tokens associate requests to Mapbox’s vector tile and style APIs with your Mapbox account. They also deter other developers from using your styles without your permission. - + Adding your own gesture recognizer to `MGLMapView` will block the corresponding gesture recognizer built into `MGLMapView`. To avoid conflicts, define which gesture recognizer takes precedence. For example, you can subclass `NSClickGestureRecognizer` and override `-[NSGestureRecognizer shouldRequireFailureOfGestureRecognizer:]`, so that your subclass will be invoked only if the default `MGLMapView` click gesture recognizer fails: - + ```swift class MapClickGestureRecognizer: NSClickGestureRecognizer { override func shouldRequireFailure(of otherGestureRecognizer: NSGestureRecognizer) -> Bool { @@ -59,7 +59,7 @@ NS_ASSUME_NONNULL_BEGIN } } ``` - + @note You are responsible for getting permission to use the map data and for ensuring that your use adheres to the relevant terms of use. */ @@ -71,7 +71,7 @@ MGL_EXPORT IB_DESIGNABLE /** Initializes and returns a newly allocated map view with the specified frame and the default style. - + @param frame The frame for the view, measured in points. @return An initialized map view. */ @@ -80,7 +80,7 @@ MGL_EXPORT IB_DESIGNABLE /** Initializes and returns a newly allocated map view with the specified frame and style URL. - + @param frame The frame for the view, measured in points. @param styleURL URL of the map style to display. The URL may be a full HTTP or HTTPS URL, a Mapbox URL indicating the style’s map ID @@ -94,7 +94,7 @@ MGL_EXPORT IB_DESIGNABLE /** The receiver’s delegate. - + A map view sends messages to its delegate to notify it of changes to its contents or the viewpoint. The delegate also provides information about annotations displayed on the map, such as the styles to apply to individual @@ -106,17 +106,17 @@ MGL_EXPORT IB_DESIGNABLE /** The style currently displayed in the receiver. - + Unlike the `styleURL` property, this property is set to an object that allows you to manipulate every aspect of the style locally. - + If the style is loading, this property is set to `nil` until the style finishes loading. If the style has failed to load, this property is set to `nil`. Because the style loads asynchronously, you should manipulate it in the `-[MGLMapViewDelegate mapView:didFinishLoadingStyle:]` or `-[MGLMapViewDelegate mapViewDidFinishLoadingMap:]` method. It is not possible to manipulate the style before it has finished loading. - + @note The default styles provided by Mapbox contain sources and layers with identifiers that will change over time. Applications that use APIs that manipulate a style's sources and layers must first set the style URL to an @@ -128,14 +128,14 @@ MGL_EXPORT IB_DESIGNABLE /** URL of the style currently displayed in the receiver. - + The URL may be a full HTTP or HTTPS URL, a Mapbox URL indicating the style’s map ID (`mapbox://styles/<user>/<style>`), or a path to a local file relative to the application’s resource path. - + If you set this property to `nil`, the receiver will use the default style and this property will automatically be set to that style’s URL. - + If you want to modify the current style without replacing it outright, or if you want to introspect individual style attributes, use the `style` property. */ @@ -143,7 +143,7 @@ MGL_EXPORT IB_DESIGNABLE /** Reloads the style. - + You do not normally need to call this method. The map view automatically responds to changes in network connectivity by reloading the style. You may need to call this method if you change the access token after a style has @@ -164,7 +164,7 @@ MGL_EXPORT IB_DESIGNABLE /** The Mapbox logo, positioned in the lower-left corner. - + @note The Mapbox terms of service, which governs the use of Mapbox-hosted vector tiles and styles, <a href="https://www.mapbox.com/help/mapbox-logo/">requires</a> most Mapbox @@ -176,7 +176,7 @@ MGL_EXPORT IB_DESIGNABLE /** A view showing legally required copyright notices, positioned along the bottom of the map view, to the left of the Mapbox logo. - + @note The Mapbox terms of service, which governs the use of Mapbox-hosted vector tiles and styles, <a href="https://www.mapbox.com/help/attribution/">requires</a> these @@ -191,10 +191,10 @@ MGL_EXPORT IB_DESIGNABLE /** The geographic coordinate at the center of the map view. - + Changing the value of this property centers the map on the new coordinate without changing the current zoom level. - + Changing the value of this property updates the map view immediately. If you want to animate the change, use the `-setCenterCoordinate:animated:` method instead. @@ -203,10 +203,10 @@ MGL_EXPORT IB_DESIGNABLE /** Changes the center coordinate of the map and optionally animates the change. - + Changing the center coordinate centers the map on the new coordinate without changing the current zoom level. - + @param coordinate The new center coordinate for the map. @param animated Specify `YES` if you want the map view to scroll to the new location or `NO` if you want the map to display the new location @@ -216,12 +216,12 @@ MGL_EXPORT IB_DESIGNABLE /** The zoom level of the receiver. - + In addition to affecting the visual size and detail of features on the map, the zoom level affects the size of the vector tiles that are loaded. At zoom level 0, each tile covers the entire world map; at zoom level 1, it covers ¼ of the world; at zoom level 2, <sup>1</sup>⁄<sub>16</sub> of the world, and so on. - + Changing the value of this property updates the map view immediately. If you want to animate the change, use the `-setZoomLevel:animated:` method instead. */ @@ -229,34 +229,34 @@ MGL_EXPORT IB_DESIGNABLE /** The minimum zoom level at which the map can be shown. - + Depending on the map view’s aspect ratio, the map view may be prevented from reaching the minimum zoom level, in order to keep the map from repeating within the current viewport. - + If the value of this property is greater than that of the `maximumZoomLevel` property, the behavior is undefined. - + The default value of this property is 0. */ @property (nonatomic) double minimumZoomLevel; /** The maximum zoom level the map can be shown at. - + If the value of this property is smaller than that of the `minimumZoomLevel` property, the behavior is undefined. - + The default value of this property is 20. */ @property (nonatomic) double maximumZoomLevel; /** Changes the zoom level of the map and optionally animates the change. - + Changing the zoom level scales the map without changing the current center coordinate. - + @param zoomLevel The new zoom level for the map. @param animated Specify `YES` if you want the map view to animate the change to the new zoom level or `NO` if you want the map to display the new zoom @@ -266,11 +266,11 @@ MGL_EXPORT IB_DESIGNABLE /** The heading of the map, measured in degrees clockwise from true north. - + The value `0` means that the top edge of the map view corresponds to true north. The value `90` means the top of the map is pointing due east. The value `180` means the top of the map points due south, and so on. - + Changing the value of this property updates the map view immediately. If you want to animate the change, use the `-setDirection:animated:` method instead. */ @@ -278,10 +278,10 @@ MGL_EXPORT IB_DESIGNABLE /** Changes the heading of the map and optionally animates the change. - + Changing the heading rotates the map without changing the current center coordinate or zoom level. - + @param direction The heading of the map, measured in degrees clockwise from true north. @param animated Specify `YES` if you want the map view to animate the change @@ -298,7 +298,7 @@ MGL_EXPORT IB_DESIGNABLE /** Moves the viewpoint to a different location with respect to the map with an optional transition animation. - + @param camera The new viewpoint. @param animated Specify `YES` if you want the map view to animate the change to the new viewpoint or `NO` if you want the map to display the new viewpoint @@ -309,7 +309,7 @@ MGL_EXPORT IB_DESIGNABLE /** 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 @@ -325,10 +325,10 @@ MGL_EXPORT IB_DESIGNABLE 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 path. - + The transition animation seamlessly incorporates zooming and panning to help the user find his or her bearings even after traversing a great distance. - + @param camera The new viewpoint. @param completion The block to execute after the animation finishes. */ @@ -337,10 +337,10 @@ MGL_EXPORT IB_DESIGNABLE /** Moves the viewpoint to a different location using a transition animation that evokes powered flight and an optional transition duration. - + The transition animation seamlessly incorporates zooming and panning to help the user find his or her bearings even after traversing a great distance. - + @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 @@ -353,10 +353,10 @@ MGL_EXPORT IB_DESIGNABLE /** Moves the viewpoint to a different location using a transition animation that evokes powered flight and an optional transition duration and peak altitude. - + The transition animation seamlessly incorporates zooming and panning to help the user find his or her bearings even after traversing a great distance. - + @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 @@ -372,7 +372,7 @@ MGL_EXPORT IB_DESIGNABLE /** The geographic coordinate bounds visible in the receiver’s viewport. - + Changing the value of this property updates the receiver immediately. If you want to animate the change, use the `-setVisibleCoordinateBounds:animated:` method instead. @@ -382,7 +382,7 @@ MGL_EXPORT IB_DESIGNABLE /** Changes the receiver’s viewport to fit the given coordinate bounds, optionally animating the change. - + @param bounds The bounds that the viewport will show in its entirety. @param animated Specify `YES` to animate the change by smoothly scrolling and zooming or `NO` to immediately display the given bounds. @@ -392,7 +392,7 @@ MGL_EXPORT IB_DESIGNABLE /** Changes the receiver’s viewport to fit the given coordinate bounds and optionally some additional padding on each side. - + @param bounds The bounds that the viewport will show in its entirety. @param insets The minimum padding (in screen points) that will be visible around the given coordinate bounds. @@ -432,7 +432,7 @@ MGL_EXPORT IB_DESIGNABLE /** Returns the camera that best fits the given coordinate bounds. - + @param bounds The coordinate bounds to fit to the receiver’s viewport. @return A camera object centered on the same location as the coordinate bounds with zoom level as high (close to the ground) as possible while still @@ -444,7 +444,7 @@ MGL_EXPORT IB_DESIGNABLE /** Returns the camera that best fits the given coordinate bounds, optionally with some additional padding on each side. - + @param bounds The coordinate bounds to fit to the receiver’s viewport. @param insets The minimum padding (in screen points) that would be visible around the returned camera object if it were set as the receiver’s camera. @@ -458,13 +458,13 @@ MGL_EXPORT IB_DESIGNABLE /** A Boolean value indicating whether the receiver automatically adjusts its content insets. - + When the value of this property is `YES`, the map view automatically updates its `contentInsets` property to account for any overlapping title bar or toolbar. To overlap with the title bar or toolbar, the containing window’s style mask must have `NSFullSizeContentViewWindowMask` set, and the title bar must not be transparent. - + The default value of this property is `YES`. */ @property (nonatomic, assign) BOOL automaticallyAdjustsContentInsets; @@ -472,16 +472,16 @@ MGL_EXPORT IB_DESIGNABLE /** The distance from the edges of the map view’s frame to the edges of the map view’s logical viewport. - + When the value of this property is equal to `NSEdgeInsetsZero`, viewport properties such as `centerCoordinate` assume a viewport that matches the map view’s frame. Otherwise, those properties are inset, excluding part of the frame from the viewport. For instance, if the only the top edge is inset, the map center is effectively shifted downward. - + When the value of the `automaticallyAdjustsContentInsets` property is `YES`, the value of this property may be overridden at any time. - + Changing the value of this property updates the map view immediately. If you want to animate the change, use the `-setContentInsets:animated:` method instead. @@ -491,16 +491,16 @@ MGL_EXPORT IB_DESIGNABLE /** Sets the distance from the edges of the map view’s frame to the edges of the map view’s logical viewport, with an optional transition animation. - + When the value of this property is equal to `NSEdgeInsetsZero`, viewport properties such as `centerCoordinate` assume a viewport that matches the map view’s frame. Otherwise, those properties are inset, excluding part of the frame from the viewport. For instance, if the only the top edge is inset, the map center is effectively shifted downward. - + When the value of the `automaticallyAdjustsContentInsets` property is `YES`, the value of this property may be overridden at any time. - + @param contentInsets The new values to inset the content by. @param animated Specify `YES` if you want the map view to animate the change to the content insets or `NO` if you want the map to inset the content @@ -513,13 +513,13 @@ MGL_EXPORT IB_DESIGNABLE /** A Boolean value that determines whether the user may zoom the map in and out, changing the zoom level. - + When this property is set to `YES`, the default, the user may zoom the map in and out by pinching two fingers, by using a scroll wheel on a traditional mouse, or by dragging the mouse cursor up and down while holding down the Shift key. When the receiver has focus, the user may also zoom by pressing the up and down arrow keys while holding down the Option key. - + This property controls only user interactions with the map. If you set the value of this property to `NO`, you may still change the map zoom programmatically. @@ -529,11 +529,11 @@ MGL_EXPORT IB_DESIGNABLE /** A Boolean value that determines whether the user may scroll around the map, changing the center coordinate. - + When this property is set to `YES`, the default, the user may scroll the map by swiping with two fingers or dragging the mouse cursor. When the receiver has focus, the user may also scroll around the map by pressing the arrow keys. - + This property controls only user interactions with the map. If you set the value of this property to `NO`, you may still change the map location programmatically. @@ -543,13 +543,13 @@ MGL_EXPORT IB_DESIGNABLE /** A Boolean value that determines whether the user may rotate the map, changing the direction. - + When this property is set to `YES`, the default, the user may rotate the map by moving two fingers in a circular motion or by dragging the mouse cursor left and right while holding down the Option key. When the receiver has focus, the user may also zoom by pressing the left and right arrow keys while holding down the Option key. - + This property controls only user interactions with the map. If you set the value of this property to `NO`, you may still rotate the map programmatically. */ @@ -558,10 +558,10 @@ MGL_EXPORT IB_DESIGNABLE /** A Boolean value that determines whether the user may tilt of the map, changing the pitch. - + When this property is set to `YES`, the default, the user may rotate the map by dragging the mouse cursor up and down while holding down the Option key. - + This property controls only user interactions with the map. If you set the value of this property to `NO`, you may still change the pitch of the map programmatically. @@ -572,7 +572,7 @@ MGL_EXPORT IB_DESIGNABLE /** The complete list of annotations associated with the receiver. (read-only) - + The objects in this array must adopt the `MGLAnnotation` protocol. If no annotations are associated with the map view, the value of this property is `nil`. @@ -581,13 +581,13 @@ MGL_EXPORT IB_DESIGNABLE /** Adds an annotation to the map view. - + @note `MGLMultiPolyline`, `MGLMultiPolygon`, and `MGLShapeCollection` objects cannot be added to the map view at this time. Nor can `MGLMultiPoint` objects that are not instances of `MGLPolyline` or `MGLPolygon`. Any multipoint, multipolyline, multipolygon, or shape collection object that is specified is silently ignored. - + @param annotation The annotation object to add to the receiver. This object must conform to the `MGLAnnotation` protocol. The map view retains the annotation object. @@ -596,13 +596,13 @@ MGL_EXPORT IB_DESIGNABLE /** Adds an array of annotations to the map view. - + @note `MGLMultiPolyline`, `MGLMultiPolygon`, and `MGLShapeCollection` objects cannot be added to the map view at this time. Nor can `MGLMultiPoint` objects that are not instances of `MGLPolyline` or `MGLPolygon`. Any multipoint, multipolyline, multipolygon, or shape collection objects that are specified are silently ignored. - + @param annotations An array of annotation objects. Each object in the array must conform to the `MGLAnnotation` protocol. The map view retains each individual annotation object. @@ -612,7 +612,7 @@ MGL_EXPORT IB_DESIGNABLE /** The complete list of annotations associated with the receiver that are currently visible. - + The objects in this array must adopt the `MGLAnnotation` protocol. If no annotations are associated with the map view or if no annotations associated with the map view are currently visible, the value of this property is `nil`. @@ -621,11 +621,11 @@ MGL_EXPORT IB_DESIGNABLE /** Removes an annotation from the map view, deselecting it if it is selected. - + Removing an annotation object dissociates it from the map view entirely, preventing it from being displayed on the map. Thus you would typically call this method only when you want to hide or delete a given annotation. - + @param annotation The annotation object to remove. This object must conform to the `MGLAnnotation` protocol. */ @@ -634,11 +634,11 @@ MGL_EXPORT IB_DESIGNABLE /** Removes an array of annotations from the map view, deselecting any selected annotations in the array. - + Removing annotation objects dissociates them from the map view entirely, preventing them from being displayed on the map. Thus you would typically call this method only when you want to hide or delete the given annotations. - + @param annotations The array of annotation objects to remove. Objects in the array must conform to the `MGLAnnotation` protocol. */ @@ -646,11 +646,11 @@ MGL_EXPORT IB_DESIGNABLE /** Returns a reusable annotation image object associated with its identifier. - + For performance reasons, you should generally reuse `MGLAnnotationImage` objects for identical-looking annotations in your map views. Dequeueing saves time and memory during performance-critical operations such as scrolling. - + @param identifier A string identifying the annotation image to be reused. This string is the same one you specify when initially returning the annotation image object using the `-mapView:imageForAnnotation:` method. @@ -662,7 +662,7 @@ MGL_EXPORT IB_DESIGNABLE /** Returns the list of annotations associated with the receiver that intersect with the given rectangle. - + @param rect A rectangle expressed in the map view’s coordinate system. @return An array of objects that adopt the `MGLAnnotation` protocol or `nil` if no annotations associated with the map view are currently visible in the @@ -674,7 +674,7 @@ MGL_EXPORT IB_DESIGNABLE /** The currently selected annotations. - + Assigning a new array to this property selects only the first annotation in the array. */ @@ -682,30 +682,30 @@ MGL_EXPORT IB_DESIGNABLE /** Selects an annotation and displays a callout popover for it. - + If the given annotation is not visible within the current viewport, this method has no effect. - + @param annotation The annotation object to select. */ - (void)selectAnnotation:(id <MGLAnnotation>)annotation; /** Deselects an annotation and hides its callout popover. - + @param annotation The annotation object to deselect. */ - (void)deselectAnnotation:(nullable id <MGLAnnotation>)annotation; /** A common view controller for managing a callout popover’s content view. - + Like any instance of `NSPopover`, an annotation callout manages its contents with a view controller. The annotation object is the view controller’s represented object. This means that you can bind controls in the view controller’s content view to KVO-compliant properties of the annotation object, such as `title` and `subtitle`. - + This property defines a common view controller that is used for every annotation’s callout view. If you set this property to `nil`, a default view controller will be used that manages a simple title label and subtitle label. @@ -719,7 +719,7 @@ MGL_EXPORT IB_DESIGNABLE /** Returns a point annotation located at the given point. - + @param point A point in the view’s coordinate system. @return A point annotation whose annotation image coincides with the point. If multiple point annotations coincide with the point, the return value is the @@ -731,9 +731,9 @@ MGL_EXPORT IB_DESIGNABLE /** Adds a single overlay to the map. - + To remove an overlay from a map, use the `-removeOverlay:` method. - + @param overlay The overlay object to add. This object must conform to the `MGLOverlay` protocol. */ @@ -741,9 +741,9 @@ MGL_EXPORT IB_DESIGNABLE /** Adds an array of overlays to the map. - + To remove multiple overlays from a map, use the `-removeOverlays:` method. - + @param overlays An array of objects, each of which must conform to the `MGLOverlay` protocol. */ @@ -751,19 +751,19 @@ MGL_EXPORT IB_DESIGNABLE /** Removes a single overlay from the map. - + If the specified overlay is not currently associated with the map view, this method does nothing. - + @param overlay The overlay object to remove. */ - (void)removeOverlay:(id <MGLOverlay>)overlay; /** Removes an array of overlays from the map. - + If a given overlay object is not associated with the map view, it is ignored. - + @param overlays An array of objects, each of which conforms to the `MGLOverlay` protocol. */ @@ -773,12 +773,12 @@ MGL_EXPORT IB_DESIGNABLE /** Returns an array of rendered map features that intersect with a given point. - + This method may return features from any of the map’s style layers. To restrict the search to a particular layer or layers, use the `-visibleFeaturesAtPoint:inStyleLayersWithIdentifiers:` method. For more information about searching for map features, see that method’s documentation. - + @param point A point expressed in the map view’s coordinate system. @return An array of objects conforming to the `MGLFeature` protocol that represent features in the sources used by the current style. @@ -788,13 +788,13 @@ MGL_EXPORT IB_DESIGNABLE /** Returns an array of rendered map features that intersect with a given point, restricted to the given style layers. - + Each object in the returned array represents a feature rendered by the current style and provides access to attributes specified by the relevant <a href="https://www.mapbox.com/mapbox-gl-style-spec/#sources">tile sources</a>. The returned array includes features specified in vector and GeoJSON tile sources but does not include anything from raster, image, or video sources. - + Only visible features are returned. For example, suppose the current style uses the <a href="https://www.mapbox.com/vector-tiles/mapbox-streets/">Mapbox Streets source</a>, @@ -807,22 +807,22 @@ MGL_EXPORT IB_DESIGNABLE attributes). The dictionary contains only the attributes provided by the tile source; it does not include computed attribute values or rules about how the feature is rendered by the current style. - + The returned array is sorted by z-order, starting with the topmost rendered feature and ending with the bottommost rendered feature. A feature that is rendered multiple times due to wrapping across the antimeridian at low zoom levels is included only once, subject to the caveat that follows. - + Features come from tiled vector data or GeoJSON data that is converted to tiles internally, so feature geometries are clipped at tile boundaries and features may appear duplicated across tiles. For example, suppose the specified point lies along a road that spans the screen. The resulting array includes those parts of the road that lie within the map tile that contain the specified point, even if the road extends into other tiles. - + To find out the layer names in a particular style, view the style in <a href="https://www.mapbox.com/studio/">Mapbox Studio</a>. - + @note Layer identifiers are not guaranteed to exist across styles or different versions of the same style. Applications that use this API must first set the style URL to an explicitly versioned style using a convenience method like @@ -843,12 +843,12 @@ MGL_EXPORT IB_DESIGNABLE /** Returns an array of rendered map features that intersect with the given rectangle. - + This method may return features from any of the map’s style layers. To restrict the search to a particular layer or layers, use the `-visibleFeaturesAtPoint:inStyleLayersWithIdentifiers:` method. For more information about searching for map features, see that method’s documentation. - + @param rect A rectangle expressed in the map view’s coordinate system. @return An array of objects conforming to the `MGLFeature` protocol that represent features in the sources used by the current style. @@ -858,13 +858,13 @@ MGL_EXPORT IB_DESIGNABLE /** Returns an array of rendered map features that intersect with the given rectangle, restricted to the given style layers. - + Each object in the returned array represents a feature rendered by the current style and provides access to attributes specified by the relevant <a href="https://www.mapbox.com/mapbox-gl-style-spec/#sources">tile sources</a>. The returned array includes features specified in vector and GeoJSON tile sources but does not include anything from raster, image, or video sources. - + Only visible features are returned. For example, suppose the current style uses the <a href="https://www.mapbox.com/vector-tiles/mapbox-streets/">Mapbox Streets source</a>, @@ -877,12 +877,12 @@ MGL_EXPORT IB_DESIGNABLE contains only the attributes provided by the tile source; it does not include computed attribute values or rules about how the feature is rendered by the current style. - + The returned array is sorted by z-order, starting with the topmost rendered feature and ending with the bottommost rendered feature. A feature that is rendered multiple times due to wrapping across the antimeridian at low zoom levels is included only once, subject to the caveat that follows. - + Features come from tiled vector data or GeoJSON data that is converted to tiles internally, so feature geometries are clipped at tile boundaries and features may appear duplicated across tiles. For example, suppose the specified @@ -890,10 +890,10 @@ MGL_EXPORT IB_DESIGNABLE includes those parts of the road that lie within the map tiles covering the specified rectangle, even if the road extends into other tiles. The portion of the road within each map tile is included individually. - + To find out the layer names in a particular style, view the style in <a href="https://www.mapbox.com/studio/">Mapbox Studio</a>. - + @note Layer identifiers are not guaranteed to exist across styles or different versions of the same style. Applications that use this API must first set the style URL to an explicitly versioned style using a convenience method like @@ -916,7 +916,7 @@ MGL_EXPORT IB_DESIGNABLE /** Converts a geographic coordinate to a point in the given view’s coordinate system. - + @param coordinate The geographic coordinate to convert. @param view The view in whose coordinate system the returned point should be expressed. If this parameter is `nil`, the returned point is expressed in @@ -930,7 +930,7 @@ MGL_EXPORT IB_DESIGNABLE /** Converts a point in the given view’s coordinate system to a geographic coordinate. - + @param point The point to convert. @param view The view in whose coordinate system the point is expressed. @return The geographic coordinate at the given point. @@ -940,7 +940,7 @@ MGL_EXPORT IB_DESIGNABLE /** Converts a geographic bounding box to a rectangle in the given view’s coordinate system. - + @param bounds The geographic bounding box to convert. @param view The view in whose coordinate system the returned rectangle should be expressed. If this parameter is `nil`, the returned rectangle is @@ -952,7 +952,7 @@ MGL_EXPORT IB_DESIGNABLE /** Converts a rectangle in the given view’s coordinate system to a geographic bounding box. - + @param rect The rectangle to convert. @param view The view in whose coordinate system the rectangle is expressed. @return The geographic bounding box coextensive with the given rectangle. @@ -962,11 +962,11 @@ MGL_EXPORT IB_DESIGNABLE /** Returns the distance spanned by one point in the map view’s coordinate system at the given latitude and current zoom level. - + The distance between points decreases as the latitude approaches the poles. This relationship parallels the relationship between longitudinal coordinates at different latitudes. - + @param latitude The latitude of the geographic coordinate represented by the point. @return The distance in meters spanned by a single point. @@ -978,11 +978,11 @@ MGL_EXPORT IB_DESIGNABLE /** Opens one or more webpages in the default Web browser in which the user can provide feedback about the map data. - + You should add a menu item to the Help menu of your application that invokes this method. Title it “Improve This Map” or similar. Set its target to the first responder and its action to `giveFeedback:`. - + This map view searches the current style’s sources for webpages to open. Specifically, each source’s tile set has an `attribution` property containing HTML code; if an <code><a></code> tag (link) within that code has an @@ -996,7 +996,7 @@ MGL_EXPORT IB_DESIGNABLE /** The options that determine which debugging aids are shown on the map. - + These options are all disabled by default and should remain disabled in released software for performance and aesthetic reasons. */ diff --git a/platform/macos/src/MGLMapView.mm b/platform/macos/src/MGLMapView.mm index 6755c5de62..86d74d768d 100644 --- a/platform/macos/src/MGLMapView.mm +++ b/platform/macos/src/MGLMapView.mm @@ -436,7 +436,7 @@ public: } attributionView.subviews = @[]; [attributionView removeConstraints:attributionView.constraints]; - + // Make the whole string mini by default. // Force links to be black, because the default blue is distracting. CGFloat miniSize = [NSFont systemFontSizeForControlSize:NSMiniControlSize]; @@ -446,7 +446,7 @@ public: if (info.feedbackLink) { continue; } - + // For each attribution, add a borderless button that responds to clicks // and feels like a hyperlink. NSButton *button = [[MGLAttributionButton alloc] initWithAttributionInfo:info]; @@ -483,7 +483,7 @@ public: multiplier:1 constant:0]]; } - + if (attributionInfos.count) { [attributionView addConstraint: [NSLayoutConstraint constraintWithItem:attributionView @@ -615,7 +615,7 @@ public: if (_isTargetingInterfaceBuilder) { return; } - + // Default to Streets. if (!styleURL) { // An access token is required to load any default style, including @@ -1706,12 +1706,12 @@ public: { return nil; } - + std::vector<MGLAnnotationTag> annotationTags = [self annotationTagsInRect:rect]; if (annotationTags.size()) { NSMutableArray *annotations = [NSMutableArray arrayWithCapacity:annotationTags.size()]; - + for (auto const& annotationTag: annotationTags) { if (!_annotationContextsByAnnotationTag.count(annotationTag)) @@ -1721,10 +1721,10 @@ public: MGLAnnotationContext annotationContext = _annotationContextsByAnnotationTag.at(annotationTag); [annotations addObject:annotationContext.annotation]; } - + return [annotations copy]; } - + return nil; } diff --git a/platform/macos/src/MGLMapViewDelegate.h b/platform/macos/src/MGLMapViewDelegate.h index 1cf86263f3..534e28e3a8 100644 --- a/platform/macos/src/MGLMapViewDelegate.h +++ b/platform/macos/src/MGLMapViewDelegate.h @@ -26,10 +26,10 @@ NS_ASSUME_NONNULL_BEGIN /** Tells the delegate that the viewpoint depicted by the map view is about to change. - + This method is called whenever the currently displayed map camera will start changing for any reason. - + @param mapView The map view whose viewpoint will change. @param animated Whether the change will cause an animated effect on the map. */ @@ -37,14 +37,14 @@ NS_ASSUME_NONNULL_BEGIN /** Tells the delegate that the viewpoint depicted by the map view is changing. - + This method is called as the currently displayed map camera changes as part of an animation, whether due to a user gesture or due to a call to a method such as `-[MGLMapView setCamera:animated:]`. During the animation, this method may be called many times to report updates to the viewpoint. Therefore, your implementation of this method should be as lightweight as possible to avoid affecting performance. - + @param mapView The map view whose viewpoint is changing. */ - (void)mapViewCameraIsChanging:(MGLMapView *)mapView; @@ -52,10 +52,10 @@ NS_ASSUME_NONNULL_BEGIN /** Tells the delegate that the viewpoint depicted by the map view has finished changing. - + This method is called whenever the currently displayed map camera has finished changing, after any calls to `-mapViewRegionIsChanging:` due to animation. - + @param mapView The map view whose viewpoint has changed. @param animated Whether the change caused an animated effect on the map. */ @@ -65,20 +65,20 @@ NS_ASSUME_NONNULL_BEGIN /** Tells the delegate that the map view will begin to load. - + This method is called whenever the map view starts loading, including when a new style has been set and the map must reload. - + @param mapView The map view that is starting to load. */ - (void)mapViewWillStartLoadingMap:(MGLMapView *)mapView; /** Tells the delegate that the map view has finished loading. - + This method is called whenever the map view finishes loading, either after the initial load or after a style change has forced a reload. - + @param mapView The map view that has finished loading. */ - (void)mapViewDidFinishLoadingMap:(MGLMapView *)mapView; @@ -86,11 +86,11 @@ NS_ASSUME_NONNULL_BEGIN /** Tells the delegate that the map view was unable to load data needed for displaying the map. - + This method may be called for a variety of reasons, including a network connection failure or a failure to fetch the style from the server. You can use the given error message to notify the user that map data is unavailable. - + @param mapView The map view that is unable to load the data. @param error The reason the data could not be loaded. */ @@ -101,26 +101,26 @@ NS_ASSUME_NONNULL_BEGIN /** Tells the delegate that the map view is about to redraw. - + This method is called any time the map view needs to redraw due to a change in the viewpoint or style property transition. This method may be called very frequently, even moreso than `-mapViewRegionIsChanging:`. Therefore, your implementation of this method should be as lightweight as possible to avoid affecting performance. - + @param mapView The map view that is about to redraw. */ - (void)mapViewWillStartRenderingFrame:(MGLMapView *)mapView; /** Tells the delegate that the map view has just redrawn. - + This method is called any time the map view needs to redraw due to a change in the viewpoint or style property transition. This method may be called very frequently, even moreso than `-mapViewRegionIsChanging:`. Therefore, your implementation of this method should be as lightweight as possible to avoid affecting performance. - + @param mapView The map view that has just redrawn. */ - (void)mapViewDidFinishRenderingFrame:(MGLMapView *)mapView fullyRendered:(BOOL)fullyRendered; @@ -147,7 +147,7 @@ NS_ASSUME_NONNULL_BEGIN /** Returns an annotation image object to mark the given point annotation object on the map. - + @param mapView The map view that requested the annotation image. @param annotation The object representing the annotation that is about to be displayed. @@ -161,7 +161,7 @@ NS_ASSUME_NONNULL_BEGIN A value of 0.0 results in a completely transparent shape. A value of 1.0, the default, results in a completely opaque shape. - + This method sets the opacity of an entire shape, inclusive of its stroke and fill. To independently set the values for stroke or fill, specify an alpha component in the color returned by `-mapView:strokeColorForShapeAnnotation:` or @@ -175,13 +175,13 @@ NS_ASSUME_NONNULL_BEGIN /** Returns the color to use when rendering the outline of a shape annotation. - + The default stroke color is the selected menu item color. If a pattern color is specified, the result is undefined. - + Opacity may be set by specifying an alpha component. The default alpha value is `1.0` and results in a completely opaque stroke. - + @param mapView The map view rendering the shape annotation. @param annotation The annotation being rendered. @return A color to use for the shape outline. @@ -190,13 +190,13 @@ NS_ASSUME_NONNULL_BEGIN /** Returns the color to use when rendering the fill of a polygon annotation. - + The default fill color is the selected menu item color. If a pattern color is specified, the result is undefined. - + Opacity may be set by specifying an alpha component. The default alpha value is `1.0` and results in a completely opaque shape. - + @param mapView The map view rendering the polygon annotation. @param annotation The annotation being rendered. @return The polygon’s interior fill color. @@ -206,9 +206,9 @@ NS_ASSUME_NONNULL_BEGIN /** Returns the line width in points to use when rendering the outline of a polyline annotation. - + By default, the polyline is outlined with a line 3.0 points wide. - + @param mapView The map view rendering the polygon annotation. @param annotation The annotation being rendered. @return A line width for the polyline, measured in points. @@ -219,9 +219,9 @@ NS_ASSUME_NONNULL_BEGIN /** Tells the delegate that one of its annotations has been selected. - + You can use this method to track changes to the selection state of annotations. - + @param mapView The map view containing the annotation. @param annotation The annotation that was selected. */ @@ -229,9 +229,9 @@ NS_ASSUME_NONNULL_BEGIN /** Tells the delegate that one of its annotations has been deselected. - + You can use this method to track changes in the selection state of annotations. - + @param mapView The map view containing the annotation. @param annotation The annotation that was deselected. */ @@ -242,19 +242,19 @@ NS_ASSUME_NONNULL_BEGIN /** Returns a Boolean value indicating whether the annotation is able to display extra information in a callout popover. - + This method is called after an annotation is selected, before any callout is displayed for the annotation. - + If the return value is `YES`, a callout popover is shown when the user clicks on an annotation, selecting it. The default callout displays the annotation’s title and subtitle. You can customize the popover’s contents by implementing the `-mapView:calloutViewControllerForAnnotation:` method. - + If the return value is `NO`, or if this method is absent from the delegate, or if the annotation lacks a title, the annotation will not show a callout even when selected. - + @param mapView The map view that has selected the annotation. @param annotation The object representing the annotation. @return A Boolean value indicating whether the annotation should show a @@ -264,16 +264,16 @@ NS_ASSUME_NONNULL_BEGIN /** Returns a view controller to manage the callout popover’s content view. - + Like any instance of `NSPopover`, an annotation callout manages its contents with a view controller. The annotation object is the view controller’s represented object. This means that you can bind controls in the view controller’s content view to KVO-compliant properties of the annotation object, such as `title` and `subtitle`. - + If each annotation should have an identical callout, you can set the `MGLMapView.calloutViewController` property instead. - + @param mapView The map view that is requesting a callout view controller. @param annotation The object representing the annotation. @return A view controller for the given annotation. diff --git a/platform/macos/src/MGLOpenGLLayer.mm b/platform/macos/src/MGLOpenGLLayer.mm index 16b4042ce1..17ba9951c7 100644 --- a/platform/macos/src/MGLOpenGLLayer.mm +++ b/platform/macos/src/MGLOpenGLLayer.mm @@ -8,9 +8,9 @@ return (MGLMapView *)super.view; } -//- (BOOL)isAsynchronous { +// - (BOOL)isAsynchronous { // return YES; -//} +// } - (BOOL)needsDisplayOnBoundsChange { return YES; diff --git a/platform/macos/src/NSColor+MGLAdditions.mm b/platform/macos/src/NSColor+MGLAdditions.mm index 2a55af5cad..5288f2bc61 100644 --- a/platform/macos/src/NSColor+MGLAdditions.mm +++ b/platform/macos/src/NSColor+MGLAdditions.mm @@ -5,9 +5,9 @@ - (mbgl::Color)mgl_color { CGFloat r, g, b, a; - + [[self colorUsingColorSpaceName:NSCalibratedRGBColorSpace] getRed:&r green:&g blue:&b alpha:&a]; - + return { (float)r, (float)g, (float)b, (float)a }; } diff --git a/platform/macos/test/MGLAttributionButtonTests.m b/platform/macos/test/MGLAttributionButtonTests.m index f5c0aac856..b41de95317 100644 --- a/platform/macos/test/MGLAttributionButtonTests.m +++ b/platform/macos/test/MGLAttributionButtonTests.m @@ -16,12 +16,12 @@ }]; MGLAttributionInfo *info = [[MGLAttributionInfo alloc] initWithTitle:title URL:nil]; MGLAttributionButton *button = [[MGLAttributionButton alloc] initWithAttributionInfo:info]; - + NSRange symbolUnderlineRange; NSNumber *symbolUnderline = [button.attributedTitle attribute:NSUnderlineStyleAttributeName atIndex:0 effectiveRange:&symbolUnderlineRange]; XCTAssertNil(symbolUnderline); XCTAssertEqual(symbolUnderlineRange.length, 6); - + NSRange wordUnderlineRange; NSNumber *wordUnderline = [button.attributedTitle attribute:NSUnderlineStyleAttributeName atIndex:6 effectiveRange:&wordUnderlineRange]; XCTAssertEqualObjects(wordUnderline, @(NSUnderlineStyleSingle)); diff --git a/platform/node/src/node_map.cpp b/platform/node/src/node_map.cpp index ea3517f2a6..b73206c6cb 100644 --- a/platform/node/src/node_map.cpp +++ b/platform/node/src/node_map.cpp @@ -582,18 +582,18 @@ void NodeMap::RemoveLayer(const Nan::FunctionCallbackInfo<v8::Value>& info) { nodeMap->map->removeLayer(*Nan::Utf8String(info[0])); } - + void NodeMap::AddImage(const Nan::FunctionCallbackInfo<v8::Value>& info) { using namespace mbgl::style; using namespace mbgl::style::conversion; - + auto nodeMap = Nan::ObjectWrap::Unwrap<NodeMap>(info.Holder()); if (!nodeMap->map) return Nan::ThrowError(releasedMessage()); - + if (info.Length() != 3) { return Nan::ThrowTypeError("Three arguments required"); } - + if (!info[0]->IsString()) { return Nan::ThrowTypeError("First argument must be a string"); } @@ -601,61 +601,61 @@ void NodeMap::AddImage(const Nan::FunctionCallbackInfo<v8::Value>& info) { if (!info[1]->IsObject()) { return Nan::ThrowTypeError("Second argument must be an object"); } - + if (!info[2]->IsObject()) { return Nan::ThrowTypeError("Third argument must be an object"); } - + auto optionObject = Nan::To<v8::Object>(info[2]).ToLocalChecked(); - + if (!Nan::Get(optionObject, Nan::New("height").ToLocalChecked()).ToLocalChecked()->IsUint32()) { return Nan::ThrowTypeError("height parameter required"); } - + if (!Nan::Get(optionObject, Nan::New("width").ToLocalChecked()).ToLocalChecked()->IsUint32()) { return Nan::ThrowTypeError("width parameter required"); } - + if (!Nan::Get(optionObject, Nan::New("pixelRatio").ToLocalChecked()).ToLocalChecked()->IsUint32()) { return Nan::ThrowTypeError("pixelRatio parameter required"); } - + uint32_t imageHeight = Nan::Get(optionObject, Nan::New("height").ToLocalChecked()).ToLocalChecked()->Uint32Value(); uint32_t imageWidth = Nan::Get(optionObject, Nan::New("width").ToLocalChecked()).ToLocalChecked()->Uint32Value(); - + if (imageWidth > 1024 || imageHeight > 1024) { return Nan::ThrowTypeError("Max height and width is 1024"); } - + uint32_t pixelRatio = Nan::Get(optionObject, Nan::New("pixelRatio").ToLocalChecked()).ToLocalChecked()->Uint32Value(); auto imageBuffer = Nan::To<v8::Object>(info[1]).ToLocalChecked()->ToObject(); - + if (node::Buffer::Length(imageBuffer) != imageHeight * imageWidth * 4) { return Nan::ThrowTypeError("Image size does not match buffer size"); } - + std::unique_ptr<uint8_t[]> data = std::make_unique<uint8_t[]>(node::Buffer::Length(imageBuffer)); std::copy(node::Buffer::Data(imageBuffer), node::Buffer::Data(imageBuffer) + node::Buffer::Length(imageBuffer), data.get()); mbgl::PremultipliedImage cPremultipliedImage({ imageWidth, imageHeight}, std::move(data)); nodeMap->map->addImage(*Nan::Utf8String(info[0]), std::make_unique<mbgl::SpriteImage>(std::move(cPremultipliedImage), pixelRatio)); } - + void NodeMap::RemoveImage(const Nan::FunctionCallbackInfo<v8::Value>& info) { using namespace mbgl::style; using namespace mbgl::style::conversion; - + auto nodeMap = Nan::ObjectWrap::Unwrap<NodeMap>(info.Holder()); if (!nodeMap->map) return Nan::ThrowError(releasedMessage()); - + if (info.Length() != 1) { return Nan::ThrowTypeError("One argument required"); } - + if (!info[0]->IsString()) { return Nan::ThrowTypeError("First argument must be a string"); } - + nodeMap->map->removeImage(*Nan::Utf8String(info[0])); } diff --git a/platform/node/test/memory.test.js b/platform/node/test/memory.test.js index ad54098832..e23cb60f89 100644 --- a/platform/node/test/memory.test.js +++ b/platform/node/test/memory.test.js @@ -27,7 +27,7 @@ var tile_raster = readFixture('raster.tile'); var tile_vector = readFixture('vector.tile'); test('Memory', function(t) { - // Trigger garbage collection before starting test, then initialize + // Trigger garbage collection before starting test, then initialize // heap size if (typeof gc === 'function') gc(); var lastHeapSize = process.memoryUsage()['heapUsed']; @@ -86,7 +86,7 @@ test('Memory', function(t) { if (renderCount % (testParams.numRenderings / 10) == 0) { // Manually trigger garbage collection if (typeof gc === 'function') gc(); - + var currentHeapSize = process.memoryUsage()['heapUsed']; // Print some progress, so slow build bots don't timeout. diff --git a/platform/qt/src/http_file_source.cpp b/platform/qt/src/http_file_source.cpp index 6831c040b0..573b707c27 100644 --- a/platform/qt/src/http_file_source.cpp +++ b/platform/qt/src/http_file_source.cpp @@ -108,4 +108,4 @@ uint32_t HTTPFileSource::maximumConcurrentRequests() { #endif } -} // mbgl +} // namespace mbgl diff --git a/platform/qt/src/http_request.cpp b/platform/qt/src/http_request.cpp index e19316fe2f..6141216c65 100644 --- a/platform/qt/src/http_request.cpp +++ b/platform/qt/src/http_request.cpp @@ -118,7 +118,7 @@ void HTTPRequest::handleNetworkReply(QNetworkReply *reply) } case 429: response.error = std::make_unique<Error>( - Error::Reason::RateLimit, "HTTP status code 429", + Error::Reason::RateLimit, "HTTP status code 429", http::parseRetryHeaders(retryAfter, xRateLimitReset)); break; default: diff --git a/scripts/codestyle.sh b/scripts/codestyle.sh new file mode 100755 index 0000000000..3ed74f17c2 --- /dev/null +++ b/scripts/codestyle.sh @@ -0,0 +1,37 @@ +#!/usr/bin/env bash + +set -e +set -o pipefail + +# Treats all characters as bytes, removes Unicode awareness from (broken?) macOS sed. +export LC_ALL=C + +if [ `uname -s` = 'Darwin' ]; then + # BSD sed accepts a file extension. + SED="sed -i''" +else + # GNU sed does not. + SED="sed -i" +fi + +# Gather list of files +FILES=$(git ls-files "*.hpp" "*.cpp" "*.h" "*.mm" "*.m" "*.c" "*.java" "*.xml" "*.ejs" "*.gradle" | + sed '/^platform\/android\/MapboxGLAndroidSDK\/src\/main\/java\/com\/almeros\// d;/^src\/clipper\// d;/^platform\/ios\/uitest\/OCMock/d') + +# Adds trailing newlines to files. +echo "Checking for missing trailing newlines..." +echo "${FILES}" | tr '\n' '\0' | xargs -0 ${SED} -e '$a\' + +# Removes trailing whitespace. +echo "Checking for trailing whitespace..." +echo "${FILES}" | tr '\n' '\0' | xargs -0 ${SED} 's/ *$// ' + +# Add space after // comments. Does not replace // within double quotes. +# Part of the regex is from http://stackoverflow.com/a/11503678 +echo "Checking for missing spaces after comments..." +echo "${FILES}" | tr '\n' '\0' | xargs -0 perl -p -i -e 's/(?<!(:|\/))\/\/(?=[^ \/\n])(?=(?:[^"]*"[^"]*")*[^"]*\Z)/\/\/ /g' + +git diff --exit-code -- ${FILES} || { + echo "Some files were modified during code style checking." + exit 1 +} diff --git a/src/mbgl/annotation/annotation_manager.cpp b/src/mbgl/annotation/annotation_manager.cpp index f8c1c3adf7..fbc0469c21 100644 --- a/src/mbgl/annotation/annotation_manager.cpp +++ b/src/mbgl/annotation/annotation_manager.cpp @@ -90,7 +90,7 @@ void AnnotationManager::add(const AnnotationID& id, const StyleSourcedAnnotation Update AnnotationManager::update(const AnnotationID& id, const SymbolAnnotation& annotation, const uint8_t maxZoom) { Update result = Update::Nothing; - + auto it = symbolAnnotations.find(id); if (it == symbolAnnotations.end()) { assert(false); // Attempt to update a non-existent symbol annotation diff --git a/src/mbgl/gl/debugging.cpp b/src/mbgl/gl/debugging.cpp index f99308de7e..5ce3e606ee 100644 --- a/src/mbgl/gl/debugging.cpp +++ b/src/mbgl/gl/debugging.cpp @@ -132,7 +132,7 @@ void enable() { } // This will enable all messages including performance hints - //MBGL_CHECK_ERROR(DebugMessageControl(GL_DONT_CARE, GL_DONT_CARE, GL_DONT_CARE, 0, nullptr, GL_TRUE)); + // MBGL_CHECK_ERROR(DebugMessageControl(GL_DONT_CARE, GL_DONT_CARE, GL_DONT_CARE, 0, nullptr, GL_TRUE)); // This will only enable high and medium severity messages MBGL_CHECK_ERROR(DebugMessageControl(GL_DONT_CARE, GL_DONT_CARE, GL_DEBUG_SEVERITY_HIGH, 0, nullptr, GL_TRUE)); diff --git a/src/mbgl/gl/vertex_array.hpp b/src/mbgl/gl/vertex_array.hpp index 6215e56f21..6b6e11324f 100644 --- a/src/mbgl/gl/vertex_array.hpp +++ b/src/mbgl/gl/vertex_array.hpp @@ -11,4 +11,4 @@ extern ExtensionFunction<void(GLsizei n, const GLuint* arrays)> DeleteVertexArra extern ExtensionFunction<void(GLsizei n, GLuint* arrays)> GenVertexArrays; } // namespace gl -} // namespace mbgl
\ No newline at end of file +} // namespace mbgl diff --git a/src/mbgl/layout/symbol_layout.hpp b/src/mbgl/layout/symbol_layout.hpp index c89b791ccc..3430b937e9 100644 --- a/src/mbgl/layout/symbol_layout.hpp +++ b/src/mbgl/layout/symbol_layout.hpp @@ -92,7 +92,7 @@ private: GlyphRangeSet ranges; std::vector<SymbolInstance> symbolInstances; std::vector<SymbolFeature> features; - + BiDi bidi; // Consider moving this up to geometry tile worker to reduce reinstantiation costs; use of BiDi/ubiditransform object must be constrained to one thread }; diff --git a/src/mbgl/programs/program.hpp b/src/mbgl/programs/program.hpp index e5aae24997..85902d3351 100644 --- a/src/mbgl/programs/program.hpp +++ b/src/mbgl/programs/program.hpp @@ -16,7 +16,7 @@ public: Program(gl::Context& context, const ProgramParameters& programParameters) : ParentType(context, vertexSource(programParameters), fragmentSource(programParameters)) {} - + static std::string pixelRatioDefine(const ProgramParameters& parameters) { std::ostringstream pixelRatioSS; pixelRatioSS.imbue(std::locale("C")); diff --git a/src/mbgl/renderer/circle_bucket.cpp b/src/mbgl/renderer/circle_bucket.cpp index ba2285c4eb..d3ce8405d0 100644 --- a/src/mbgl/renderer/circle_bucket.cpp +++ b/src/mbgl/renderer/circle_bucket.cpp @@ -20,7 +20,7 @@ void CircleBucket::upload(gl::Context& context) { } void CircleBucket::render(Painter& painter, - PaintParameters& parameters, + PaintParameters& parameters, const Layer& layer, const RenderTile& tile) { painter.renderCircle(parameters, *this, *layer.as<CircleLayer>(), tile); diff --git a/src/mbgl/renderer/painter.cpp b/src/mbgl/renderer/painter.cpp index 505007304d..2e16777cdb 100644 --- a/src/mbgl/renderer/painter.cpp +++ b/src/mbgl/renderer/painter.cpp @@ -94,7 +94,7 @@ Painter::Painter(gl::Context& context_, const TransformState& state_, float pixe ProgramParameters programParameters{ pixelRatio, false }; programs = std::make_unique<Programs>(context, programParameters); #ifndef NDEBUG - + ProgramParameters programParametersOverdraw{ pixelRatio, true }; overdrawPrograms = std::make_unique<Programs>(context, programParametersOverdraw); #endif diff --git a/src/mbgl/storage/local_file_source.hpp b/src/mbgl/storage/local_file_source.hpp index 5d665c3848..43319bc06e 100644 --- a/src/mbgl/storage/local_file_source.hpp +++ b/src/mbgl/storage/local_file_source.hpp @@ -14,7 +14,7 @@ public: ~LocalFileSource() override; std::unique_ptr<AsyncRequest> request(const Resource&, Callback) override; - + static bool acceptsURL(const std::string& url); private: diff --git a/src/mbgl/style/source_observer.hpp b/src/mbgl/style/source_observer.hpp index dcbcaeabaf..9be7c67960 100644 --- a/src/mbgl/style/source_observer.hpp +++ b/src/mbgl/style/source_observer.hpp @@ -20,7 +20,7 @@ public: virtual void onSourceAttributionChanged(Source&, const std::string&) {} virtual void onSourceError(Source&, std::exception_ptr) {} - //Source description needs to be reloaded + // Source description needs to be reloaded virtual void onSourceDescriptionChanged(Source&) {} virtual void onTileChanged(Source&, const OverscaledTileID&) {} diff --git a/src/mbgl/style/sources/geojson_source_impl.cpp b/src/mbgl/style/sources/geojson_source_impl.cpp index 3f3bc879f7..c7c3753076 100644 --- a/src/mbgl/style/sources/geojson_source_impl.cpp +++ b/src/mbgl/style/sources/geojson_source_impl.cpp @@ -39,7 +39,7 @@ GeoJSONSource::Impl::~Impl() = default; void GeoJSONSource::Impl::setURL(std::string url_) { url = std::move(url_); - //Signal that the source description needs a reload + // Signal that the source description needs a reload if (loaded || req) { loaded = false; req.reset(); @@ -57,7 +57,7 @@ void GeoJSONSource::Impl::setGeoJSON(const GeoJSON& geoJSON) { _setGeoJSON(geoJSON); } -//Private implementation +// Private implementation void GeoJSONSource::Impl::_setGeoJSON(const GeoJSON& geoJSON) { double scale = util::EXTENT / util::tileSize; diff --git a/src/mbgl/style/style.cpp b/src/mbgl/style/style.cpp index 0b516f7b9f..d6a525f502 100644 --- a/src/mbgl/style/style.cpp +++ b/src/mbgl/style/style.cpp @@ -134,12 +134,12 @@ void Style::setJSON(const std::string& json) { spriteAtlas->load(parser.spriteURL, fileSource); loaded = true; - + observer->onStyleLoaded(); } void Style::addSource(std::unique_ptr<Source> source) { - //Guard against duplicate source ids + // Guard against duplicate source ids auto it = std::find_if(sources.begin(), sources.end(), [&](const auto& existing) { return existing->getID() == source->getID(); }); @@ -667,7 +667,7 @@ void Style::onLayerLayoutPropertyChanged(Layer& layer, const char * property) { auto update = Update::Layout; - //Recalculate the style for certain properties + // Recalculate the style for certain properties bool needsRecalculation = strcmp(property, "icon-size") == 0 || strcmp(property, "text-size") == 0; if (needsRecalculation) { update |= Update::RecalculateStyle; diff --git a/src/mbgl/style/tile_source_impl.hpp b/src/mbgl/style/tile_source_impl.hpp index 366e0b60a2..2b17872d2b 100644 --- a/src/mbgl/style/tile_source_impl.hpp +++ b/src/mbgl/style/tile_source_impl.hpp @@ -33,7 +33,7 @@ public: const variant<std::string, Tileset>& getURLOrTileset() const { return urlOrTileset; } - + optional<std::string> getAttribution() const override; protected: diff --git a/src/mbgl/text/glyph_set.cpp b/src/mbgl/text/glyph_set.cpp index f9a90f9bb0..b4b3195486 100644 --- a/src/mbgl/text/glyph_set.cpp +++ b/src/mbgl/text/glyph_set.cpp @@ -114,7 +114,7 @@ float GlyphSet::determineAverageLineWidth(const std::u16string& logicalInput, int32_t targetLineCount = std::fmax(1, std::ceil(totalWidth / maxWidth)); return totalWidth / targetLineCount; } - + float calculateBadness(const float lineWidth, const float targetWidth, const float penalty, const bool isLastBreak) { const float raggedness = std::pow(lineWidth - targetWidth, 2); if (isLastBreak) { @@ -130,7 +130,7 @@ float calculateBadness(const float lineWidth, const float targetWidth, const flo } return raggedness + std::pow(penalty, 2); } - + float calculatePenalty(char16_t codePoint, char16_t nextCodePoint) { float penalty = 0; // Force break on newline @@ -146,28 +146,28 @@ float calculatePenalty(char16_t codePoint, char16_t nextCodePoint) { if (nextCodePoint == 0x29 || nextCodePoint == 0xff09) { penalty += 50; } - + return penalty; } - + struct PotentialBreak { PotentialBreak(const std::size_t p_index, const float p_x, const PotentialBreak* p_priorBreak, const float p_badness) : index(p_index), x(p_x), priorBreak(p_priorBreak), badness(p_badness) {} - + const std::size_t index; const float x; const PotentialBreak* priorBreak; const float badness; }; - + PotentialBreak evaluateBreak(const std::size_t breakIndex, const float breakX, const float targetWidth, const std::list<PotentialBreak>& potentialBreaks, const float penalty, const bool isLastBreak) { // We could skip evaluating breaks where the line length (breakX - priorBreak.x) > maxWidth // ...but in fact we allow lines longer than maxWidth (if there's no break points) // ...and when targetWidth and maxWidth are close, strictly enforcing maxWidth can give // more lopsided results. - + const PotentialBreak* bestPriorBreak = nullptr; float bestBreakBadness = calculateBadness(breakX, targetWidth, penalty, isLastBreak); for (const auto& potentialBreak : potentialBreaks) { @@ -182,7 +182,7 @@ PotentialBreak evaluateBreak(const std::size_t breakIndex, const float breakX, c return PotentialBreak(breakIndex, breakX, bestPriorBreak, bestBreakBadness); } - + std::set<std::size_t> leastBadBreaks(const PotentialBreak& lastLineBreak) { std::set<std::size_t> leastBadBreaks = { lastLineBreak.index }; const PotentialBreak* priorBreak = lastLineBreak.priorBreak; @@ -206,9 +206,9 @@ std::set<std::size_t> GlyphSet::determineLineBreaks(const std::u16string& logica if (logicalInput.empty()) { return {}; } - + const float targetWidth = determineAverageLineWidth(logicalInput, spacing, maxWidth); - + std::list<PotentialBreak> potentialBreaks; float currentX = 0; @@ -218,7 +218,7 @@ std::set<std::size_t> GlyphSet::determineLineBreaks(const std::u16string& logica if (it != sdfs.end() && !boost::algorithm::is_any_of(u" \t\n\v\f\r")(codePoint)) { currentX += it->second.metrics.advance + spacing; } - + // Ideographic characters, spaces, and word-breaking punctuation that often appear without // surrounding spaces. if ((i < logicalInput.size() - 1) && @@ -274,7 +274,7 @@ void GlyphSet::shapeLines(Shaping& shaping, if (shaping.positionedGlyphs.size() != lineStartIndex) { float lineLength = x - spacing; // Don't count trailing spacing maxLineLength = util::max(lineLength, maxLineLength); - + justifyLine(shaping.positionedGlyphs, sdfs, lineStartIndex, shaping.positionedGlyphs.size() - 1, justify); } diff --git a/src/mbgl/tile/geojson_tile.cpp b/src/mbgl/tile/geojson_tile.cpp index 61437b79b1..db2f37f96c 100644 --- a/src/mbgl/tile/geojson_tile.cpp +++ b/src/mbgl/tile/geojson_tile.cpp @@ -80,7 +80,7 @@ GeoJSONTile::GeoJSONTile(const OverscaledTileID& overscaledTileID, const style::UpdateParameters& parameters) : GeometryTile(overscaledTileID, sourceID_, parameters) { } - + void GeoJSONTile::updateData(const mapbox::geometry::feature_collection<int16_t>& features) { setData(std::make_unique<GeoJSONTileData>(features)); } diff --git a/src/mbgl/tile/geojson_tile.hpp b/src/mbgl/tile/geojson_tile.hpp index 2880408736..6ddc6ea482 100644 --- a/src/mbgl/tile/geojson_tile.hpp +++ b/src/mbgl/tile/geojson_tile.hpp @@ -16,7 +16,7 @@ public: const style::UpdateParameters&); void updateData(const mapbox::geometry::feature_collection<int16_t>&); - + void setNecessity(Necessity) final; }; diff --git a/src/mbgl/tile/tile_id.hpp b/src/mbgl/tile/tile_id.hpp index 6415debfdc..1ce3eea98e 100644 --- a/src/mbgl/tile/tile_id.hpp +++ b/src/mbgl/tile/tile_id.hpp @@ -252,7 +252,7 @@ template <> struct hash<mbgl::CanonicalTileID> { return seed; } }; - + template <> struct hash<mbgl::UnwrappedTileID> { size_t operator()(const mbgl::UnwrappedTileID &id) const { std::size_t seed = 0; @@ -261,7 +261,7 @@ template <> struct hash<mbgl::UnwrappedTileID> { return seed; } }; - + template <> struct hash<mbgl::OverscaledTileID> { size_t operator()(const mbgl::OverscaledTileID &id) const { std::size_t seed = 0; diff --git a/src/mbgl/util/chrono.cpp b/src/mbgl/util/chrono.cpp index f338f524b9..5c8fd3c0ff 100644 --- a/src/mbgl/util/chrono.cpp +++ b/src/mbgl/util/chrono.cpp @@ -33,7 +33,7 @@ std::string iso8601(Timestamp timestamp) { Timestamp parseTimestamp(const char* timestamp) { return std::chrono::time_point_cast<Seconds>(std::chrono::system_clock::from_time_t(parse_date(timestamp))); } - + Timestamp parseTimestamp(const int32_t timestamp) { return std::chrono::time_point_cast<Seconds>(std::chrono::system_clock::from_time_t(timestamp)); } diff --git a/src/mbgl/util/http_header.cpp b/src/mbgl/util/http_header.cpp index e337d4c8ab..40711232ff 100644 --- a/src/mbgl/util/http_header.cpp +++ b/src/mbgl/util/http_header.cpp @@ -28,7 +28,7 @@ CacheControl CacheControl::parse(const std::string& value) { optional<Timestamp> CacheControl::toTimePoint() const { return maxAge ? util::now() + Seconds(*maxAge) : optional<Timestamp>{}; } - + optional<Timestamp> parseRetryHeaders(const optional<std::string>& retryAfter, const optional<std::string>& xRateLimitReset) { if (retryAfter) { @@ -45,7 +45,7 @@ optional<Timestamp> parseRetryHeaders(const optional<std::string>& retryAfter, return {}; } } - + return {}; } diff --git a/src/mbgl/util/http_header.hpp b/src/mbgl/util/http_header.hpp index fa76cb724e..23da2c9ea4 100644 --- a/src/mbgl/util/http_header.hpp +++ b/src/mbgl/util/http_header.hpp @@ -17,7 +17,7 @@ public: optional<Timestamp> toTimePoint() const; }; - + optional<Timestamp> parseRetryHeaders(const optional<std::string>& retryAfter, const optional<std::string>& xRateLimitReset); diff --git a/src/mbgl/util/http_timeout.cpp b/src/mbgl/util/http_timeout.cpp index ded0128ac9..ca9a93498f 100644 --- a/src/mbgl/util/http_timeout.cpp +++ b/src/mbgl/util/http_timeout.cpp @@ -17,7 +17,7 @@ Duration errorRetryTimeout(Response::Error::Reason failedRequestReason, uint32_t if (retryAfter) { return *retryAfter - util::now(); } else { - //Default + // Default return Seconds(util::DEFAULT_RATE_LIMIT_TIMEOUT); } } else { @@ -34,7 +34,7 @@ Duration expirationTimeout(optional<Timestamp> expires, uint32_t expiredRequests } else { return Duration::max(); } -} +} } // namespace http } // namespace mbgl diff --git a/test/map/map.test.cpp b/test/map/map.test.cpp index 8eedeb3c01..fa331288c5 100644 --- a/test/map/map.test.cpp +++ b/test/map/map.test.cpp @@ -237,7 +237,7 @@ TEST(Map, StyleLoadedSignal) { }); map.setStyleJSON(util::read_file("test/fixtures/api/empty.json")); EXPECT_TRUE(emitted); - + // But not when the style couldn't be parsed emitted = false; map.setStyleJSON("invalid"); diff --git a/test/map/transform.test.cpp b/test/map/transform.test.cpp index d5b98ac109..9125b6ef1d 100644 --- a/test/map/transform.test.cpp +++ b/test/map/transform.test.cpp @@ -343,12 +343,12 @@ TEST(Transform, Padding) { ASSERT_DOUBLE_EQ(10, trueCenter.latitude); ASSERT_DOUBLE_EQ(-100, trueCenter.longitude); ASSERT_DOUBLE_EQ(10, transform.getZoom()); - + const LatLng manualShiftedCenter = transform.getState().screenCoordinateToLatLng({ 1000.0 / 2.0, 1000.0 / 4.0, }); - + EdgeInsets padding; padding.top = 0; @@ -359,7 +359,7 @@ TEST(Transform, Padding) { padding.top = 1000.0 / 2.0; ASSERT_TRUE(bool(padding)); - + const LatLng shiftedCenter = transform.getLatLng(padding); ASSERT_NE(trueCenter.latitude, shiftedCenter.latitude); ASSERT_NEAR(trueCenter.longitude, shiftedCenter.longitude, 1e-9); diff --git a/test/math/wrap.test.cpp b/test/math/wrap.test.cpp index 9ec1c6ef0c..5610257a5c 100644 --- a/test/math/wrap.test.cpp +++ b/test/math/wrap.test.cpp @@ -23,4 +23,4 @@ TEST(Math, WrapMaxValue) { TEST(Math, WrapMinValue) { ASSERT_DOUBLE_EQ(0.0, util::wrap(0.0, 0.0, 12.0)); -}
\ No newline at end of file +} diff --git a/test/src/mbgl/test/conversion_stubs.hpp b/test/src/mbgl/test/conversion_stubs.hpp index ddffb1e3b2..e6581c5e53 100644 --- a/test/src/mbgl/test/conversion_stubs.hpp +++ b/test/src/mbgl/test/conversion_stubs.hpp @@ -24,7 +24,7 @@ class Value : public mbgl::variant<std::string, }; inline bool isUndefined(const Value&) { - //Variant is always intialized + // Variant is always intialized return false; } diff --git a/test/storage/local_file_source.test.cpp b/test/storage/local_file_source.test.cpp index c2f04d7543..1b90e5bb1e 100644 --- a/test/storage/local_file_source.test.cpp +++ b/test/storage/local_file_source.test.cpp @@ -104,14 +104,14 @@ TEST(LocalFileSource, URLEncoding) { TEST(LocalFileSource, URLLimit) { util::RunLoop loop; - + size_t length = PATH_MAX - toAbsoluteURL("").size(); LocalFileSource fs; char filename[length]; memset(filename, 'x', length); - + std::string url(filename, length); - + std::unique_ptr<AsyncRequest> req = fs.request({ Resource::Unknown, toAbsoluteURL(url) }, [&](Response res) { req.reset(); ASSERT_NE(nullptr, res.error); @@ -119,6 +119,6 @@ TEST(LocalFileSource, URLLimit) { ASSERT_FALSE(res.data.get()); loop.stop(); }); - + loop.run(); } diff --git a/test/storage/offline_database.test.cpp b/test/storage/offline_database.test.cpp index 2e25835d80..872310e46f 100644 --- a/test/storage/offline_database.test.cpp +++ b/test/storage/offline_database.test.cpp @@ -276,12 +276,12 @@ TEST(OfflineDatabase, CreateRegion) { TEST(OfflineDatabase, UpdateMetadata) { using namespace mbgl; - + OfflineDatabase db(":memory:"); OfflineRegionDefinition definition { "http://example.com/style", LatLngBounds::hull({1, 2}, {3, 4}), 5, 6, 2.0 }; OfflineRegionMetadata metadata {{ 1, 2, 3 }}; OfflineRegion region = db.createRegion(definition, metadata); - + OfflineRegionMetadata newmetadata {{ 4, 5, 6 }}; db.updateMetadata(region.getID(), newmetadata); EXPECT_EQ(db.listRegions().at(0).getMetadata(), newmetadata); diff --git a/test/storage/online_file_source.test.cpp b/test/storage/online_file_source.test.cpp index 966ef6239a..1a1d2d42f8 100644 --- a/test/storage/online_file_source.test.cpp +++ b/test/storage/online_file_source.test.cpp @@ -364,7 +364,7 @@ TEST(OnlineFileSource, TEST_REQUIRES_SERVER(NetworkStatusOnlineOffline)) { TEST(OnlineFileSource, TEST_REQUIRES_SERVER(RateLimitStandard)) { util::RunLoop loop; OnlineFileSource fs; - + auto req = fs.request({ Resource::Unknown, "http://127.0.0.1:3000/rate-limit?std=true" }, [&](Response res) { ASSERT_NE(nullptr, res.error); EXPECT_EQ(Response::Error::Reason::RateLimit, res.error->reason); @@ -372,14 +372,14 @@ TEST(OnlineFileSource, TEST_REQUIRES_SERVER(RateLimitStandard)) { ASSERT_LT(util::now(), res.error->retryAfter); loop.stop(); }); - + loop.run(); } TEST(OnlineFileSource, TEST_REQUIRES_SERVER(RateLimitMBX)) { util::RunLoop loop; OnlineFileSource fs; - + auto req = fs.request({ Resource::Unknown, "http://127.0.0.1:3000/rate-limit?mbx=true" }, [&](Response res) { ASSERT_NE(nullptr, res.error); EXPECT_EQ(Response::Error::Reason::RateLimit, res.error->reason); @@ -387,28 +387,28 @@ TEST(OnlineFileSource, TEST_REQUIRES_SERVER(RateLimitMBX)) { ASSERT_LT(util::now(), res.error->retryAfter); loop.stop(); }); - + loop.run(); } TEST(OnlineFileSource, TEST_REQUIRES_SERVER(RateLimitDefault)) { util::RunLoop loop; OnlineFileSource fs; - + auto req = fs.request({ Resource::Unknown, "http://127.0.0.1:3000/rate-limit" }, [&](Response res) { ASSERT_NE(nullptr, res.error); EXPECT_EQ(Response::Error::Reason::RateLimit, res.error->reason); ASSERT_FALSE(res.error->retryAfter); loop.stop(); }); - + loop.run(); } TEST(OnlineFileSource, ChangeAPIBaseURL){ util::RunLoop loop; OnlineFileSource fs; - + EXPECT_EQ(mbgl::util::API_BASE_URL, fs.getAPIBaseURL()); const std::string customURL = "test.domain"; fs.setAPIBaseURL(customURL); diff --git a/test/storage/server.js b/test/storage/server.js index a7538b55f1..92e9e9e0e7 100755 --- a/test/storage/server.js +++ b/test/storage/server.js @@ -117,13 +117,13 @@ app.get('/temporary-error', function(req, res) { }); app.get('/rate-limit', function(req, res) { - + if (req.query.std) { res.setHeader('Retry-After', 1); } else if (req.query.mbx) { res.setHeader('x-rate-limit-reset', Math.round(Date.now() / 1000) + 1); } - + res.status(429).end(); }); diff --git a/test/style/conversion/geojson_options.test.cpp b/test/style/conversion/geojson_options.test.cpp index 14a7adbba7..ddf261ea52 100644 --- a/test/style/conversion/geojson_options.test.cpp +++ b/test/style/conversion/geojson_options.test.cpp @@ -28,13 +28,13 @@ TEST(GeoJSONOptions, RetainsDefaults) { Value raw(map); GeoJSONOptions converted = *convert<GeoJSONOptions>(raw); GeoJSONOptions defaults; - - //GeoJSON-VT + + // GeoJSON-VT ASSERT_EQ(converted.maxzoom, defaults.maxzoom); ASSERT_EQ(converted.buffer, defaults.buffer); ASSERT_EQ(converted.tolerance, defaults.tolerance); - - //Supercluster + + // Supercluster ASSERT_EQ(converted.cluster, defaults.cluster); ASSERT_EQ(converted.clusterRadius, defaults.clusterRadius); ASSERT_EQ(converted.clusterMaxZoom, defaults.clusterMaxZoom); @@ -43,25 +43,25 @@ TEST(GeoJSONOptions, RetainsDefaults) { TEST(GeoJSONOptions, FullConversion) { ValueMap map { - //GeoJSON-VT + // GeoJSON-VT {"maxzoom", 1.0f}, {"buffer", 2.0f}, {"tolerance", 3.0f}, - - //Supercluster + + // Supercluster {"cluster", true}, {"clusterRadius", 4.0f}, {"clusterMaxZoom", 5.0f} }; Value raw(map); GeoJSONOptions converted = *convert<GeoJSONOptions>(raw); - - //GeoJSON-VT + + // GeoJSON-VT ASSERT_EQ(converted.maxzoom, 1); ASSERT_EQ(converted.buffer, 2); ASSERT_EQ(converted.tolerance, 3); - - //Supercluster + + // Supercluster ASSERT_EQ(converted.cluster, true); ASSERT_EQ(converted.clusterRadius, 4); ASSERT_EQ(converted.clusterMaxZoom, 5); diff --git a/test/style/source.test.cpp b/test/style/source.test.cpp index 01f54d6b18..fb7737e417 100644 --- a/test/style/source.test.cpp +++ b/test/style/source.test.cpp @@ -393,7 +393,7 @@ TEST(Source, GeoJSonSourceUrlUpdate) { }; test.observer.sourceDescriptionChanged = [&] (Source&) { - //Should be called (test will hang if it doesn't) + // Should be called (test will hang if it doesn't) test.end(); }; @@ -404,12 +404,12 @@ TEST(Source, GeoJSonSourceUrlUpdate) { GeoJSONSource source("source"); source.baseImpl->setObserver(&test.observer); - //Load initial, so the source state will be loaded=true + // Load initial, so the source state will be loaded=true source.baseImpl->loadDescription(test.fileSource); - //Schedule an update + // Schedule an update test.loop.invoke([&] () { - //Update the url + // Update the url source.setURL(std::string("http://source-url.ext")); }); diff --git a/test/style/style.test.cpp b/test/style/style.test.cpp index 89c5c4ce6f..b49058420e 100644 --- a/test/style/style.test.cpp +++ b/test/style/style.test.cpp @@ -131,6 +131,6 @@ TEST(Style, DuplicateSource) { style.addSource(std::make_unique<VectorSource>("sourceId", "mapbox://mapbox.mapbox-terrain-v2")); FAIL() << "Should not have been allowed to add a duplicate source id"; } catch (std::runtime_error) { - //Expected + // Expected } } diff --git a/test/style/style_layer.test.cpp b/test/style/style_layer.test.cpp index 8356f3accd..773d172876 100644 --- a/test/style/style_layer.test.cpp +++ b/test/style/style_layer.test.cpp @@ -278,20 +278,20 @@ TEST(Layer, Observer) { TEST(Layer, DuplicateLayer) { util::RunLoop loop; - //Setup style + // Setup style StubFileSource fileSource; Style style { fileSource, 1.0 }; style.setJSON(util::read_file("test/fixtures/resources/style-unused-sources.json")); - //Add initial layer + // Add initial layer style.addLayer(std::make_unique<LineLayer>("line", "unusedsource")); - //Try to add duplicate + // Try to add duplicate try { style.addLayer(std::make_unique<LineLayer>("line", "unusedsource")); FAIL() << "Should not have been allowed to add a duplicate layer id"; } catch (const std::runtime_error e) { - //Expected + // Expected ASSERT_STREQ("Layer line already exists", e.what()); } } diff --git a/test/util/http_timeout.test.cpp b/test/util/http_timeout.test.cpp index e99c703159..26a306c6e5 100644 --- a/test/util/http_timeout.test.cpp +++ b/test/util/http_timeout.test.cpp @@ -9,7 +9,7 @@ using namespace mbgl; using namespace mbgl::http; TEST(HttpRetry, OtherError) { - //Non-retryable + // Non-retryable ASSERT_EQ(Duration::max(), errorRetryTimeout(Response::Error::Reason::Other, 1)); } @@ -17,7 +17,7 @@ TEST(HttpRetry, ServerError) { // 1-3 failures -> 1 sec ASSERT_EQ(Seconds(1), errorRetryTimeout(Response::Error::Reason::Server, 1)); ASSERT_EQ(Seconds(1), errorRetryTimeout(Response::Error::Reason::Server, 3)); - + // After 3, exponential backoff ASSERT_EQ(Seconds(2), errorRetryTimeout(Response::Error::Reason::Server, 4)); ASSERT_EQ(Seconds(1u << 31), errorRetryTimeout(Response::Error::Reason::Server, 50)); @@ -32,8 +32,8 @@ TEST(HttpRetry, ConnectionError) { TEST(HttpRetry, RateLimit) { // Pre-set value from header ASSERT_EQ(Seconds(1), errorRetryTimeout(Response::Error::Reason::Server, 1, { util::now() + Seconds(1) })); - - //Default + + // Default ASSERT_EQ(Seconds(5), errorRetryTimeout(Response::Error::Reason::RateLimit, 1, {})); } |