private string[] OpenGDBFile()
{
string[] GDBFile = new string[2];
OpenFileDialog OpenShpFile = new OpenFileDialog();
OpenShpFile.Title = "打开GDB文件";
OpenShpFile.InitialDirectory = "E:";
OpenShpFile.Filter = "GDB文件(*.GDB)|*.SPX";
OpenShpFile.RestoreDirectory = true;
if (OpenShpFile.ShowDialog() == DialogResult.OK)
{
string ShapPath = OpenShpFile.FileName;
int Position = ShapPath.LastIndexOf("\\");
string FilePath = ShapPath.Substring(0, Position);
string ShpName = ShapPath.Substring(Position + 1);
GDBFile[0] = FilePath + '\\';
GDBFile[1] = ShpName;
}
return GDBFile;
}
private string[] OpenShapeFile()
{
string[] ShpFile = new string[2];
OpenFileDialog OpenShpFile = new OpenFileDialog();
OpenShpFile.Title = "打开Shape文件";
OpenShpFile.InitialDirectory = "E:";
OpenShpFile.Filter = "Shape文件(*.shp)|*.shp";
OpenShpFile.RestoreDirectory = true;
if (OpenShpFile.ShowDialog() == DialogResult.OK)
{
string ShapPath = OpenShpFile.FileName;
int Position = ShapPath.LastIndexOf("\\");
string FilePath = ShapPath.Substring(0, Position);
string ShpName = ShapPath.Substring(Position + 1);
ShpFile[0] = FilePath + '\\';
ShpFile[1] = ShpName;
}
return ShpFile;
}
private string[] SaveAsShapeFile()
{
string[] ShpFile = new string[2];
SaveFileDialog saveFileDialog = new SaveFileDialog();
saveFileDialog.Title = "保存Shape文件";
saveFileDialog.InitialDirectory = "E:";
saveFileDialog.Filter = "shape files (*.shp)|*.shp|All files (*.*)|*.*";
saveFileDialog.RestoreDirectory = true;
if (saveFileDialog.ShowDialog() == DialogResult.OK)
{
string ShapPath = saveFileDialog.FileName;
int Position = ShapPath.LastIndexOf("\\");
string FilePath = ShapPath.Substring(0, Position);
string ShpName = ShapPath.Substring(Position + 1);
ShpFile[0] = FilePath + '\\';
ShpFile[1] = ShpName;
}
return ShpFile;
}