00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef GCU_SPECTRUM_DOC_H
00024 #define GCU_SPECTRUM_DOC_H
00025
00026 #include "document.h"
00027 #include "macros.h"
00028 #include "printable.h"
00029 #include <complex>
00030
00031 namespace gcu
00032 {
00033
00034 typedef enum {
00035 GCU_SPECTRUM_INFRARED,
00036 GCU_SPECTRUM_RAMAN,
00037 GCU_SPECTRUM_INFRARED_PEAK_TABLE,
00038 GCU_SPECTRUM_INFRARED_INTERFEROGRAM,
00039 GCU_SPECTRUM_INFRARED_TRANSFORMED,
00040 GCU_SPECTRUM_UV_VISIBLE,
00041 GCU_SPECTRUM_NMR,
00042 GCU_SPECTRUM_MASS,
00043 GCU_SPECTRUM_MAX
00044 } SpectrumType;
00045
00046 typedef enum {
00047 GCU_SPECTRUM_UNIT_CM_1,
00048 GCU_SPECTRUM_UNIT_TRANSMITTANCE,
00049 GCU_SPECTRUM_UNIT_ABSORBANCE,
00050 GCU_SPECTRUM_UNIT_PPM,
00051 GCU_SPECTRUM_NANOMETERS,
00052 GCU_SPECTRUM_MICROMETERS,
00053 GCU_SPECTRUM_UNIT_MAX
00054 } SpectrumUnitType;
00055
00056 class Application;
00057 class SpectrumView;
00058
00059 class SpectrumDocument: public Document, public Printable
00060 {
00061 public:
00065 SpectrumDocument ();
00070 SpectrumDocument (Application *app, SpectrumView *view = NULL);
00071
00075 ~SpectrumDocument ();
00076
00084 void Load (char const *uri, char const *mime_type = NULL);
00085
00086 private:
00087 void LoadJcampDx (char const *data);
00088 void ReadDataLine (char const *data, std::list<double> &l);
00089 void DoPrint (GtkPrintOperation *print, GtkPrintContext *context);
00090 GtkWindow *GetGtkWindow ();
00091
00092 private:
00093 double *x, *y;
00094 std::complex<double> *z;
00095 unsigned npoints;
00096 double maxx, maxy, minx, miny;
00097 double firstx, lastx, deltax, firsty;
00098 double xfactor, yfactor;
00099
00100 GCU_PROT_PROP (SpectrumView*, View)
00101 GCU_RO_PROP (bool, Empty)
00102 GCU_RO_PROP (SpectrumType, SpectrumType)
00103 GCU_RO_PROP (SpectrumUnitType, XUnit)
00104 GCU_RO_PROP (SpectrumUnitType, YUnit)
00105 };
00106
00107 }
00108
00109 #endif // GCU_SPECTRUM_DOC_H