91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 3KB
    文件類型: .cs
    金幣: 1
    下載: 0 次
    發布日期: 2021-06-04
  • 語言: C#
  • 標簽: C#??DEM??

資源簡介

利用C#語言讀取DEN數據的ASCII碼文件,并進行坡度的求取

資源截圖

代碼片段和文件信息

using?System;
using?System.IO;
using?System.Collections.Generic;
using?System.Linq;
using?System.Text;


namespace?slope
{
????class?Program
????{
????????static?void?Main(string[]?args)
????????{
????????????//讀取DEM轉換后得到的ASCII碼文本,將高程值保存在二維數組中
????????????//StreamReader[]?str?=?new?StreamReader(@“G:\C#\dem.txt“);
????????????string[]?str?=?File.ReadAllLines(@“G:\C#\dem.txt“?Encoding.Default);
????????????int?ncols?nrows;
????????????int?i?j?k;
????????????double?xllcorner?yllcorner?cellsize?NODATA_value;?
??????
????????????ncols?=?Convert.ToInt32(str[0].Substring(143));
????????????nrows?=?Convert.ToInt32(str[1].Substring(14?3));
????????????xllcorner?=?Convert.ToDouble(str[2].Substring(14?6));
????????????yllcorner?=?Convert.ToDouble(str[3].Substring(14?7));
????????????cellsize?=?Convert.ToDouble(str[4].Substring(14?2));
????????????NODATA_value?=?Convert.ToDouble(str[5].Substring(14?5));
????????????Console.WriteLine(“ncols:{0}“?ncols);
????????????Console.WriteLine(“nrows:{0}“?nrows);
????????????Console.WriteLine(“xllcorner:{0}“?xllcorner);
????????????Console.WriteLine(“yllcorner:{0}“?yllcorner);
????????????Console.WriteLine(“cellsize:{0}“?cellsize);
????????????Console.WriteLine(“NODATA_value:{0}“?NODATA_value);

????????????double[]?dem?=?new?double[nrows?ncols];
????????????string?[]?str1?=?new?string[ncols];
????????????char[]?interval?=?new?char[]?{?‘?‘?};
????????????for?(i?=?6k=0;?i?????????????{
????????????????str1?=?str[i].Split(interval);

???????

評論

共有 條評論