createFromAssetType static method
- required UtilityNetwork utilityNetwork,
- required UtilityAssetType assetType,
Analyzes an UtilityNetwork for the rules which allow or limit the snapping of the given UtilityAssetType to other features, and returns a SnapRules which can be used to configure interactive snapping behavior in a GeometryEditor.
To configure rule-based snapping, use this method to create a SnapRules that you can then pass to SnapSettings.syncSourceSettingsUsingRules. This method is ideal for creating SnapRules when you have a reference to the UtilityAssetType, for example if you have identified an existing feature to be edited, you can call UtilityNetwork.createElement, then get UtilityElement.assetType to pass in.
Ensure that the feature tables underlying the given UtilityNetwork are the same used by operational layers in the map, so that the SnapRules are based on the same underlying data sets.
If your map view displays a web map, or is set from a MobileMapPackage, the ArcGISMap.utilityNetworks collection may already contain the relevant utility network object to use. Alternatively you may get the utility network from the same Geodatabase that backs your operational layers, or call UtilityNetwork.new to create the network from a ServiceGeodatabase and associate it with your ArcGISMap using ArcGISMap.utilityNetworks.
Ensure that the UtilityAssetType is from the given UtilityNetwork.
Parameters:
utilityNetwork— The UtilityNetwork object to analyze for its connectivity rules relating to the given assetType.assetType— The asset type of the feature geometry that will be edited in the GeometryEditor. Connectivity rules involving this asset type are included in the returned SnapRules.
Return Value: A SnapRules appropriate for interactively editing the geometry of a feature of the given UtilityAssetType.