com.esri.core.tasks.ags.identify
Class IdentifyParameters

java.lang.Object
  extended by com.esri.core.tasks.TaskParameters
      extended by com.esri.core.tasks.ags.identify.IdentifyParameters
All Implemented Interfaces:
Serializable

public class IdentifyParameters
extends TaskParameters

The IdentifyParameters class is a container for input parameters that are used during the instantiation of the IdentifyTask object. The IdentifyTask uses these parameters to perform the action and return the results of the identify task. See the IdentifyTask class description for more details on what it accomplishes.

This class provides a method, validate(), that will make sure the required parameters have been set with values.

This class also provides a developer with the convenience method generateRequestParams() that will generate a HashMap of pairs for each parameter.

See Also:
Serialized Form

Field Summary
static int ALL_LAYERS
          Identify on all layers of the service.
static int TOP_MOST_LAYER
          Identify only on the top-most layer of the service.
static int VISIBLE_LAYERS
          Identify only on the visible layers of the service.
 
Fields inherited from class com.esri.core.tasks.TaskParameters
url
 
Constructor Summary
IdentifyParameters()
          Default constructor.
IdentifyParameters(String url, Geometry geometry, Envelope mapExtent, SpatialReference extentSR, int[] layers, int mapWidth, int mapHeight, int dpi)
          Constructor with required parameters.
 
Method Summary
 Map<String,String> generateRequestParams()
          Generates the input parameter used by this class
 int getDPI()
          Returns the dot-per-inch ratio of the map as it is being displayed.
 Geometry getGeometry()
          Returns the geometry to be identified.
 int getLayerMode()
          Returns the mode used by the IdentifyTask to determine which layers to perform the task on.
 int[] getLayers()
          Returns the array of layer IDs that reference the layers that the IdentifyTask will execute on.
 Envelope getMapExtent()
          Returns the extent of the map to be identified on
 int getMapHeight()
          Returns the height of the map in screen pixels.
 int getMapWidth()
          Returns the width of the map in screen pixels.
 SpatialReference getSpatialReference()
          Returns the spatial reference of the map extent.
 int getTolerance()
           
 void setDPI(int dpi)
          Sets the dot-per-inch ratio of the map (used to determine the resolution of the map).
 void setGeometry(Geometry geometry)
          Sets the Geometry to be identified.
 void setLayerMode(int layerMode)
          Sets the mode used by the IdentifyTask to determine which layers to perform the task on.
 void setLayers(int[] layers)
           Sets The array of layer IDs that reference the layers that the IdentifyTask will execute on.
 void setMapExtent(Envelope mapExtent)
          Sets the extent of the map to perform the identify in.
 void setMapHeight(int mapHeight)
          Sets the height in pixels of the extent of the map (used to determine the resolution of the map).
 void setMapWidth(int mapWidth)
          Sets the width in pixels of the extent of the map (used to determine the resolution of the map).
 void setSpatialReference(SpatialReference mapExtentSpatialReference)
          Sets the spatial reference of the map extent.
 void setTolerance(int tolerance)
           Sets the tolerance.
 boolean validate()
           
 
Methods inherited from class com.esri.core.tasks.TaskParameters
equals, getUrl, hashCode, setUrl
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ALL_LAYERS

public static final int ALL_LAYERS
Identify on all layers of the service.

See Also:
Constant Field Values

VISIBLE_LAYERS

public static final int VISIBLE_LAYERS
Identify only on the visible layers of the service.

See Also:
Constant Field Values

TOP_MOST_LAYER

public static final int TOP_MOST_LAYER
Identify only on the top-most layer of the service.

See Also:
Constant Field Values
Constructor Detail

IdentifyParameters

public IdentifyParameters()
Default constructor.


IdentifyParameters

public IdentifyParameters(String url,
                          Geometry geometry,
                          Envelope mapExtent,
                          SpatialReference extentSR,
                          int[] layers,
                          int mapWidth,
                          int mapHeight,
                          int dpi)
Constructor with required parameters.

Parameters:
url - the URL of the service to identify on
geometry - the geometry to be identified
mapExtent - the current extent of the map
extentSR - the spatial reference of the map
layers - the array of layer IDs that reference the layers that the IdentifyTask will execute on
mapWidth - the width of the map in pixels
mapHeight - the height of the map in pixels
dpi - the dot-per-inch ratio of the map as it is being displayed on the device
Method Detail

getGeometry

public Geometry getGeometry()
Returns the geometry to be identified.

Returns:
the geometry.

getMapExtent

public Envelope getMapExtent()
Returns the extent of the map to be identified on

Returns:
the extent of the map.

getLayers

public int[] getLayers()
Returns the array of layer IDs that reference the layers that the IdentifyTask will execute on.

Returns:
the array of layer IDs.

getMapWidth

public int getMapWidth()
Returns the width of the map in screen pixels.

Returns:
the width of the map in screen pixels.

getMapHeight

public int getMapHeight()
Returns the height of the map in screen pixels.

