Class GeoModel
- java.lang.Object
-
- com.esri.arcgisruntime.mapping.GeoModel
-
- All Implemented Interfaces:
Loadable
- Direct Known Subclasses:
ArcGISMap
,ArcGISScene
public abstract class GeoModel extends Object implements Loadable
A base class for either anArcGISMap
or anArcGISScene
.The base class GeoModel represents the model in a model-view-controller (MVC) architecture, while
GeoView
represents the view.ArcGISMap
andArcGISScene
derive from GeoModel.You provide a GeoModel to the appropriate type of view:
- Since:
- 100.12.0
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addDoneLoadingListener(Runnable runner)
Adds a listener to the loadable resource that is invoked when loading has completed.void
addLoadStatusChangedListener(LoadStatusChangedListener listener)
Adds aLoadStatusChangedListener
to the loadable resource that is invoked whenever the load status changes.void
cancelLoad()
Cancels loading metadata for the object.Basemap
getBasemap()
Optional layers in a map or scene that show background information — roads, landmarks, and so on — to help orient the user of the map or scene.BookmarkList
getBookmarks()
Gets the mutable list of bookmarks of this GeoModel.GeoModelFloorDefinition
getFloorDefinition()
Gets the floor definition that defines the properties that allow a map or a scene to be floor-aware.FloorManager
getFloorManager()
Gets the FloorManager instance if this geo-model supports floor filtering, otherwise null.GeotriggersInfo
getGeotriggersInfo()
Gets an object that presents information on the set ofGeotrigger
objects defined for the map or scene.Viewpoint
getInitialViewpoint()
Gets the initial viewpoint for the map or scene.Item
getItem()
Gets the item for the map or scene.ArcGISRuntimeException
getLoadError()
Returns the most recent error that was encountered when the loadable resource transitioned to theLoadStatus.FAILED_TO_LOAD
state, either due to calling theLoadable.loadAsync()
orLoadable.retryLoadAsync()
method.LoadSettings
getLoadSettings()
Gets the default behaviors (preferences) that control the rendering behaviors for maps and scenes as they load.LoadStatus
getLoadStatus()
Returns theLoadStatus
of the loadable resource.LayerList
getOperationalLayers()
Gets the mutable list of operational layers of this GeoModel.SpatialReference
getSpatialReference()
Gets a well-known ID (WKID) integer value or a text string definition referred to as a well-known text (WKT) representation that identifies how a geometry's coordinates relate to real-world space.List<FeatureTable>
getTables()
Gets a list of tables in the map or scene.List<TransportationNetworkDataset>
getTransportationNetworks()
Gets an unmodifiable list of transportation network datasets defined for the map or scene.String
getVersion()
Gets the version for theArcGISMap
orArcGISScene
, which is read when the map/scene is opened.void
loadAsync()
Loads the metadata of the loadable resource asynchronously.boolean
removeDoneLoadingListener(Runnable runner)
Removes a done loading listener from the loadable resource.boolean
removeLoadStatusChangedListener(LoadStatusChangedListener listener)
Removes aLoadStatusChangedListener
from the loadable resource.void
retryLoadAsync()
Loads or retries loading metadata for the object asynchronously.void
setBasemap(Basemap basemap)
Optional layers in a map or scene that show background information — roads, landmarks, and so on — to help orient the user of the map or scene.void
setFloorDefinition(GeoModelFloorDefinition floorDefinition)
Sets the floor definition that defines the properties that allow a map or a scene to be floor-aware.void
setInitialViewpoint(Viewpoint initialViewpoint)
Sets the initial viewpoint for the map or scene.void
setItem(Item item)
Sets the item for the map or scene.void
setLoadSettings(LoadSettings loadSettings)
Set default behaviors (preferences) that control the rendering behaviors for maps and scenes as they load.
-
-
-
Method Detail
-
getBasemap
public Basemap getBasemap()
Optional layers in a map or scene that show background information — roads, landmarks, and so on — to help orient the user of the map or scene. Typically image tile or vector tile layer types. Basemaps can be composed of different layers organized inbaseLayers
(displayed beneath other layers) andreferenceLayers
(displayed on top of other layers). You can use ready-to-use basemaps, style your own with the ArcGIS Vector Tile Style Editor, or create and publish your own with ArcGIS Pro.- Returns:
- optional layers in a map or scene that show background information — roads, landmarks, and so on — to help orient the user of the map or scene. Typically image tile or vector tile layer types. Returns null if none.
- Since:
- 100.0.0 for JavaSE and 100.1.0 for Android
- See Also:
Basemap
-
setBasemap
public void setBasemap(Basemap basemap)
Optional layers in a map or scene that show background information — roads, landmarks, and so on — to help orient the user of the map or scene. Typically image tile or vector tile layer types. Basemaps can be composed of different layers organized inbaseLayers
(displayed beneath other layers) andreferenceLayers
(displayed on top of other layers). You can use ready-to-use basemaps, style your own with the ArcGIS Vector Tile Style Editor, or create and publish your own with ArcGIS Pro.- Parameters:
basemap
- optional layers in a map or scene that show background information — roads, landmarks, and so on — to help orient the user of the map or scene. Typically image tile or vector tile layer types.- Since:
- 100.0.0 for JavaSE and 100.1.0 for Android
- See Also:
Basemap
-
getBookmarks
public BookmarkList getBookmarks()
Gets the mutable list of bookmarks of this GeoModel.You can get notified about changes to the BookmarkList by adding a list changed listener with
BookmarkList.addListChangedListener(com.esri.arcgisruntime.util.ListChangedListener<com.esri.arcgisruntime.mapping.Bookmark>)
.- Returns:
- the BookmarkList that contains the bookmarks of this GeoModel; may return an empty list but never null
- Since:
- 100.0.0 for JavaSE and 100.1.0 for Android
- See Also:
BookmarkList
,Bookmark
-
getFloorDefinition
public GeoModelFloorDefinition getFloorDefinition()
Gets the floor definition that defines the properties that allow a map or a scene to be floor-aware.Floor-aware maps and scenes contain data representing floor plan and indoor features. The data displayed by floor-aware maps and scenes can be filtered based on floor levels using the
FloorManager
. This property is null for maps or scenes that are not floor-aware. When this property is set, a new unloadedFloorManager
is instantiated.- Returns:
- the floor definition that defines the properties that allow a map or a scene to be floor-aware, or null if none
- Since:
- 100.12.0
- See Also:
getFloorManager()
-
setFloorDefinition
public void setFloorDefinition(GeoModelFloorDefinition floorDefinition)
Sets the floor definition that defines the properties that allow a map or a scene to be floor-aware.Floor-aware maps and scenes contain data representing floor plan and indoor features. The data displayed by floor-aware maps and scenes can be filtered based on floor levels using the
FloorManager
. This property is null for maps or scenes that are not floor-aware. When this property is set, a new unloadedFloorManager
is instantiated.Upon setting the floor definition, the current
getFloorManager()
instance is invalidated. You should get a new unloaded FloorManager instance to perform floor filtering.- Parameters:
floorDefinition
- defines the properties that allow a map or a scene to be floor-aware- Since:
- 100.12.0
-
getFloorManager
public FloorManager getFloorManager()
Gets the FloorManager instance if this geo-model supports floor filtering, otherwise null. Manages the data displayed for a floor-aware map or scene, allowing the data to be filtered based on floor levels.This property is created using the floor-aware metadata defined by
getFloorDefinition()
, if not-null. Null if the map or scene is not loaded or if the map or scene is not floor-aware. AFloorManager
must be loaded before you can access its properties and perform floor-filtering.Please note that this property is invalidated upon setting the floor definition
setFloorDefinition(GeoModelFloorDefinition)
.- Returns:
- the FloorManager instance for working with floor filtering, or null if none
- Since:
- 100.12.0
- See Also:
FloorManager
-
getGeotriggersInfo
public GeotriggersInfo getGeotriggersInfo()
Gets an object that presents information on the set ofGeotrigger
objects defined for the map or scene.You must load the
GeotriggersInfo
to populate theGeotriggersInfo.getGeotriggers()
list with any geotriggers defined by the author of the map or scene. If no geotriggers were defined this list will remain empty.Use a
GeotriggerMonitor
to check each of the conditions defined inGeotriggersInfo.getGeotriggers()
.When you save a map, any
Geotrigger
objects that reference local data (for example aGraphicsOverlayFenceParameters
) will be omitted.- Returns:
- an object that presents information on the set of
Geotrigger
objects defined for the map or scene - Since:
- 100.14.0
-
getInitialViewpoint
public Viewpoint getInitialViewpoint()
Gets the initial viewpoint for the map or scene.The visible area of a map or scene after the map or scene first loads until the associated view's viewpoint is set. The model uses the initial viewpoint until you add the model, map, or scene to a view and set the viewpoint for the view. After the view has a viewpoint, this initial viewpoint property is ignored.
To set the viewpoint for a view, you use a viewpoint method, such as one of the following:
-
GeoView.setViewpoint(Viewpoint)
for 2D, no animation to zoom to the initial visible area -
SceneView.setViewpointCamera(Camera)
for 3D, no animation -
GeoView.setViewpointAsync(Viewpoint, float)
for 2D, with animation.
- Returns:
- the initial viewpoint for the map or scene, or null if none
- Since:
- 100.0.0 for JavaSE and 100.1.0 for Android
-
-
setInitialViewpoint
public void setInitialViewpoint(Viewpoint initialViewpoint)
Sets the initial viewpoint for the map or scene.The visible area of a map or scene after the map or scene first loads until the associated view's viewpoint is set. The model uses the initial viewpoint until you add the model, map, or scene to a view and set the viewpoint for the view. After the view has a viewpoint, this initial viewpoint property is ignored.
To set the viewpoint for a view, you use a viewpoint method, such as one of the following:
-
GeoView.setViewpoint(Viewpoint)
for 2D, no animation to zoom to the initial visible area -
SceneView.setViewpointCamera(Camera)
for 3D, no animation -
GeoView.setViewpointAsync(Viewpoint, float)
for 2D, with animation.
- Parameters:
initialViewpoint
- the initial viewpoint for the map or scene- Throws:
IllegalArgumentException
- if initialViewpoint is null- Since:
- 100.0.0 for JavaSE and 100.1.0 for Android
-
-
getItem
public Item getItem()
Gets the item for the map or scene.An ID for a resource, such as a
PortalItem
(for maps created from a portal) or aLocalItem
(for maps and scenes in a map or scene package). Note that a map or scene cannot be instantiated from aLocalItem
.- Returns:
- the item for the map or scene, or null if none
- Since:
- 100.3.0
-
setItem
public void setItem(Item item)
Sets the item for the map or scene.An ID for a resource, such as a
PortalItem
(for maps created from a portal) or aLocalItem
(for maps and scenes in a map or scene package). Note that a map or scene cannot be instantiated from aLocalItem
.- Parameters:
item
- the item for the map or scene- Since:
- 100.3.0
-
getLoadSettings
public LoadSettings getLoadSettings()
Gets the default behaviors (preferences) that control the rendering behaviors for maps and scenes as they load.- Returns:
- the current default behaviors (preferences) that control the rendering behaviors for maps and scenes as they load
- Since:
- 100.2.0
-
setLoadSettings
public void setLoadSettings(LoadSettings loadSettings)
Set default behaviors (preferences) that control the rendering behaviors for maps and scenes as they load.Set preferences that control rendering behaviors when maps and scenes load. For example, you can specify which tiling mode should be used when feature layers are added or specify whether feature tables should use advanced symbology.
- Parameters:
loadSettings
- set default behaviors (preferences) that control the rendering behaviors for maps and scenes as they load- Throws:
IllegalArgumentException
- if loadSettings is null- Since:
- 100.2.0
-
getOperationalLayers
public LayerList getOperationalLayers()
Gets the mutable list of operational layers of this GeoModel.Layers that reference data from a file or a service and are typically used to visualize the data in a map or scene, for example, a fleet of vehicles being tracked on a map.
Operational layers, which display on top of the
basemap layers
, are hosted and managed on the ArcGIS Platform as feature layers, KML layers, WFS layers, tile layers, and more. Several layer types can also be used by your ArcGIS Runtime app as local layers, such as feature layers and tiled layers. You cannot reuse a layer collection coming from a different map or scene. Instead, you must create a new collection ofLayer
.- Returns:
- the LayerList that contains the operational layers; may return an empty list but never null
- Since:
- 100.0.0 for JavaSE and 100.1.0 for Android
- See Also:
Layer
,Basemap.getBaseLayers()
-
getSpatialReference
public SpatialReference getSpatialReference()
Gets a well-known ID (WKID) integer value or a text string definition referred to as a well-known text (WKT) representation that identifies how a geometry's coordinates relate to real-world space.Spatial reference ensures that spatial data in different layers or graphic overlays can be used together for accurate viewing or analysis.
- Returns:
- a well-known ID (WKID) integer value or a text string definition referred to as a well-known text (WKT) representation that identifies how a geometry's coordinates relate to real-world space. Returns null if none.
- Since:
- 100.0.0 for JavaSE and 100.1.0 for Android
- See Also:
SpatialReference
-
getTables
public List<FeatureTable> getTables()
Gets a list of tables in the map or scene. Unlikeoperational layers
, Tables are not displayed by theGeoView
.- The collection is specific to this GeoModel.
- Tables can be added and removed from the GeoModel through this model.
- Tables are not loaded by default. Tables are loaded internally when
asynchronous operations like query are performed. Alternatively, they can
be loaded by calling
FeatureTable.loadAsync()
.
- Returns:
- a modifiable list of tables
- Since:
- 100.3.0
- See Also:
FeatureTable
-
getTransportationNetworks
public List<TransportationNetworkDataset> getTransportationNetworks()
Gets an unmodifiable list of transportation network datasets defined for the map or scene.Map and Scene authors can use ArcGIS Pro to create mobile map or scene packages containing maps and scenes that include transportation networks. If so, this property will be populated with the collection of
TransportationNetworkDataset
objects. ATransportationNetworkDataset
from this collection can be used to construct one of the network analysis tasks (such asRouteTask
,ServiceAreaTask
, andClosestFacilityTask
).- Returns:
- a list of transportation network datasets defined for the map or scene
- Since:
- 100.7.0
- See Also:
RouteTask
,MobileScenePackage
-
getVersion
public String getVersion()
Gets the version for theArcGISMap
orArcGISScene
, which is read when the map/scene is opened. The version of a newly createdArcGISMap
orArcGISScene
is empty.The version that the map or scene is saved to might differ from the version it was opened at. The version saved depends on the ArcGIS Runtime version.
- Returns:
- the version for the map or scene
- Since:
- 100.3.0
-
getLoadError
public ArcGISRuntimeException getLoadError()
Description copied from interface:Loadable
Returns the most recent error that was encountered when the loadable resource transitioned to theLoadStatus.FAILED_TO_LOAD
state, either due to calling theLoadable.loadAsync()
orLoadable.retryLoadAsync()
method.If the resource subsequently transitions to
LoadStatus.LOADED
(for example, if a call toretryLoadAsync
completes successfully) the error is cleared out.- Specified by:
getLoadError
in interfaceLoadable
- Returns:
- the most recent error that was encountered when the loadable resource transitioned to the
LoadStatus.FAILED_TO_LOAD
state.
-
getLoadStatus
public LoadStatus getLoadStatus()
Description copied from interface:Loadable
Returns theLoadStatus
of the loadable resource.- Specified by:
getLoadStatus
in interfaceLoadable
- Returns:
- the LoadStatus of the loadable resource
-
cancelLoad
public void cancelLoad()
Description copied from interface:Loadable
Cancels loading metadata for the object.Cancels loading the metadata if the object is loading, and always invokes the done loading listener.
A load operation that is in progress (
LoadStatus.LOADING
state) can be cancelled by calling this method and the resource will transition fromLoadStatus.LOADING
toLoadStatus.FAILED_TO_LOAD
state. If the load operation was successfully cancelled, a CancellationException will be returned fromLoadable.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.- Specified by:
cancelLoad
in interfaceLoadable
-
loadAsync
public void loadAsync()
Description copied from interface:Loadable
Loads the metadata of the loadable resource asynchronously.The load status changes from
LoadStatus.NOT_LOADED
toLoadStatus.LOADING
. A listener can be added viaLoadable.addDoneLoadingListener(java.lang.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 callingLoadable.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) whenloadAsync
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
orLoadStatus.FAILED_TO_LOAD
state) whenloadAsync
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,Loadable.retryLoadAsync()
needs to be used.A load operation that is in progress (
LoadStatus.LOADING
state) can be cancelled by callingLoadable.cancelLoad()
.
-
retryLoadAsync
public void retryLoadAsync()
Description copied from interface:Loadable
Loads or retries loading metadata for the object asynchronously.Will retry loading the metadata if the object's load status is
LoadStatus.FAILED_TO_LOAD
. Will load the object if it is not loaded. Will not retry to load the object if the object is loaded.For more details on the load process see
Loadable.loadAsync()
.- Specified by:
retryLoadAsync
in interfaceLoadable
-
addDoneLoadingListener
public void addDoneLoadingListener(Runnable runner)
Description copied from interface:Loadable
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
Loadable.addLoadStatusChangedListener(LoadStatusChangedListener)
method instead.- Specified by:
addDoneLoadingListener
in interfaceLoadable
- Parameters:
runner
- a Runnable that is invoked upon completion of the load operation
-
removeDoneLoadingListener
public boolean removeDoneLoadingListener(Runnable runner)
Description copied from interface:Loadable
Removes a done loading listener from the loadable resource.- Specified by:
removeDoneLoadingListener
in interfaceLoadable
- Parameters:
runner
- the listener to be removed- Returns:
- true if the listener was removed, otherwise false
-
addLoadStatusChangedListener
public void addLoadStatusChangedListener(LoadStatusChangedListener listener)
Description copied from interface:Loadable
Adds aLoadStatusChangedListener
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
Loadable.addDoneLoadingListener(Runnable)
method.- Specified by:
addLoadStatusChangedListener
in interfaceLoadable
- Parameters:
listener
- theLoadStatusChangedListener
to be added
-
removeLoadStatusChangedListener
public boolean removeLoadStatusChangedListener(LoadStatusChangedListener listener)
Description copied from interface:Loadable
Removes aLoadStatusChangedListener
from the loadable resource.- Specified by:
removeLoadStatusChangedListener
in interfaceLoadable
- Parameters:
listener
- theLoadStatusChangedListener
to be removed- Returns:
- true if the listener was removed, otherwise false
-
-