public abstract class

Layer

extends Object
java.lang.Object
   ↳ com.esri.android.map.Layer
Known Direct Subclasses
Known Indirect Subclasses

Class Overview

The base layer for all layers that can be added into MapView.

Developer Guides

For more information about map layer types, read the Layer developer guide.

Summary

Fields
protected UserCredentials credentials Gets the direct access of the credentials; You can access the credentials by the getCredentials() or setCredentials(UserCredentials); but those two methods copy the instance internally.
protected long nativeHandle
protected Map<IntegerArcGISPopupInfo> popUpInfos
protected Object serviceInfo
Public Constructors
Layer()
Instantiates an object of Layer.
Protected Constructors
Layer(boolean initLayer)
Layer(long handle)
Instantiates an object of Layer.
Public Methods
Popup createPopup(MapView mapView, int sublayerId, Graphic graphic)
Creates the popup.
UserCredentials getCredentials()
Gets a copy of the credentials attached to the Layer.
SpatialReference getDefaultSpatialReference()
Gets the defaultSpatialReference of the Layer.
Polygon getExtent()
Gets the current extent.
Envelope getFullExtent()
Returns the full extent of the layer.
int getHeight()
Gets the height of the Layer in screen units.
long getID()
Return the Layer runtime ID which is a long integer.
double getMaxScale()
Gets max scale.
double getMinScale()
Gets min scale.
String getName()
Gets the name of the layer.
float getOpacity()
Gets the opacity of the Layer.
Layer getParent()
Returns parent layer if the layer is in a group layer otherwise returning null.
ArcGISPopupInfo getPopupInfo(int sublayerId)
Gets the PopupInfo associated with the sub-layer id.
Map<IntegerArcGISPopupInfo> getPopupInfos()
Gets the popup infos.
String getQueryUrl(int subLayerId)
Gets the query url.
double getResolution()
Gets the resolution of the Layer.
SpatialReference getSpatialReference()
Gets the current spatial reference of the Layer.
String getTitle()
Gets the title of the Layer.
String getUrl()
Gets the URL of the map service associated with the layer.
int getUrlHashCode()
A convenience method that returns the hash code of the map service URL.
String getWebMapLayerID()
Gets the web map layer id.
int getWidth()
Gets the width of the Layer in screen units.
boolean isInitialized()
Gets the initialized of the Layer.
boolean isRecycled()
Returns true or false if the Layer object has been recycled.
boolean isShowLegend()
Returns true if legend of the layer will be shown up; by default it is true; The property is usually defined in the web map, a operation layer legend could be on or off.
boolean isVisible()
Gets the visibility of the Layer.
boolean isWebMapBaselayer()
Returns true if the layer is used as base layer in a web map.
void recycle()
Releases resources referenced by the Layer so that they can be recycled.
void reinitializeLayer(UserCredentials usercredentials)
Re-initializes the layer with the given credentials.
void setMaxScale(double maxScale)
Sets max scale.
void setMinScale(double minScale)
Sets min scale.
void setName(String name)
Sets the layer name.
void setOnStatusChangedListener(OnStatusChangedListener onStatusChangedListener)
Sets the onStatusChangedListener.
void setOpacity(float opacity)
Sets the opacity of the Layer.
void setPopupInfos(Map<IntegerArcGISPopupInfo> popUpInfos)
Sets the popup infos.
void setQueryUrls(Map<IntegerString> queryUrls)
Sets the query urls.
void setVisible(boolean visible)
Sets the visibility of the Layer.
Protected Methods
void changeStatus(OnStatusChangedListener.STATUS status)
Changes the STATUS of the layer and notifies the listener.
abstract long create()
void finalize()
float getDpi()
Envelope getInitialExtent()
Returns the initial extent of the layer.
ExecutorService getPoolExecutor()
Returns the ThreadPoolExecutor based on the context.
ExecutorService getServiceExecutor()
Returns the ThreadPoolExecutor based on the context.
abstract void initLayer()
Initializes the layer.
void initializeMinMaxScale(double initalMinScale, double initalMaxScale)
honor the webmaplayer min/max scale first, if it is not override, then using service min/max if they are set.
<T> T loadServiceInfo(Callable<T> task)
If the Layer is loaded as a WebMapLayer and the OnWebMapLoadListener is specified, the service information will be loaded interactively.
synchronized long lock()
void setCredentials(UserCredentials credentials)
Sets the credentials of the Layer.
void setDefaultSpatialReference(SpatialReference defaultSpatialReference)
Sets the defaultSpatialReference of the Layer.
void setFullExtent(Envelope extent)
void setInitialExtent(Envelope e)
Sets the initial extent of layer.
void setUrl(String url)
Sets the URL of the map service associated with the layer.
void unlock(long handle)
void updateSpatialReferenceStatus(int SRStatus)
The callback method is invoked when the layer is added to map.
boolean verifyCredentials()
Returns true if the credentials is valid.
[Expand]
Inherited Methods
From class java.lang.Object

