Skip to content

Commit 6d38a62

Browse files
committed
Add files for sample.
1 parent 0390d7a commit 6d38a62

File tree

4 files changed

+114
-0
lines changed

4 files changed

+114
-0
lines changed

Samples.xcodeproj/project.pbxproj

Lines changed: 14 additions & 0 deletions
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 */; };
@@ -374,6 +376,7 @@
374376
dstPath = "";
375377
dstSubfolderSpec = 7;
376378
files = (
379+
D7010EC12B05618400D43F55 /* DisplaySceneFromMobileScenePackageView.swift in Copy Source Code Files */,
377380
D737237B2AF5AE1A00846884 /* FindRouteInMobileMapPackageView.Models.swift in Copy Source Code Files */,
378381
D737237A2AF5AE1600846884 /* FindRouteInMobileMapPackageView.MobileMapView.swift in Copy Source Code Files */,
379382
D76000B12AF19C4600B3084D /* FindRouteInMobileMapPackageView.swift in Copy Source Code Files */,
@@ -595,6 +598,7 @@
595598
883C121429C9136600062FF9 /* DownloadPreplannedMapAreaView.MapPicker.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DownloadPreplannedMapAreaView.MapPicker.swift; sourceTree = "<group>"; };
596599
88F93CC029C3D59C0006B28E /* CreateAndEditGeometriesView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CreateAndEditGeometriesView.swift; sourceTree = "<group>"; };
597600
D70082EA2ACF900100E0C3C2 /* IdentifyKMLFeaturesView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IdentifyKMLFeaturesView.swift; sourceTree = "<group>"; };
601+
D7010EBC2B05616900D43F55 /* DisplaySceneFromMobileScenePackageView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DisplaySceneFromMobileScenePackageView.swift; sourceTree = "<group>"; };
598602
D701D72B2A37C7F7006FF0C8 /* bradley_low_3ds */ = {isa = PBXFileReference; lastKnownFileType = folder; path = bradley_low_3ds; sourceTree = "<group>"; };
599603
D704AA592AB22C1A00A3BB63 /* GroupLayersTogetherView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GroupLayersTogetherView.swift; sourceTree = "<group>"; };
600604
D7054AE82ACCCB6C007235BA /* Animate3DGraphicView.SettingsView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Animate3DGraphicView.SettingsView.swift; sourceTree = "<group>"; };
@@ -825,6 +829,7 @@
825829
00B04FB3283EEB830026C882 /* Display overview map */,
826830
1C56B5DE2A82C02D000381DA /* Display points using clustering feature reduction */,
827831
E004A6D528465C70002A1FE6 /* Display scene */,
832+
D7010EBA2B05616900D43F55 /* Display scene from mobile scene package */,
828833
E070A0A1286F3B3400F2B606 /* Download preplanned map area */,
829834
E004A6EE284E4B7A002A1FE6 /* Download vector tiles to local cache */,
830835
1C26ED122A859525009B7721 /* Filter features in scene */,
@@ -1279,6 +1284,14 @@
12791284
path = "Identify KML features";
12801285
sourceTree = "<group>";
12811286
};
1287+
D7010EBA2B05616900D43F55 /* Display scene from mobile scene package */ = {
1288+
isa = PBXGroup;
1289+
children = (
1290+
D7010EBC2B05616900D43F55 /* DisplaySceneFromMobileScenePackageView.swift */,
1291+
);
1292+
path = "Display scene from mobile scene package";
1293+
sourceTree = "<group>";
1294+
};
12821295
D701D7242A37C7E4006FF0C8 /* 07d62a792ab6496d9b772a24efea45d0 */ = {
12831296
isa = PBXGroup;
12841297
children = (
@@ -2257,6 +2270,7 @@
22572270
D72C43F32AEB066D00B6157B /* GeocodeOfflineView.Model.swift in Sources */,
22582271
1C9B74C929DB43580038B06F /* ShowRealisticLightAndShadowsView.swift in Sources */,
22592272
D7232EE12AC1E5AA0079ABFF /* PlayKMLTourView.swift in Sources */,
2273+
D7010EBF2B05616900D43F55 /* DisplaySceneFromMobileScenePackageView.swift in Sources */,
22602274
1C56B5E62A82C02D000381DA /* DisplayPointsUsingClusteringFeatureReductionView.swift in Sources */,
22612275
D7337C602ABD142D00A5D865 /* ShowMobileMapPackageExpirationDateView.swift in Sources */,
22622276
00E5401E27F3CCA200CF66D5 /* ContentView.swift in Sources */,
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
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 view model for the sample.
20+
@StateObject private var model = Model()
21+
22+
var body: some View {
23+
MapView(map: model.map)
24+
.alert(isPresented: $model.errorAlertIsShowing, presentingError: model.error)
25+
}
26+
}
27+
28+
private extension DisplaySceneFromMobileScenePackageView {
29+
/// The view model for the sample.
30+
class Model: ObservableObject {
31+
/// A map with a topographic basemap.
32+
let map = Map(basemapStyle: .arcGISTopographic)
33+
34+
/// A Boolean value indicating whether the error alert is showing.
35+
@Published var errorAlertIsShowing = false
36+
37+
/// The error shown in the error alert.
38+
@Published var error: Error? {
39+
didSet { errorAlertIsShowing = error != nil }
40+
}
41+
}
42+
}
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](DisplaySceneFromMobileScenePackage.jpg)
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+
Since this sample works with a local .mspk, you may need to download the file to your device.
16+
17+
## How it works
18+
19+
This sample takes a Mobile Scene Package that was created in ArcGIS Pro, and displays a `Scene` from within the package in a `SceneView`.
20+
21+
1. Create a `MobileScenePackage` using the path to the local .mspk file.
22+
2. Call `MobileScenePackage::load` and check for any errors.
23+
3. When the `MobileScenePackage` is loaded, obtain the first `Scene` from the `MobileScenePackage::scenes` property.
24+
4. Create a `SceneView` and call `SceneView::setView` to display the scene from the package.
25+
26+
## Relevant API
27+
28+
* MobileScenePackage
29+
* SceneView
30+
31+
## Offline data
32+
33+
_Put instructions for your SDK's handling of offline data here._
34+
35+
## Tags
36+
37+
offline, scene
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"category": "Scenes",
3+
"description": "Opens and displays a scene from a Mobile Scene Package (.mspk).",
4+
"ignore": false,
5+
"images": [],
6+
"keywords": [
7+
"offline",
8+
"scene",
9+
"MobileScenePackage",
10+
"SceneView"
11+
],
12+
"redirect_from": [],
13+
"relevant_apis": [
14+
"MobileScenePackage",
15+
"SceneView"
16+
],
17+
"snippets": [
18+
"DisplaySceneFromMobileScenePackageView.swift"
19+
],
20+
"title": "Display scene from mobile scene package"
21+
}

0 commit comments

Comments
 (0)