This document is archived and information here might be outdated. Recommended version. |
Adds a weight to an existing the geometric network, features are not changed in this process.
[Visual Basic .NET] Public Sub AddWeightToNetwork ( _ ByVal GeometricNetwork As IGeometricNetwork, _ ByVal weightName As String, _ ByVal weightType As esriWeightType, _ ByVal bitGateSize As Integer, _ ByVal weightAssociations As ISet _ )
[C#] public void AddWeightToNetwork ( IGeometricNetwork GeometricNetwork, string weightName, esriWeightType weightType, int bitGateSize, ISet weightAssociations );
[C++]
HRESULT AddWeightToNetwork(
IGeometricNetwork* GeometricNetwork,
BSTR weightName,
esriWeightType weightType,
long bitGateSize,
ISet* weightAssociations
);
[C++] Parameters GeometricNetwork [in]
GeometricNetwork is a parameter of type IGeometricNetwork* weightName [in]
weightName is a parameter of type BSTR weightType [in]
weightType is a parameter of type esriWeightType bitGateSize [in]
bitGateSize is a parameter of type long weightAssociations [in]
weightAssociations is a parameter of type ISet*
The AddWeightToNetwork method will add a weight to the geometric network with the specified name and the type. Additionally, the weight associations will be created for all feature class and field pairings that are specified in the weightAssociations parameter.
The weightAssociations parameter is a set of StringPair objects. A StringPair is a set of strings where the first string represents the class name, the second the field name. Both must be supplied for the StringPair to be valid. Fully qualified strings are supported.
When specifying a weightType not of type esriWTBitGate, set the bitGateSize parameter to 0.
If the network is on SDE and is versioned, the addition of the weight will be reflected across all versions of the geometric network. The AddWeightToNetwork method will not act upon the features in the network, no snapping will occur and no orphan junction features will be created.
Weights cannot be specified under the following circumstances:
An exclusive schema lock must be obtained before using the AddWeightToNetwork method. See the ISchemaLock interface for information on listing existing schema locks and obtaining an exclusive schema lock.
The following code can be used to add a weight of type Integer to a geometric network:
The following code can be used to add a weight of type Integer to a geometric network: