|
|||||||||
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 | |
---|---|
Map<com.esri.arcgis.carto.IFeatureLayer,Integer> |
getLayers()
Gets the layer and snap type pairs. |
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(Map<com.esri.arcgis.carto.IFeatureLayer,Integer> layers)
Sets the layer and snap type pairs. |
Integer |
setSnapType(com.esri.arcgis.carto.IFeatureLayer key,
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 |
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 Exception
geometry
- the geometry to snap.bounds
- the map bounds.imageWidth
- the map width in pixels.
Exception
public static com.esri.arcgis.geometry.ISpatialReference getSpatialReference(com.esri.arcgis.carto.IFeatureLayer flayer) throws IOException, com.esri.arcgis.interop.AutomationException
flayer
- the layer
IOException
com.esri.arcgis.interop.AutomationException
public 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 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.
Exception
public void onEvent(EditEvent event)
ActionEventListener
onEvent
in interface ActionEventListener
event
- the event.public Integer getSnapType(com.esri.arcgis.carto.IFeatureLayer key)
key
- the layer
public Integer setSnapType(com.esri.arcgis.carto.IFeatureLayer key, Integer value)
key
- value
-
public Map<com.esri.arcgis.carto.IFeatureLayer,Integer> getLayers()
public void setLayers(Map<com.esri.arcgis.carto.IFeatureLayer,Integer> layers)
layers
- The layers to set.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |