adding circulararc to feature class

583
3
01-30-2013 10:32 AM
johnjackson2
New Contributor
Hello,

I'm trying to import data from a legacy system. The legacy system stores all the info I need to create lines and circular arcs.
I have been able to create the circulararc object, but I can't figure out how to get it added to the feature class.
I keep getting the error: "No support for this geometry type"... I've looked at lots of other forum and documentation resources, but I just can't seem to get it to work.
[
            ESRI.ArcGIS.RuntimeManager.BindLicense(ESRI.ArcGIS.ProductCode.Desktop);

            Type factoryType = Type.GetTypeFromProgID(
    "esriDataSourcesGDB.FileGDBWorkspaceFactory");
            IWorkspaceFactory wf = (IWorkspaceFactory)Activator.CreateInstance(factoryType);
            IWorkspace workSpace = wf.OpenFromFile("f:\\test_shapes\\test-import.gdb", 0);
            IFeatureWorkspace featureSpace = (IFeatureWorkspace)workSpace;
            IFeatureClass featureClass = featureSpace.OpenFeatureClass("import45poly");
            CircularArc addme = new CircularArcClass();
            IPoint start = new Point();
            start.X = 1865640;
            start.Y = 683172;
            IPoint end = new Point();
            end.X = 1865672;
            end.Y = 683240;
            IPoint center = new Point();
            center.X = 1865686;
            center.Y = 683192;
            addme.PutCoords(center, start, end, esriArcOrientation.esriArcCounterClockwise);

            //here is where I don't know what I'm doing wrong.
            object mis1= Type.Missing;
            object mis2 = Type.Missing;

            ISegmentCollection path = new ESRI.ArcGIS.Geometry.PathClass();
            path.AddSegment((ISegment)addme, ref mis1, ref mis2);
            Polyline polyline = new Polyline();
            IGeometryCollection coll = (IGeometryCollection) polyline;
            coll.AddGeometry((IGeometry) path);

            IFeature addFeature = featureClass.CreateFeature();
            addFeature.Shape = coll.get_Geometry(0);
            addFeature.Store();
        }


Thanks in advance for your help.

--John Jackson
0 Kudos
3 Replies
AlexanderGray
Occasional Contributor III
Looks to me like you are trying to add a path geometry into a polyline feature when you specify the item 0 of the collection...  If you add the geometry collection (polylineclass object) instead of the first element of the collection, do you get the same problem?
0 Kudos
johnjackson2
New Contributor
Yes, either way I get the error.
0 Kudos
WeifengHe
Esri Contributor
One obvious mistake I can see here is:
addFeature.Shape = coll.get_Geometry(0);
Instead, it should be  addFeature.Shape = coll;
I guess the error message "No support for this geometry type" coming from this line.
0 Kudos