Esempio n. 1
0
        //OK Loop
        public ZhFeatureClass GetZhFeatureClass(string featureClassName)
        {
            ZhFeatureClass ZHfeatcls = null;
            IFeatureClass  fc        = GetFeatureClass(featureClassName);

            if (fc != null)
            {
                switch (fc.ShapeType)
                {
                case esriGeometryType.esriGeometryPolygon:
                    ZHfeatcls = new ZhPolygonFeatureClass(fc);
                    break;

                case esriGeometryType.esriGeometryPolyline:
                case esriGeometryType.esriGeometryLine:
                    ZHfeatcls = new ZhPolylineFeatureClass(fc);
                    break;

                case esriGeometryType.esriGeometryPoint:
                case esriGeometryType.esriGeometryMultipoint:
                    ZHfeatcls = new ZhPointFeatureClass(fc);
                    break;
                }
            }
            return(ZHfeatcls);
        }
Esempio n. 2
0
        /// <summary>
        ///  getZHFeatureClass
        /// </summary>
        /// <returns></returns>
        public ZhFeatureClass getZHFeatureClass()
        {
            IFeatureClass  fc   = this.getIFeatureClass();
            ZhFeatureClass zhfc = new ZhPointFeatureClass(fc);

            return(zhfc);
        }
Esempio n. 3
0
        /// <summary>
        /// deleteAllFeatures
        /// </summary>
        /// <returns></returns>
        public bool deleteAllFeatures()
        {
            bool rbc = false;

            try
            {
                IFeatureClass fc = this.getIFeatureClass();
                if (fc != null)
                {
                    ZhPointFeatureClass zhfc = new ZhPointFeatureClass(fc);
                    zhfc.DeleteAllFeatures();
                    TokayWorkspace.ComRelease(fc);
                    fc   = null;
                    zhfc = null;

                    rbc = true;
                }
            }
            catch (Exception ee)
            {
                System.Diagnostics.Debug.WriteLine(ee.ToString());
                rbc = false;
            }
            return(rbc);
        }
