Basemap

Class Overview

A basemap is a non-editable layer that provides background, or reference information in your map.

The basemap is drawn beneath all other layers on the map and designed to provide a visual reference for other layers
to help orient the user of the map. Aerial imagery, terrain, and streets are examples of basemap layers.

It can also contain layers that are drawn on top of all other layers,
referred to as reference layers, for example boundaries, labels, or a road network.

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).

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).

Public Constructors

public
Basemap()

Creates a Basemap instance. Layers will need to be added to the Basemap before it can be used.

Throws

Public Methods

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.

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.

Returns

See Also

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 webmaps and known to the version of the webmap specification the API supports
(see system requirements), 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
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().

Returns

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).