public final class

ArcGISScene

extends Object
implements Loadable
java.lang.Object
   ↳ com.esri.arcgisruntime.mapping.ArcGISScene

Class Overview

An ArcGISScene contains the layers of mapping data which are visualized in a SceneView.

In an MVC architecture, an ArcGISScene represents the model and a SceneView represents the view.

An ArcGISScene specifies how the geographic data is organized, and a SceneView renders the data on the screen and allows users to interact with it.

An ArcGISScene contains a BaseMap, a Surface, usually one or more operational layers, and potentially tables:

  • A Basemap is a map layer that helps orient the user of the map. Typically it sits behind operational layers and shows features, such as roads and parcel boundaries, to give context to operational layers. Basemaps can also contain layers which are drawn over the top operational layers such as label layers.
  • A Surface is a collection of ElevationSource that determines how elevation is handled in the scene. It also contains the BackgroundGrid for the ArcGISScene.
  • An operational layer provides content that is of unique interest to the app and the task at hand, such as data about earthquakes, traffic, or weather for example. Its content might change frequently.
  • A table contains data potentially related to the Scene or one of the operational layers within the scene.

An ArcGISScene can be manually created by adding layers or it can be derived from a web scene stored an an ArcGIS Portal. It can also be created from a JSON string with fromJson(String).

See Also

Summary

Nested Classes
class ArcGISScene.BasemapChangedEvent An event which indicates that the Basemap of the source has changed. 
interface ArcGISScene.BasemapChangedListener The listener interface to get notified when the Basemap of the ArcGISScene changes. 
enum ArcGISScene.SceneViewTilingScheme Defines types of tiling scheme used for tiled layers. 
Public Constructors
ArcGISScene()
Creates an empty ArcGISScene instance.
ArcGISScene(Basemap basemap)
Creates an ArcGISScene instance which will contain just a basemap.
ArcGISScene(Basemap basemap, Surface baseSurface)
Creates an ArcGISScene instance which will contain a basemap and a base surface.
ArcGISScene(Basemap.Type basemapType)
Creates an ArcGISScene instance which will contain just a basemap.
ArcGISScene(ArcGISScene.SceneViewTilingScheme sceneViewTilingScheme)
Creates an ArcGISScene instance which will use the specified tiling scheme for tiled layers.
ArcGISScene(PortalItem portalItem)
Creates an ArcGISScene instance based on a PortalItem.
ArcGISScene(String webSceneUrl)
Creates an ArcGISScene instance from a web scene URL.
Public Methods
void addBasemapChangedListener(ArcGISScene.BasemapChangedListener listener)
Adds a BasemapChangedListener to this ArcGISScene that gets invoked when the Basemap has changed.
void addDoneLoadingListener(Runnable listener)
Adds a listener to the loadable resource that is invoked when loading has completed.
void addLoadStatusChangedListener(LoadStatusChangedListener listener)
Adds a LoadStatusChangedListener to the loadable resource that is invoked whenever the load status changes.
void cancelLoad()
Cancels a pending load operation.
static ArcGISScene fromJson(String json)
Creates an ArcGISScene instance from a JSON string.
Surface getBaseSurface()
Gets the base surface of this ArcGISScene.
Basemap getBasemap()
Gets the Basemap of this ArcGISScene.
BookmarkList getBookmarks()
Gets the mutable list of bookmarks of this ArcGISScene.
Viewpoint getInitialViewpoint()
Gets the initial viewpoint of the ArcGISScene.
Item getItem()
Gets the associated Item of this ArcGISScene.
ArcGISRuntimeException getLoadError()
Returns the most recent error that was encountered when the loadable resource transitioned to the FAILED_TO_LOAD state, either due to calling loadAsync or retryLoadAsync.
LoadSettings getLoadSettings()
Gets a load settings properties object that can be used to make changes to how feature layers loaded by this scene are rendered.
LoadStatus getLoadStatus()
Returns the LoadStatus of the loadable resource.
LayerList getOperationalLayers()
Gets the mutable list of operational layers of this ArcGISScene.
ArcGISScene.SceneViewTilingScheme getSceneViewTilingScheme()
Gets the tiling scheme to use for tiled layers.
SpatialReference getSpatialReference()
Gets the SpatialReference of this ArcGISScene.
List<FeatureTable> getTables()
Gets the tables in this ArcGISScene.
Map<String, Object> getUnknownJson()
If this object was created from JSON, this method gets unknown data from the source JSON.
Map<String, Object> getUnsupportedJson()
If this object was created from JSON, this method gets unsupported data from the source JSON.
String getVersion()
Gets the version of this ArcGISScene.
void loadAsync()
Loads the metadata of the loadable resource asynchronously.
boolean removeBasemapChangedListener(ArcGISScene.BasemapChangedListener listener)
Removes a BasemapChangedListener from this ArcGISScene.
boolean removeDoneLoadingListener(Runnable listener)
Removes a done loading listener from the loadable resource.
boolean removeLoadStatusChangedListener(LoadStatusChangedListener listener)
Removes a LoadStatusChangedListener from the loadable resource.
void retryLoadAsync()
Tries to reload the metadata of the loadable resource asynchronously, but only if the resource failed to load previously (LoadStatus.FAILED_TO_LOAD state) or wasn't loaded to begin with ( LoadStatus.NOT_LOADED state).
void setBaseSurface(Surface baseSurface)
Sets the base surface of this scene.
void setBasemap(Basemap basemap)
Sets the Basemap of this ArcGISScene.
void setInitialViewpoint(Viewpoint viewpoint)
Sets the initial viewpoint of the ArcGISScene.
void setLoadSettings(LoadSettings loadSettings)
Sets the load settings for this map.
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.esri.arcgisruntime.loadable.Loadable

