Getting EID from Junction Flag in Geometric Network

726
2
08-25-2010 05:17 PM
GüntherGrill
New Contributor III
Hello everyone,

I´m starting to learn the object model for utility networks (c#) and I am trying to create my own IForwardStar crawler. I´m stuck with what should be an easy task. Using the Utility Network Analyst, I set a junction flag and need the junctionEID (and the incoming edgeEID) to pass into the FindAdjacent method of the IForwardStar Interface.

Any help or code snippets are highly appreciated.
Thanks for reading,

Günther
0 Kudos
2 Replies
KirkKuykendall
Occasional Contributor III
Try INetElements.GetEID.
0 Kudos
nicogis
MVP Frequent Contributor

JunctionFlag implements INetFlag ( ArcObjects 10 .NET SDK Help  ). Here you can get UserClassID, UserID and UserSubId

Then with these three info you get EID ( ArcObjects 10 .NET SDK Help  ) with GetEID ( in this sample fromEIDJunction )

Then you can use code:

                        IEnumNetEIDBuilderGEN eids = new EnumNetEIDArrayClass();

                        eids.ElementType = esriElementType.esriETEdge;

                        eids.Add(nearestEdgeID);

                        while (true)

                        {

                            int fromEIDJunction, toEIDJunction;

                            INetTopologyEditGEN netTopology = networkElements as INetTopologyEditGEN;

                            netTopology.GetFromToJunctionEIDs(nearestEdgeID, out fromEIDJunction, out toEIDJunction);

                            int edgeCount = netTopology.GetAdjacentEdgeCount(fromEIDJunction);

                            if (edgeCount == 1)

                            {

                                break;

                            }

                            bool reverseOrientation;

                            int adjacentEdge;

                            int livello = -1;

                            int eidCurrent = -1;

                            for (int i = 0; i < edgeCount; i++)

                            {

                                netTopology.GetAdjacentEdge(fromEIDJunction, i, out adjacentEdge, out reverseOrientation);

                                if (reverseOrientation == true) // Junction incoming

                                {

                                    int userClassID, userID, userSubID;

                                    networkElements.QueryIDs(adjacentEdge, esriElementType.esriETEdge, out userClassID, out userID, out userSubID);

                                    IFeature f = this.GetFeatureClassFromID(userClassID).GetFeature(userID);

                                    bla bla bla

0 Kudos