Returns:
the height of the map in screen pixels.

getDPI

public int getDPI()
Returns the dot-per-inch ratio of the map as it is being displayed.

Returns:
the DPI

getLayerMode

public int getLayerMode()
Returns the mode used by the IdentifyTask to determine which layers to perform the task on.

There are 3 possible values:

  • ALL_LAYERS: identify features on all layers of the service
  • VISIBLE_LAYERS: identify features on the visible layers of the service only
  • TOP_MOST_LAYER identify features on the top-most layer of the service only

  • By default the value is ALL_LAYERS.


    Returns:
    The layer mode

    getTolerance

    public int getTolerance()
    Returns:
    The distance in screen pixels from the specified geometry within which the identify should be performed.

    By default the value is 5. Consider adjusting the tolerance according to the resolution or level of zoom in order to retrieve an accurate number of results. Typically, the tolerance should be small with a low level of zoom (potentially lots of results in a small area of the map) and high on a closer zoom level (results spread out as the zoom level increase).


    setLayerMode

    public void setLayerMode(int layerMode)
    Sets the mode used by the IdentifyTask to determine which layers to perform the task on.

    There are 3 possible values:

  • ALL_LAYERS: identify features on all layers of the service
  • VISIBLE_LAYERS: identify features on the visible layers of the service only
  • TOP_MOST_LAYER identify features on the top-most layer of the service only

  • By default the value is ALL_LAYERS.


    You must carefully consider the following when setting the layer mode because this method's inherent relationship with the setLayers() method of this class. For instance, when you set a layer mode as well as the layer IDs, the ArcGIS Server treats the REST request as a Boolean "AND" operation between options setup with this and the setLayers() methods.


    Here is an example to help explain this relationship:
    Assume you have set the layer mode to visible so only visible layers are identified by the identify task. At the same time, let's assume you have called the setLayers() method passing in two layer IDs (2, and 5). However, layers 0, 1, 3 and 4 are all visible layers (6 layers altogether for a map service). When the identify task performs its operation, then only features on the layers with IDs 2 and 5 are identified, if they are currently visible. It's possible for layers 0, 1, 3 or 4 to be visible as well, but because of the "AND" condition they do not satisfy the relationship and features will not be identified on them.


    Parameters:
    layerMode - the layer mode to set.

    setTolerance

    public void setTolerance(int tolerance)

    Sets the tolerance. The tolerance is the acceptable buffer distance, in screen pixels, around the geometry parameter that the IdentifyTask will identify features. The geometry type is specified by using the setGeometry() method or by passing in a geometry object during the instantiation of the IdentifyParameters object.


    By default tolerance value is 2.

    Example: if the geometry type is defined as an ArcGIS geometry Point and a tolerance of 2 is used, then when a user taps the device any feature that is within 2 pixels of the point created by the tap gesture will be identified.

    Parameters:
    tolerance - The tolerance to be set.

    setGeometry

    public void setGeometry(Geometry geometry)
    Sets the Geometry to be identified.

    The supported geometries are: Point, Polyline, Polygon and Envelope

    Parameters:
    geometry - The geometry to be identified.

    setMapExtent

    public void setMapExtent(Envelope mapExtent)
    Sets the extent of the map to perform the identify in.

    Parameters:
    mapExtent - The extent of the map.

    setLayers

    public void setLayers(int[] layers)

    Sets The array of layer IDs that reference the layers that the IdentifyTask will execute on.

    See the setLayerMode(int) method for details explaining the boolean "AND" relationship between the two methods when the REST request is sent to the ArcGIS Server to identify features.

    Parameters:
    layers - The IDs of the layers to perform the identify operation on.

    setMapWidth

    public void setMapWidth(int mapWidth)
    Sets the width in pixels of the extent of the map (used to determine the resolution of the map).

    Parameters:
    mapWidth - width of the map.

    setMapHeight

    public void setMapHeight(int mapHeight)
    Sets the height in pixels of the extent of the map (used to determine the resolution of the map).

    Parameters:
    mapHeight - height of the map.

    setDPI

    public void setDPI(int dpi)
    Sets the dot-per-inch ratio of the map (used to determine the resolution of the map).

    Parameters:
    dpi - dot-per-inch ratio of the map

    validate

    public boolean validate()
    Specified by:
    validate in class TaskParameters

    getSpatialReference

    public SpatialReference getSpatialReference()
    Returns the spatial reference of the map extent.

    Returns:
    the spatial reference of the map extent.

    setSpatialReference

    public void setSpatialReference(SpatialReference mapExtentSpatialReference)
    Sets the spatial reference of the map extent.

    Parameters:
    mapExtentSpatialReference - the spatial reference of the map extent.

    generateRequestParams

    public Map<String,String> generateRequestParams()
    Description copied from class: TaskParameters
    Generates the input parameter used by this class

    Specified by:
    generateRequestParams in class TaskParameters
    Returns:
    a Map containing the input parameters


    Copyright © 2010. All Rights Reserved.