Each element in a logical network has a unique element ID (EID). The EID can be accessed by providing the following three ids: UserClassID, UserID, and UserSubID. If the network is part of a geometric network, the UserClassID and UserID correspond to the
FeatureClassID and
OID of the feature. The UserSubID is the ID of the subelement of the feature
1。How get FeatureClass and FeatureClass Name from a paticular Feature
Dim pFC As ESRI.ArcGIS.Geodatabase.IFeatureClass
CurrentFCName = ""
If m_pFeat Is Nothing Then Exit Property
pFC = m_pFeat.Class
CurrentFCName = ""
If m_pFeat Is Nothing Then Exit Property
pFC = m_pFeat.Class
Dim pDS As ESRI.ArcGIS.Geodatabase.IDataset
FCName = ""
If pFC Is Nothing Then Exit Property
pDS = pFC
FCName = pDS.Name
FCName = ""
If pFC Is Nothing Then Exit Property
pDS = pFC
FCName = pDS.Name
2.
'Find the network elements corresponding to a given OID. If the feature
'represents a complex edge there may be multiple corresponding elements
Private ReadOnly Property EIDsByOID(ByVal lngOID As Integer, ByVal lngClsID As Integer, ByVal elttype As ESRI.ArcGIS.Geodatabase.esriElementType) As ESRI.ArcGIS.Geodatabase.IEnumNetEID
Get
Dim pNetElements As ESRI.ArcGIS.Geodatabase.INetElements
'UPGRADE_NOTE: Object EIDsByOID may not be destroyed until it is garbage collected. Click for more: 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1029"'
EIDsByOID = Nothing
If Not Me.HasNetwork Then Exit Property
pNetElements = m_pGN.Network
EIDsByOID = pNetElements.GetEIDs(lngClsID, lngOID, elttype)
End Get
End Property
'represents a complex edge there may be multiple corresponding elements
Private ReadOnly Property EIDsByOID(ByVal lngOID As Integer, ByVal lngClsID As Integer, ByVal elttype As ESRI.ArcGIS.Geodatabase.esriElementType) As ESRI.ArcGIS.Geodatabase.IEnumNetEID
Get
Dim pNetElements As ESRI.ArcGIS.Geodatabase.INetElements
'UPGRADE_NOTE: Object EIDsByOID may not be destroyed until it is garbage collected. Click for more: 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1029"'
EIDsByOID = Nothing
If Not Me.HasNetwork Then Exit Property
pNetElements = m_pGN.Network
EIDsByOID = pNetElements.GetEIDs(lngClsID, lngOID, elttype)
End Get
End Property
1. userClassID = FeatrureClassID, userID = OID, userSubID = id of the subment in that feature
2. how to get FeatureClass:
FeatureLayer.FeatureClass, or Feature.Class
3.how to get FeatureClassId from a given Feature.
Feature.Class.ObjectClassID, in this case ObjectClassID equals FeatureClassId
4.use INetments to do IDs query
private IEdgeFeature getEdgeByEid(int eid)
{
IFeatureLayer layer = this.param.pipeLayer;
int userClsId,userId, userSubId;
_netElements.QueryIDs(eid,esriElementType.esriETEdge,out userClsId,out userId,out userSubId);
{
IFeatureLayer layer = this.param.pipeLayer;
int userClsId,userId, userSubId;
_netElements.QueryIDs(eid,esriElementType.esriETEdge,out userClsId,out userId,out userSubId);
IEdgeFeature edge = ArcHelper.getFeatureByOID(userId,layer.FeatureClass) as IEdgeFeature;
return edge;
}
}
private int getFeatureEID(IFeature feature)
{
int eid = 0;
esriElementType type = esriElementType.esriETEdge;
{
int eid = 0;
esriElementType type = esriElementType.esriETEdge;
if(feature.FeatureType == esriFeatureType.esriFTSimpleEdge
|| feature.FeatureType == esriFeatureType.esriFTComplexEdge)
{
type = esriElementType.esriETEdge;
}
else if(feature.FeatureType == esriFeatureType.esriFTSimpleJunction
|| feature.FeatureType == esriFeatureType.esriFTComplexJunction)
{
type = esriElementType.esriETJunction;
}
|| feature.FeatureType == esriFeatureType.esriFTComplexEdge)
{
type = esriElementType.esriETEdge;
}
else if(feature.FeatureType == esriFeatureType.esriFTSimpleJunction
|| feature.FeatureType == esriFeatureType.esriFTComplexJunction)
{
type = esriElementType.esriETJunction;
}
eid = _netElements.GetEID(feature.Class.ObjectClassID,feature.OID,-1,type);
return eid;
return eid;
}
5. how to get INetElements
INetworkCollection coll = nodeLayer.FeatureClass.FeatureDataset as INetworkCollection;
_geometryNtwk = coll.get_GeometricNetworkByName(hook.CurrentNetwork);
_netElements = (INetElements)_geometryNtwk.Network;
_geometryNtwk = coll.get_GeometricNetworkByName(hook.CurrentNetwork);
_netElements = (INetElements)_geometryNtwk.Network;
6. how to get forwardstar
IForwardStar forwarder = _geometryNtwk.Network.CreateForwardStar(true,null,null,null,null);
IForwardStar forwarder = _geometryNtwk.Network.CreateForwardStar(true,null,null,null,null);
7. how to get FeatureLayer
from IMap you can get each FeatureLayer, FocusMap is an implementatin of IMap.
---All rights reserved by WangBo, any unauthorized actions are forbidden.--