Arcengine implements area/volumn functions of surfaceanalysis

Source: Internet
Author: User
        ///   <Summary>          ///  Load tin from directory  ///  ESRI tin is a folder, which contains eight fixed-name ADF files.  ///   </Summary>          ///   <Param name = "folder">  Parent directory of tindataset  </Param>          ///   <Param name = "tindataset">  Tindataset name </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> /// Check whether it is Tin Dataset /// </Summary> /// <Param name = "folderpath"> User-selected 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>          /// This method uses the entire tin as the computing object.  ///   </Summary>          ///   <Param name = "Tin">  Tinlayer  </Param>          ///   <Param name = "planeheight">  Reference height  </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 ); //  Retain two decimal places Surfacearea = math. Round (surfacearea, 2  ); Volume = Math. Round (volume, 2  );} 

 

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.