示例#1
0
        private void 现势性检查ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            IWorkspaceFactory pFileGDBWorkspaceFactory;

            pFileGDBWorkspaceFactory = new FileGDBWorkspaceFactoryClass();
            IWorkspace   pWorkspace   = pFileGDBWorkspaceFactory.OpenFromFile(Path, 0);
            IEnumDataset pEnumDataset = pWorkspace.get_Datasets(ESRI.ArcGIS.Geodatabase.esriDatasetType.esriDTAny);

            pEnumDataset.Reset();
            IDataset  pDataset        = pEnumDataset.Next();
            DataTable SpatialRefTable = new DataTable();

            SpatialRefTable.Columns.Add(new DataColumn("影像名称", typeof(string)));
            SpatialRefTable.Columns.Add(new DataColumn("影像拍摄时间", typeof(string)));
            SpatialRefTable.Columns.Add(new DataColumn("时间现势性检查", typeof(string)));

            //判断数据集是否有数据
            while (pDataset != null)
            {
                if (pDataset is IRasterDataset) //栅格数据集
                {
                    IRasterWorkspaceEx pRasterWorkspace = (IRasterWorkspaceEx)pWorkspace;
                    IRasterDataset     pRasterDataset   = pRasterWorkspace.OpenRasterDataset(pDataset.Name);
                    //影像金字塔判断与创建
                    ISpatialReference pSpatialRef = (pRasterDataset as IGeoDataset).SpatialReference;
                    string            spatialref  = pSpatialRef.Name.ToString();
                    string            rastername  = pDataset.Name.ToString();
                    string[]          strArray    = rastername.Split('_');

                    DataRow dr = SpatialRefTable.NewRow();
                    dr["影像名称"]   = pDataset.Name.ToString();
                    dr["影像拍摄时间"] = strArray[1].Substring(0, 8);
                    IRasterLayer pRasterLayer = new RasterLayerClass();
                    pRasterLayer.CreateFromDataset(pRasterDataset);
                    if (int.Parse(strArray[1].Substring(0, 8)) < 20170000 && int.Parse(strArray[1].Substring(0, 8)) > 20120000)
                    {
                        dr["时间现势性检查"] = "√";
                    }
                    else
                    {
                        dr["时间现势性检查"] = "×";
                    }
                    SpatialRefTable.Rows.Add(dr);
                }
                pDataset = pEnumDataset.Next();
            }
            // ExportExcel(SpatialRefTable);
            //弹出显示框
            TimeCheck tc = new TimeCheck();

            tc.Text = "影像质量检查";
            tc.dataGridView1.DataSource       = SpatialRefTable;
            tc.dataGridView1.Columns[1].Width = 200;
            tc.dataGridView1.Columns[2].Width = 300;
            tc.Show();
        }
