//从las文件中获取到所有的数据,数据都放在dataset中,dataset[3].Samples[0].Value代表的就是第4列第一行的数据,gt的第一个值。 public void GetDatasFromLasFile() { // string fileName = @"E:\xt18\6.Repos\GitHub\Bay\WpfApp_WitsServer\WpfApp_WitsServer\Files\sv.las"; var data_Set = new LasDataSet(); string str = string.Empty; using (Stream stream = new FileStream(fileName, FileMode.Open, FileAccess.Read)) using (StreamReader tr = new StreamReader(new BufferedStream(stream))) data_Set.Load(tr); if (data_Set.ErrorDescription != null) { System.Windows.MessageBox.Show("dataset.errorDescription return null"); } using (Stream stream = new FileStream(fileName, FileMode.Open, FileAccess.Read)) using (StreamReader tr = new StreamReader(new BufferedStream(stream))) str = tr.ReadToEnd(); dataset = data_Set.DataSources; string[] DepthString = new string[dataset.Count]; string strTest = dataset[3].Samples[0].Value; //System.Windows.MessageBox.Show(strTest); }
private void Loadlas_Click(object sender, RoutedEventArgs e) { string fileName = @"E:\xt18\6.Repos\GitHub\Bay\WpfApp_WitsServer\WpfApp_WitsServer\Files\sv.las"; var data_Set = new LasDataSet(); string str = string.Empty; AllDatasFromLas = new List <string[]>(); using (Stream stream = new FileStream(fileName, FileMode.Open, FileAccess.Read)) using (StreamReader tr = new StreamReader(new BufferedStream(stream))) data_Set.Load(tr); if (data_Set.ErrorDescription != null) { System.Windows.MessageBox.Show("dataset.errorDescription return null"); } using (Stream stream = new FileStream(fileName, FileMode.Open, FileAccess.Read)) using (StreamReader tr = new StreamReader(new BufferedStream(stream))) str = tr.ReadToEnd(); List <DataSourceLib.DataSourceModel> dataset = data_Set.DataSources; string[] DepthString = new string[dataset.Count]; string strTest = dataset[3].Samples[0].Value; System.Windows.MessageBox.Show(strTest); //foreach (var item in dataset) //{ // foreach (var item2 in item.Samples) // { // System.Windows.MessageBox.Show(item2.Depth + "," + item2.Value); // } //} }