Esempio n. 4
0
        //
        //输出外环面 shape
        public bool OutPutPolygonExteriorRing(IFeatureClass featclass, string outShapeFilePath, bool IsGetExtRingOfHaveInnerRing)
        {
            bool rbc = false;

            if (System.IO.File.Exists(outShapeFilePath) == true)
            {   //输出Shape文件
                LocalShapeFileOperator delshpOp = new LocalShapeFileOperator();
                delshpOp.LocalShapePathFileName = outShapeFilePath;
                delshpOp.DeleteShapeFile();
                delshpOp.Dispose();
            }

            esriGeometryType geoType = featclass.ShapeType;

            //创建新的Shape文件
            LocalShapeFileOperator shpOp = new LocalShapeFileOperator();

            shpOp.LocalShapePathFileName = outShapeFilePath;

            string dir  = shpOp.getDir(outShapeFilePath);
            string name = shpOp.getFileName(outShapeFilePath);
            ShapefileWorkspaceFactoryClass objwsf = new ShapefileWorkspaceFactoryClass();
            IWorkspace        objws    = objwsf.OpenFromFile(dir, 0);
            IFeatureWorkspace feaureWS = objws as IFeatureWorkspace;
            //设置投影
            ISpatialReference sr = (featclass as IGeoDataset).SpatialReference;

            shpOp.ShapeSpatialReference = sr;
            //设置shp文件的oid字段和几何字段
            if (IsObjGeo == false)
            {
                if (featclass.HasOID == true)
                {
                    this.OIDFieldName = featclass.OIDFieldName;
                }
                this.GeometryFieldName = featclass.ShapeFieldName;
            }
            shpOp.OIDFieldName      = this.OIDFieldName;
            shpOp.GeometryFieldName = this.GeometryFieldName;
            //创建要素类
            IFeatureClass fc = shpOp.CreateFeatureClass(feaureWS, name, esriFeatureType.esriFTSimple, geoType);

            if (fc != null)
            {
                TokayWorkspace.ComRelease(fc);
                fc  = null;
                rbc = true;
            }
            TokayWorkspace.ComRelease(objws);
            feaureWS = null;
            objws    = null;
            objwsf   = null;
            //拷贝字段结构
            IFeatureClass  Dfeatclass   = shpOp.getIFeatureClass();
            ZhFeatureClass Szhfeatclass = new ZhPointFeatureClass(featclass);

            Szhfeatclass.CopyFieldsToObjectFeatureClass(Dfeatclass);

            //拷贝几何对象和属性数据
            ZhFeature      Szhfeat       = null;
            IFeatureBuffer DfeatBuffer   = null;
            IFeatureCursor featCurInsert = Dfeatclass.Insert(true);

            //获取总要素个数
            int             fIndex    = 0;
            int             tmpFCount = Szhfeatclass.FeatureClass.FeatureCount(null);
            frmProgressBar1 pb        = new frmProgressBar1();

            pb.Text                 = "正在输出shp文件...";
            pb.Caption1.Text        = "正在输出shp文件...";
            pb.progressBar1.Maximum = tmpFCount + 1;
            pb.progressBar1.Value   = 0;
            pb.Show(this.ParentForm);
            Application.DoEvents();

            object   refobj = Type.Missing;
            IPolygon s_p    = null;

            IRing[] ExtRingArray   = null;
            IRing[] InnerRingArray = null;


            IFeatureCursor featcur = Szhfeatclass.FeatureClass.Search(null, false);
            IFeature       feat    = featcur.NextFeature();

            while (feat != null)
            {
                fIndex += 1;
                if (fIndex % 200 == 0)
                {
                    pb.Caption1.Text      = "已输出要素个数:" + fIndex.ToString() + "/总" + tmpFCount.ToString();
                    pb.progressBar1.Value = fIndex;
                    Application.DoEvents();
                    featCurInsert.Flush();
                }
                s_p = feat.ShapeCopy as IPolygon;
                //获取外环面几何对象
                ExtRingArray = PolygonHelper.GetExteriorRings(s_p);
                if (ExtRingArray != null && ExtRingArray.Length > 0)
                {
                    foreach (IRing r in ExtRingArray)
                    {
                        if (IsGetExtRingOfHaveInnerRing == true)
                        {
                            InnerRingArray = PolygonHelper.GetInteriorRingsByExterior(r, s_p);
                            if (InnerRingArray != null && InnerRingArray.Length > 0)
                            {   //有内环
                                //外环构面并输出保存
                                DfeatBuffer = Dfeatclass.CreateFeatureBuffer();

                                PolygonClass pclass = new PolygonClass();
                                pclass.AddGeometry(r, ref refobj, ref refobj);
                                pclass.SimplifyPreserveFromTo();
                                pclass.SpatialReference = sr;

                                DfeatBuffer.Shape = pclass;

                                //拷贝属性数据
                                Szhfeat = new ZHFeaturePoint(feat);
                                Szhfeat.CopyField(ref DfeatBuffer);

                                featCurInsert.InsertFeature(DfeatBuffer);
                                //
                            }
                        }
                        else
                        {
                            //外环构面并输出保存
                            DfeatBuffer = Dfeatclass.CreateFeatureBuffer();

                            PolygonClass pclass = new PolygonClass();
                            pclass.AddGeometry(r, ref refobj, ref refobj);
                            pclass.SimplifyPreserveFromTo();
                            pclass.SpatialReference = sr;

                            DfeatBuffer.Shape = pclass;

                            //拷贝属性数据
                            Szhfeat = new ZHFeaturePoint(feat);
                            Szhfeat.CopyField(ref DfeatBuffer);

                            featCurInsert.InsertFeature(DfeatBuffer);
                            //
                        }
                    }
                }
                feat = featcur.NextFeature();
            }
            featCurInsert.Flush();
            TokayWorkspace.ComRelease(featcur);
            featcur = null;
            TokayWorkspace.ComRelease(featCurInsert);
            featCurInsert = null;
            rbc           = true;

            pb.Close();
            pb.Dispose();
            pb = null;

            return(rbc);
        }
Esempio n. 5
0
        //输出单个图层中所有要素集合到shp文件中功能 OK
        public bool OutPut(IFeatureClass featclass, string outShapeFilePath)
        {
            bool rbc = false;

            if (System.IO.File.Exists(outShapeFilePath) == true)
            {   //输出Shape文件
                LocalShapeFileOperator delshpOp = new LocalShapeFileOperator();
                delshpOp.LocalShapePathFileName = outShapeFilePath;
                delshpOp.DeleteShapeFile();
                delshpOp.Dispose();
            }

            esriGeometryType geoType = featclass.ShapeType;

            //创建新的Shape文件
            LocalShapeFileOperator shpOp = new LocalShapeFileOperator();

            shpOp.LocalShapePathFileName = outShapeFilePath;

            string dir  = shpOp.getDir(outShapeFilePath);
            string name = shpOp.getFileName(outShapeFilePath);
            ShapefileWorkspaceFactoryClass objwsf = new ShapefileWorkspaceFactoryClass();
            IWorkspace        objws    = objwsf.OpenFromFile(dir, 0);
            IFeatureWorkspace feaureWS = objws as IFeatureWorkspace;

            //设置投影
            shpOp.ShapeSpatialReference = (featclass as IGeoDataset).SpatialReference;
            //设置shp文件的oid字段和几何字段
            if (IsObjGeo == false)
            {
                if (featclass.HasOID == true)
                {
                    this.OIDFieldName = featclass.OIDFieldName;
                }
                this.GeometryFieldName = featclass.ShapeFieldName;
            }
            shpOp.OIDFieldName      = this.OIDFieldName;
            shpOp.GeometryFieldName = this.GeometryFieldName;
            //创建要素类
            IFeatureClass fc = shpOp.CreateFeatureClass(feaureWS, name, esriFeatureType.esriFTSimple, geoType);

            if (fc != null)
            {
                TokayWorkspace.ComRelease(fc);
                fc  = null;
                rbc = true;
            }
            TokayWorkspace.ComRelease(objws);
            feaureWS = null;
            objws    = null;
            objwsf   = null;
            //拷贝字段结构
            IFeatureClass  Dfeatclass   = shpOp.getIFeatureClass();
            ZhFeatureClass Szhfeatclass = new ZhPointFeatureClass(featclass);

            Szhfeatclass.CopyFieldsToObjectFeatureClass(Dfeatclass);

            //拷贝几何对象和属性数据
            ZhFeature      Szhfeat       = null;
            IFeatureBuffer DfeatBuffer   = null;
            ZhFeature      Dzhfeat       = null;
            IFeatureCursor featCurInsert = Dfeatclass.Insert(true);

            //获取总要素个数
            int             fIndex    = 0;
            int             tmpFCount = Szhfeatclass.FeatureClass.FeatureCount(null);
            frmProgressBar1 pb        = new frmProgressBar1();

            pb.Text                 = "正在输出shp文件...";
            pb.Caption1.Text        = "正在输出shp文件...";
            pb.progressBar1.Maximum = tmpFCount + 1;
            pb.progressBar1.Value   = 0;
            pb.Show(this.ParentForm);
            Application.DoEvents();
            //
            IGeometry geo = null;
            //
            IFeatureCursor featcur = Szhfeatclass.FeatureClass.Search(null, false);
            IFeature       feat    = featcur.NextFeature();

            while (feat != null)
            {
                fIndex += 1;
                if (fIndex % 500 == 0)
                {
                    pb.Caption1.Text      = "已输出要素个数:" + fIndex.ToString() + "/总" + tmpFCount.ToString();
                    pb.progressBar1.Value = fIndex;
                    Application.DoEvents();
                    featCurInsert.Flush();
                }
                DfeatBuffer = Dfeatclass.CreateFeatureBuffer();

                //拷贝几何对象
                geo = feat.ShapeCopy;
                //去掉Z值
                IZAware pZaware = geo as IZAware;
                if (pZaware.ZAware == true)
                {
                    pZaware.DropZs();
                    pZaware.ZAware = false;
                }
                //
                DfeatBuffer.Shape = geo;
                //
                //拷贝属性数据
                Szhfeat = new ZHFeaturePoint(feat);
                Szhfeat.CopyField(ref DfeatBuffer);

                featCurInsert.InsertFeature(DfeatBuffer);

                feat = featcur.NextFeature();
            }
            featCurInsert.Flush();
            TokayWorkspace.ComRelease(featcur);
            featcur = null;
            TokayWorkspace.ComRelease(featCurInsert);
            featCurInsert = null;
            rbc           = true;

            pb.Close();
            pb.Dispose();
            pb = null;

            return(rbc);
        }
