文件获取裁剪多边形

        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;
            }

        }

 

posted @ 2022-03-02 15:17  恋上微笑的天使  阅读(32)  评论(0编辑  收藏  举报