private void shpToolStripMenuItem_Click(object sender, EventArgs e) { GeoUtil util = new GeoUtil(axMapControl1); OpenFileDialog dialog = new OpenFileDialog(); if (dialog.ShowDialog() == DialogResult.OK) { util.loadShapefile(dialog.FileName); this.lAYER_COUNT = axMapControl1.LayerCount; } }
private void button4_Click(object sender, EventArgs e) { if (textBox1.Text == "" && textBox2.Text == "" && textBox3.Text == "") { MessageBox.Show("输入要素不可以为空\n裁剪要素不可以为空\n输出要素不可以为空"); } else if (textBox1.Text == "" && textBox2.Text == "") { MessageBox.Show("输入要素不可以为空\n裁剪要素不可以为空"); return; } else if (textBox1.Text == "" && textBox3.Text == "") { MessageBox.Show("输入要素不可以为空\n输出要素不可以为空"); return; } else if (textBox2.Text == "" && textBox3.Text == "") { MessageBox.Show("裁剪要素不可以为空\n输出要素不可以为空"); return; } else if (textBox2.Text == "") { MessageBox.Show("裁剪要素不可以为空"); } else if (textBox1.Text == "") { MessageBox.Show("输入要素不可以为空"); } else if (textBox3.Text == "") { MessageBox.Show("输出要素不可以为空"); } else { Geoprocessor gp = new Geoprocessor(); ESRI.ArcGIS.AnalysisTools.Clip clipTool = new Clip(textBox1.Text, textBox2.Text, textBox3.Text); gp.OverwriteOutput = true; gp.Execute(clipTool, null); GeoUtil util = new GeoUtil(axmapcontrol1); util.loadShapefile(textBox3.Text); this.Close(); } }