Esempio n. 6
0
        //输出通过一个图层已选中的要素去选择输出其他图层shp文件功能 OK
        public bool OutPutSelectedFeatureByOverlap(IFeatureLayer SelectedFeatLayer, IFeatureClass outFeatClass, string outShapeFilePath)
        {
            bool rbc = false;

            if (System.IO.File.Exists(outShapeFilePath) == true)
            {   //输出Shape文件
                LocalShapeFileOperator delshpOp = new LocalShapeFileOperator();
                delshpOp.LocalShapePathFileName = outShapeFilePath;
                delshpOp.DeleteShapeFile();
                delshpOp.Dispose();
            }

            esriGeometryType geoType = outFeatClass.ShapeType;

            //创建新的Shape文件
            LocalShapeFileOperator shpOp = new LocalShapeFileOperator();

            shpOp.LocalShapePathFileName = outShapeFilePath;
            shpOp.GeometryType           = geoType;
            //
            string dir  = shpOp.getDir(outShapeFilePath);
            string name = shpOp.getFileName(outShapeFilePath);
            ShapefileWorkspaceFactoryClass objwsf = new ShapefileWorkspaceFactoryClass();
            IWorkspace        objws    = objwsf.OpenFromFile(dir, 0);
            IFeatureWorkspace feaureWS = objws as IFeatureWorkspace;

            //设置投影
            shpOp.ShapeSpatialReference = (outFeatClass as IGeoDataset).SpatialReference;
            //设置shp文件的oid字段和几何字段
            if (IsObjGeo == false)
            {
                if (outFeatClass.HasOID == true)
                {
                    this.OIDFieldName = outFeatClass.OIDFieldName;
                }
                this.GeometryFieldName = outFeatClass.ShapeFieldName;
            }
            shpOp.OIDFieldName      = this.OIDFieldName;
            shpOp.GeometryFieldName = this.GeometryFieldName;
            //创建要素类
            IFeatureClass fc = shpOp.CreateFeatureClass(feaureWS, name, esriFeatureType.esriFTSimple, geoType);

            if (fc != null)
            {
                TokayWorkspace.ComRelease(fc);
                fc  = null;
                rbc = true;
            }
            TokayWorkspace.ComRelease(objws);
            feaureWS = null;
            objws    = null;
            objwsf   = null;
            //拷贝字段结构
            IFeatureClass  Dfeatclass   = shpOp.getIFeatureClass();
            ZhFeatureClass Szhfeatclass = new ZhPointFeatureClass(outFeatClass);

            Szhfeatclass.CopyFieldsToObjectFeatureClass(Dfeatclass);

            //拷贝几何对象和属性数据
            ZhFeature      Szhfeat       = null;
            IFeatureBuffer DfeatBuffer   = null;
            ZhFeature      Dzhfeat       = null;
            IFeatureCursor featCurInsert = Dfeatclass.Insert(true);

            //获取总要素个数
            int             fIndex    = 0;
            int             tmpFCount = Szhfeatclass.FeatureClass.FeatureCount(null);
            frmProgressBar1 pb        = new frmProgressBar1();

            pb.Text                 = "正在输出shp文件...";
            pb.Caption1.Text        = "正在输出shp文件...";
            pb.progressBar1.Maximum = tmpFCount + 1;
            pb.progressBar1.Value   = 0;
            pb.Show(this.ParentForm);
            Application.DoEvents();

            //获取已选择要的要素集合
            IFeatureSelection featSel     = SelectedFeatLayer as IFeatureSelection;
            ICursor           SelectedCur = null;

            featSel.SelectionSet.Search(null, false, out SelectedCur);
            if (SelectedCur != null)
            {
                IFeatureCursor Selectedfeatcur = SelectedCur as IFeatureCursor;// Szhfeatclass.FeatureClass.Search(null, false);
                if (Selectedfeatcur != null)
                {
                    IFeature Selectedfeat = Selectedfeatcur.NextFeature();
                    while (Selectedfeat != null)
                    {
                        ISpatialFilter sFilter = new SpatialFilterClass();
                        sFilter.Geometry      = Selectedfeat.ShapeCopy;
                        sFilter.GeometryField = Szhfeatclass.FeatureClass.ShapeFieldName;
                        sFilter.SpatialRel    = esriSpatialRelEnum.esriSpatialRelIntersects; //相交
                        //总个数
                        pb.progressBar1.Maximum = Szhfeatclass.FeatureClass.FeatureCount(sFilter);
                        pb.progressBar1.Value   = 0;
                        Application.DoEvents();
                        fIndex = 0;
                        //
                        IFeatureCursor featcur = Szhfeatclass.FeatureClass.Search(sFilter, false);
                        IFeature       feat    = featcur.NextFeature();
                        while (feat != null)
                        {
                            fIndex += 1;
                            //
                            pb.Caption1.Text      = "已输出要素个数... 第" + fIndex.ToString() + "个/总" + pb.progressBar1.Maximum.ToString() + "个";
                            pb.progressBar1.Value = fIndex;
                            Application.DoEvents();
                            if (fIndex % 500 == 0)
                            {
                                featCurInsert.Flush();
                            }
                            //
                            DfeatBuffer = Dfeatclass.CreateFeatureBuffer();
                            //拷贝几何对象
                            DfeatBuffer.Shape = feat.ShapeCopy;
                            //拷贝属性数据
                            Szhfeat = new ZHFeaturePoint(feat);
                            Szhfeat.CopyField(ref DfeatBuffer);
                            //
                            featCurInsert.InsertFeature(DfeatBuffer);
                            //下一个要素
                            feat = featcur.NextFeature();
                        }
                        featCurInsert.Flush();
                        if (featcur != null)
                        {
                            TokayWorkspace.ComRelease(featcur);
                            featcur = null;
                        }
                        //下一个选中的要素
                        Selectedfeat = Selectedfeatcur.NextFeature();
                    }
                    if (Selectedfeatcur != null)
                    {
                        TokayWorkspace.ComRelease(Selectedfeatcur);
                        Selectedfeatcur = null;
                    }
                }
                if (featCurInsert != null)
                {
                    TokayWorkspace.ComRelease(featCurInsert);
                    featCurInsert = null;
                }
                rbc = true;
            }
            pb.Close();
            pb.Dispose();
            pb = null;
            //
            return(rbc);
        }