Public Constructors

public ArcGISScene ()

Creates an empty ArcGISScene instance.

public ArcGISScene (Basemap basemap)

Creates an ArcGISScene instance which will contain just a basemap.

Parameters
basemap the Basemap used with this ArcGISScene
Throws
IllegalArgumentException if the basemap is null
See Also

public ArcGISScene (Basemap basemap, Surface baseSurface)

Creates an ArcGISScene instance which will contain a basemap and a base surface.

Parameters
basemap the Basemap used with this ArcGISScene
baseSurface the Surface to use as the base surface of this scene
Throws
IllegalArgumentException if the basemap is null
IllegalArgumentException if the base surface is null
See Also

public ArcGISScene (Basemap.Type basemapType)

Creates an ArcGISScene instance which will contain just a basemap.

Parameters
basemapType the type of Basemap used with this ArcGISScene
Throws
IllegalArgumentException if the basemapType is null
See Also

public ArcGISScene (ArcGISScene.SceneViewTilingScheme sceneViewTilingScheme)

Creates an ArcGISScene instance which will use the specified tiling scheme for tiled layers.

Parameters
sceneViewTilingScheme the tiling scheme for tiled layers
Throws
IllegalArgumentException if the sceneViewTilingScheme is null

public ArcGISScene (PortalItem portalItem)

Creates an ArcGISScene instance based on a PortalItem.

If the portal item is not in LoadStatus.LOADED state it will be loaded automatically when this ArcGISScene instance is loaded.

If the loaded portalItem is not of type PortalItem.Type.WEB_SCENE the ArcGISScene will fail to load.

Parameters
portalItem the PortalItem associated with this ArcGISScene instance
Throws
IllegalArgumentException if the portalItem is null
See Also

public ArcGISScene (String webSceneUrl)

Creates an ArcGISScene instance from a web scene URL. Example URLs:

  • http://www.arcgis.com/home/item.html?id=[web_scene_id]
  • http://www.arcgis.com/home/webscene/viewer.html?webscene=[web_scene_id]
  • http://www.arcgis.com/sharing/rest/content/items/[web_scene_id]/data
  • http://www.arcgis.com/sharing/rest/content/items/[web_scene_id]?f=pjson

Parameters
webSceneUrl the URL of the web scene on ArcGIS Online or an on-premises portal
Throws
IllegalArgumentException if the URL is null or empty
IllegalArgumentException if the URL does not match the basic URL types

Public Methods

public void addBasemapChangedListener (ArcGISScene.BasemapChangedListener listener)

Adds a BasemapChangedListener to this ArcGISScene that gets invoked when the Basemap has changed.

Adding this listener on the UI thread will cause it to be invoked on the UI thread, otherwise it is not guaranteed on which thread the listener is invoked.

Parameters
listener a BasemapChangedListener that gets invoked when the Basemap has changed
Throws
IllegalArgumentException if the listener is null

public void addDoneLoadingListener (Runnable listener)

Adds a listener to the loadable resource that is invoked when loading has completed.

The listener may be added at any point, whether the loadable resource has already completed loading or not.

  • For resources that are not loaded when the listener is added (LoadStatus is NOT_LOADED or LOADING): When the resource completes loading, the listener will be invoked on the UI thread if it is added from the UI thread, otherwise it is not guaranteed on which thread the listener is invoked.
  • For resources that are already loaded when the listener is added (LoadStatus is LOADED or FAILED_TO_LOAD): The listener will be called immediately, on the current thread.

