Class GeoModel

  • All Implemented Interfaces:
    Loadable
    Direct Known Subclasses:
    ArcGISMap, ArcGISScene

    public abstract class GeoModel
    extends Object
    implements Loadable
    A base class for either an ArcGISMap or an ArcGISScene.

    The base class GeoModel represents the model in a model-view-controller (MVC) architecture, while GeoView represents the view. ArcGISMap and ArcGISScene derive from GeoModel.

    You provide a GeoModel to the appropriate type of view:

    Since:
    100.12.0
    • 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 in baseLayers (displayed beneath other layers) and referenceLayers (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 in baseLayers (displayed beneath other layers) and referenceLayers (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
      • 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 unloaded FloorManager 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 unloaded FloorManager 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. A FloorManager 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
      • 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:

        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:

        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 a LocalItem (for maps and scenes in a map or scene package). Note that a map or scene cannot be instantiated from a LocalItem.

        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 a LocalItem (for maps and scenes in a map or scene package). Note that a map or scene cannot be instantiated from a LocalItem.

        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 of Layer.

        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. Unlike operational layers, Tables are not displayed by the GeoView.
        • 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. A TransportationNetworkDataset from this collection can be used to construct one of the network analysis tasks (such as RouteTask, ServiceAreaTask, and ClosestFacilityTask).

        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 the ArcGISMap or ArcGISScene, which is read when the map/scene is opened. The version of a newly created ArcGISMap or ArcGISScene 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
      • getLoadStatus

        public LoadStatus getLoadStatus()
        Description copied from interface: Loadable
        Returns the LoadStatus of the loadable resource.
        Specified by:
        getLoadStatus in interface Loadable
        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 from LoadStatus.LOADING to LoadStatus.FAILED_TO_LOAD state. If the load operation was successfully cancelled, a CancellationException will be returned from Loadable.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 interface Loadable
      • 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 to LoadStatus.LOADING. A listener can be added via Loadable.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 calling Loadable.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, Loadable.retryLoadAsync() needs to be used.

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

        Specified by:
        loadAsync in interface Loadable
      • 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 interface Loadable
      • 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 interface Loadable
        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 interface Loadable
        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 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 Loadable.addDoneLoadingListener(Runnable) method.

        Specified by:
        addLoadStatusChangedListener in interface Loadable
        Parameters:
        listener - the LoadStatusChangedListener to be added
      • removeLoadStatusChangedListener

        public boolean removeLoadStatusChangedListener​(LoadStatusChangedListener listener)
        Description copied from interface: Loadable
        Removes a LoadStatusChangedListener from the loadable resource.
        Specified by:
        removeLoadStatusChangedListener in interface Loadable
        Parameters:
        listener - the LoadStatusChangedListener to be removed
        Returns:
        true if the listener was removed, otherwise false