示例#2
0
        private void 格式一致性检查ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            IWorkspaceFactory pFileGDBWorkspaceFactory;

            pFileGDBWorkspaceFactory = new FileGDBWorkspaceFactoryClass(); //using ESRI.ArcGIS.DataSourcesGDB;

            //获取工作空间
            IWorkspace   pWorkspace   = pFileGDBWorkspaceFactory.OpenFromFile(Path, 0);
            IEnumDataset pEnumDataset = pWorkspace.get_Datasets(ESRI.ArcGIS.Geodatabase.esriDatasetType.esriDTAny);

            pEnumDataset.Reset();
            //将Enum数据集中的数据一个个读到DataSet中
            IDataset pDataset = pEnumDataset.Next();

            DataTable SpatialRefTable = new DataTable();

            SpatialRefTable.Columns.Add(new DataColumn("影像名称", typeof(string)));
            SpatialRefTable.Columns.Add(new DataColumn("数据类型", typeof(string)));
            SpatialRefTable.Columns.Add(new DataColumn("所在数据库", typeof(string)));
            SpatialRefTable.Columns.Add(new DataColumn("名称格式检查", typeof(string)));

            //判断数据集是否有数据
            while (pDataset != null)
            {
                if (pDataset is IRasterDataset) //栅格数据集
                {
                    IRasterWorkspaceEx pRasterWorkspace = (IRasterWorkspaceEx)pWorkspace;
                    IRasterDataset     pRasterDataset   = pRasterWorkspace.OpenRasterDataset(pDataset.Name);
                    //影像金字塔判断与创建
                    ISpatialReference pSpatialRef = (pRasterDataset as IGeoDataset).SpatialReference;
                    string            spatialref  = pSpatialRef.Name.ToString();

                    DataRow dr = SpatialRefTable.NewRow();
                    dr["影像名称"]  = pDataset.Name.ToString();
                    dr["数据类型"]  = "File GeoDatabase Raster Dataset";
                    dr["所在数据库"] = Path;
                    string   rastername = pDataset.Name.ToString();
                    string[] strArray   = rastername.Split('_');
                    if (strArray[0] == "GF1" && strArray[1].Length == 10)
                    {
                        dr["名称格式检查"] = "√";
                    }
                    else
                    {
                        dr["名称格式检查"] = "×";
                    }
                    SpatialRefTable.Rows.Add(dr);
                    //IRasterPyramid3 pRasPyrmid;
                    //pRasPyrmid = pRasterDataset as IRasterPyramid3;
                    //if (pRasPyrmid != null)
                    //{
                    //    if (!(pRasPyrmid.Present))
                    //    {
                    //        pRasPyrmid.Create(); //创建金字塔
                    //    }
                    //}
                    IRasterLayer pRasterLayer = new RasterLayerClass();
                    pRasterLayer.CreateFromDataset(pRasterDataset);
                    ILayer pLayer = pRasterLayer as ILayer;


                    //axMapControl1.AddLayer(pLayer, 0);
                }
                pDataset = pEnumDataset.Next();
            }
            // ExportExcel(SpatialRefTable);
            //弹出显示框
            TimeCheck tc = new TimeCheck();

            tc.Text = "格式一致性";
            tc.dataGridView1.DataSource       = SpatialRefTable;
            tc.dataGridView1.Columns[1].Width = 200;
            tc.dataGridView1.Columns[2].Width = 300;
            tc.Show();
        }
示例#3
0
        private void 完备性检查ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            IWorkspaceFactory pFileGDBWorkspaceFactory;

            pFileGDBWorkspaceFactory = new FileGDBWorkspaceFactoryClass(); //using ESRI.ArcGIS.DataSourcesGDB;

            //获取工作空间
            IWorkspace pWorkspace = pFileGDBWorkspaceFactory.OpenFromFile(Path, 0);
            //  AddAllDataset(pWorkspace, axMapControl1);

            IEnumDataset pEnumDataset = pWorkspace.get_Datasets(ESRI.ArcGIS.Geodatabase.esriDatasetType.esriDTAny);

            pEnumDataset.Reset();
            //将Enum数据集中的数据一个个读到DataSet中
            IDataset pDataset = pEnumDataset.Next();


            DataTable SpatialRefTable = new DataTable();

            SpatialRefTable.Columns.Add(new DataColumn("未分幅影像名称", typeof(string)));
            SpatialRefTable.Columns.Add(new DataColumn("分幅数量", typeof(int)));
            SpatialRefTable.Columns.Add(new DataColumn("分幅影像完备性检查", typeof(string)));
            int           rastercount = 0;
            string        rastername  = "a";
            List <string> testList    = new List <string>();

            //判断数据集是否有数据
            while (pDataset != null)
            {
                if (pDataset is IRasterDataset) //栅格数据集
                {
                    IRasterWorkspaceEx pRasterWorkspace = (IRasterWorkspaceEx)pWorkspace;
                    IRasterDataset     pRasterDataset   = pRasterWorkspace.OpenRasterDataset(pDataset.Name);
                    //影像金字塔判断与创建
                    ISpatialReference pSpatialRef = (pRasterDataset as IGeoDataset).SpatialReference;
                    string            spatialref  = pSpatialRef.Name.ToString();


                    testList.Add(pDataset.Name.ToString());
                }
                pDataset = pEnumDataset.Next();
            }
            testList.Sort();

            for (int i = 0; i < testList.Count; i++)
            {
                DataRow dr = SpatialRefTable.NewRow();
                if (rastername != testList[i].Substring(0, testList[i].Length - 1))
                {
                    rastername    = testList[i].Substring(0, testList[i].Length - 1);
                    dr["未分幅影像名称"] = rastername;
                    dr["分幅数量"]    = rastercount;
                    if (rastercount == 4)
                    {
                        dr["分幅影像完备性检查"] = "√";
                        SpatialRefTable.Rows.Add(dr);
                    }
                    else if (rastercount == 3)
                    {
                        dr["分幅影像完备性检查"] = "×";
                        SpatialRefTable.Rows.Add(dr);
                    }


                    rastercount = 1;
                }
                else
                {
                    rastercount = rastercount + 1;
                }
            }

            // ExportExcel(SpatialRefTable);
            //弹出显示框
            TimeCheck tc = new TimeCheck();

            tc.Text = "影像完备性检查";
            tc.dataGridView1.DataSource       = SpatialRefTable;
            tc.dataGridView1.Columns[1].Width = 200;
            tc.dataGridView1.Columns[2].Width = 300;
            tc.Show();
        }
