没有合适的资源?快使用搜索试试~ 我知道了~
用C#+AE编写的导出选中的矢量要素为矢量文件,可以按照图层批量导出选中要素。
资源推荐
资源详情
资源评论
private void btnExportSelect_Click(object sender, EventArgs e)
{
FolderBrowserDialog ExportShapeFile = new FolderBrowserDialog();
ExportShapeFile.Description="选择保存路径";
if (ExportShapeFile.ShowDialog() == DialogResult.OK)
{
string Diretory = ExportShapeFile.SelectedPath;
this.Cursor = System.Windows.Forms.Cursors.WaitCursor;
for (int i = 0; i < axMapControl1.LayerCount; i++)
ExportShapefile(Diretory, axMapControl1.get_Layer(i));
this.Cursor = System.Windows.Forms.Cursors.Default;
MessageBox.Show("导出完成!", "提示");
}
}
//导出选择要素
public void ExportShapefile(string ShapeFileFolder, ILayer pLayer)
{
try
{
IFeatureLayer Featurelayer = pLayer as IFeatureLayer;
if (Featurelayer == null)
{
return;
}
IFeatureSelection pFeatureSelection = Featurelayer as IFeatureSelection;
ISelectionSet SelectionSet = pFeatureSelection.SelectionSet;
if (SelectionSet.Count < 1) return;
IFeatureClass FeatureClass = Featurelayer.FeatureClass;
if (FeatureClass == null) return;
IFields pFields = FeatureClass.Fields;
{
FolderBrowserDialog ExportShapeFile = new FolderBrowserDialog();
ExportShapeFile.Description="选择保存路径";
if (ExportShapeFile.ShowDialog() == DialogResult.OK)
{
string Diretory = ExportShapeFile.SelectedPath;
this.Cursor = System.Windows.Forms.Cursors.WaitCursor;
for (int i = 0; i < axMapControl1.LayerCount; i++)
ExportShapefile(Diretory, axMapControl1.get_Layer(i));
this.Cursor = System.Windows.Forms.Cursors.Default;
MessageBox.Show("导出完成!", "提示");
}
}
//导出选择要素
public void ExportShapefile(string ShapeFileFolder, ILayer pLayer)
{
try
{
IFeatureLayer Featurelayer = pLayer as IFeatureLayer;
if (Featurelayer == null)
{
return;
}
IFeatureSelection pFeatureSelection = Featurelayer as IFeatureSelection;
ISelectionSet SelectionSet = pFeatureSelection.SelectionSet;
if (SelectionSet.Count < 1) return;
IFeatureClass FeatureClass = Featurelayer.FeatureClass;
if (FeatureClass == null) return;
IFields pFields = FeatureClass.Fields;
资源评论
勤学才是正道
- 粉丝: 8
- 资源: 25
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功