AE 缓冲区分析问题
高手们帮我看一下我这个代码哪里有问题,刚开始学习AE二次开发,很多不懂.....privatevoidbuttonBuffer_Click(objectsender,Ev...
高手们帮我看一下 我这个代码哪里有问题,刚开始学习AE二次开发,很多不懂.....
private void buttonBuffer_Click(object sender, EventArgs e)
{
if (textBoxDistance.Text == "" || comboBoxUnit.Text == comboBoxUnit.Items[0].ToString() || comboBox1.Text == "" || textBox1.Text == "")
{
MessageBox.Show("单位设置不正确!");
}
else
{
string path = textBox1.Text;
string strFolder = System.IO.Path.GetDirectoryName(path);
string strFilename = System.IO.Path.GetFileNameWithoutExtension(path);
CreatShapefile(strFolder, strFilename);
ESRI.ArcGIS.Geoprocessor.Geoprocessor gp = new Geoprocessor();
IFeatureLayer pLayer = null;
for (int i = 0; i < axMapControl1.LayerCount; i++)
{
if (axMapControl1.Map.get_Layer(i).Name.ToString() == comboBox1.SelectedItem.ToString())
{
pLayer = (IFeatureLayer)axMapControl1.Map.get_Layer(i);
break;
}
}
ESRI.ArcGIS.AnalysisTools.Buffer pBuffer = new ESRI.ArcGIS.AnalysisTools.Buffer(pLayer, textBox1.Text, Convert.ToString(textBoxDistance.Text) + "" + (string)comboBoxUnit.SelectedItem);
IGeoProcessorResult results = (IGeoProcessorResult)gp.Execute(pBuffer, null);
pBuffer.dissolve_option = "All";
//if (results.Status != esriJobStatus.esriJobSucceeded)
//{
// MessageBox.Show("创建失败");
//}
//else
//{
MessageBox.Show("ok");
//string path = textBox1.Text;
//string folder = System.IO.Path.GetDirectoryName(path);
//string filename = System.IO.Path.GetFileName(path);
//axMapControl1.AddShapeFile(folder, filename);
//}
}
我是先创建了shapefile文件 ,再以此文件来作为缓冲文件的,在创建文件时我把空间参考定义为pGeoDefEdit.SpatialReference_2 = new UnknownCoordinateSystemClass();,不知道对不对,做完了以后在创建的shape文件中好像什么东西都没有,还请高手看一下,
能告诉我AE学习步骤更好了,定追加高分! 展开
private void buttonBuffer_Click(object sender, EventArgs e)
{
if (textBoxDistance.Text == "" || comboBoxUnit.Text == comboBoxUnit.Items[0].ToString() || comboBox1.Text == "" || textBox1.Text == "")
{
MessageBox.Show("单位设置不正确!");
}
else
{
string path = textBox1.Text;
string strFolder = System.IO.Path.GetDirectoryName(path);
string strFilename = System.IO.Path.GetFileNameWithoutExtension(path);
CreatShapefile(strFolder, strFilename);
ESRI.ArcGIS.Geoprocessor.Geoprocessor gp = new Geoprocessor();
IFeatureLayer pLayer = null;
for (int i = 0; i < axMapControl1.LayerCount; i++)
{
if (axMapControl1.Map.get_Layer(i).Name.ToString() == comboBox1.SelectedItem.ToString())
{
pLayer = (IFeatureLayer)axMapControl1.Map.get_Layer(i);
break;
}
}
ESRI.ArcGIS.AnalysisTools.Buffer pBuffer = new ESRI.ArcGIS.AnalysisTools.Buffer(pLayer, textBox1.Text, Convert.ToString(textBoxDistance.Text) + "" + (string)comboBoxUnit.SelectedItem);
IGeoProcessorResult results = (IGeoProcessorResult)gp.Execute(pBuffer, null);
pBuffer.dissolve_option = "All";
//if (results.Status != esriJobStatus.esriJobSucceeded)
//{
// MessageBox.Show("创建失败");
//}
//else
//{
MessageBox.Show("ok");
//string path = textBox1.Text;
//string folder = System.IO.Path.GetDirectoryName(path);
//string filename = System.IO.Path.GetFileName(path);
//axMapControl1.AddShapeFile(folder, filename);
//}
}
我是先创建了shapefile文件 ,再以此文件来作为缓冲文件的,在创建文件时我把空间参考定义为pGeoDefEdit.SpatialReference_2 = new UnknownCoordinateSystemClass();,不知道对不对,做完了以后在创建的shape文件中好像什么东西都没有,还请高手看一下,
能告诉我AE学习步骤更好了,定追加高分! 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询