Esempio n. 7
0
        //输出单个图层中已选中的要素集合到shp文件中功能 OK
        public bool OutPutSelectedFeature(IFeatureLayer featLayer, string outShapeFilePath)
        {
            IFeatureClass featclass = featLayer.FeatureClass;

            bool rbc = false;

            if (System.IO.File.Exists(outShapeFilePath) == true)
            {   //输出Shape文件
                LocalShapeFileOperator delshpOp = new LocalShapeFileOperator();
                delshpOp.LocalShapePathFileName = outShapeFilePath;
                delshpOp.DeleteShapeFile();
                delshpOp.Dispose();
            }

            esriGeometryType geoType = featclass.ShapeType;

            //创建新的Shape文件
            LocalShapeFileOperator shpOp = new LocalShapeFileOperator();

            shpOp.LocalShapePathFileName = outShapeFilePath;

            string dir  = shpOp.getDir(outShapeFilePath);
            string name = shpOp.getFileName(outShapeFilePath);
            ShapefileWorkspaceFactoryClass objwsf = new ShapefileWorkspaceFactoryClass();
            IWorkspace        objws    = objwsf.OpenFromFile(dir, 0);
            IFeatureWorkspace feaureWS = objws as IFeatureWorkspace;

            //设置投影
            shpOp.ShapeSpatialReference = (featclass as IGeoDataset).SpatialReference;
            //设置shp文件的oid字段和几何字段
            if (IsObjGeo == false)
            {
                if (featclass.HasOID == true)
                {
                    this.OIDFieldName = featclass.OIDFieldName;
                }
                this.GeometryFieldName = featclass.ShapeFieldName;
            }
            shpOp.OIDFieldName      = this.OIDFieldName;
            shpOp.GeometryFieldName = this.GeometryFieldName;
            //创建要素类
            IFeatureClass fc = shpOp.CreateFeatureClass(feaureWS, name, esriFeatureType.esriFTSimple, geoType);

            if (fc != null)
            {
                TokayWorkspace.ComRelease(fc);
                fc  = null;
                rbc = true;
            }
            TokayWorkspace.ComRelease(objws);
            feaureWS = null;
            objws    = null;
            objwsf   = null;
            //拷贝字段结构
            IFeatureClass  Dfeatclass   = shpOp.getIFeatureClass();
            ZhFeatureClass Szhfeatclass = new ZhPointFeatureClass(featclass);

            Szhfeatclass.CopyFieldsToObjectFeatureClass(Dfeatclass);

            //拷贝几何对象和属性数据
            ZhFeature      Szhfeat       = null;
            IFeatureBuffer DfeatBuffer   = null;
            ZhFeature      Dzhfeat       = null;
            IFeatureCursor featCurInsert = Dfeatclass.Insert(true);

            //获取已选择要的要素集合
            IFeatureSelection featSel = featLayer as IFeatureSelection;
            ICursor           cur     = null;

            featSel.SelectionSet.Search(null, false, out cur);
            if (cur != null)
            {
                IFeatureCursor featcur = cur as IFeatureCursor;// Szhfeatclass.FeatureClass.Search(null, false);
                if (featcur != null)
                {
                    IFeature feat = featcur.NextFeature();
                    while (feat != null)
                    {
                        DfeatBuffer = Dfeatclass.CreateFeatureBuffer();

                        //拷贝几何对象
                        DfeatBuffer.Shape = feat.ShapeCopy;

                        //拷贝属性数据
                        Szhfeat = new ZHFeaturePoint(feat);
                        Szhfeat.CopyField(ref DfeatBuffer);

                        featCurInsert.InsertFeature(DfeatBuffer);

                        feat = featcur.NextFeature();
                    }
                }
                TokayWorkspace.ComRelease(featcur);
                featcur = null;
            }
            featCurInsert.Flush();

            TokayWorkspace.ComRelease(featCurInsert);
            featCurInsert = null;
            rbc           = true;

            return(rbc);
        }