Fields

protected UserCredentials credentials

Gets the direct access of the credentials; You can access the credentials by the getCredentials() or setCredentials(UserCredentials); but those two methods copy the instance internally.

protected long nativeHandle

protected Map<IntegerArcGISPopupInfo> popUpInfos

protected Object serviceInfo

Public Constructors

public Layer ()

Instantiates an object of Layer.

Protected Constructors

protected Layer (boolean initLayer)

protected Layer (long handle)

Instantiates an object of Layer.

Public Methods

public Popup createPopup (MapView mapView, int sublayerId, Graphic graphic)

Creates the popup.

Parameters
mapView the map view
sublayerId the sublayer id
graphic the graphic
Returns
  • the popup

public UserCredentials getCredentials ()

Gets a copy of the credentials attached to the Layer.

Returns
  • Returns the credentials.

public SpatialReference getDefaultSpatialReference ()

Gets the defaultSpatialReference of the Layer.

Returns
  • Returns the defaultSpatialReference.

public Polygon getExtent ()

Gets the current extent.

Returns
  • a polygon which represents the current extent.

public Envelope getFullExtent ()

Returns the full extent of the layer. Returns NULL if the layer does not have a full extent.

Returns
  • an Envelope object

public int getHeight ()

Gets the height of the Layer in screen units.

Returns
  • height.

public long getID ()

Return the Layer runtime ID which is a long integer. A zero will be returned if the Layer object is invalid.

Returns
  • a long integer.

public double getMaxScale ()

Gets max scale. When map zooms in beyond max scale, graphics are not visible.

Returns
  • max scale.

public double getMinScale ()

Gets min scale. When map zooms out beyond min scale, graphics are not visible.

Returns
  • min scale

public String getName ()

Gets the name of the layer. The name is the name of the service if the layer is associated with a service, otherwise it is null. You should not call this method until the layer is initialized.

Returns
  • the name of the associated service or null otherwise.

public float getOpacity ()

Gets the opacity of the Layer.

Returns
  • the opacity.

public Layer getParent ()

Returns parent layer if the layer is in a group layer otherwise returning null.

Returns
  • Layer a Layer object

public ArcGISPopupInfo getPopupInfo (int sublayerId)

Gets the PopupInfo associated with the sub-layer id.

Parameters
sublayerId the sublayer id
Returns

public Map<IntegerArcGISPopupInfo> getPopupInfos ()

Gets the popup infos.

Returns
  • the popup infos

public String getQueryUrl (int subLayerId)

Gets the query url.

Parameters
subLayerId the sub layer id
Returns
  • the queryUrl for the sub-layer ID

public double getResolution ()

Gets the resolution of the Layer.

Returns
  • resolution.

public SpatialReference getSpatialReference ()

Gets the current spatial reference of the Layer.

Returns
  • spatial reference.

public String getTitle ()

Gets the title of the Layer. WebMap may define title of a layer, when the layer is instantiated from a WebMap, it may have a tile.

Returns
  • Returns the title.

public String getUrl ()

Gets the URL of the map service associated with the layer.

Returns
  • the URL as a string.

public int getUrlHashCode ()

A convenience method that returns the hash code of the map service URL. The hash codes for map service URLs are cached and this method spares the effort of the developer programmatically calculating the hash code.

Returns
  • integer of the hashcode

public String getWebMapLayerID ()

Gets the web map layer id.

Returns
  • the web map layer id

public int getWidth ()

Gets the width of the Layer in screen units.

Returns
  • width.

public boolean isInitialized ()

Gets the initialized of the Layer.

