syncSourceSettingsUsingRules method
- SnapRules rules, {
- required SnapSourceEnablingBehavior snapSourceEnablingBehavior,
Synchronizes the SnapSettings.sourceSettings collection based on SnapSource objects in the currently connected ArcGISMap and the given SnapRules which may affect each of them.
Call this method to configure rule-based snapping. Similarly to SnapSettings.syncSourceSettings, this method will populate SnapSettings.sourceSettings with a SnapSourceSettings for each valid SnapSource present in the ArcGISMapViewController currently connected to this SnapSettings via GeometryEditor.snapSettings, and ArcGISMapViewController.geometryEditor. In addition to populating the collection, the given SnapRules will be applied to each SnapSourceSettings, setting SnapSourceSettings.ruleBehavior appropriately for those rules. SnapRules are created by calling SnapRules.createFromAssetType, specifying a particular UtilityAssetType that matches the feature whose geometry will be edited using the GeometryEditor. When editing features in a utility network, it is important to ensure that you have synchronized the snap sources with appropriate snap rules, so that the interactive snapping behavior is configured correctly for editing that asset type.
When using rule-based snapping, SnapSourceSettings.ruleBehavior may limit or prevent snapping to a snap source, regardless of its SnapSourceSettings.isEnabled value. Values of SnapSourceSettings.isEnabled will be affected by the given value of SnapSourceEnablingBehavior.
When rule-based snapping is configured, any edits made by interactively snapping to a SnapSource geometry will use the z-value of the feature geometry, if that snap source geometry is z-aware.
The SnapSettings.sourceSettings collection includes all valid snap sources in the map after synchronization, and therefore may include snap sources from data that is unrelated to the UtilityNetwork given when creating the SnapRules, for example graphics overlays or feature layers from separate data sources. If there is no connected ArcGISMapViewController, or the map view and the associated map contains no SnapSource objects valid for snapping, then the collection will be empty after this method returns.
The order of SnapSourceSettings objects will match the order that the associated SnapSource objects appear in the GeoModel.operationalLayers and GeoViewController.graphicsOverlays collections, with objects from GeoModel.operationalLayers appearing first, followed by GeoViewController.graphicsOverlays objects, in order. The collection will not contain a SnapSourceSettings for any loadable SnapSource which is not yet LoadStatus.loaded when synchronization occurs.
Parameters:
rules— The rules to apply to the SnapSource objects.snapSourceEnablingBehavior— Whether to set SnapSourceSettings.isEnabled based on the given SnapRules, or preserve the existing values.