SkelGIS
3.0
|
00001 /*! \file utility.hpp 00002 * \brief Definitions of the object 00003 */ 00004 #ifndef UTILITY_H 00005 #define UTILITY_H 00006 00007 #include <iostream> 00008 #include <fstream> 00009 #include <sstream> 00010 #include<math.h> 00011 00012 namespace skelgis{ 00013 00014 //================================================================================ 00015 //! header structure of the input binary file for DMatrix 00016 //------------------------------------------------------------------------------- 00017 struct HEADER 00018 //------------------------------------------------------------------------------- 00019 { 00020 unsigned int width; 00021 unsigned int height; 00022 float x; 00023 float y; 00024 float spacing; 00025 float nodata; 00026 }; 00027 //------------------------------------------------------------------------------- 00028 00029 //================================================================================ 00030 //! header structure to read HEADER object 00031 //------------------------------------------------------------------------------- 00032 struct Header 00033 //------------------------------------------------------------------------------- 00034 { 00035 //! read method of Header 00036 /*! 00037 \param binFile is the path to the binary file to read 00038 */ 00039 static HEADER read(const char * binFile) 00040 { 00041 HEADER head; 00042 std::ifstream f(binFile, std::ios::binary | std::ios::in); 00043 f.read(reinterpret_cast<char*>(&head),sizeof(HEADER)); 00044 00045 return head; 00046 } 00047 }; 00048 //------------------------------------------------------------------------------ 00049 } 00050 00051 #endif