资源简介
C#与libLAS的简单操作:头文件,点数,XYZ等(VS2010窗体+代码)
代码片段和文件信息
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
using LibLAS;
namespace Csharp与libLAS
{
public partial class MainForm : Form
{
public MainForm()
{
InitializeComponent();
}
#region 方法,函数
///
/// 获取单一文件 绝对路径
///
/// 扩展名
///
private string xjGetFileFullPath(string extension)
{
OpenFileDialog xjOpenFileDialog = new OpenFileDialog();
xjOpenFileDialog.Filter = extension + “文件|*.“ + extension;
string xjFileFillPath = string.Empty;
if (xjOpenFileDialog.ShowDialog() == DialogResult.OK)
{
xjFileFillPath = xjOpenFileDialog.FileName;
}
return xjFileFillPath;
}
///
/// 保存文件
///
/// 扩展名
///
private string xjSaveFileFullPath(string extension)
{
SaveFileDialog xjSaveFileDialog = new SaveFileDialog();
xjSaveFileDialog.Filter = extension + “文件|*.“ + extension;
xjSaveFileDialog.FileName = “导出“ + extension;
string xjFileFillPath = string.Empty;
if (xjSaveFileDialog.ShowDialog() == DialogResult.OK)
{
xjFileFillPath = xjSaveFileDialog.FileName;
FileStream xjOutFileStream = new FileStream(xjFileFillPath FileMode.Create FileAccess.Write);//using System.IO;
StreamWriter xjOutStreamWriter = new StreamWriter(xjOutFileStream);
xjOutStreamWriter.Flush();//清空缓冲区
xjOutStreamWriter.Close();//关闭流
xjOutFileStream.Close();
}
return xjFileFillPath;
}
#endregion
//选择las
private void btn_Path_Click(object sender EventArgs e)
{
string xjExtension = “las“;
string xjFileFullPath = xjGetFileFullPath(xjExtension);
this.txt_lasPath.Text = xjFileFullPath;
//点云数量
LASReader xjLASReader = new LASReader(xjFileFullPath);//using LibLAS;
LASHeader xjLASHeader = xjLASReader.GetHeader();
uint xjPointCount = xjLASHeader.PointRecordsCount;//点数量//uint=[04294967295]
this.txt_Count.Text = xjPointCount.ToString();
}
//显示XYZ
private void lbl_XYZ_Click(object sender EventArgs e)
{
DataTable xjDataTable = new DataTable();
#region 新建列
DataColumn xjColumnID = new DataColumn(“ID“ typeof(string));
xjDataTable.Columns.Add(xjColumnID);
DataColumn
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 13312 2017-12-21 17:28 Csharp与libLAS\Csharp与libLAS\bin\Debug\Csharp与libLAS.exe
文件 30208 2017-12-21 17:28 Csharp与libLAS\Csharp与libLAS\bin\Debug\Csharp与libLAS.pdb
文件 11600 2017-12-21 17:29 Csharp与libLAS\Csharp与libLAS\bin\Debug\Csharp与libLAS.vshost.exe
文件 490 2015-07-10 19:01 Csharp与libLAS\Csharp与libLAS\bin\Debug\Csharp与libLAS.vshost.exe.manifest
文件 26112 2017-02-10 09:01 Csharp与libLAS\Csharp与libLAS\bin\Debug\dotnetLibLAS.dll
文件 1771008 2016-07-11 17:10 Csharp与libLAS\Csharp与libLAS\bin\Debug\liblas.dll
文件 780800 2016-07-11 15:05 Csharp与libLAS\Csharp与libLAS\bin\Debug\liblas_c.dll
文件 3926 2017-12-21 16:49 Csharp与libLAS\Csharp与libLAS\Csharp与libLAS.csproj
文件 7379 2017-12-21 17:28 Csharp与libLAS\Csharp与libLAS\MainForm.cs
文件 6599 2017-12-21 16:49 Csharp与libLAS\Csharp与libLAS\MainForm.Designer.cs
文件 5990 2017-12-21 16:49 Csharp与libLAS\Csharp与libLAS\MainForm.resx
文件 989 2017-12-21 17:29 Csharp与libLAS\Csharp与libLAS\obj\x86\Debug\Csharp与libLAS.csproj.FileListAbsolute.txt
文件 978 2017-12-21 16:49 Csharp与libLAS\Csharp与libLAS\obj\x86\Debug\Csharp与libLAS.csproj.GenerateResource.Cache
文件 10669 2017-12-21 16:49 Csharp与libLAS\Csharp与libLAS\obj\x86\Debug\Csharp与libLAS.csprojResolveAssemblyReference.cache
文件 13312 2017-12-21 17:28 Csharp与libLAS\Csharp与libLAS\obj\x86\Debug\Csharp与libLAS.exe
文件 180 2017-12-21 16:49 Csharp与libLAS\Csharp与libLAS\obj\x86\Debug\Csharp与libLAS.MainForm.resources
文件 30208 2017-12-21 17:28 Csharp与libLAS\Csharp与libLAS\obj\x86\Debug\Csharp与libLAS.pdb
文件 180 2017-12-21 16:49 Csharp与libLAS\Csharp与libLAS\obj\x86\Debug\Csharp与libLAS.Properties.Resources.resources
文件 5420 2017-12-21 17:15 Csharp与libLAS\Csharp与libLAS\obj\x86\Debug\DesignTimeResolveAssemblyReferences.cache
文件 6529 2017-12-21 17:28 Csharp与libLAS\Csharp与libLAS\obj\x86\Debug\DesignTimeResolveAssemblyReferencesInput.cache
文件 499 2017-12-21 16:35 Csharp与libLAS\Csharp与libLAS\Program.cs
文件 1362 2017-12-21 16:34 Csharp与libLAS\Csharp与libLAS\Properties\AssemblyInfo.cs
文件 2882 2017-12-21 16:34 Csharp与libLAS\Csharp与libLAS\Properties\Resources.Designer.cs
文件 5612 2017-12-21 16:34 Csharp与libLAS\Csharp与libLAS\Properties\Resources.resx
文件 1102 2017-12-21 16:34 Csharp与libLAS\Csharp与libLAS\Properties\Settings.Designer.cs
文件 249 2017-12-21 16:34 Csharp与libLAS\Csharp与libLAS\Properties\Settings.settings
文件 887 2017-12-21 16:34 Csharp与libLAS\Csharp与libLAS.sln
..A..H. 20480 2017-12-21 17:29 Csharp与libLAS\Csharp与libLAS.suo
目录 0 2017-12-21 16:34 Csharp与libLAS\Csharp与libLAS\obj\x86\Debug\TempPE
目录 0 2017-12-21 17:28 Csharp与libLAS\Csharp与libLAS\obj\x86\Debug
............此处省略11个文件信息
评论
共有 条评论