How to set a fance while moving the graphic using edit tools?

2252
1
05-19-2016 11:59 PM
LeoDeng
Occasional Contributor II

Hi, I'm using the edit tools to Move the feature(GeometryType is Point) on the FeatureLayer. When I activate the Edit.MOVE, I want to set a fance for the point graphic.

I notice the "graphic-move" event of Edit can get the moving graphic point, and the geometryEngine also identify the spatial relationship between the graphic and the fance polygon.

But how to display on the map or graphic layer, so that the move point only located inside the fance area?

bufferGeometry = results.features[0].geometry;


editTools.on("graphic-move", function(evt)
{
  var graphic = evt.graphic;
  var geometry = graphic.geometry;


  if (geometryEngine.within(geometry, bufferGeometry))
  {
  // do nothing
  } else
  {
  // the current position is outside the fance, go back to the previous 
  }
});

In the circumstances, the highlight graphic should be along the boundary.

0 Kudos
1 Reply
FC_Basson
MVP Regular Contributor

If you only want to display the feature movement limit as a graphic, you can use the selected point graphic as input for the geometry buffer function (3.16: esri/geometry/geometryEngine | API Reference | ArcGIS API for JavaScript , 4.0: geometryEngine | API Reference | ArcGIS API for JavaScript 4.0) to create a polygon geometry, which you can add to the map in a seperate graphics layer, on selection of the point graphic.

0 Kudos