00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #ifndef ORIGIN_750_PARSER_H
00031 #define ORIGIN_750_PARSER_H
00032
00033 #include "OriginParser.h"
00034 #include "endianfstream.hh"
00035 #include <cmath>
00036 #include <string>
00037 using namespace std;
00038 using namespace Origin;
00039
00040 class Origin750Parser : public OriginParser
00041 {
00042 public:
00043 Origin750Parser(const string& fileName);
00044 bool parse();
00045
00046 protected:
00047 void skipObjectInfo();
00048 void readParameters();
00049 void readFunction(unsigned int colpos, char valuesize, unsigned int *oldpos);
00050 void readSpreadInfo();
00051 void readExcelInfo();
00052 void readMatrixInfo();
00053 void readColumnValues(unsigned int spread, unsigned int col, short data_type, char valuesize, unsigned int nr, bool validColumn = true);
00054 void readMatrixValues(short data_type, char data_type_u, char valuesize, unsigned int size, int mIndex = -1);
00055 virtual bool readGraphInfo();
00056 unsigned int readGraphAxisInfo(GraphAxis& axis);
00057 void readGraphGridInfo(GraphGrid& grid);
00058 void readGraphAxisBreakInfo(GraphAxisBreak& axis_break);
00059 void readGraphAxisFormatInfo(GraphAxisFormat& format);
00060 void readGraphAxisTickLabelsInfo(GraphAxisTick& tick);
00061 void readGraphAxisPrefixSuffixInfo(const string& sec_name, unsigned int size, GraphLayer& layer);
00062 void readProjectTree();
00063 virtual void readProjectTreeFolder(tree<ProjectNode>::iterator parent);
00064 void readWindowProperties(Window& window, unsigned int size);
00065 virtual void readColorMap(ColorMap& colorMap);
00066 void skipLine();
00067
00068 inline double stringToDouble(const string& s)
00069 {
00070 string s1 = s;
00071 size_t pos = s.find(",");
00072 if (pos != string::npos)
00073 s1.replace(pos, 1, ".");
00074 return strtod(s1.c_str(), NULL);
00075 }
00076
00077 inline time_t doubleToPosixTime(double jdt)
00078 {
00079
00080 return (time_t) floor((jdt - 2440587) * 86400. + 0.5);
00081 }
00082
00083 unsigned int objectIndex;
00084 iendianfstream file;
00085 FILE *logfile;
00086
00087 unsigned int d_colormap_offset;
00088 };
00089
00090 #endif // ORIGIN_750_PARSER_H