IFeature和IPoint接口的转换以及文…

时间:2022-03-13 15:01:23
IFeature和IPoint接口的转换以及文件读取//读取硬盘上的shp数据IWorkspaceFactory pWsFac = newShapefileWorkspaceFactoryClass();IWorkspace pWs = pWsFac.OpenFromFile(@"E:", 0);IFeatureWorkspace pFWs = pWs as IFeatureWorkspace;IFeatureClass pointsClass =pFWs.OpenFeatureClass("randomPoints2");IFeatureCursor featureCursor = pFeatClass.Search(null,true); IFeature feature =featureCursor.NextFeature();IPointCollection pointsColl = newMultipointClass();       while (feature != null)       {           IPoint pt= new PointClass();          pt =feature.Shape as IPoint;///////////           pointsColl.AddPoint(pt);       }