ArcGIS Runtime SDK for iOS
100.15
|
A mobile scene package.
Mobile scene packages allow you to work with 3D scenes on a mobile device.
A mobile scene package contains all of the files necessary to work with your scenes and is stored on a device as either:
A mobile scene package can encapsulate one or more scenes, their layers and data, transportation networks, and a locator. The mobile scene package also contains an AGSItem
object with metadata about the package (description, thumbnail, etc.). You can use these packages to share scenes across the ArcGIS platform and to allow your users to work with scenes in the field. Mobile scene packages also allow you to continue working when you have limited connectivity.
Starting with ArcGIS Pro 2.3 you can create mobile scene packages for use in ArcGIS Runtime. This version of ArcGIS Runtime will support any mobile scene package up to major version 3.
Mobile scene packages can contain links to online services, but be aware that these services will be unavailable if your device is offline.
You can choose whether to use:
AGSScene::basemap
property AGSGeoModel::operationalLayers
AGSScene::baseSurface
propety. Online services (such as traffic or weather) can provide excellent contextual information for your users. If the mobile scene package is going to be used in areas of poor connectivity, however, you must ensure that data critical to your workflow is stored locally on the device.Mobile scene packages implement the AGSLoadable
interface; you need to load the AGSMobileScenePackage
object before you can access its content.
Once loaded you can:
AGSMobileScenePackage::version
property. ArcGIS Runtime currently supports mobile scene packages up to and including major version 3. If the package is from an unsupported version it will fail to load. AGSMobileScenePackage::expiration
property AGSSceneView
object Instance Methods | |
(void) | - cancelLoad |
(void) | - close |
(void) | - doCancelLoading |
(void) | - doStartLoading: |
(instancetype) | - initWithFileURL: |
(instancetype) | - initWithName: |
(void) | - loadDidFinishWithError: |
(void) | - loadWithCompletion: |
(void) | - onLoadStatusChanged |
(void) | - retryLoadWithCompletion: |
Class Methods | |
(id< AGSCancelable >) | + checkDirectReadSupportForMobileScenePackageAtFileURL:completion: |
(instancetype) | + mobileScenePackageWithFileURL: |
(instancetype) | + mobileScenePackageWithName: |
(id< AGSCancelable >) | + unpackMobileScenePackageAtFileURL:outputDirectory:completion: |
Properties | |
AGSExpiration * | expiration |
NSURL * | fileURL |
AGSItem * | item |
NSError * | loadError |
AGSLoadStatus | loadStatus |
AGSLocatorTask * | locatorTask |
NSArray< AGSScene * > * | scenes |
NSString * | version |
|
requiredinherited |
Cancels loading if it is in progress, otherwise it does nothing. This should be called carefully because other objects could be waiting for loadWithCompletion:
or retryLoadWithCompletion:
to complete and this will call them all back with the error of NSUserCancelledError
+ (id<AGSCancelable>) checkDirectReadSupportForMobileScenePackageAtFileURL: | (NSURL *) | fileURL | |
completion: | (void(^)(BOOL isDirectReadSupported, NSError *__nullable error)) | completion | |
Checks if the package can be read directly without requiring to be unpacked. isDirectReadSupported
will always be YES
after deprecation in version 100.7.
Prior to ArcGIS Runtime version 100.7, some data formats (such as AGSRasterLayer
) could only be accessed if they were unpacked from a mobile scene package file (.mspk). In these situations, isDirectReadSupported
would be NO
and you would need to call AGSMobileScenePackage::unpackWithMobileScenePackageFileURL:outputDirectory:completion:
to unpack the mspk file.
From version 100.7 and onwards this limitation has been removed allowing the data to be read directly from the mobile scene package. isDirectReadSupported
is always YES
.
Since this method is no longer required it can be removed from calling code including any subsequent use of AGSMobileScenePackage::unpackWithMobileScenePackageFileURL:outputDirectory:completion:
.
fileURL | The file URL to the .mspk file |
completion | A block that is invoked with information about whether direct read is supported if the operation succeeds, or an error if it fails. |
AGSMobileScenePackage::unpackWithMobileScenePackageFileURL:outputDirectory:completion:
AGSMobileScenePackage::unpackWithMobileScenePackageFileURL:outputDirectory:completion:
. Provided by category AGSMobileScenePackage(AGSDeprecated).
- (void) close |
Closes a mobile scene package.
Closes a mobile scene package and frees file locks on the underlying .mspk file or directory.
All references to mobile scene package data (scenes, layers, tables, locators, etc.) should be released before closing the package. If active references to mobile scene package data exist, this method will still close the package, but subsequent rendering and data access methods will fail. Results of accessing mobile scene package data after closing it are undefined.
After closing a mobile scene package, the underlying .mspk file or directory can be moved or deleted.
Closing a mobile scene package is not necessary if the package has not been loaded.
- (void) doCancelLoading |
Never call this method directly. The framework calls this method on a background thread when cancelLoad (AGSLoadable-p)
is called. It is meant to be overriden by subclasses. Subclasses should override this method to cancel loading their data and call loadDidFinishWithError: (AGSLoadableBase(ForSubclassEyesOnly))
at the end passing in an error representing NSUserCancelledError
.
Provided by category AGSLoadableBase(ForSubclassEyesOnly).
- (void) doStartLoading: | (BOOL) | retrying |
Never call this method directly. The framework calls this method on a background thread when loadWithCompletion: (AGSLoadable-p)
or retryLoadWithCompletion: (AGSLoadable-p)
is called. It is meant to be overriden by subclasses. Subclasses should override this method to load their data and call loadDidFinishWithError: (AGSLoadableBase(ForSubclassEyesOnly))
upon completion, passing in the error if any.
retrying | flag that is true if this method was called from retryLoadWithCompletion: (AGSLoadable-p) . |
Provided by category AGSLoadableBase(ForSubclassEyesOnly).
- (instancetype) initWithFileURL: | (NSURL *) | fileURL |
Creates an object with the specified mobile scene package (.mspk file) on disk or a directory containing an unpacked mobile scene package.
fileURL | to the mobile scene package. |
- (instancetype) initWithName: | (NSString *) | name |
Creates an object with the name of a mobile scene package (.mspk file), excluding the ".mspk" extension, within the application bundle or shared documents directory.
name | of the mobile scene package (excluding the .mspk extension) |
- (void) loadDidFinishWithError: | (nullable NSError *) | error |
Only subclasses should call this method in doStartLoading: (AGSLoadableBase(ForSubclassEyesOnly))
and doCancelLoading (AGSLoadableBase(ForSubclassEyesOnly))
when done loading or failed to load.
Provided by category AGSLoadableBase(ForSubclassEyesOnly).
|
requiredinherited |
Loads data for the object asynchronously. The completion block is invoked upon completion.
You can call this method any number of times, however only one attempt is made to load the data. If it is already loading, it will just continue to load (i.e. not force a reload). If it has already loaded successfully, the completion block will be invoked right away. If it has already failed to load, the completion block will be invoked right away with error previously encountered. This method supports multiple callers and will call them all back on completion. However, each caller's completion block will be invoked once and only once.
completion | block that is invoked when object loads successfully or fails to load. An error is passed to the block if the object fails to load. |
- cancelLoad
to cancel loading - retryLoadWithCompletion:
to force reload + (instancetype) mobileScenePackageWithFileURL: | (NSURL *) | fileURL |
Creates an object with the specified mobile scene package (.mspk file) on disk or a directory containing an unpacked mobile scene package.
fileURL | The file URL to the mobile scene package. |
+ (instancetype) mobileScenePackageWithName: | (NSString *) | name |
Creates an object with the name of a mobile scene package (.mspk file), excluding the ".mspk" extension, within the application bundle or shared documents directory.
name | The name of the mobile scene package (excluding the .mspk extension). |
- (void) onLoadStatusChanged |
Never call this method directly. The framework calls this method on a background thread when AGSLoadable::loadStatus
changes is called. Subclasses can optionally implement this to know when their loading status has changed.
Provided by category AGSLoadableBase(ForSubclassEyesOnly).
|
requiredinherited |
Tries to reload when an object has failed to load. This method should be called judiciously. It should be called when:
cancelLoad
and then this methodIf the data hasn't started loading, it will start loading. If it is already loading, it will just continue to load. If it has already loaded successfully, calls back right away. If it has already failed to load, tries again. This method supports multiple callers and will call them all back on completion. However, each caller's completion block will be invoked once and only once.
completion | block that is invoked when object loads successfully or fails to load. An error is passed to the block if the object fails to load. |
+ (id<AGSCancelable>) unpackMobileScenePackageAtFileURL: | (NSURL *) | fileURL | |
outputDirectory: | (NSURL *) | outputDirectory | |
completion: | (void(^)(NSError *__nullable error)) | completion | |
Unpacks a mobile scene package file (.mspk) to an output directory.
If the last level of the output directory is not present, it will be created as part of the unpack task. The returned operation can be canceled to abort the unpack. The unpack task writes the full content of the mobile scene package to the output directory. Care should be taken on devices with limited storage space, especially if the package is very large. After unpacking, you can remove the original .mspk file from the device.
Note that unpacking will fail if the package has expired and was authored as AGSExpirationTypePreventExpiredAccess
.
fileURL | The file URL to .mspk file |
outputDirectory | The output directory specifying where to unpack the package. If the last component of the directory location does not exist, it will be created during unpacking. |
completion | A block that is invoked when the operation completes. |
|
readnonatomicstrong |
Expiration details for this mobile scene package, if provided.
Expiration details provide:
By publishing a package with expiration details, the author can control the experience an end-user has when they try to access information that is no longer valid. For example, for time limited data (such as major sporting events), the author can ensure that the data cannot be accessed after the expiry date.
These expiration details can be specified when the author creates a mobile scene package using ArcGIS Pro (from version 2.4). This requires the ArcGIS Pro Publisher Extension.
During package loading, the ArcGIS Runtime will determine whether the mobile scene package was authored with expiration. If so, then this property will be populated.
If the package has expired and was authored as AGSExpirationTypePreventExpiredAccess
, loading will fail and you will not be able to access the scenes. The expiration details will be accessible for you to examine and/or communicate to the user.
|
readnonatomicstrong |
The URL of the mobile scene package (.mspk file) on disk or a directory containing an unpacked mobile scene package.
|
readnonatomicstrong |
The mobile scene package's AGSItem
object describing metadata about the package.
The item includes the metadata that was provided by the mobile scene package author in ArcGIS Pro.
This includes information such as:
A mobile scene package's item will be an instance of an AGSLocalItem
. Returns nil
if the package is not loaded.
AGSItem
|
readnonatomicstronginherited |
The error that was encountered during the most recent load operation. Will be nil if the operation succeeded.
|
readrequirednonatomicassigninherited |
Status of the load operation.
|
readnonatomicstrong |
An AGSLocatorTask
object from the mobile scene package.
Use this task to geocode and reverse-geocode addresses and places. There is only one AGSLocatorTask
object in each mobile scene package, but it can be used by all scenes. Returns nil
if there is no AGSLocatorTask
in the package, or the package is not loaded.
AGSLocatorTask
|
readnonatomiccopy |
An array of AGSScene
objects from the AGSMobileScenePackage
object.
To use the scenes in an AGSMobileScenePackage
object, you first need to load the package. The scenes are presented in the same order in which they were packaged with ArcGIS Pro. To display an AGSScene
object set the scene to an AGSSceneView
object. This will automatically load the scene and all of its content. If you only need to access the scene's content or metadata, then you need to load it by calling AGSScene::load
method. If the package is not loaded, an empty array is returned.
NSArray
, AGSScene
|
readnonatomiccopy |
The mobile scene package's version.
The mobile scene package version was set when the package was authored in ArcGIS Pro.
This property is populated when you attempt to load the package. The version property will always be populated, for you to examine, even if the package is an unsupported version.
ArcGIS Runtime currently supports mobile scene packages up to and including major version 3.
You may wish to check the version property before trying to access specific functionality.
For example:
If the package fails to load, check that the version number does not exceeded the supported major version.