#ifndef _FUNC_H #define _FUNC_H #include "iostream" #include "fstream" #include "sstream" #include "iomanip" #include "stdio.h" #include "string.h" #include "list" #define OUTFILE "-o" #define RESET "\033[0m" /* reset */ #define BOLDRED "\033[1m\033[31m" /* Bold Red */ using namespace std; struct loc { double geox,geoy,altitude; string tag; }; typedef list LocList; class XyzGpx { public: XyzGpx(); ~XyzGpx(); int readxyz(char*); int outgpx(char*); private: LocList list_loc; LocList::iterator il; loc temp_loc; double outbox[4]; }; XyzGpx::XyzGpx() { outbox[0] = outbox[2] = 1e+30; outbox[1] = outbox[3] = -1e+30; } XyzGpx::~XyzGpx() { if(!list_loc.empty()) list_loc.clear(); } int XyzGpx::readxyz(char* filename) { stringstream stemp; string strtemp; ifstream xyzin(filename); if (!xyzin) { cout<>temp_loc.tag>>temp_loc.geox>>temp_loc.geoy>>temp_loc.altitude; list_loc.push_back(temp_loc); if(temp_loc.geoxoutbox[1]) outbox[1] = temp_loc.geox; if(temp_loc.geoyoutbox[3]) outbox[3] = temp_loc.geoy; } } xyzin.close(); return 0; } } int XyzGpx::outgpx(char* filename) { ofstream gpxout(filename); if (!gpxout) { cout<<"can not create "<"<"<"<"<Garmin International"<"<2014-07-06T00:40:40Z"<"<"<"<"<"<"<"<Dot, White"<"<"<"<"; gpxout.close(); return 0; } } #endif