Alternatively, to be notified when there is any change in the load status, use the addLoadStatusChangedListener(LoadStatusChangedListener) method instead.

Parameters
listener a Runnable that is invoked upon completion of the load operation

public void addLoadStatusChangedListener (LoadStatusChangedListener listener)

Adds a LoadStatusChangedListener to the loadable resource that is invoked whenever the load status changes.

Adding this listener on the UI thread will cause it to be invoked on the UI thread, otherwise it is not guaranteed on which thread the listener is invoked.

The listener will not be called if added to a loadable resource that has already completed loading. To be notified when a loadable resource has completed loading, including if the resource is already loaded when the listener is added, use the addDoneLoadingListener(Runnable) method.

Parameters
listener the LoadStatusChangedListener to be added

public void cancelLoad ()

Cancels a pending load operation.

A load operation that is in progress (LoadStatus.LOADING state) can be cancelled by calling this method and the resource will transition from LoadStatus.LOADING to LoadStatus.FAILED_TO_LOAD state. If the load operation was successfully cancelled a CancellationException will be returned from getLoadError().

Cancellation should be used carefully because all enqueued done loading listeners for that resource instance will get invoked with an error stating that the operation was cancelled. Thus, one component in the application can cancel the load operation initiated by other components.

This method does nothing if the resource is not in LoadStatus.LOADING state.

public static ArcGISScene fromJson (String json)

Creates an ArcGISScene instance from a JSON string.

Parameters
json the JSON representation of an ArcGISScene
Returns
  • an ArcGISScene instance deserialized from the JSON string
Throws
IllegalArgumentException if json is null or empty

public Surface getBaseSurface ()

Gets the base surface of this ArcGISScene.

Returns
  • the current base surface, can be null
See Also

public Basemap getBasemap ()

Gets the Basemap of this ArcGISScene.

Returns
  • the Basemap of this ArcGISScene, which provides the geographical context
See Also

public BookmarkList getBookmarks ()

Gets the mutable list of bookmarks of this ArcGISScene.

You can get notified about changes to the BookmarkList by adding a callback listener with addListChangedListener(ListChangedListener).

Returns
  • the BookmarkList that contains the bookmarks of this ArcGISScene; may return an empty list but never null

public Viewpoint getInitialViewpoint ()

Gets the initial viewpoint of the ArcGISScene.

Returns
  • the initial viewpoint, which determines the initial visible extent of this ArcGISScene when added to a SceneView

public Item getItem ()

Gets the associated Item of this ArcGISScene.

Returns
  • the associated Item or null if this ArcGISScene is not associated with an Item

public ArcGISRuntimeException getLoadError ()

Returns the most recent error that was encountered when the loadable resource transitioned to the FAILED_TO_LOAD state, either due to calling loadAsync or retryLoadAsync.

If the resource subsequently transitions to LOADED, for example if a call to retryLoadAsync completes successfully, the error is cleared out.

Returns
  • the most recent error that was encountered when the loadable resource transitioned to the LoadStatus.FAILED_TO_LOAD state.

public LoadSettings getLoadSettings ()

Gets a load settings properties object that can be used to make changes to how feature layers loaded by this scene are rendered.

Returns
  • the load settings
See Also

public LoadStatus getLoadStatus ()

Returns the LoadStatus of the loadable resource.

Returns
  • the LoadStatus of the loadable resource

public LayerList getOperationalLayers ()

Gets the mutable list of operational layers of this ArcGISScene.

Operational layers are drawn between the base and reference layers of a Basemap.

You can be notified about changes to the LayerList by adding a callback listener with addListChangedListener(ListChangedListener).

Returns
  • the LayerList that contains the operational layers; may return an empty list but never null
See Also

public ArcGISScene.SceneViewTilingScheme getSceneViewTilingScheme ()

Gets the tiling scheme to use for tiled layers.

Returns
  • the tiling scheme to use for tiled layers

public SpatialReference getSpatialReference ()

Gets the SpatialReference of this ArcGISScene.

Returns
  • the SpatialReference of this ArcGISScene
See Also

public List<FeatureTable> getTables ()

Gets the tables in this ArcGISScene. The list is modifiable, that is, tables can be added and removed. Tables are not loaded by default. Tables are loaded internally when asynchronous operations like query are performed. Alternatively, they can be loaded by calling loadAsync().

Returns
  • a modifiable list of tables

public Map<String, Object> getUnknownJson ()

If this object was created from JSON, this method gets unknown data from the source JSON. Unknown JSON is a Map of values that were in the source JSON but are not known by the Runtime and therefore not exposed in the API.

