Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Feb 24, 2025
1 parent bf5e4f6 commit 0b75b15
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 51 deletions.
18 changes: 9 additions & 9 deletions platform/darwin/src/MLNTileOperation.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
#endif

typedef NS_ENUM(NSInteger, MLNTileOperation) {
MLNTileOperationRequestedFromCache, ///< A read request from the cache
MLNTileOperationRequestedFromNetwork, ///< A read request from the online source
MLNTileOperationLoadFromNetwork, ///< Tile data from the network has been retrieved
MLNTileOperationLoadFromCache, ///< Tile data from the cache has been retrieved
MLNTileOperationStartParse, ///< Background processing of tile data has been initiated
MLNTileOperationEndParse, ///< Background processing of tile data has been completed
MLNTileOperationError, ///< An error occurred while loading the tile
MLNTileOperationCancelled, ///< Loading of a tile was cancelled
MLNTileOperationNullOp, ///< No operation has taken place
MLNTileOperationRequestedFromCache, ///< A read request from the cache
MLNTileOperationRequestedFromNetwork, ///< A read request from the online source
MLNTileOperationLoadFromNetwork, ///< Tile data from the network has been retrieved
MLNTileOperationLoadFromCache, ///< Tile data from the cache has been retrieved
MLNTileOperationStartParse, ///< Background processing of tile data has been initiated
MLNTileOperationEndParse, ///< Background processing of tile data has been completed
MLNTileOperationError, ///< An error occurred while loading the tile
MLNTileOperationCancelled, ///< Loading of a tile was cancelled
MLNTileOperationNullOp, ///< No operation has taken place
};
55 changes: 22 additions & 33 deletions platform/ios/app-swift/Sources/ObserverExample.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import UIKit
// #-example-code(ObserverExample)
class ObserverExampleView: UIViewController, MLNMapViewDelegate {
var mapView: MLNMapView!

override func viewDidLoad() {
super.viewDidLoad()

mapView = MLNMapView(frame: view.bounds, styleURL: AMERICANA_STYLE)
mapView.autoresizingMask = [.flexibleWidth, .flexibleHeight]

Expand All @@ -21,21 +21,21 @@ class ObserverExampleView: UIViewController, MLNMapViewDelegate {

mapView.delegate = self
}

// MARK: - MLNMapViewDelegate methods

func mapView(_: MLNMapView, shaderWillCompile id: Int, backend: Int, defines: String) {
print("A new shader is being compiled - shaderID:\(id), backend type:\(backend), program configuration:\(defines)")
}

func mapView(_: MLNMapView, shaderDidCompile id: Int, backend: Int, defines: String) {
print("A shader has been compiled - shaderID:\(id), backend type:\(backend), program configuration:\(defines)")
}

func mapView(_: MLNMapView, glyphsWillLoad fontStack: [String], range: NSRange) {
print("Glyphs are being requested for the font stack \(fontStack), ranging from \(range.location) to \(range.location + range.length)")
}

func mapView(_: MLNMapView, glyphsDidLoad fontStack: [String], range: NSRange) {
print("Glyphs have been loaded for the font stack \(fontStack), ranging from \(range.location) to \(range.location + range.length)")
}
Expand All @@ -46,59 +46,48 @@ class ObserverExampleView: UIViewController, MLNMapViewDelegate {
z: Int,
wrap: Int,
overscaledZ: Int,
sourceID: String) {
let tileStr = String(format:"(x: %ld, y: %ld, z: %ld, wrap: %ld, overscaledZ: %ld, sourceID: %@)",
sourceID: String)
{
let tileStr = String(format: "(x: %ld, y: %ld, z: %ld, wrap: %ld, overscaledZ: %ld, sourceID: %@)",
x, y, z, wrap, overscaledZ, sourceID)
switch (operation) {

switch operation {
case MLNTileOperation.requestedFromCache:
print("Requesting tile \(tileStr) from cache")
break


case MLNTileOperation.requestedFromNetwork:
print("Requesting tile \(tileStr) from network")
break


case MLNTileOperation.loadFromCache:
print("Loading tile \(tileStr), requested from the cache")
break


case MLNTileOperation.loadFromNetwork:
print("Loading tile \(tileStr), requested from the network")
break


case MLNTileOperation.startParse:
print("Parsing tile \(tileStr)")
break


case MLNTileOperation.endParse:
print("Completed parsing tile \(tileStr)")
break


case MLNTileOperation.error:
print("An error occured during proccessing for tile \(tileStr)")
break


case MLNTileOperation.cancelled:
print("Pending work on tile \(tileStr)")
break


case MLNTileOperation.nullOp:
print("An unknown tile operation was emitted for tile \(tileStr)")
break

@unknown default:
assertionFailure()
}
}

func mapView(_: MLNMapView, spriteWillLoad _: String, url _: String) {

}

func mapView(_: MLNMapView, spriteDidLoad _: String, url _: String) {

}
func mapView(_: MLNMapView, spriteWillLoad _: String, url _: String) {}

func mapView(_: MLNMapView, spriteDidLoad _: String, url _: String) {}
}

// #-end-example-code
Expand Down
18 changes: 9 additions & 9 deletions platform/ios/app/MBXViewController.mm
Original file line number Diff line number Diff line change
Expand Up @@ -2315,40 +2315,40 @@ - (void)mapView:(MLNMapView *)mapView
{
NSString* tileStr = [NSString stringWithFormat:@"(x: %ld, y: %ld, z: %ld, wrap: %ld, overscaledZ: %ld, sourceID: %@)",
x, y, z, wrap, overscaledZ, sourceID];

switch (operation) {
case MLNTileOperationRequestedFromCache:
NSLog(@"Requesting tile %@ from cache", tileStr);
break;

case MLNTileOperationRequestedFromNetwork:
NSLog(@"Requesting tile %@ from network", tileStr);
break;

case MLNTileOperationLoadFromCache:
NSLog(@"Loading tile %@, requested from the cache", tileStr);
break;

case MLNTileOperationLoadFromNetwork:
NSLog(@"Loading tile %@, requested from the network", tileStr);
break;

case MLNTileOperationStartParse:
NSLog(@"Parsing tile %@", tileStr);
break;

case MLNTileOperationEndParse:
NSLog(@"Completed parsing tile %@", tileStr);
break;

case MLNTileOperationError:
NSLog(@"An error occured during proccessing for tile %@", tileStr);
break;

case MLNTileOperationCancelled:
NSLog(@"Pending work on tile %@", tileStr);
break;

case MLNTileOperationNullOp:
NSLog(@"An unknown tile operation was emitted for tile %@", tileStr);
break;
Expand Down

0 comments on commit 0b75b15

Please sign in to comment.