com.esri.android.map
Class Layer

java.lang.Object
  extended by com.esri.android.map.Layer
Direct Known Subclasses:
DynamicLayer, GraphicsLayer, GroupLayer, TiledLayer

public abstract class Layer
extends Object

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


Constructor Summary
Layer()
          Instantiates an object of Layer.
 
Method Summary
 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.
 String getName()
          Gets the name of the layer.
 float getOpacity()
          Gets the opacity of the Layer.
 PopupInfo getPopupInfo(int sublayerId)
          Gets the PopupInfo associated with the sub-layer id.
 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.
 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 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 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<Integer,PopupInfo> popUpInfos)
           
 void setVisible(boolean visible)
          Sets the visibility of the Layer.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Layer

public Layer()
Instantiates an object of Layer.

Method Detail

reinitializeLayer

public void reinitializeLayer(UserCredentials usercredentials)
Re-initializes the layer with the given credentials.

Parameters:
usercredentials - the new credentials to try.

recycle

public void recycle()
Releases resources referenced by the Layer so that they can be recycled.


isRecycled

public boolean isRecycled()
Returns true or false if the Layer object has been recycled.

Returns:
boolean

isVisible

public boolean isVisible()
Gets the visibility of the Layer.

Returns:
true if visible.

setVisible

public void setVisible(boolean visible)
Sets the visibility of the Layer.

Parameters:
visible - The visibility to set.

getOpacity

public float getOpacity()
Gets the opacity of the Layer.

Returns:
the opacity.

setOpacity

public void setOpacity(float opacity)
Sets the opacity of the Layer.

Parameters:
opacity - the opacity to set.

setOnStatusChangedListener

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

Parameters:
onStatusChangedListener - The onStatusChangedListener to set.

isInitialized

public boolean isInitialized()
Gets the initialized of the Layer.

Returns:
Returns the initialized.

getName

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.

setName

public void setName(String name)
Sets the layer name.

Parameters:
name - a String

getUrl

public String getUrl()
Gets the URL of the map service associated with the layer.

Returns:
the URL as a string.

getUrlHashCode

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

getCredentials

public UserCredentials getCredentials()
Gets a copy of the credentials attached to the Layer.

Returns:
Returns the credentials.

getExtent

public Polygon getExtent()
Gets the current extent.

Returns:
a polygon which represents the current extent.

getFullExtent

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

getID

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.

getTitle

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.

getPopupInfo

public PopupInfo getPopupInfo(int sublayerId)
Gets the PopupInfo associated with the sub-layer id.

Returns:
PopupInfo

setPopupInfos

public void setPopupInfos(Map<Integer,PopupInfo> popUpInfos)

getSpatialReference

public SpatialReference getSpatialReference()
Gets the current spatial reference of the Layer.

Returns:
spatial reference.

getResolution

public double getResolution()
Gets the resolution of the Layer.

Returns:
resolution.

getWidth

public int getWidth()
Gets the width of the Layer in screen units.

Returns:
width.

getHeight

public int getHeight()
Gets the height of the Layer in screen units.

Returns:
height.

getDefaultSpatialReference

public SpatialReference getDefaultSpatialReference()
Gets the defaultSpatialReference of the Layer.

Returns:
Returns the defaultSpatialReference.

isWebMapBaselayer

public boolean isWebMapBaselayer()
Returns true if the layer is used as base layer in a web map.

Returns:
boolean


Copyright © 2012. All Rights Reserved.