ISimpleJunction

425
2
04-22-2014 11:17 PM
New Contributor III
I want to run this sample code just to manage the edges of a selected feature (junctionFeature)...

// Assume we already have a pointer to a junction feature.
ISimpleJunctionFeature simplejunctionFeature = junctionFeature;
IEdgeFeature edgeFeature;
IRow row;

for(int i = 0; i < simplejunctionFeature.EdgeFeatureCount; i++)
{
    edgeFeature = simplejunctionFeature.get_EdgeFeature(i);
    row = (IRow)edgeFeature;
    Console.WriteLine("EdgeFeature " + i + " has OID of: " + row.OID);
}


Well, first Im trying another code.

I have an IFeature selected . I have notice that when I hit a breakpoint for debbuging the FeatureType property of this element is esriFTSimpleJunction.

The code is this:


try 
                {
                    ISimpleJunctionFeature junction = firstSelectedFeature as ISimpleJunctionFeature; //firstSelectedFeature is my IFeature

                    staticUtilities.writeToDockableWindowJon(junction.EdgeFeatureCount.ToString()); //this just writes in my dockable window textbox...
                
                }
                catch (Exception ex) 
                
                {

                    staticUtilities.writeToDockableWindowJon(ex.ToString()); //this just writes in my dockable window textbox...
                }




The error is this:

System.Runtime.InteropServices.COMException (0x80004005): Error no especificado (Excepción de HRESULT: 0x80004005 (E_FAIL))
   en ESRI.ArcGIS.Geodatabase.ISimpleJunctionFeature.get_EdgeFeatureCount()...

Pleas help!!!

Thans in advance

Jon
Reply
0 Kudos
2 Replies
New Contributor III
After a lot of tests... I have realized that the code works well with a the geometric network imported in an sde geodatabase...

I've noticed that in the filegeodatabase:

-  simplejunctionFeature.EID is always 0
-  simplejunctionFeature.EdgeFeatureCount throws the explained exception
-   the original IFeature.hasOID property is false and and OID throws a exception as well.

What's the reason of this? I need the code to work on a filedatabase!!

Thanks in advance,

Jon


Complete code now:


      ISimpleJunctionFeature simplejunctionFeature = firstSelectedFeature as ISimpleJunctionFeature;
                IEdgeFeature edgeFeature;
                IRow row;

                try
                {

                    for (int i = 0; i < simplejunctionFeature.EdgeFeatureCount; i++)
                    {
                        edgeFeature = simplejunctionFeature.get_EdgeFeature(i);
                        row = (IRow)edgeFeature;
                        staticUtilities.writeToDockableWindowJon("EdgeFeature " + i + " has OID of: " + row.OID);
                    }
                }

                catch (Exception ex) {
                    staticUtilities.writeToDockableWindowJon(ex.ToString());
                }
Reply
0 Kudos
New Contributor III
Hi everybody!!

Any idea of this stuff? I need this code to run at a filegdb as well...

Please help!!

Thanks in any case..

Jon
Reply
0 Kudos