示例#4
0
        private void 影像质量检查ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            IWorkspaceFactory pFileGDBWorkspaceFactory;

            pFileGDBWorkspaceFactory = new FileGDBWorkspaceFactoryClass(); //using ESRI.ArcGIS.DataSourcesGDB;


            //获取工作空间
            IWorkspace pWorkspace = pFileGDBWorkspaceFactory.OpenFromFile(Path, 0);
            //  AddAllDataset(pWorkspace, axMapControl1);

            IEnumDataset pEnumDataset = pWorkspace.get_Datasets(ESRI.ArcGIS.Geodatabase.esriDatasetType.esriDTAny);

            pEnumDataset.Reset();
            //将Enum数据集中的数据一个个读到DataSet中
            IDataset pDataset = pEnumDataset.Next();

            DataTable SpatialRefTable = new DataTable();

            SpatialRefTable.Columns.Add(new DataColumn("影像名称", typeof(string)));
            SpatialRefTable.Columns.Add(new DataColumn("影像分辨率", typeof(string)));
            SpatialRefTable.Columns.Add(new DataColumn("影像分辨率检查", typeof(string)));

            //判断数据集是否有数据
            while (pDataset != null)
            {
                if (pDataset is IRasterDataset) //栅格数据集
                {
                    IRasterWorkspaceEx pRasterWorkspace = (IRasterWorkspaceEx)pWorkspace;
                    IRasterDataset     pRasterDataset   = pRasterWorkspace.OpenRasterDataset(pDataset.Name);
                    //影像金字塔判断与创建
                    ISpatialReference pSpatialRef = (pRasterDataset as IGeoDataset).SpatialReference;
                    string            spatialref  = pSpatialRef.Name.ToString();

                    DataRow dr = SpatialRefTable.NewRow();
                    dr["影像名称"] = pDataset.Name.ToString();
                    IRasterLayer pRasterLayer = new RasterLayerClass();
                    pRasterLayer.CreateFromDataset(pRasterDataset);


                    IRasterProps rasterProps = (IRasterProps)pRasterLayer.Raster;
                    double       dX          = rasterProps.MeanCellSize().X;
                    double       dY          = rasterProps.MeanCellSize().Y;
                    dr["影像分辨率"] = "(" + dX.ToString() + "*" + dX.ToString() + ")";
                    //string rasterformat = pRasterDataset.Format.ToString();
                    if (dX == 20 && dY == 20)
                    {
                        dr["影像分辨率检查"] = "√";
                    }
                    else
                    {
                        dr["影像分辨率检查"] = "×";
                    }

                    SpatialRefTable.Rows.Add(dr);
                }
                pDataset = pEnumDataset.Next();
            }
            // ExportExcel(SpatialRefTable);
            //弹出显示框
            TimeCheck tc = new TimeCheck();

            tc.Text = "影像质量检查";
            tc.dataGridView1.DataSource       = SpatialRefTable;
            tc.dataGridView1.Columns[1].Width = 200;
            tc.dataGridView1.Columns[2].Width = 300;
            tc.Show();
        }