Returns
  • an unmodifiable Map containing unknown JSON data. The keys are Strings containing names. The types of the values depend on the types of tokens within the JSON as follows:
    • a Map<String, Object> represents an object in the JSON
    • a List<Object> represents an array in the JSON
    • a String represents a string in the JSON
    • a Double represents a number in the JSON
    • a Boolean represents true or false in the JSON
    • null represents null in the JSON

public Map<String, Object> getUnsupportedJson ()

If this object was created from JSON, this method gets unsupported data from the source JSON. Unsupported JSON is a Map of values that are supported by webscenes and known to the version of the webscene specification the API supports getVersion(), but are not explicitly exposed through the Runtime API.

Returns
  • an unmodifiable Map containing unsupported JSON data. The keys are Strings containing names. The types of the values depend on the types of tokens within the JSON as follows:
    • a Map<String, Object> represents an object in the JSON
    • a List<Object> represents an array in the JSON
    • a String represents a string in the JSON
    • a Double represents a number in the JSON
    • a Boolean represents true or false in the JSON
    • null represents null in the JSON

public String getVersion ()

Gets the version of this ArcGISScene. This is the current version of the web scene specification supported by the Runtime API.

Returns
  • the version of this ArcGISScene

public void loadAsync ()

Loads the metadata of the loadable resource asynchronously.

The load status changes from LoadStatus.NOT_LOADED to LoadStatus.LOADING. A listener can be added via addDoneLoadingListener(Runnable) that is invoked upon completion of the asynchronous load operation.

If the load operation completes successfully, the load status will be LoadStatus.LOADED, which means the resource has loaded its metadata.

If the load operation failed, the load status will be LoadStatus.FAILED_TO_LOAD and the error can be retrieved by calling getLoadError().

This method can be called concurrently and repeatedly, but only one attempt is ever made to perform the load operation. If a load operation is already in progress (LoadStatus.LOADING state) when loadAsync is called, it simply piggy-backs on the outstanding operation and the done loading listener added to the loadable resource is enqueued to be invoked when that operation completes. If the operation has already completed (LoadStatus.LOADED or LoadStatus.FAILED_TO_LOAD state) when loadAsync is called, the done loading listener is immediately invoked when added to the loadable resource.

If a loadable resource has failed to load, calling loadAsync on it subsequently will not change its state. The done loading listener will be invoked immediately when added to the loadable resource. In order to retry loading the resource, retryLoadAsync() needs to be used.

A load operation that is in progress (LoadStatus.LOADING state) can be cancelled by calling cancelLoad().

public boolean removeBasemapChangedListener (ArcGISScene.BasemapChangedListener listener)

Removes a BasemapChangedListener from this ArcGISScene.

Parameters
listener the BasemapChangedListener to remove
Returns
  • true if the BasemapChangedListener has been removed, otherwise false
Throws
IllegalArgumentException if the listener is null

public boolean removeDoneLoadingListener (Runnable listener)

Removes a done loading listener from the loadable resource.

Parameters
listener the listener to be removed
Returns
  • true if the listener was removed, otherwise false

public boolean removeLoadStatusChangedListener (LoadStatusChangedListener listener)

Removes a LoadStatusChangedListener from the loadable resource.

Parameters
listener the LoadStatusChangedListener to be removed
Returns
  • true if the listener was removed, otherwise false

public void retryLoadAsync ()

Tries to reload the metadata of the loadable resource asynchronously, but only if the resource failed to load previously (LoadStatus.FAILED_TO_LOAD state) or wasn't loaded to begin with ( LoadStatus.NOT_LOADED state).

For more details on the load process see loadAsync().

public void setBaseSurface (Surface baseSurface)

Sets the base surface of this scene.

Parameters
baseSurface the base surface of this ArcGISScene
Throws
IllegalArgumentException if baseSurface is null
See Also

public void setBasemap (Basemap basemap)

Sets the Basemap of this ArcGISScene.

Parameters
basemap the Basemap of this ArcGISScene, which provides the geographical context
Throws
IllegalArgumentException if basemap is null
See Also

public void setInitialViewpoint (Viewpoint viewpoint)

Sets the initial viewpoint of the ArcGISScene.

Parameters
viewpoint the initial viewpoint, which determines the initial visible extent of this ArcGISScene when added to a SceneView

public void setLoadSettings (LoadSettings loadSettings)

Sets the load settings for this map. The load settings change how feature layers loaded by this scene are rendered.

Parameters
loadSettings the load settings
Throws
IllegalArgumentException if loadSettings is null
See Also