Returns
  • Returns the initialized.

public boolean isRecycled ()

Returns true or false if the Layer object has been recycled.

Returns
  • boolean

public boolean isShowLegend ()

Returns true if legend of the layer will be shown up; by default it is true; The property is usually defined in the web map, a operation layer legend could be on or off.

Returns
  • boolean

public boolean isVisible ()

Gets the visibility of the Layer.

Returns
  • true if visible.

public boolean isWebMapBaselayer ()

Returns true if the layer is used as base layer in a web map.

Returns
  • boolean

public void recycle ()

Releases resources referenced by the Layer so that they can be recycled.

public void reinitializeLayer (UserCredentials usercredentials)

Re-initializes the layer with the given credentials.

Parameters
usercredentials the new credentials to try.

public void setMaxScale (double maxScale)

Sets max scale.

Parameters
maxScale max scale.

public void setMinScale (double minScale)

Sets min scale.

Parameters
minScale min scale.

public void setName (String name)

Sets the layer name.

Parameters
name a String

public void setOnStatusChangedListener (OnStatusChangedListener onStatusChangedListener)

Sets the onStatusChangedListener. When initialize a Layer, the OnStatusChangedListener notifies you the status changes for INITIALIZED or INITIALIZATION_FAILED. When the initialization is failed, you can use the getError() to get the error details.

Parameters
onStatusChangedListener The onStatusChangedListener to set.

public void setOpacity (float opacity)

Sets the opacity of the Layer.

Parameters
opacity the opacity to set.

public void setPopupInfos (Map<IntegerArcGISPopupInfo> popUpInfos)

Sets the popup infos.

Parameters
popUpInfos the popup infos

public void setQueryUrls (Map<IntegerString> queryUrls)

Sets the query urls.

Parameters
queryUrls the query urls

public void setVisible (boolean visible)

Sets the visibility of the Layer.

Parameters
visible The visibility to set.

Protected Methods

protected void changeStatus (OnStatusChangedListener.STATUS status)

Changes the STATUS of the layer and notifies the listener.

Parameters
status the new STATUS.

protected abstract long create ()

protected void finalize ()

Throws
Throwable

protected float getDpi ()

protected Envelope getInitialExtent ()

Returns the initial extent of the layer. Returns the full extent if the initial extent is not valid.

Returns
  • an Envelope object

protected ExecutorService getPoolExecutor ()

Returns the ThreadPoolExecutor based on the context.

protected ExecutorService getServiceExecutor ()

Returns the ThreadPoolExecutor based on the context.

protected abstract void initLayer ()

Initializes the layer. The implementation should submit the OnStatusChangedListener.STATUS event accordingly.

protected void initializeMinMaxScale (double initalMinScale, double initalMaxScale)

honor the webmaplayer min/max scale first, if it is not override, then using service min/max if they are set.

Parameters
initalMinScale - min scale of service.
initalMaxScale - max scale of service.

protected T loadServiceInfo (Callable<T> task)

If the Layer is loaded as a WebMapLayer and the OnWebMapLoadListener is specified, the service information will be loaded interactively.

Parameters
task the Task to load the service information.
Returns
  • the service information.
Throws
Exception

protected synchronized long lock ()

protected void setCredentials (UserCredentials credentials)

Sets the credentials of the Layer. The layer holds the copy of the given instance.

Parameters
credentials The credentials to set.

protected void setDefaultSpatialReference (SpatialReference defaultSpatialReference)

Sets the defaultSpatialReference of the Layer.

Parameters
defaultSpatialReference The defaultSpatialReference to set.

protected void setFullExtent (Envelope extent)

protected void setInitialExtent (Envelope e)

Sets the initial extent of layer.

Parameters
e --an Envelope object.

protected void setUrl (String url)

Sets the URL of the map service associated with the layer.

Parameters
url the URL pointing to your map service.

protected void unlock (long handle)

protected void updateSpatialReferenceStatus (int SRStatus)

The callback method is invoked when the layer is added to map. 0 - Spatial Reference Invalid 1 - Spatial Reference NotNeeded 2 - Spatial Reference Projected 3 - Spatial Reference Good

Parameters
SRStatus an integer indicating the spatial reference status of layer

protected boolean verifyCredentials ()

Returns true if the credentials is valid.