|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.esri.adf.web.ags.data.edit.SnapHandler
public class SnapHandler
Handles Geometry snapping. It can also work as an event listener that listens to PreFeatureStoreEvent and snaps the feature geometry curried by the event. A sample of copy and snapping:
//create a select action
SelectByExtent select = new SelectByExtent(EditUtil.toEnvelope(-2309712.539, -887434.291, -1023725.086, 411499.344, map
.getSpatialReference(), ctx));
//one feature per select
select.setMaxCount(1);
//create a copy feature action
CopyFeature copy = new CopyFeature(EditUtil.toILine(-2309712.539, -887434.291, -1023725.086, 411499.344, map
.getSpatialReference(), ctx));
SnapHandler snap = new SnapHandler();
//create a snap rule
snap.setSnapType(snaplayer, Integer.valueOf(esriGeometryHitPartType.esriGeometryPartBoundary
| esriGeometryHitPartType.esriGeometryPartEndpoint | esriGeometryHitPartType.esriGeometryPartVertex));
//all the feature to be copy will be snapped
copy.addEventListener(snap);
// select and copy
workspace.perform(context, select, copy);
| Constructor Summary | |
|---|---|
SnapHandler()
|
|
| Method Summary | |
|---|---|
java.util.Map<com.esri.arcgis.carto.IFeatureLayer,java.lang.Integer> |
getLayers()
Gets the layer and snap type pairs. |
java.lang.Integer |
getSnapType(com.esri.arcgis.carto.IFeatureLayer key)
Gets the snap type. |
static com.esri.arcgis.geometry.ISpatialReference |
getSpatialReference(com.esri.arcgis.carto.IFeatureLayer flayer)
Gets spatial reference of the feature layer. |
int |
getTolerance()
Gets the snapping tolerance in pixels. |
void |
onEvent(EditEvent event)
Invokes the listener for the event. |
void |
setLayers(java.util.Map<com.esri.arcgis.carto.IFeatureLayer,java.lang.Integer> layers)
Sets the layer and snap type pairs. |
java.lang.Integer |
setSnapType(com.esri.arcgis.carto.IFeatureLayer key,
java.lang.Integer value)
Sets the snap type. |
void |
setTolerance(int tolerance)
Sets the snapping tolerance in pixels. |
com.esri.arcgis.geometry.IGeometry |
snapGeometry(com.esri.arcgis.geometry.IGeometry geometry,
com.esri.arcgis.geometry.IEnvelope bounds,
int imageWidth,
com.esri.arcgis.server.IServerContext ctx)
Snaps a geometry |
java.lang.Object[] |
snapPoint(com.esri.arcgis.geometry.IPoint point,
boolean returnNull,
com.esri.arcgis.server.IServerContext ctx,
com.esri.arcgis.geometry.IEnvelope mapbounds,
int imageWidth)
Snaps a point. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public SnapHandler()
| Method Detail |
|---|
public int getTolerance()
public void setTolerance(int tolerance)
tolerance - The tolerance to set.
public com.esri.arcgis.geometry.IGeometry snapGeometry(com.esri.arcgis.geometry.IGeometry geometry,
com.esri.arcgis.geometry.IEnvelope bounds,
int imageWidth,
com.esri.arcgis.server.IServerContext ctx)
throws java.lang.Exception
geometry - the geometry to snap.bounds - the map bounds.imageWidth - the map width in pixels.
java.lang.Exception
public static com.esri.arcgis.geometry.ISpatialReference getSpatialReference(com.esri.arcgis.carto.IFeatureLayer flayer)
throws java.io.IOException,
com.esri.arcgis.interop.AutomationException
flayer - the layer
java.io.IOException
com.esri.arcgis.interop.AutomationException
public java.lang.Object[] snapPoint(com.esri.arcgis.geometry.IPoint point,
boolean returnNull,
com.esri.arcgis.server.IServerContext ctx,
com.esri.arcgis.geometry.IEnvelope mapbounds,
int imageWidth)
throws java.lang.Exception
point - the point to snap.returnNull - set true to return null when no snap performed.mapbounds - the map bounds.imageWidth - the map width in pixels.
java.lang.Exceptionpublic void onEvent(EditEvent event)
ActionEventListener
onEvent in interface ActionEventListenerevent - the event.public java.lang.Integer getSnapType(com.esri.arcgis.carto.IFeatureLayer key)
key - the layer
public java.lang.Integer setSnapType(com.esri.arcgis.carto.IFeatureLayer key,
java.lang.Integer value)
key - value -
public java.util.Map<com.esri.arcgis.carto.IFeatureLayer,java.lang.Integer> getLayers()
public void setLayers(java.util.Map<com.esri.arcgis.carto.IFeatureLayer,java.lang.Integer> layers)
layers - The layers to set.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||