示例#1
0
        private Dictionary <IPoint, int> _ExtractUpstreamPipeEnds()
        {
            int iInletClassID = _inletClass.FeatureClassID;

            INetwork     network     = _geometricNetwork.Network;
            INetElements netElements = network as INetElements;
            INetTopology netTopology = network as INetTopology;

            Dictionary <IPoint, int> endPoints = new Dictionary <IPoint, int>();

            IEnumNetEID netEnum = network.CreateNetBrowser(esriElementType.esriETJunction);
            int         junctionCount = netEnum.Count;
            int         classId, userId, subId, edgeId;
            bool        towardJunction;
            int         junctionId = -1;

            for (int j = 0; j < junctionCount; j++)
            {
                junctionId = netEnum.Next();

                netElements.QueryIDs(junctionId, esriElementType.esriETJunction, out classId, out userId, out subId);

                if (classId != iInletClassID)
                {
                    bool disabled = false;
                    if (_excludeDisabled)
                    {
                        disabled = _IsDisabled(junctionId, esriElementType.esriETJunction, netElements);
                    }

                    if (!(_excludeDisabled && disabled))
                    {
                        int  edgeCount     = netTopology.GetAdjacentEdgeCount(junctionId);
                        bool isUpstreamEnd = edgeCount > 0; // initializing only (zero edge count always excluded)
                        for (int e = 0; e < edgeCount; e++)
                        {
                            netTopology.GetAdjacentEdge(junctionId, e, out edgeId, out towardJunction);
                            if (towardJunction)
                            {
                                isUpstreamEnd = false;
                                break;
                            }
                        }
                        if (isUpstreamEnd)
                        {
                            endPoints.Add(_geometricNetwork.get_GeometryForJunctionEID(junctionId) as IPoint, junctionId);
                        }
                    }
                }
            }

            return(endPoints);
        }