zoukankan      html  css  js  c++  java
  • ArcEngine 实现 SurfaceAnalysis的Area/Volumn功能

            /// <summary>
            /// 从目录加载Tin
            /// Esri的TIN,是一个文件夹,下面包好8个名称固定的adf文件
            /// </summary>
            /// <param name="folder">TinDataSet的父目录</param>
            /// <param name="tinDataset">tinDataSet的名称</param>
            /// <returns></returns>
            public ITin GetTinLayer(string folder, string tinDataset)
            {
                IWorkspaceFactory pWSFact = new TinWorkspaceFactoryClass();
                IWorkspace pWS = pWSFact.OpenFromFile(folder, 0);
                ITinWorkspace pTinWS = pWS as ITinWorkspace;
                ITin pTin = pTinWS.OpenTin(tinDataset);
                return pTin;
            }
       li_TinDataset = new List<string> { "tdenv.adf", "tedg.adf", "thul.adf", "tmsk.adf", "tmsx.adf", "tnod.adf", "tnxy.adf", "tnz.adf" };  
    /// <summary> /// 检查是否是TIN dataset /// </summary> /// <param name="folderpath">用户选择的folder</param> /// <returns></returns> public bool CheckTinDataSet(string folderpath) { if (!Directory.Exists(folderpath)) return false; DirectoryInfo di = new DirectoryInfo(folderpath); FileInfo[] ar_fi= di.GetFiles("*.adf"); List<string> li_tem=new List<string>(); for (int i = 0; i <= ar_fi.Length - 1; i++) { li_tem.Add(ar_fi[i].Name); } int afirmed = 0; for (int i = 0; i <= li_TinDataset.Count - 1; i++) { if (li_tem.Contains(li_TinDataset[i])) afirmed++; else break; } if (afirmed == 8) return true; else return false; }
            /// <summary>
            /// 将整个TIN作为计算对象,使用此方法
            /// </summary>
            /// <param name="Tin">TinLayer</param>
            /// <param name="planeheight">参考面高度</param>
            public void CalculateAreaVolumeISurface(ITin Tin, double planeheight,esriPlaneReferenceType aboveOrBelow,out double projectedArea,out double surfaceArea,out double volume)
            {
                ISurface pSurface = Tin as ISurface;
                projectedArea = pSurface.GetProjectedArea(planeheight, aboveOrBelow);
                surfaceArea = pSurface.GetSurfaceArea(planeheight, aboveOrBelow);
                volume = pSurface.GetVolume(planeheight, aboveOrBelow);
    
                projectedArea = Math.Round(projectedArea, 2);//保留两位小数
                surfaceArea = Math.Round(surfaceArea, 2);
                volume = Math.Round(volume, 2);
            }
  • 相关阅读:
    C#快速生成数据数组
    PHP访问Oracle数据库
    C# 监听HTTP请求
    三维重建基础
    三维重建技术概述
    python+OpenCV 特征点检测
    windows10,redhat6.5下python3.5.2使用cx_Oracle链接oracle
    《读书报告 -- Elasticsearch入门 》-- 安装以及简单使用(1)
    2016年简直一晃而过
    windows下python3.5使用pip离线安装whl包
  • 原文地址:https://www.cnblogs.com/imihiroblog/p/2453857.html
Copyright © 2011-2022 走看看