diff --git a/Examples/DemoARViewController.swift b/Examples/DemoARViewController.swift index ab1bc4a..5b1bffb 100644 --- a/Examples/DemoARViewController.swift +++ b/Examples/DemoARViewController.swift @@ -96,7 +96,7 @@ final class DemoARViewController: UIViewController, ARSCNViewDelegate, ARSession terrainNode.geometry?.materials = defaultMaterials() arView!.scene.rootNode.addChildNode(terrainNode) terrain = terrainNode - terrainNode.fetchTerrainAndTexture(minWallHeight: 50.0, enableDynamicShadows: true, textureStyle: "mapbox/satellite-v9", heightProgress: nil, heightCompletion: { fetchError in + terrainNode.fetchTerrainAndTexture(minWallHeight: 50.0, enableDynamicShadows: true, textureStyle: MapStyles.satellite.url, heightProgress: nil, heightCompletion: { fetchError in if let fetchError = fetchError { NSLog("Terrain load failed: \(fetchError.localizedDescription)") } else { diff --git a/Examples/DemoHeightmapViewController.swift b/Examples/DemoHeightmapViewController.swift index 761c0f9..20ab6a4 100644 --- a/Examples/DemoHeightmapViewController.swift +++ b/Examples/DemoHeightmapViewController.swift @@ -13,7 +13,7 @@ class DemoHeightmapViewController: UIViewController { private weak var terrainNode: TerrainNode? private var progressHandler: ProgressCompositor! - private let styles = ["mapbox/outdoors-v10", "mapbox/satellite-v9", "mapbox/navigation-preview-day-v2"] + private let styles = [MapStyles.outdoors.url, MapStyles.satellite.url, MapStyles.navigationPreviewDay.url] required init?(coder aDecoder: NSCoder) { super.init(coder: aDecoder) diff --git a/Examples/DemoPlacementViewController.swift b/Examples/DemoPlacementViewController.swift index b3b0e58..917357f 100644 --- a/Examples/DemoPlacementViewController.swift +++ b/Examples/DemoPlacementViewController.swift @@ -61,7 +61,7 @@ class DemoPlacementViewController: UIViewController { let terrainFetcherHandler = progressHandler.registerForProgress() let textureFetchHandler = progressHandler.registerForProgress() - terrainNode.fetchTerrainAndTexture(minWallHeight: 50.0, enableDynamicShadows: true, textureStyle: "mapbox/satellite-v9", heightProgress: { progress, total in + terrainNode.fetchTerrainAndTexture(minWallHeight: 50.0, enableDynamicShadows: true, textureStyle: MapStyles.satellite.url, heightProgress: { progress, total in progressHandler.updateProgress(handlerID: terrainFetcherHandler, progress: progress, total: total) }, heightCompletion: { fetchError in if let fetchError = fetchError { diff --git a/Examples/DemoStyleViewController.swift b/Examples/DemoStyleViewController.swift index 486dfdc..bb66bc6 100644 --- a/Examples/DemoStyleViewController.swift +++ b/Examples/DemoStyleViewController.swift @@ -12,8 +12,8 @@ class DemoStyleViewController: UIViewController { @IBOutlet private weak var stylePicker: UISegmentedControl? private weak var terrainNode: TerrainNode? - private let styles = ["mapbox/outdoors-v10", "mapbox/satellite-v9", "mapbox/navigation-preview-day-v2"] - + private let styles = [MapStyles.outdoors.url, MapStyles.satellite.url, MapStyles.navigationPreviewDay.url] + override func viewDidLoad() { super.viewDidLoad() diff --git a/Examples/MapStyles.swift b/Examples/MapStyles.swift new file mode 100644 index 0000000..54b565f --- /dev/null +++ b/Examples/MapStyles.swift @@ -0,0 +1,27 @@ +// +// MapStyles.swift +// Examples +// +// Created by Steven Rockarts on 2018-10-25. +// Copyright © 2018 MapBox. All rights reserved. +// + +import Foundation + +struct MapStyles { + public static let streets:DefaultStyle = DefaultStyle(url:"mapbox/streets-v10", name:"Streets", currentVersion:10) + static let outdoors:DefaultStyle = DefaultStyle(url:"mapbox/outdoors-v10", name:"Outdoors", currentVersion:10) + static let light:DefaultStyle = DefaultStyle(url:"mapbox/light-v9", name:"Light", currentVersion:9) + static let dark:DefaultStyle = DefaultStyle(url:"mapbox/dark-v9", name:"Dark", currentVersion: 9) + static let satellite:DefaultStyle = DefaultStyle(url:"mapbox/satellite-v9", name:"Satellite",currentVersion: 9) + static let satelliteStreets:DefaultStyle = DefaultStyle(url:"mapbox/satellite-streets-v10", name:"Satellite Streets", currentVersion:10) + static let navigationPreviewDay:DefaultStyle = DefaultStyle(url: "mapbox/navigation-preview-day-v2", name:"Navigation Preview Day", currentVersion: 2) + + static let allStyles:[String] = [streets.url, outdoors.url, light.url, dark.url, satellite.url, satelliteStreets.url, navigationPreviewDay.url] + + struct DefaultStyle { + let url:String + let name:String + let currentVersion:Int + } +} diff --git a/MapboxSceneKit.xcodeproj/project.pbxproj b/MapboxSceneKit.xcodeproj/project.pbxproj index 42dec59..604a6e0 100644 --- a/MapboxSceneKit.xcodeproj/project.pbxproj +++ b/MapboxSceneKit.xcodeproj/project.pbxproj @@ -42,6 +42,7 @@ 9598A005215EB4E80086CF4E /* StaticConstants.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9598A003215EB4460086CF4E /* StaticConstants.swift */; }; 959F81622149DE9700A290DF /* PolylineRenderer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 959F81612149DE9700A290DF /* PolylineRenderer.swift */; }; 95CC6AA4214ADB05000CD0E6 /* SCNExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95CC6AA3214ADB05000CD0E6 /* SCNExtensions.swift */; }; + B0EACBFC218291060061CB26 /* MapStyles.swift in Sources */ = {isa = PBXBuildFile; fileRef = B0EACBFB218291060061CB26 /* MapStyles.swift */; }; F44BB60520C75CBF00CE41C6 /* DemoExtrusionViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = F44BB60420C75CBF00CE41C6 /* DemoExtrusionViewController.m */; }; /* End PBXBuildFile section */ @@ -106,6 +107,7 @@ 9598A003215EB4460086CF4E /* StaticConstants.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StaticConstants.swift; sourceTree = ""; }; 959F81612149DE9700A290DF /* PolylineRenderer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PolylineRenderer.swift; sourceTree = ""; }; 95CC6AA3214ADB05000CD0E6 /* SCNExtensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SCNExtensions.swift; sourceTree = ""; }; + B0EACBFB218291060061CB26 /* MapStyles.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MapStyles.swift; sourceTree = ""; }; F44BB60220C75CBF00CE41C6 /* Examples-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Examples-Bridging-Header.h"; sourceTree = ""; }; F44BB60320C75CBF00CE41C6 /* DemoExtrusionViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DemoExtrusionViewController.h; sourceTree = ""; }; F44BB60420C75CBF00CE41C6 /* DemoExtrusionViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DemoExtrusionViewController.m; sourceTree = ""; }; @@ -151,6 +153,7 @@ 81293BCF20B4A1AE0014A17A /* Main.storyboard */, 81293BD420B4A1AE0014A17A /* Info.plist */, F44BB60220C75CBF00CE41C6 /* Examples-Bridging-Header.h */, + B0EACBFB218291060061CB26 /* MapStyles.swift */, ); path = Examples; sourceTree = ""; @@ -396,6 +399,7 @@ files = ( 81293BF320B4A35C0014A17A /* DemoStyleViewController.swift in Sources */, F44BB60520C75CBF00CE41C6 /* DemoExtrusionViewController.m in Sources */, + B0EACBFC218291060061CB26 /* MapStyles.swift in Sources */, 81293BF820B4A35C0014A17A /* TerrainDemoScene.swift in Sources */, 81293BF720B4A35C0014A17A /* ProgressCompositor.swift in Sources */, 8190075F20C07FAD002F23C3 /* AppDelegate.swift in Sources */,