Exemple #1
0
        /// <summary>
        /// 打开遥感图像文件
        /// </summary>
        private void OpenHeaderFile_Click(object sender, RoutedEventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog
            {
                Filter = "ENVI遥感数据头文件(*.HDR)|*.HDR;*.hdr|一般图像(*.jpg,*.bmp)|*.jpg;*.bmp"
            };

            if (ofd.ShowDialog() != true)
            {
                return;
            }
            _loading.Start();

            try
            {
                if (ofd.FilterIndex == 1)
                {
                    _image.Add(new RS_Lib.RsImage(ofd.FileName));
                }
                else if (ofd.FilterIndex == 2)
                {
                    _image.Add(new RS_Lib.RsImage(ofd.FileName, " 来自图像文件"));
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("打开失败!\n" + ex.Message, "失败", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }
            finally { _loading.Abort(); }

            _fChoose.AddByFilePath(_image[_image.Count - 1].GetFilePath());
        }
Exemple #2
0
        /// <summary>
        /// 打开遥感图像文件
        /// </summary>
        private void OpenHeaderFile_Click(object sender, RoutedEventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog {
                Filter = "ENVI遥感数据头文件(*.HDR)|*.HDR"
            };

            if (ofd.ShowDialog() != true)
            {
                return;
            }
            _loading.Start();

            try
            {
                _image.Add(new RS_Lib.RsImage(ofd.FileName));
            }
            catch (Exception ex)
            {
                MessageBox.Show("打开失败!\n" + ex.Message, "失败", MessageBoxButton.OK, MessageBoxImage.Error);
                _loading.Abort();
                return;
            }

            if (_image != null)
            {
                _loading.Abort();
                _fChoose.AddByFilePath(ofd.FileName);
                _dock.AddDocWpf(new RS_Diag.FileInfo(_image[_image.Count - 1]),
                                "图像信息: " + _image[_image.Count - 1].FileName);
            }
        }