导出数据为矢量或栅格
string strDataSourceName = pListItem.Text; // 数据源名
string strSrcName = pListItem.SubItems[1].Text; // 数据集名
string strType = pListItem.SubItems[2].Text; // 输出类型
string strTargetName = pListItem.SubItems[3].Text; // 数据集新名
/// 数据源
soDataSource pSoDataSource = m_soDataSources[strDataSourceName];
if (pSoDataSource == null)
{
bFlag = false;
Marshal.ReleaseComObject(pSoDataSource); pSoDataSource = null;
continue;
}
/// 数据泵
soDataPump pSoDataPump = pSoDataSource.DataPump;
if (pSoDataPump == null)
{
bFlag = false;
Marshal.ReleaseComObject(pSoDataPump); pSoDataPump = null;
Marshal.ReleaseComObject(pSoDataSource); pSoDataSource = null;
continue;
}
string strExtention = Path.GetExtension(strType).Replace(")", "").Replace(".","").ToUpper();
switch (strExtention)
{
case "MIF":
pSoDataPump.FileType = seFileType.scfMIF;
strTargetName += ".mif";
break;
case "DXF":
pSoDataPump.FileType = seFileType.scfDXF;
strTargetName += ".dxf";
break;
case "DGN":
pSoDataPump.FileType = seFileType.scfDGN;
strTargetName += ".dgn";
break;
case "E00":
pSoDataPump.FileType = seFileType.scfE00;
strTargetName += ".e00";
break;
case "SHP":
pSoDataPump.FileType = seFileType.scfSHP;
strTargetName += ".shp";
break;
case "*.*": // COVERAGE文件
pSoDataPump.FileType = seFileType.scfCoverage;
break;
case "BMP":
pSoDataPump.FileType = seFileType.scfBMP;
strTargetName += ".bmp";
break;
case "JPG":
pSoDataPump.FileType = seFileType.scfJPG;
strTargetName += ".jpg";
break;
case "TIF":
pSoDataPump.FileType = seFileType.scfTIF;
strTargetName += ".tif";
break;
case "ECW":
pSoDataPump.FileType = seFileType.scfECW;
strTargetName += ".ecw";
break;
default:
continue;
}
pSoDataPump.DatasetToBeExported = strSrcName;
pSoDataPump.FileName = txtPath.Text + strTargetName;
pSoDataPump.DefaultUnits = seUnits.scuMeter;
if (!pSoDataPump.Export())
{
bFlag = false;
continue;
}