Skip To Content ArcGIS for Developers Sign In Dashboard

MobileScenePackage Class


A mobile scene package (.mspk file). More...

Header: #include <MobileScenePackage>
Since: Esri::ArcGISRuntime 100.5
Inherits: Object and Loadable

Public Functions

MobileScenePackage(const QString &path, QObject *parent = nullptr)
void close()
Expiration expiration() const
Item *item() const
LocatorTask *locatorTask() const
QString path() const
QList<Scene *> scenes() const
QString version() const

Reimplemented Public Functions

virtual void cancelLoad()
virtual void load()
virtual Error loadError() const
virtual LoadStatus loadStatus() const
virtual void retryLoad()


void doneLoading(Esri::ArcGISRuntime::Error loadError)
void loadStatusChanged(Esri::ArcGISRuntime::LoadStatus loadStatus)
void unpackCompleted(QUuid taskId, bool success)

Static Public Members

MobileScenePackage *instance()
TaskWatcher unpack(const QString &mobileScenePackageFilePath, const QString &outputDirectory)
  • 10 static public members inherited from QObject

Additional Inherited Members

  • 1 property inherited from QObject
  • 1 public slot inherited from QObject
  • 1 public variable inherited from QObject
  • 9 protected functions inherited from QObject
  • 2 protected variables inherited from QObject

Detailed Description

A mobile scene package (.mspk file).

A mobile scene package is a transport mechanism for mobile scenes, their layers, and the layer's data. It contains metadata about the package (description, thumbnail, and so on), one or more mobile scenes, layers, data, and optionally locators.

A mobile scene package can be created from ArcGIS Pro.

Mobile scene packages are a major part of the offline workflow. Scenes inside a mobile scene package can be used and programmatically edited (layers can be added or removed). Note, mobile scene packages are read-only; edits to scenes or layers are not persisted to disk.

MobileScenePackage implements the Loadable interface; the mobile scene package contents can be accessed after the mobile scene package has loaded.

The mobile scene package has a version property which application developers can use to determine if it can be opened in this version of the ArcGIS Runtime SDK. The ArcGIS Runtime will be backwards compatible to version 1.0 mobile scene packages and will open the latest supported major version, but will not be able to open future major versions of packages. Please see the system requirements for details on what scene package versions are currently supported.

Member Function Documentation

MobileScenePackage::MobileScenePackage(const QString &path, QObject *parent = nullptr)

Constructor that takes a file path and an optional parent.

The path can also be a path to the root folder that contains an exploded mobile scene package.

Note: Constructing a MobileScenePackage from a path to a .mspk file does not load the MobileScenePackage automatically. You must call load to load it explicitly.



[virtual] void MobileScenePackage::cancelLoad()

Reimplemented from Loadable::cancelLoad().

See Loadable.

void MobileScenePackage::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, networks, 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 close 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.

This function was introduced in Esri::ArcGISRuntime 100.6.

See also MobileMapPackage::close and Geodatabase::close.

[signal] void MobileScenePackage::doneLoading(Esri::ArcGISRuntime::Error loadError)

Signal emitted when this object is done loading.

  • loadError - Details about any error that may have occurred.

Note: If there is a load error it will also be emitted on the errorOccurred signal.

See also Loadable and Object.

Expiration MobileScenePackage::expiration() const

Gets expiration details for this mobile scene package, if provided.

If the mobile scene package was authored with expiration, this property will be populated when the package is loaded or fails to load.

You should check Expiration::isEmpty to see whether the returned expiration object is valid.

If the package has expired and was authored as ExpirationType::preventExpiredAccess then loading will fail and the package can no longer be used.

This property will still be populated even in the event of a load failure.

[static] MobileScenePackage *MobileScenePackage::instance()

Returns an instance of the MobileScenePackage singleton.

The instance is used to connect to the unpackCompleted signals. For static methods this instance will also emit the errorOccurred signal.

You do not need to obtain the instance to call the static methods on the MobileScenePackage.

Item *MobileScenePackage::item() const

Gets the item describing the contents of the mobile scene package.

The mobile scene package will contain information about itself. The information is equivalent to the JSON description of a PortalItem plus a few additional properties.

[virtual] void MobileScenePackage::load()

Reimplemented from Loadable::load().

See Loadable.

[virtual] Error MobileScenePackage::loadError() const

Reimplemented from Loadable::loadError().

See Loadable.

[virtual] LoadStatus MobileScenePackage::loadStatus() const

Reimplemented from Loadable::loadStatus().

See Loadable.

[signal] void MobileScenePackage::loadStatusChanged(Esri::ArcGISRuntime::LoadStatus loadStatus)

Signal emitted when the load status changes for this object.

  • loadStatus - The load status of this object.

See also Loadable.

LocatorTask *MobileScenePackage::locatorTask() const

Gets the locator contained in the mobile scene package as a LocatorTask.

QString MobileScenePackage::path() const

Gets the path of the mobile scene package (.mmpk file).

[virtual] void MobileScenePackage::retryLoad()

Reimplemented from Loadable::retryLoad().

See Loadable.

QList<Scene *> MobileScenePackage::scenes() const

Gets a list of the scenes contained in the mobile scene package.

[static] TaskWatcher MobileScenePackage::unpack(const QString &mobileScenePackageFilePath, const QString &outputDirectory)

Unpacks the mobile scene package at mobileScenePackageFilePath to the outputDirectory.

This method returns a TaskWatcher for the asynchronous operation. Connect to the MobileScenePackage singleton provided by the instance() method to determine when the operation is completed.

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 original package is very large. After unpacking, you can remove the original .mspk file from the device.

[signal] void MobileScenePackage::unpackCompleted(QUuid taskId, bool success)

Signal emitted when unpack completes.

  • taskId - The task ID that this signal corresponds to.
  • success - Whether the task was successful.

QString MobileScenePackage::version() const

Returns the version of the mobile scene package.

Feedback on this topic?