Class GeoModel
- java.lang.Object
-
- com.esri.arcgisruntime.mapping.GeoModel
-
- All Implemented Interfaces:
Loadable
- Direct Known Subclasses:
ArcGISMap,ArcGISScene
public abstract class GeoModel extends java.lang.Object implements Loadable
A base class for either anArcGISMapor anArcGISScene.The base class GeoModel represents the model in a model-view-controller (MVC) architecture, while
GeoViewrepresents the view.ArcGISMapandArcGISScenederive 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 voidaddDoneLoadingListener(java.lang.Runnable runner)Adds a listener to the loadable resource that is invoked when loading has completed.voidaddLoadStatusChangedListener(LoadStatusChangedListener listener)Adds aLoadStatusChangedListenerto the loadable resource that is invoked whenever the load status changes.voidcancelLoad()Cancels loading metadata for the object.BasemapgetBasemap()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.BookmarkListgetBookmarks()Gets the mutable list of bookmarks of this GeoModel.GeoModelFloorDefinitiongetFloorDefinition()Gets the floor definition that defines the properties that allow a map or a scene to be floor-aware.FloorManagergetFloorManager()Gets the FloorManager instance if this geo-model supports floor filtering, otherwise null.GeotriggersInfogetGeotriggersInfo()Gets an object that presents information on the set ofGeotriggerobjects defined for the map or scene.ViewpointgetInitialViewpoint()Gets the initial viewpoint for the map or scene.ItemgetItem()Gets the item for the map or scene.ArcGISRuntimeExceptiongetLoadError()Returns the most recent error that was encountered when the loadable resource transitioned to theLoadStatus.FAILED_TO_LOADstate, either due to calling theLoadable.loadAsync()orLoadable.retryLoadAsync()method.LoadSettingsgetLoadSettings()Gets the default behaviors (preferences) that control the rendering behaviors for maps and scenes as they load.LoadStatusgetLoadStatus()Returns theLoadStatusof the loadable resource.LayerListgetOperationalLayers()Gets the mutable list of operational layers of this GeoModel.SpatialReferencegetSpatialReference()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.java.util.List<FeatureTable>getTables()Gets a list of tables in the map or scene.java.util.List<TransportationNetworkDataset>getTransportationNetworks()Gets an unmodifiable list of transportation network datasets defined for the map or scene.java.lang.StringgetVersion()Gets the version for theArcGISMaporArcGISScene, which is read when the map/scene is opened.voidloadAsync()Loads the metadata of the loadable resource asynchronously.booleanremoveDoneLoadingListener(java.lang.Runnable runner)Removes a done loading listener from the loadable resource.booleanremoveLoadStatusChangedListener(LoadStatusChangedListener listener)Removes aLoadStatusChangedListenerfrom the loadable resource.voidretryLoadAsync()Loads or retries loading metadata for the object asynchronously.voidsetBasemap(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.voidsetFloorDefinition(GeoModelFloorDefinition floorDefinition)Sets the floor definition that defines the properties that allow a map or a scene to be floor-aware.voidsetInitialViewpoint(Viewpoint initialViewpoint)Sets the initial viewpoint for the map or scene.voidsetItem(Item item)Sets the item for the map or scene.voidsetLoadSettings(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 unloadedFloorManageris 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 unloadedFloorManageris 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. AFloorManagermust 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 ofGeotriggerobjects defined for the map or scene.You must load the
GeotriggersInfoto 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
GeotriggerMonitorto check each of the conditions defined inGeotriggersInfo.getGeotriggers().When you save a map, any
Geotriggerobjects that reference local data (for example aGraphicsOverlayFenceParameters) will be omitted.- Returns:
- an object that presents information on the set of
Geotriggerobjects 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:
java.lang.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:
java.lang.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 java.util.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 java.util.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
TransportationNetworkDatasetobjects. ATransportationNetworkDatasetfrom 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 java.lang.String getVersion()
Gets the version for theArcGISMaporArcGISScene, which is read when the map/scene is opened. The version of a newly createdArcGISMaporArcGISSceneis 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:LoadableReturns the most recent error that was encountered when the loadable resource transitioned to theLoadStatus.FAILED_TO_LOADstate, either due to calling theLoadable.loadAsync()orLoadable.retryLoadAsync()method.If the resource subsequently transitions to
LoadStatus.LOADED(for example, if a call toretryLoadAsynccompletes successfully) the error is cleared out.- Specified by:
getLoadErrorin interfaceLoadable- Returns:
- the most recent error that was encountered when the loadable resource transitioned to the
LoadStatus.FAILED_TO_LOADstate.
-
getLoadStatus
public LoadStatus getLoadStatus()
Description copied from interface:LoadableReturns theLoadStatusof the loadable resource.- Specified by:
getLoadStatusin interfaceLoadable- Returns:
- the LoadStatus of the loadable resource
-
cancelLoad
public void cancelLoad()
Description copied from interface:LoadableCancels 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.LOADINGstate) can be cancelled by calling this method and the resource will transition fromLoadStatus.LOADINGtoLoadStatus.FAILED_TO_LOADstate. 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.LOADINGstate.- Specified by:
cancelLoadin interfaceLoadable
-
loadAsync
public void loadAsync()
Description copied from interface:LoadableLoads the metadata of the loadable resource asynchronously.The load status changes from
LoadStatus.NOT_LOADEDtoLoadStatus.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_LOADand 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.LOADINGstate) whenloadAsyncis 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.LOADEDorLoadStatus.FAILED_TO_LOADstate) whenloadAsyncis called, the done loading listener is immediately invoked when added to the loadable resource.If a loadable resource has failed to load, calling
loadAsyncon 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.LOADINGstate) can be cancelled by callingLoadable.cancelLoad().
-
retryLoadAsync
public void retryLoadAsync()
Description copied from interface:LoadableLoads 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:
retryLoadAsyncin interfaceLoadable
-
addDoneLoadingListener
public void addDoneLoadingListener(java.lang.Runnable runner)
Description copied from interface:LoadableAdds 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:
addDoneLoadingListenerin interfaceLoadable- Parameters:
runner- a Runnable that is invoked upon completion of the load operation
-
removeDoneLoadingListener
public boolean removeDoneLoadingListener(java.lang.Runnable runner)
Description copied from interface:LoadableRemoves a done loading listener from the loadable resource.- Specified by:
removeDoneLoadingListenerin 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:LoadableAdds aLoadStatusChangedListenerto 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:
addLoadStatusChangedListenerin interfaceLoadable- Parameters:
listener- theLoadStatusChangedListenerto be added
-
removeLoadStatusChangedListener
public boolean removeLoadStatusChangedListener(LoadStatusChangedListener listener)
Description copied from interface:LoadableRemoves aLoadStatusChangedListenerfrom the loadable resource.- Specified by:
removeLoadStatusChangedListenerin interfaceLoadable- Parameters:
listener- theLoadStatusChangedListenerto be removed- Returns:
- true if the listener was removed, otherwise false
-
-