Skip to content

Commit 395443d

Browse files
authored
Merge branch 'v.next' into Caleb/New-FindAddressWithReverseGeocode
2 parents 1e5a187 + bc0b747 commit 395443d

File tree

5 files changed

+138
-1
lines changed

5 files changed

+138
-1
lines changed

Samples.xcodeproj/project.pbxproj

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,8 @@
154154
88F93CC229C4D3480006B28E /* CreateAndEditGeometriesView.swift in Copy Source Code Files */ = {isa = PBXBuildFile; fileRef = 88F93CC029C3D59C0006B28E /* CreateAndEditGeometriesView.swift */; };
155155
D70082EB2ACF900100E0C3C2 /* IdentifyKMLFeaturesView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D70082EA2ACF900100E0C3C2 /* IdentifyKMLFeaturesView.swift */; };
156156
D70082EC2ACF901600E0C3C2 /* IdentifyKMLFeaturesView.swift in Copy Source Code Files */ = {isa = PBXBuildFile; fileRef = D70082EA2ACF900100E0C3C2 /* IdentifyKMLFeaturesView.swift */; };
157+
D7010EBF2B05616900D43F55 /* DisplaySceneFromMobileScenePackageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7010EBC2B05616900D43F55 /* DisplaySceneFromMobileScenePackageView.swift */; };
158+
D7010EC12B05618400D43F55 /* DisplaySceneFromMobileScenePackageView.swift in Copy Source Code Files */ = {isa = PBXBuildFile; fileRef = D7010EBC2B05616900D43F55 /* DisplaySceneFromMobileScenePackageView.swift */; };
157159
D701D72C2A37C7F7006FF0C8 /* bradley_low_3ds in Resources */ = {isa = PBXBuildFile; fileRef = D701D72B2A37C7F7006FF0C8 /* bradley_low_3ds */; settings = {ASSET_TAGS = (ShowViewshedFromGeoelementInScene, ); }; };
158160
D704AA5A2AB22C1A00A3BB63 /* GroupLayersTogetherView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D704AA592AB22C1A00A3BB63 /* GroupLayersTogetherView.swift */; };
159161
D704AA5B2AB22D8400A3BB63 /* GroupLayersTogetherView.swift in Copy Source Code Files */ = {isa = PBXBuildFile; fileRef = D704AA592AB22C1A00A3BB63 /* GroupLayersTogetherView.swift */; };
@@ -268,7 +270,7 @@
268270
D7CC34002A3147FF00198EDF /* ShowLineOfSightBetweenPointsView.swift in Copy Source Code Files */ = {isa = PBXBuildFile; fileRef = D7CC33FD2A31475C00198EDF /* ShowLineOfSightBetweenPointsView.swift */; };
269271
D7CE9F9B2AE2F575008F7A5F /* streetmap_SD.tpkx in Resources */ = {isa = PBXBuildFile; fileRef = D7CE9F9A2AE2F575008F7A5F /* streetmap_SD.tpkx */; settings = {ASSET_TAGS = (GeocodeOffline, ); }; };
270272
D7CE9FA32AE2F595008F7A5F /* san-diego-eagle-locator in Resources */ = {isa = PBXBuildFile; fileRef = D7CE9FA22AE2F595008F7A5F /* san-diego-eagle-locator */; settings = {ASSET_TAGS = (GeocodeOffline, ); }; };
271-
D7D1F3532ADDBE5D009CE2DA /* philadelphia.mspk in Resources */ = {isa = PBXBuildFile; fileRef = D7D1F3522ADDBE5D009CE2DA /* philadelphia.mspk */; settings = {ASSET_TAGS = (AugmentRealityToShowTabletopScene, ); }; };
273+
D7D1F3532ADDBE5D009CE2DA /* philadelphia.mspk in Resources */ = {isa = PBXBuildFile; fileRef = D7D1F3522ADDBE5D009CE2DA /* philadelphia.mspk */; settings = {ASSET_TAGS = (AugmentRealityToShowTabletopScene, DisplaySceneFromMobileScenePackage, ); }; };
272274
D7DDF84E2AF43AA2004352D9 /* GeocodeOfflineView.Model.swift in Copy Source Code Files */ = {isa = PBXBuildFile; fileRef = D72C43F22AEB066D00B6157B /* GeocodeOfflineView.Model.swift */; };
273275
D7DDF8532AF47C6C004352D9 /* FindRouteAroundBarriersView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7DDF8502AF47C6C004352D9 /* FindRouteAroundBarriersView.swift */; };
274276
D7DDF8562AF47C86004352D9 /* FindRouteAroundBarriersView.swift in Copy Source Code Files */ = {isa = PBXBuildFile; fileRef = D7DDF8502AF47C6C004352D9 /* FindRouteAroundBarriersView.swift */; };
@@ -377,6 +379,7 @@
377379
dstSubfolderSpec = 7;
378380
files = (
379381
D73FCFFA2B02A3C50006360D /* FindAddressWithReverseGeocodeView.swift in Copy Source Code Files */,
382+
D7010EC12B05618400D43F55 /* DisplaySceneFromMobileScenePackageView.swift in Copy Source Code Files */,
380383
D737237B2AF5AE1A00846884 /* FindRouteInMobileMapPackageView.Models.swift in Copy Source Code Files */,
381384
D737237A2AF5AE1600846884 /* FindRouteInMobileMapPackageView.MobileMapView.swift in Copy Source Code Files */,
382385
D76000B12AF19C4600B3084D /* FindRouteInMobileMapPackageView.swift in Copy Source Code Files */,
@@ -598,6 +601,7 @@
598601
883C121429C9136600062FF9 /* DownloadPreplannedMapAreaView.MapPicker.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DownloadPreplannedMapAreaView.MapPicker.swift; sourceTree = "<group>"; };
599602
88F93CC029C3D59C0006B28E /* CreateAndEditGeometriesView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CreateAndEditGeometriesView.swift; sourceTree = "<group>"; };
600603
D70082EA2ACF900100E0C3C2 /* IdentifyKMLFeaturesView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IdentifyKMLFeaturesView.swift; sourceTree = "<group>"; };
604+
D7010EBC2B05616900D43F55 /* DisplaySceneFromMobileScenePackageView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DisplaySceneFromMobileScenePackageView.swift; sourceTree = "<group>"; };
601605
D701D72B2A37C7F7006FF0C8 /* bradley_low_3ds */ = {isa = PBXFileReference; lastKnownFileType = folder; path = bradley_low_3ds; sourceTree = "<group>"; };
602606
D704AA592AB22C1A00A3BB63 /* GroupLayersTogetherView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GroupLayersTogetherView.swift; sourceTree = "<group>"; };
603607
D7054AE82ACCCB6C007235BA /* Animate3DGraphicView.SettingsView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Animate3DGraphicView.SettingsView.swift; sourceTree = "<group>"; };
@@ -829,6 +833,7 @@
829833
00B04FB3283EEB830026C882 /* Display overview map */,
830834
1C56B5DE2A82C02D000381DA /* Display points using clustering feature reduction */,
831835
E004A6D528465C70002A1FE6 /* Display scene */,
836+
D7010EBA2B05616900D43F55 /* Display scene from mobile scene package */,
832837
E070A0A1286F3B3400F2B606 /* Download preplanned map area */,
833838
E004A6EE284E4B7A002A1FE6 /* Download vector tiles to local cache */,
834839
1C26ED122A859525009B7721 /* Filter features in scene */,
@@ -1284,6 +1289,14 @@
12841289
path = "Identify KML features";
12851290
sourceTree = "<group>";
12861291
};
1292+
D7010EBA2B05616900D43F55 /* Display scene from mobile scene package */ = {
1293+
isa = PBXGroup;
1294+
children = (
1295+
D7010EBC2B05616900D43F55 /* DisplaySceneFromMobileScenePackageView.swift */,
1296+
);
1297+
path = "Display scene from mobile scene package";
1298+
sourceTree = "<group>";
1299+
};
12871300
D701D7242A37C7E4006FF0C8 /* 07d62a792ab6496d9b772a24efea45d0 */ = {
12881301
isa = PBXGroup;
12891302
children = (
@@ -2021,6 +2034,7 @@
20212034
ChangeCameraController,
20222035
DisplayDimensions,
20232036
DisplayMapFromMobileMapPackage,
2037+
DisplaySceneFromMobileScenePackage,
20242038
FindRouteInMobileMapPackage,
20252039
FindRouteInTransportNetwork,
20262040
GeocodeOffline,
@@ -2271,6 +2285,7 @@
22712285
D72C43F32AEB066D00B6157B /* GeocodeOfflineView.Model.swift in Sources */,
22722286
1C9B74C929DB43580038B06F /* ShowRealisticLightAndShadowsView.swift in Sources */,
22732287
D7232EE12AC1E5AA0079ABFF /* PlayKMLTourView.swift in Sources */,
2288+
D7010EBF2B05616900D43F55 /* DisplaySceneFromMobileScenePackageView.swift in Sources */,
22742289
1C56B5E62A82C02D000381DA /* DisplayPointsUsingClusteringFeatureReductionView.swift in Sources */,
22752290
D7337C602ABD142D00A5D865 /* ShowMobileMapPackageExpirationDateView.swift in Sources */,
22762291
00E5401E27F3CCA200CF66D5 /* ContentView.swift in Sources */,
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
// Copyright 2023 Esri
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// https://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
import ArcGIS
16+
import SwiftUI
17+
18+
struct DisplaySceneFromMobileScenePackageView: View {
19+
/// The scene used to create the scene view.
20+
@State private var scene = ArcGIS.Scene()
21+
22+
/// A Boolean value indicating whether the error alert is showing.
23+
@State private var errorAlertIsShowing = false
24+
25+
/// The error shown in the error alert.
26+
@State private var error: Error? {
27+
didSet { errorAlertIsShowing = error != nil }
28+
}
29+
30+
var body: some View {
31+
// Create a scene view with the scene.
32+
SceneView(scene: scene)
33+
.task {
34+
do {
35+
// Create a mobile scene package using a URL to a .mspk file.
36+
let mobileScenePackage = MobileScenePackage(fileURL: .philadelphia)
37+
38+
// Load the package.
39+
try await mobileScenePackage.load()
40+
41+
// Get the first scene from the package.
42+
guard let scene = mobileScenePackage.scenes.first else { return }
43+
44+
// Use the scene to update the scene view.
45+
self.scene = scene
46+
} catch {
47+
self.error = error
48+
}
49+
}
50+
.alert(isPresented: $errorAlertIsShowing, presentingError: error)
51+
}
52+
}
53+
54+
private extension URL {
55+
/// A URL to the local mobile scene package of Philadelphia, PA, USA.
56+
static var philadelphia: URL {
57+
Bundle.main.url(forResource: "philadelphia", withExtension: "mspk")!
58+
}
59+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Display scene from mobile scene package
2+
3+
Opens and displays a scene from a Mobile Scene Package (.mspk).
4+
5+
![Image of display scene from mobile scene package](display-scene-from-mobile-scene-package.png)
6+
7+
## Use case
8+
9+
An .mspk file is an archive containing the data (specifically, basemaps and features), used to display an offline 3D scene.
10+
11+
## How to use the sample
12+
13+
When the sample opens, it will automatically display the Scene in the Mobile Map Package.
14+
15+
## How it works
16+
17+
This sample takes a Mobile Scene Package that was created in ArcGIS Pro, and displays a `Scene` from within the package in a `SceneView`.
18+
19+
1. Create a `MobileScenePackage` using the path to the local .mspk file.
20+
2. Call `MobileScenePackage.load()` and check for any errors.
21+
3. When the `MobileScenePackage` is loaded, obtain the first `Scene` from the `MobileScenePackage.scenes` property.
22+
4. Create a `SceneView` by passing in the scene.
23+
24+
## Relevant API
25+
26+
* MobileScenePackage
27+
* SceneView
28+
29+
## Offline data
30+
31+
This mobile scene package was authored with ArcGIS Pro. It is downloaded from ArcGIS Online automatically.
32+
33+
[This item is available on ArcGIS Online](https://www.arcgis.com/home/item.html?id=7dd2f97bb007466ea939160d0de96a9d).
34+
35+
## Tags
36+
37+
offline, scene
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"category": "Scenes",
3+
"description": "Opens and displays a scene from a Mobile Scene Package (.mspk).",
4+
"ignore": false,
5+
"images": [
6+
"display-scene-from-mobile-scene-package.png"
7+
],
8+
"keywords": [
9+
"offline",
10+
"scene",
11+
"MobileScenePackage",
12+
"SceneView"
13+
],
14+
"offline_data": [
15+
"7dd2f97bb007466ea939160d0de96a9d"
16+
],
17+
"redirect_from": [],
18+
"relevant_apis": [
19+
"MobileScenePackage",
20+
"SceneView"
21+
],
22+
"snippets": [
23+
"DisplaySceneFromMobileScenePackageView.swift"
24+
],
25+
"title": "Display scene from mobile scene package"
26+
}
221 KB
Loading

0 commit comments

Comments
 (0)