Esempio n. 8
0
        private void ShapeFileProjectionConvert(ISpatialReference SourceSpatialReference, ISpatialReference ObjectSpatialReference, IFeatureClass SourceFeatureClass, IFeatureClass ObjectFeatureClass)
        {
            int SourceFactoryCode = SourceSpatialReference.FactoryCode;
            int ObjectFactoryCode = ObjectSpatialReference.FactoryCode;
            //if (SourceFactoryCode == 0 || ObjectFactoryCode == 0)
            //{
            //    MessageBox.Show("源文件是自定义的投影坐标系统,这里暂不进行转换", "投影转换提示");
            //    return;
            //}
            EnumProjectionDatum SourceProjection = EnumProjectionDatum.Bejing54; //默认
            EnumStrip           SourceStrip      = EnumStrip.Strip3;             //默认

            EnumProjectionDatum ObjectProjection = EnumProjectionDatum.Xian80;   //默认
            EnumStrip           ObjectStrip      = EnumStrip.Strip3;             //默认

            //源中央子午线
            double L0 = (SourceSpatialReference as IProjectedCoordinateSystem4GEN).GetCentralLongitude();

            bool IsBigNumber_Source = true;  //源文件默认是大数
            bool IsBigNumber_Object = true;  //目标默认是大数


            //------------------------------------------------------------------------------------------
            //高斯投影大数情况分析
            int BJ54D3_25srid = (int)esriSRProjCS4Type.esriSRProjCS_Beijing1954_3_Degree_GK_Zone_25;
            int BJ54D3_45srid = (int)esriSRProjCS4Type.esriSRProjCS_Beijing1954_3_Degree_GK_Zone_45;

            int BJ54D6_13srid = (int)esriSRProjCSType.esriSRProjCS_Beijing1954GK_13;
            int BJ54D6_23srid = (int)esriSRProjCSType.esriSRProjCS_Beijing1954GK_23;

            int Xian80D3_25srid = (int)esriSRProjCS4Type.esriSRProjCS_Xian1980_3_Degree_GK_Zone_25;
            int Xian80D3_45srid = (int)esriSRProjCS4Type.esriSRProjCS_Xian1980_3_Degree_GK_Zone_45;

            int Xian80D6_13srid = (int)esriSRProjCS4Type.esriSRProjCS_Xian1980_GK_Zone_13;
            int Xian80D6_23srid = (int)esriSRProjCS4Type.esriSRProjCS_Xian1980_GK_Zone_23;

            //源文件分析

            //BeiJing1954 3 degree
            if (SourceFactoryCode >= BJ54D3_25srid && SourceFactoryCode <= BJ54D3_45srid)
            {
                SourceProjection   = EnumProjectionDatum.Bejing54;
                SourceStrip        = EnumStrip.Strip3;
                IsBigNumber_Source = true;
            }

            //BeiJing1954 6 degree
            if (SourceFactoryCode >= BJ54D6_13srid && SourceFactoryCode <= BJ54D6_23srid)
            {
                SourceProjection   = EnumProjectionDatum.Bejing54;
                SourceStrip        = EnumStrip.Strip3;
                IsBigNumber_Source = true;
            }

            //Xian1980 3 degree
            if (SourceFactoryCode >= Xian80D3_25srid && SourceFactoryCode <= Xian80D3_45srid)
            {
                SourceProjection   = EnumProjectionDatum.Xian80;
                SourceStrip        = EnumStrip.Strip3;
                IsBigNumber_Source = true;
            }

            //Xian1980 6 degree
            if (SourceFactoryCode >= Xian80D6_13srid && SourceFactoryCode <= Xian80D6_23srid)
            {
                SourceProjection   = EnumProjectionDatum.Xian80;
                SourceStrip        = EnumStrip.Strip3;
                IsBigNumber_Source = true;
            }
            //目标文件分析
            //BeiJing1954 3 degree
            if (ObjectFactoryCode >= BJ54D3_25srid && ObjectFactoryCode <= BJ54D3_45srid)
            {
                ObjectProjection   = EnumProjectionDatum.Bejing54;
                ObjectStrip        = EnumStrip.Strip3;
                IsBigNumber_Object = true;
            }

            //BeiJing1954 6 degree
            if (ObjectFactoryCode >= BJ54D6_13srid && ObjectFactoryCode <= BJ54D6_23srid)
            {
                ObjectProjection   = EnumProjectionDatum.Bejing54;
                ObjectStrip        = EnumStrip.Strip3;
                IsBigNumber_Object = true;
            }

            //Xian1980 3 degree
            if (ObjectFactoryCode >= Xian80D3_25srid && ObjectFactoryCode <= Xian80D3_45srid)
            {
                ObjectProjection   = EnumProjectionDatum.Xian80;
                ObjectStrip        = EnumStrip.Strip3;
                IsBigNumber_Object = true;
            }

            //Xian1980 6 degree
            if (ObjectFactoryCode >= Xian80D6_13srid && ObjectFactoryCode <= Xian80D6_23srid)
            {
                ObjectProjection   = EnumProjectionDatum.Xian80;
                ObjectStrip        = EnumStrip.Strip3;
                IsBigNumber_Object = true;
            }
            //-------------------------------------------------------------------------------------
            ////高斯投影小数情况分析
            int BJ54D3_25srid_CM = (int)esriSRProjCS4Type.esriSRProjCS_Beijing1954_3_Degree_GK_CM_75E;
            int BJ54D3_45srid_CM = (int)esriSRProjCS4Type.esriSRProjCS_Beijing1954_3_Degree_GK_CM_135E;

            int BJ54D6_13srid_CM = (int)esriSRProjCSType.esriSRProjCS_Beijing1954GK_13N;
            int BJ54D6_23srid_CM = (int)esriSRProjCSType.esriSRProjCS_Beijing1954GK_23N;

            int Xian80D3_25srid_CM = (int)esriSRProjCS4Type.esriSRProjCS_Xian1980_3_Degree_GK_CM_75E;
            int Xian80D3_45srid_CM = (int)esriSRProjCS4Type.esriSRProjCS_Xian1980_3_Degree_GK_CM_135E;

            int Xian80D6_13srid_CM = (int)esriSRProjCS4Type.esriSRProjCS_Xian1980_GK_CM_75E;
            int Xian80D6_23srid_CM = (int)esriSRProjCS4Type.esriSRProjCS_Xian1980_GK_CM_135E;

            //源文件分析

            //BeiJing1954 3 degree
            if (SourceFactoryCode >= BJ54D3_25srid_CM && SourceFactoryCode <= BJ54D3_45srid_CM)
            {
                SourceProjection   = EnumProjectionDatum.Bejing54;
                SourceStrip        = EnumStrip.Strip3;
                IsBigNumber_Source = false;
            }

            //BeiJing1954 6 degree
            if (SourceFactoryCode >= BJ54D6_13srid_CM && SourceFactoryCode <= BJ54D6_23srid_CM)
            {
                SourceProjection   = EnumProjectionDatum.Bejing54;
                SourceStrip        = EnumStrip.Strip3;
                IsBigNumber_Source = false;
            }

            //Xian1980 3 degree
            if (SourceFactoryCode >= Xian80D3_25srid_CM && SourceFactoryCode <= Xian80D3_45srid_CM)
            {
                SourceProjection   = EnumProjectionDatum.Xian80;
                SourceStrip        = EnumStrip.Strip3;
                IsBigNumber_Source = false;
            }

            //Xian1980 6 degree
            if (SourceFactoryCode >= Xian80D6_13srid_CM && SourceFactoryCode <= Xian80D6_23srid_CM)
            {
                SourceProjection   = EnumProjectionDatum.Xian80;
                SourceStrip        = EnumStrip.Strip3;
                IsBigNumber_Source = false;
            }
            //目标文件分析
            //BeiJing1954 3 degree
            if (ObjectFactoryCode >= BJ54D3_25srid_CM && ObjectFactoryCode <= BJ54D3_45srid_CM)
            {
                ObjectProjection   = EnumProjectionDatum.Bejing54;
                ObjectStrip        = EnumStrip.Strip3;
                IsBigNumber_Object = false;
            }

            //BeiJing1954 6 degree
            if (ObjectFactoryCode >= BJ54D6_13srid_CM && ObjectFactoryCode <= BJ54D6_23srid_CM)
            {
                ObjectProjection   = EnumProjectionDatum.Bejing54;
                ObjectStrip        = EnumStrip.Strip3;
                IsBigNumber_Object = false;
            }

            //Xian1980 3 degree
            if (ObjectFactoryCode >= Xian80D3_25srid_CM && ObjectFactoryCode <= Xian80D3_45srid_CM)
            {
                ObjectProjection   = EnumProjectionDatum.Xian80;
                ObjectStrip        = EnumStrip.Strip3;
                IsBigNumber_Object = false;
            }

            //Xian1980 6 degree
            if (ObjectFactoryCode >= Xian80D6_13srid_CM && ObjectFactoryCode <= Xian80D6_23srid_CM)
            {
                ObjectProjection   = EnumProjectionDatum.Xian80;
                ObjectStrip        = EnumStrip.Strip3;
                IsBigNumber_Object = false;
            }

            //------------------------------------------------------------------------------

            //KDFeatureClass sfc = new KDFeatureClass_TYPoint(SourceFeatureClass);
            //KDFeatureClass ofc = new KDFeatureClass_TYPoint(ObjectFeatureClass);
            ZhFeatureClass sfc = new ZhPointFeatureClass(SourceFeatureClass);
            ZhFeatureClass ofc = new ZhPointFeatureClass(ObjectFeatureClass);

            //KDFeature[] FeatArray = sfc.getSelectedFeaturesByQueryFilter(null);
            //KDFeature sfeat = null;
            //KDFeature ofeat = null;

            ZhFeature[] FeatArray = sfc.getSelectedFeaturesByQueryFilter(null);
            ZhFeature   sfeat     = null;
            ZhFeature   ofeat     = null;

            IGeometry geo = null;
            IPoint    p   = null;

            /*frmProgressBar1 pb = new frmProgressBar1();
             * pb.Text = "坐标投影转换";
             * pb.label1.Text = "总数:" + FeatArray.Length.ToString();
             * pb.progressBar1.Maximum = FeatArray.Length + 1;
             * pb.progressBar1.Value = 0;
             * pb.Show();*/

            for (int i = 0; i < FeatArray.Length; i++)
            {
                /*if (pb.progressBar1.Value < pb.progressBar1.Maximum)
                 * {
                 *  pb.progressBar1.Value += 1;
                 *  pb.label1.Text = "第[" + pb.progressBar1.Value.ToString() + "]个/总数[" + FeatArray.Length.ToString() + "]";
                 *  pb.Refresh();
                 * }*/

                sfeat = FeatArray[i];

                //ofeat = ofc.CreateKDFeature();
                ofeat = ofc.CreateFeature();


                //copy 源字段的值到目标字段中

                sfeat.CopyField(ref ofeat);

                geo = sfeat.pFeature.ShapeCopy;

                //geo.Project(ObjectSpatialReference);
                ////坐标投影转换
                IGeometry ObjGeometry = null;
                if (geo is IPoint)
                {   //点
                    double x = 0;
                    double y = 0;
                    double B = 0;
                    double L = 0;
                    x = (geo as IPoint).X;
                    y = (geo as IPoint).Y;
                    this.GetBLFromXY(y, x, ref B, ref L, 0, SourceProjection, SourceStrip, L0, IsBigNumber_Source);

                    this.GetXYFromBL(B, L, ref x, ref y, 0, ObjectProjection, ObjectStrip, IsBigNumber_Object);
                    IPoint objP = new PointClass();
                    objP.X = y;
                    objP.Y = x;
                    objP.SpatialReference = ObjectSpatialReference;
                    //投影到目标点对象
                    ObjGeometry = objP as IGeometry;
                }
                else if (geo is IPolyline)
                {   //线
                    IPolyline        objPolyline = new PolylineClass();
                    IPointCollection objPc       = objPolyline as IPointCollection;
                    double           x           = 0;
                    double           y           = 0;
                    double           B           = 0;
                    double           L           = 0;
                    IPointCollection pcol        = geo as IPointCollection;
                    object           miss        = Type.Missing;
                    for (int j = 0; j < pcol.PointCount; j++)
                    {
                        p = pcol.get_Point(j);
                        x = p.X;
                        y = p.Y;
                        this.GetBLFromXY(y, x, ref B, ref L, 0, SourceProjection, SourceStrip, L0, IsBigNumber_Source);

                        this.GetXYFromBL(B, L, ref x, ref y, 0, ObjectProjection, ObjectStrip, IsBigNumber_Object);
                        IPoint objPoint = new PointClass();
                        objPoint.X = y;
                        objPoint.Y = x;
                        objPoint.SpatialReference = ObjectSpatialReference;
                        objPc.AddPoint(objPoint, ref miss, ref miss);
                    }
                    (objPc as ITopologicalOperator).Simplify();
                    ObjGeometry = objPc as IGeometry;
                }
                else if (geo is IPolygon)
                {   //面
                    IPolygon            objPolygon = new PolygonClass();
                    IGeometryCollection objPc      = objPolygon as IGeometryCollection;
                    double x = 0;
                    double y = 0;
                    double B = 0;
                    double L = 0;
                    IGeometryCollection GeoCol        = geo as IGeometryCollection;
                    object           miss             = Type.Missing;
                    IGeometry        tpGeo            = null;
                    IPointCollection pcol             = null;
                    IRing            newRing          = null;
                    IPointCollection newRingPointColl = null;
                    for (int j = 0; j < GeoCol.GeometryCount; j++)
                    {
                        tpGeo = GeoCol.get_Geometry(j);  //面内环ring(内/外环)

                        pcol             = tpGeo as IPointCollection;
                        newRing          = new RingClass();
                        newRingPointColl = newRing as IPointCollection;
                        for (int k = 0; k < pcol.PointCount; k++)
                        {
                            p = pcol.get_Point(k);
                            x = p.X;
                            y = p.Y;
                            this.GetBLFromXY(y, x, ref B, ref L, 0, SourceProjection, SourceStrip, L0, IsBigNumber_Source);

                            this.GetXYFromBL(B, L, ref x, ref y, 0, ObjectProjection, ObjectStrip, IsBigNumber_Object);
                            IPoint objPoint = new PointClass();
                            objPoint.X = y;
                            objPoint.Y = x;
                            newRingPointColl.AddPoint(objPoint, ref miss, ref miss);
                        }
                        newRing.SpatialReference = ObjectSpatialReference;
                        objPc.AddGeometry(newRing as IGeometry, ref miss, ref miss);
                    }
                    (objPc as IGeometry).SpatialReference = ObjectSpatialReference;
                    (objPc as ITopologicalOperator).Simplify();
                    ObjGeometry = objPc as IGeometry;
                }
                else
                {
                    //注记  暂未写
                }
                ofeat.pFeature.Shape = ObjGeometry;
                ofeat.SaveFeature();
            }

            /*pb.Close();
             * pb.Dispose();
             * pb = null;zk*/
        }