The Gnome Chemistry Utils
0.13.91
Main Page
Namespaces
Classes
Files
File List
File Members
libs
gcugtk
spectrumdoc.h
Go to the documentation of this file.
1
/*
2
* Gnome Chemisty Utils
3
* spectrumdoc.h
4
*
5
* Copyright (C) 2007-2012 Jean Bréfort <jean.brefort@normalesup.org>
6
*
7
* This program is free software; you can redistribute it and/or
8
* modify it under the terms of the GNU General Public License as
9
* published by the Free Software Foundation; either version 3 of the
10
* License, or (at your option) any later version.
11
*
12
* This program is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU General Public License for more details.
16
*
17
* You should have received a copy of the GNU General Public License
18
* along with this program; if not, write to the Free Software
19
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
20
* USA
21
*/
22
23
#ifndef GCU_SPECTRUM_DOC_H
24
#define GCU_SPECTRUM_DOC_H
25
26
#include <
gcu/document.h
>
27
#include <
gcu/macros.h
>
28
#include "
printable.h
"
29
#include <string>
30
#include <vector>
31
33
namespace
gcugtk
34
{
35
40
typedef
enum
{
44
GCU_SPECTRUM_INFRARED
,
48
GCU_SPECTRUM_RAMAN
,
52
GCU_SPECTRUM_INFRARED_PEAK_TABLE
,
56
GCU_SPECTRUM_INFRARED_INTERFEROGRAM
,
60
GCU_SPECTRUM_INFRARED_TRANSFORMED
,
64
GCU_SPECTRUM_UV_VISIBLE
,
68
GCU_SPECTRUM_NMR
,
72
GCU_SPECTRUM_NMR_FID
,
76
GCU_SPECTRUM_NMR_PEAK_TABLE
,
80
GCU_SPECTRUM_NMR_PEAK_ASSIGNMENTS
,
84
GCU_SPECTRUM_MASS
,
89
GCU_SPECTRUM_MAX
90
}
SpectrumType
;
91
92
96
typedef
enum
{
100
GCU_SPECTRUM_UNIT_CM_1
,
104
GCU_SPECTRUM_UNIT_TRANSMITTANCE
,
108
GCU_SPECTRUM_UNIT_ABSORBANCE
,
112
GCU_SPECTRUM_UNIT_PPM
,
116
GCU_SPECTRUM_UNIT_NANOMETERS
,
120
GCU_SPECTRUM_UNIT_MICROMETERS
,
124
GCU_SPECTRUM_UNIT_SECONDS
,
128
GCU_SPECTRUM_UNIT_HZ
,
132
GCU_SPECTRUM_UNIT_M_Z
,
136
GCU_SPECTRUM_UNIT_REL_ABUNDANCE
,
141
GCU_SPECTRUM_UNIT_MAX
142
}
SpectrumUnitType
;
143
148
typedef
enum
{
152
GCU_SPECTRUM_TYPE_INDEPENDENT
,
156
GCU_SPECTRUM_TYPE_DEPENDENT
,
160
GCU_SPECTRUM_TYPE_PAGE
,
165
GCU_SPECTRUM_TYPE_MAX
166
}
SpectrumVarType
;
167
173
typedef
enum
{
177
GCU_SPECTRUM_FORMAT_ASDF
,
181
GCU_SPECTRUM_FORMAT_AFFN
,
185
GCU_SPECTRUM_FORMAT_PAC
,
189
GCU_SPECTRUM_FORMAT_SQZ
,
193
GCU_SPECTRUM_FORMAT_DIF
,
198
GCU_SPECTRUM_FORMAT_MAX
199
}
SpectrumFormatType
;
200
201
class
Application;
202
class
SpectrumView;
203
207
typedef
struct
{
211
std::string
Name
;
215
char
Symbol
;
219
SpectrumVarType
Type
;
223
SpectrumUnitType
Unit
;
227
SpectrumFormatType
Format
;
231
unsigned
NbValues
;
235
double
First
;
239
double
Last
;
243
double
Min
;
247
double
Max
;
252
double
Factor
;
256
double
*
Values
;
261
GogSeries *
Series
;
262
}
JdxVar
;
263
268
class
SpectrumDocument
:
public
gcu::Document
,
public
Printable
269
{
270
public
:
274
SpectrumDocument
();
279
SpectrumDocument
(
Application
*app,
SpectrumView
*view = NULL);
280
284
~SpectrumDocument
();
285
293
void
Load
(
char
const
*uri,
char
const
*mime_type = NULL);
294
302
void
OnXUnitChanged
(
int
i);
303
311
void
OnYUnitChanged
(
int
i);
312
319
void
OnXAxisInvert
(
bool
inverted);
320
324
void
OnShowIntegral
();
325
332
void
OnTransformFID
(GtkButton *btn);
340
bool
SetProperty
(
unsigned
property,
char
const
*value);
344
bool
Loaded
()
throw
(gcu::LoaderError);
345
346
private
:
347
void
LoadJcampDx (
char
const
*data);
348
void
ReadDataLine (
char
const
*data, std::list<double> &l);
349
void
DoPrint (GtkPrintOperation *print, GtkPrintContext *context,
int
page)
const
;
350
GtkWindow *GetGtkWindow ();
351
void
ReadDataTable (std::istream &s,
double
*x,
double
*y);
352
double (*GetConversionFunction (
SpectrumUnitType
oldu,
SpectrumUnitType
newu,
double
&factor,
double
&offset)) (double, double, double);
353
354
private
:
355
double
*x, *y;
356
unsigned
npoints;
357
double
maxx, maxy, minx, miny;
358
double
firstx, lastx, deltax, firsty;
359
double
xfactor, yfactor;
360
std::vector <JdxVar> variables;
361
int
X, Xt, Y, R, I, integral, Rt, It, Rp;
362
double
freq;
363
double
offset, refpoint;
364
GtkWidget *m_XAxisInvertBtn;
365
guint m_XAxisInvertSgn;
366
373
GCU_PROT_PROP
(
SpectrumView
*, View)
377
GCU_RO_PROP
(
bool
, Empty)
381
GCU_RO_PROP
(
SpectrumType
, SpectrumType)
386
GCU_RO_PROP
(
SpectrumUnitType
, XUnit)
391
GCU_RO_PROP
(SpectrumUnitType, YUnit)
396
GCU_RO_PROP
(
bool
, IntegralVisible)
397
};
398
399
}
400
401
#endif // GCU_SPECTRUM_DOC_H
Generated on Fri Jul 13 2012 16:36:07 for The Gnome Chemistry Utils by
1.8.1.1