private void button1_Click(object sender, EventArgs e) { if (FromPoint.PointCount == 0) { MessageBox.Show("请选择控制点对!"); return; } ((IGraphicsContainer)m_map).DeleteAllElements(); m_geoRef.Warp(FromPoint, ToPoint, 0); //m_geoRef.Register(); m_activeView.Refresh(); MessageBox.Show("配准完成!"); FolderBrowserDialog dlg = new FolderBrowserDialog(); if (dlg.ShowDialog() == DialogResult.OK) { m_selectPath = dlg.SelectedPath; frmW.Show(); Thread myThread; myThread = new Thread(new ThreadStart(Save)); myThread.IsBackground = true; myThread.Start(); } }
private void btnOK_Click(object sender, EventArgs e) { if (this.textBox1.Text.Trim() == "") { MessageBox.Show("请先加载数据!", "提示"); return; } if (this.cmbDS.SelectedItem == null) { MessageBox.Show("请选择数据大类!", "提示"); return; } m_type = this.cmbDS.SelectedItem.ToString(); if (m_type == "解译数据") { if (this.comboBox2.SelectedIndex == -1) { MessageBox.Show("请选择年份!", "提示"); return; } m_time = this.comboBox2.SelectedItem.ToString(); if (this.comboBox1.SelectedIndex == -1 && this.textBox2.Text == "") { MessageBox.Show("请选择矿区!", "提示"); return; } if (this.textBox2.Text != "") { this.m_place = this.textBox2.Text; } else { this.m_place = this.comboBox1.SelectedItem.ToString(); } if (this.comboBox3.SelectedIndex == -1) { MessageBox.Show("请选择解译类型!", "提示"); return; } this.m_interType = this.comboBox3.SelectedItem.ToString(); } frm.Show(); Importshp(); }
private void btnOK_Click(object sender, EventArgs e) { if (this.textBox1.Text.Trim() == "") { MessageBox.Show("请先加载数据!"); return; } if (this.cmbDS.SelectedItem == null) { MessageBox.Show("请选择卫星名称!"); return; } this.m_satelite = this.cmbDS.SelectedItem.ToString(); if (this.comboBox1.SelectedItem == null) { MessageBox.Show("请选择年份!"); return; } this.m_time = this.comboBox1.SelectedItem.ToString(); if (this.comboBox2.SelectedIndex == -1 && this.textBox2.Text.Trim() == "") { MessageBox.Show("请选择矿区!", "提示"); return; } if (this.textBox2.Text.Trim() != "") { this.m_place = this.textBox2.Text.Trim(); } else { this.m_place = this.comboBox2.SelectedItem.ToString(); } frm.Show(); frm.WaitingLabel = "正在导入影像数据"; Application.DoEvents(); ImportRaster(); /*Thread myThread; * myThread = new Thread(new ThreadStart(ImportThread)); * myThread.IsBackground = true; * myThread.Start();*/ }
/// <summary> /// 坐标文件展绘点图层 /// </summary> public void TextToPoint() { if (m_FeatureLayer.FeatureClass.ShapeType != ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPoint) { MessageBox.Show("请确定展绘的第一个图层为点图层", "提示信息", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning); return; } OpenFileDialog openfileDialog = new OpenFileDialog(); openfileDialog.Title = "请选择展绘点图层的坐标文件"; openfileDialog.Filter = " txt files(*.txt)|*.txt|All files(*.*)|*.*"; openfileDialog.RestoreDirectory = true; if (openfileDialog.ShowDialog() == DialogResult.OK) { frmW.WaitingLabel = "正在启动绘制..."; frmW.Show(); Application.DoEvents(); LocalFilePath = openfileDialog.FileName; StreamReader strReadToEnd = new StreamReader(LocalFilePath); string sAllLine = strReadToEnd.ReadToEnd(); int LineCount = sAllLine.Split('\n').Length + 1; string[] pline = new string[LineCount]; double[] x = new double[LineCount]; double[] y = new double[LineCount]; string[] pSeparate = new string[] { }; //m_statusBar.Panels[0].ProgressBarMinValue = 0; //m_statusBar.Panels[0].ProgressBarMaxValue = LineCount - 1; StreamReader strRead = new StreamReader(LocalFilePath); int i = 0; int j = 0; try { if (strRead != null) { pline[i] = strRead.ReadLine(); while (pline[i] != null) { pSeparate = pline[i].Split(',', ' ', ';'); if (pSeparate.Length >= 3) { x[j] = double.Parse(pSeparate[1]); y[j] = double.Parse(pSeparate[2]); IFeatureClass pFeaCls = m_FeatureLayer.FeatureClass; IFeature pFeature = pFeaCls.CreateFeature(); IPoint pPoint = new PointClass(); pPoint.X = x[j]; pPoint.Y = y[j]; pFeature.Shape = pPoint as IGeometry; pFeature.Store(); m_mapControl.ActiveView.Refresh(); j++; i++; pline[i] = strRead.ReadLine(); } else { i++; pline[i] = strRead.ReadLine(); } m_statusBar.Panels[0].ProgressBarValue = i; frmW.WaitingLabel = "正在绘制第 " + i.ToString() + " 坐标"; Application.DoEvents(); } } frmW.Close(); MessageBox.Show("绘制完成!"); } catch { MessageBox.Show("请检查文本文件的第" + i + "行", "错误信息", MessageBoxButtons.OKCancel, MessageBoxIcon.Information); } } ICommand pCommand = new ControlsMapFullExtentCommandClass(); pCommand.OnCreate(m_mapControl.Object); pCommand.OnClick(); m_statusBar.Panels[0].ProgressBarValue = 0; }