文件获取裁剪多边形
private GeoPolygon GetGeoPolygon0(string filepath) { //IVectorCls VectorCls = null; ////打开简单要素类 //VectorCls = new SFeatureCls(); /*bool rtn = VectorCls.Open("file:///" + filepath)*/; SFeatureCls featureCls = new SFeatureCls(); bool rtn = featureCls.Open("file:///" + filepath); //关闭数据 if (rtn) { IGeometry geometry = null; //对象属性信息 Record record = null; //对象图形信息 GeomInfo geomInfo = null; if (featureCls.Count<1) { return null; } featureCls.Get(1, out geometry, out record, out geomInfo); featureCls.Close(); return geometry as GeoPolygon; } else { featureCls.Close(); return null; } } private GeoPolygon GetGeoPolygon(string filepath) { IBasCls bascls = MapGIS.UI.Controls.GDBURLHelp.OpenXCls(filepath); SFeatureCls featureCls = bascls as SFeatureCls; IGeometry geometry = null; //对象属性信息 Record record = null; //对象图形信息 GeomInfo geomInfo = null; if (featureCls.Count<1) { return null; } bool rtn = featureCls.Get(1, out geometry, out record, out geomInfo); if (rtn) { return geometry as GeoPolygon; } else { return null; } }
本博有部分内容来自网络,如有问题请联系:hebeilijianghua@qq.com,并注明来自博客园。