使用.net 10i进行开发时,用到了BufferAnalyst类创建缓冲区,但在运行时报错未将对象引用设置到对象的实例,但是BufferAnalyst不是静态类吗,无法实例化呀。
代码如下:
private void menuCreateBuffer_Click(object sender, EventArgs e)
{
Datasources datasources = workspace1.Datasources;
Datasource datasource = datasources[0];
Datasets datasets = datasource.Datasets;
Dataset dataset = datasets["waterways"];
DatasetVector sourceDataset = dataset as DatasetVector;
DatasetVector resultDataset = null;
BufferAnalystParameter bufferAnalystParam = new BufferAnalystParameter();
bufferAnalystParam.EndType = BufferEndType.Flat;
bufferAnalystParam.LeftDistance = 50;
bufferAnalystParam.RightDistance = 50;
BufferAnalyst.CreateBuffer(sourceDataset, resultDataset, bufferAnalystParam, false, true);
mapControl1.Map.Layers.Add(resultDataset, true);
}