|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.util.EventObject
javax.faces.event.FacesEvent
javax.faces.event.ActionEvent
com.esri.adf.web.faces.event.ADFEvent
com.esri.adf.web.faces.event.MapEvent
public class MapEvent
A MapEvent object is created by the MapControl when a map
tool is invoked. This object is passed to the execute(MapEvent) method of the
MapToolAction or to the tool method designated by the user.
In addition to the information provided by the ADFEvent base class, this class gives the tools access to the
ClientActionArgs as well as a shortcut to the
WebGeometry representing the shape that the client had drawn on the map to
invoke the tool.
More often than not, the tools will only invoke this shortcut method getWebGeometry() to get to the
geometry. This geometry is in screen coordinates. You can use the toMapGeometry(WebMap) method on the
WebGeometry to convert it to map coordinates:
public void myToolMethod(MapEvent event) {
WebContext ctx = event.getWebContext();
WebGeometry screenGeom = event.getWebGeometry();
WebGeometry mapGeom = screen.toMapGeometry(ctx.getWebMap());
...
}
The getWebGeometry() method in this class is actually a shortcut to
ClientActionArgs.getWebGeometry(). The actual type of geometry (WebPoint,
WebExtent, etc.) depends on the
ClientActionArgs that it comes from. The
ClientActionArgs in turn depends on the client action (Javascript method) called
on the map control on the client. The out of the box client actions are defined in the ClientActions
interface. The mappings for out of the box client actions are as follows:
| Client JavaScript Action | ClientActionArgs | WebGeometry |
|---|---|---|
ClientActions.MAP_POINT(EsriMapPoint) |
PointArgs | WebPoint |
ClientActions.MAP_LINE(EsriMapLine) |
LineArgs | WebPolyline |
ClientActions.MAP_RECTANGLE(EsriMapRectangle) |
DragRectangleArgs | WebExtent |
ClientActions.MAP_CIRCLE(EsriMapCircle) |
CircleArgs | WebCircle |
ClientActions.MAP_OVAL(EsriMapOval) |
OvalArgs | WebOval |
ClientActions.MAP_POLYLINE(EsriMapPolyline) |
PolylineArgs | WebPolyline |
ClientActions.MAP_POLYGON(EsriMapPolygon) |
PolygonArgs | WebPolygon |
ClientActions.MAP_PAN(EsriMapPan) |
DragImageArgs | WebPoint |
So if the client action associated with the myToolMethod() tool from above was EsriMapPoint,
the corresponding geometry would be WebPoint, in which case you would cast
the mapGeom to WebPoint:
WebPoint mapPt = (WebPoint) mapGeom;
| Field Summary |
|---|
| Fields inherited from class com.esri.adf.web.faces.event.ADFEvent |
|---|
context, parameters |
| Fields inherited from class java.util.EventObject |
|---|
source |
| Constructor Summary | |
|---|---|
MapEvent(javax.faces.component.UIComponent source,
javax.faces.context.FacesContext facesContext,
WebContext context,
MapToolAction toolAction,
ClientActionArgs clientActionArgs,
ToolItem toolItem)
Constructs the MapEvent object with the given tool and ClientActionArgs. |
|
| Method Summary | |
|---|---|
ClientActionArgs |
getClientActionArgs()
Returns the ClientActionArgs which represents the action performed at the client. |
WebGeometry |
getMapGeometry()
Returns the WebGeometry in map coordinates corresponding to the client action performed by the user. |
MapToolAction |
getMapToolAction()
Returns the MapToolAction that needs to be invoked to process this event. |
ToolItem |
getToolItem()
Returns the ToolItem associated with the tool action that gets invoked to process this event. |
WebGeometry |
getWebGeometry()
Returns the WebGeometry in screen coordinates corresponding to the client action performed by the user. |
| Methods inherited from class com.esri.adf.web.faces.event.ADFEvent |
|---|
getParameter, getWebContext |
| Methods inherited from class javax.faces.event.ActionEvent |
|---|
isAppropriateListener, processListener |
| Methods inherited from class javax.faces.event.FacesEvent |
|---|
getComponent, getPhaseId, queue, setPhaseId |
| Methods inherited from class java.util.EventObject |
|---|
getSource, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public MapEvent(javax.faces.component.UIComponent source,
javax.faces.context.FacesContext facesContext,
WebContext context,
MapToolAction toolAction,
ClientActionArgs clientActionArgs,
ToolItem toolItem)
Constructs the MapEvent object with the given tool and ClientActionArgs. The
MapControl creates this event and also passes this event object to the
associated tool action.
If the toolAction is not null, the map control calls the execute(MapEvent) method of
this MapToolAction. Otherwise, it calls the tool method associated with the toolItem
source - the UIComponent that created this eventfacesContext - the current FacesContextcontext - the associated WebContexttoolAction - the MapToolAction that gets invoked to process this eventclientActionArgs - the ClientActionArgs associated with this eventtoolItem - the ToolItem of the tool method that gets invoked to process this event| Method Detail |
|---|
public ClientActionArgs getClientActionArgs()
Returns the ClientActionArgs which represents the action performed at the client. This object is created by
the MapControl depending on the client action (Javascript method) that was
invoked at the client. The detailed mappings table is here.
ClientActionArgs which represents the action performed at the clientpublic MapToolAction getMapToolAction()
Returns the MapToolAction that needs to be invoked to process this event.
If it is not null, the MapControl calls the execute(MapEvent)
method of this tool action. If it is null, then it invokes the tool method associated with the ToolItem
returned by the getToolItem() method.
MapToolAction that needs to be invoked to process this eventpublic ToolItem getToolItem()
Returns the ToolItem associated with the tool action that gets invoked to process this event.
If getMapToolAction() returns null, the MapControl invokes the
tool method associated with the ToolItem returned by this method.
ToolItem associated with the tool action that gets invoked to process this eventpublic WebGeometry getWebGeometry()
Returns the WebGeometry in screen coordinates corresponding to the client action performed by the user.
This method is actually a shortcut to ClientActionArgs.getWebGeometry(). The
actual type of geometry (WebPoint,
WebExtent, etc.) depends on the
ClientActionArgs that it comes from. The
ClientActionArgs in turn depends on the client action (Javascript method)
called on the map control on the client. The detailed mappings table is here.
WebGeometry in screen coordinates corresponding to the client action performed by the userpublic WebGeometry getMapGeometry()
Returns the WebGeometry in map coordinates corresponding to the client action performed by the user.
This method is actually a shortcut to ClientActionArgs.getMapGeometry(). The
actual type of geometry (WebPoint,
WebExtent, etc.) depends on the
ClientActionArgs that it comes from. The
ClientActionArgs in turn depends on the client action (Javascript method)
called on the map control on the client. The detailed mappings table is here.
WebGeometry in map coordinates corresponding to the client action performed by the user
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||