The Gnome Chemistry Utils
0.14.0
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
,
140
GCU_SPECTRUM_UNIT_RESPONSE_FACTOR
,
145
GCU_SPECTRUM_UNIT_MAX
146
}
SpectrumUnitType
;
147
152
typedef
enum
{
156
GCU_SPECTRUM_TYPE_INDEPENDENT
,
160
GCU_SPECTRUM_TYPE_DEPENDENT
,
164
GCU_SPECTRUM_TYPE_PAGE
,
169
GCU_SPECTRUM_TYPE_MAX
170
}
SpectrumVarType
;
171
177
typedef
enum
{
181
GCU_SPECTRUM_FORMAT_ASDF
,
185
GCU_SPECTRUM_FORMAT_AFFN
,
189
GCU_SPECTRUM_FORMAT_PAC
,
193
GCU_SPECTRUM_FORMAT_SQZ
,
197
GCU_SPECTRUM_FORMAT_DIF
,
202
GCU_SPECTRUM_FORMAT_MAX
203
}
SpectrumFormatType
;
204
205
class
Application;
206
class
SpectrumView;
207
211
typedef
struct
{
215
std::string
Name
;
219
char
Symbol
;
223
SpectrumVarType
Type
;
227
SpectrumUnitType
Unit
;
231
SpectrumFormatType
Format
;
235
unsigned
NbValues
;
239
double
First
;
243
double
Last
;
247
double
Min
;
251
double
Max
;
256
double
Factor
;
260
double
*
Values
;
265
GogSeries *
Series
;
266
}
JdxVar
;
267
272
class
SpectrumDocument
:
public
gcu::Document
,
public
Printable
273
{
274
public
:
278
SpectrumDocument
();
283
SpectrumDocument
(
Application
*app,
SpectrumView
*view = NULL);
284
288
~SpectrumDocument
();
289
297
void
Load
(
char
const
*uri,
char
const
*mime_type = NULL);
298
306
void
OnXUnitChanged
(
int
i);
307
315
void
OnYUnitChanged
(
int
i);
316
323
void
OnXAxisInvert
(
bool
inverted);
324
328
void
OnShowIntegral
();
329
336
void
OnTransformFID
(GtkButton *btn);
344
bool
SetProperty
(
unsigned
property,
char
const
*value);
348
bool
Loaded
()
throw
(gcu::LoaderError);
349
350
private
:
351
void
LoadJcampDx (
char
const
*data);
352
void
ReadDataLine (
char
const
*data, std::list<double> &l);
353
void
DoPrint (GtkPrintOperation *print, GtkPrintContext *context,
int
page)
const
;
354
GtkWindow *GetGtkWindow ();
355
void
ReadDataTable (std::istream &s,
double
*x,
double
*y);
356
double (*GetConversionFunction (
SpectrumUnitType
oldu,
SpectrumUnitType
newu,
double
&factor,
double
&offset)) (double, double, double);
357
358
private
:
359
double
*x, *y;
360
unsigned
npoints;
361
double
maxx, maxy, minx, miny;
362
double
firstx, lastx, deltax, firsty;
363
double
xfactor, yfactor;
364
std::vector <JdxVar> variables;
365
int
X, Xt, Y, R, I, integral, Rt, It, Rp;
366
double
freq;
367
double
offset, refpoint;
368
GtkWidget *m_XAxisInvertBtn;
369
guint m_XAxisInvertSgn;
370
377
GCU_PROT_PROP
(
SpectrumView
*, View)
381
GCU_RO_PROP
(
bool
, Empty)
385
GCU_RO_PROP
(
SpectrumType
, SpectrumType)
390
GCU_RO_PROP
(
SpectrumUnitType
, XUnit)
395
GCU_RO_PROP
(SpectrumUnitType, YUnit)
400
GCU_RO_PROP
(
bool
, IntegralVisible)
401
};
402
403
}
404
405
#endif // GCU_SPECTRUM_DOC_H
Generated on Tue Jan 1 2013 22:29:23 for The Gnome Chemistry Utils by
1.8.1.2