示例#5
0
        private void 现势性检查ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (DBHelper.VEC_TABLE == null || DBHelper.RAS_TABLE == null)
            {
                MessageBox.Show("还未初始化");
                return;
            }
            IName  vec_Name  = DBHelper.VEC_TABLE as IName;
            IName  ras_Name  = DBHelper.RAS_TABLE as IName;
            ITable vec_table = vec_Name.Open() as ITable;
            ITable ras_table = ras_Name.Open() as ITable;

            DataTable pTable = new DataTable();
            //设置自增列
            DataColumn autoIncrease = new DataColumn("序号", typeof(int));

            autoIncrease.AutoIncrement     = true;
            autoIncrease.AutoIncrementStep = 1;
            autoIncrease.AutoIncrementSeed = 1;
            //添加字段
            pTable.Columns.Add(autoIncrease);
            pTable.Columns.Add("NAME", typeof(String));
            pTable.Columns.Add("DATE", typeof(String));

            //vec_Table
            ICursor vec_Cursor = vec_table.Search(null, false);
            IRow    vec_Rrow   = vec_Cursor.NextRow();

            while (vec_Rrow != null)
            {
                DataRow pRow = pTable.NewRow();
                //string[] StrRow = new string[pRrow.Fields.FieldCount];
                for (int i = 0; i < vec_Rrow.Fields.FieldCount; i++)
                {
                    if (vec_Rrow.Fields.get_Field(i).Name.Equals("NAME"))
                    {
                        pRow["NAME"] = vec_Rrow.get_Value(i).ToString();
                    }
                    if (vec_Rrow.Fields.get_Field(i).Name.Equals("DATE"))
                    {
                        pRow["DATE"] = vec_Rrow.get_Value(i).ToString();
                    }
                    //StrRow[i] = pRrow.get_Value(i).ToString();
                }
                //pRow.ItemArray = StrRow;
                pTable.Rows.Add(pRow);
                vec_Rrow = vec_Cursor.NextRow();
            }

            //ras_Table
            ICursor ras_Cursor = ras_table.Search(null, false);
            IRow    ras_Rrow   = ras_Cursor.NextRow();

            while (ras_Rrow != null)
            {
                DataRow pRow = pTable.NewRow();
                //string[] StrRow = new string[pRrow.Fields.FieldCount];
                for (int i = 0; i < ras_Rrow.Fields.FieldCount; i++)
                {
                    if (ras_Rrow.Fields.get_Field(i).Name.Equals("NAME"))
                    {
                        pRow["NAME"] = ras_Rrow.get_Value(i).ToString();
                    }
                    if (ras_Rrow.Fields.get_Field(i).Name.Equals("DATE"))
                    {
                        pRow["DATE"] = ras_Rrow.get_Value(i).ToString();
                    }
                    //StrRow[i] = pRrow.get_Value(i).ToString();
                }
                //pRow.ItemArray = StrRow;
                pTable.Rows.Add(pRow);
                ras_Rrow = ras_Cursor.NextRow();
            }
            //弹出显示框
            TimeCheck tc = new TimeCheck();

            tc.dataGridView1.DataSource       = pTable;
            tc.dataGridView1.Columns[1].Width = 200;
            tc.dataGridView1.Columns[2].Width = 300;
            tc.Show();
        }