Пример #1
0
        /// <summary>
        /// Adds new file to the report
        /// </summary>
        /// <param name="filename">Filename</param>
        /// <param name="projection">Projection name</param>
        /// <param name="operation">Operation that was applied to the file</param>
        /// <param name="newName">The new name of the file (in case of reprojection)</param>
        public void AddFile(string filename, string projection, ProjectionOperaion operation, string newName)
        {
            string s = operation.ToString();

            switch (operation)
            {
            case ProjectionOperaion.AbsenceIgnored:
                s = "Absence ignored";
                break;

            case ProjectionOperaion.MismatchIgnored:
                s = "Mismatch ignored";
                break;

            case ProjectionOperaion.FailedToReproject:
                s = "Failed to reproject";
                break;
            }

            var item = listView1.Items.Add(Path.GetFileName(filename));

            item.SubItems.Add(projection == "" ? "none" : projection);
            item.SubItems.Add(s);
            item.SubItems.Add(Path.GetFileName(newName));

            if (operation == ProjectionOperaion.Skipped || operation == ProjectionOperaion.FailedToReproject)
            {
                item.SubItems.Add(MapConfig.GdalReprojectionErrorMsg);
            }
            else
            {
                item.SubItems.Add("");
            }

            listView1.Refresh();
            ListViewHelper.AutoResizeColumns(listView1);

            Application.DoEvents();
        }
Пример #2
0
        /// <summary>
        /// 添加新的文件到报告中
        /// </summary>
        /// <param name="filename">文件名</param>
        /// <param name="projection">投影</param>
        /// <param name="operation">投影操作</param>
        /// <param name="newName">新文件名</param>
        public void AddFile(string filename, string projection, ProjectionOperaion operation, string newName)
        {
            string s = operation.ToString();

            switch (operation)
            {
            case ProjectionOperaion.AbsenceIgnored:
                s = "不存在";
                break;

            case ProjectionOperaion.MismatchIgnored:
                s = "不匹配";
                break;

            case ProjectionOperaion.FailedToReproject:
                s = "投影失败";
                break;
            }

            //将文件添加到ListView中
            ListViewItem item = listView1.Items.Add(System.IO.Path.GetFileName(filename));                    //添加文件名及路径

            item.SubItems.Add(projection == "" ? "none" : projection);                                        //添加投影
            item.SubItems.Add(s);                                                                             //添加操作方式
            item.SubItems.Add(System.IO.Path.GetFileName(newName));                                           //添加新文件名

            if (operation == ProjectionOperaion.Skipped || operation == ProjectionOperaion.FailedToReproject) //跳过投影或投影失败
            {
                MapWinGIS.GlobalSettings settings = new MapWinGIS.GlobalSettings();
                item.SubItems.Add(settings.GdalReprojectionErrorMsg);
            }
            else
            {
                item.SubItems.Add("");
            }
            listView1.Refresh();
            Globals.AutoResizeColumns(this.listView1);//自动调整列宽
            Application.DoEvents();
        }