GIS Development Note - 1

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
 
   Dim pDS As ESRI.ArcGIS.Geodatabase.IDataset
   
   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
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);
   IEdgeFeature edge  = ArcHelper.getFeatureByOID(userId,layer.FeatureClass) as IEdgeFeature;     
   return edge;
  }
 
private int getFeatureEID(IFeature feature)
  {
   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;
   }
   eid = _netElements.GetEID(feature.Class.ObjectClassID,feature.OID,-1,type);
   return eid;
  }
 
5. how to get INetElements
   INetworkCollection coll = nodeLayer.FeatureClass.FeatureDataset as INetworkCollection;   
   _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);
 
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.--
 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值