Hi,
I want to add snapping functionality to my application. The arcgis api for flex states that the snapping mode default is on demand. I have debugged the code and checked, the editor contains all the featurelayers needed to work with. However whenever I try snapping while adding or updating a feature they don't snap. I tried using the default edit widget in the flex viewer but snapping doesn't seem to be working there as well. Can anyone suggest somet
Nigel,
Are you holding down the control key as you are hovering over features? The features must also be a feature layer and not a map layer. Otherwise the features are just in a raster image representation instead of an actual vector that can be snapped to.
Regards,
Tom
Hi Tom,
Yup I am holding down the cnrtl key while performing the edit. Also the layers in the edit tool are feature layers as I am able to add,update and delete records . is something go to do with the visibility or feature layer mode or something? Or do I have to explicitly set any properties to the edittool or drawtool on the editor component?
Regards,
Nigel
Nigel,
I believe by default snapping is available. You can expressly set snapping parameters for the edit tool or draw tool. Here is an excerpt from the API reference:
snapMode | property |
snapMode:String
Since : | ArcGIS API for Flex 2.5 |
Specifies whether snapping is off, always on or enabled by pressing the Ctrl key.
The default value is SNAP_MODE_ON_DEMAND
.
This property can be used as the source for data binding.
Implementation
public function get snapMode():String
public function set snapMode(value:String):void
I put together a measure widget that is a variation of the draw tool. It also has snapping capability. You can view it here:
Yakima CityFlex Viewer - measure widget
Here is a code snippet from my measure widget setting the draw tool snapping parameters:
<esri:DrawTool id="measureDrawTool" map="{map}"
snapDistance="20" snapMode="onDemand" snapOption="vertex"
showDrawTips="{showDrawingTips}"
drawEnd="map_drawEndHandler(event)"
graphicsLayer="{graphicsLayer}"
lineSymbol="{lineSymbol}"
fillSymbol="{fillSymbol}" />
I hope this helps you!
Regards,
Tom