1/* vim: set filetype=cpp : */
2/* due to a limitation of sip, this file has to use Unix style line endings */
3/***************************************************************************
4	File                 : qti.sip
5	Project              : QtiPlot
6--------------------------------------------------------------------
7	Copyright            : (C) 2006 by Knut Franke, Ion Vasilief, Michael Roemer, Jonas B�hr
8	Email                : knut.franke*gmx.de, ion_vasilief*yahoo.fr,
9						   roemer*nano.uni-hannover.de, Jonas.Baehr*web.de
10	Description          : Specifications for Python bindings
11
12 ***************************************************************************/
13
14/***************************************************************************
15 *                                                                         *
16 *  This program is free software; you can redistribute it and/or modify   *
17 *  it under the terms of the GNU General Public License as published by   *
18 *  the Free Software Foundation; either version 2 of the License, or      *
19 *  (at your option) any later version.                                    *
20 *                                                                         *
21 *  This program is distributed in the hope that it will be useful,        *
22 *  but WITHOUT ANY WARRANTY; without even the implied warranty of         *
23 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
24 *  GNU General Public License for more details.                           *
25 *                                                                         *
26 *   You should have received a copy of the GNU General Public License     *
27 *   along with this program; if not, write to the Free Software           *
28 *   Foundation, Inc., 51 Franklin Street, Fifth Floor,                    *
29 *   Boston, MA  02110-1301  USA                                           *
30 *                                                                         *
31 ***************************************************************************/
32
33%Module qti 0
34%Import QtCore/QtCoremod.sip
35%Import QtGui/QtGuimod.sip
36
37class ScriptEdit: QTextEdit
38{
39%TypeHeaderCode
40#include "../src/scripting/ScriptEdit.h"
41%End
42public slots:
43  void print();
44  void insertFunction(const QString &);
45  void exportPDF(const QString& fileName);
46  QString save();
47  QString exportASCII(const QString &file=QString::null)/PyName=saveAs/;
48  QString importASCII(const QString &file=QString::null);
49
50private:
51  ScriptEdit(ScriptEdit&);
52};
53
54class MdiSubWindow: QMdiSubWindow /PyName=MDIWindow/
55{
56%TypeHeaderCode
57#include "../src/core/MdiSubWindow.h"
58%End
59public:
60  enum CaptionPolicy{Name = 0, Label = 1, Both = 2};
61
62  SIP_PYOBJECT windowLabel();
63%MethodCode
64  sipRes = PyString_FromString(sipCpp->windowLabel());
65%End
66  void setWindowLabel(const QString&);
67
68  CaptionPolicy captionPolicy();
69  void setCaptionPolicy(CaptionPolicy);
70
71  virtual void restore(const QStringList& );
72  Folder* folder();
73
74  void askOnCloseEvent(bool)/PyName=confirmClose/;
75
76private:
77  MdiSubWindow(const MdiSubWindow&);
78};
79
80class Table: MdiSubWindow
81{
82%TypeHeaderCode
83#include "../src/table/Table.h"
84#include <QDate>
85#include <QTime>
86#include <QDateTime>
87#include <datetime.h> // python include
88#define CHECK_TABLE_COL(arg)\
89    int col;\
90    if (PyInt_Check(arg)) {\
91      col = (int)PyInt_AsLong(arg) - 1;\
92		if (col < 0 || col >= sipCpp->numCols()) {\
93			sipIsErr = 1;\
94			PyErr_Format(PyExc_ValueError, "There's no column %d in table %s!", col+1, sipCpp->name().ascii());\
95		}\
96	 } else {\
97      PyObject *tmp = PyObject_Str(arg);\
98		if (!tmp) {\
99			sipIsErr = 1;\
100			PyErr_Format(PyExc_TypeError, "Column argument must be either int or string.");\
101		} else {\
102			col = sipCpp->colIndex(PyString_AsString(tmp));\
103			if (col < 0) {\
104				sipIsErr = 1;\
105				PyErr_Format(PyExc_ValueError, "There's no column named %s in table %s!", PyString_AsString(tmp),\
106						sipCpp->name().ascii());\
107				Py_DECREF(tmp);\
108			}\
109		}\
110	 }
111
112#define CHECK_TABLE_ROW(arg)\
113   int row = arg-1;\
114	if (row < 0 || row >= sipCpp->numRows()) {\
115		sipIsErr = 1;\
116		PyErr_Format(PyExc_ValueError, "There's no row %d in table %s!", row+1, sipCpp->name().ascii());\
117	}
118
119static int setCellDataHelper(Table* table, int row, int col, PyObject* item) {
120  PyTypeObject* item_type = item->ob_type;
121  if (item == Py_None) {
122    table->clearCell(row, col);
123    return 0;
124  }
125  switch (table->columnType(col)) {
126  case Table::Numeric:
127    item = PyNumber_Float(item);
128    if (item) {
129      table->setCell(row, col, PyFloat_AsDouble(item));
130      Py_DECREF(item);
131    }
132    else {
133      if (PyType_Ready(item_type) == 0)
134        PyErr_Format(PyExc_TypeError, "Can't convert <%s> into a float!", item_type->tp_name);
135      return 1;
136    }
137    break;
138  case Table::Text:
139    item = PyObject_Str(item);
140    if (item) {
141      table->setText(row, col, PyString_AsString(item));
142      Py_DECREF(item);
143    }
144    else {
145      if (PyType_Ready(item_type) == 0)
146        PyErr_Format(PyExc_TypeError, "Can't convert <%s> into a string!", item_type->tp_name);
147      return 1;
148    }
149    break;
150  case Table::Date:
151    if (sipCanConvertToType(item, sipType_QDateTime, 0)) {
152      int isErr = 0;
153      QDateTime* dateTime = reinterpret_cast<QDateTime*>(sipConvertToType(item, sipType_QDateTime,
154                            0/*sipTransferObj*/, 0/*flags*/, 0/*state*/, &isErr));
155      if (isErr)
156        return 1;
157      table->setText(row, col, dateTime->toString(table->columnFormat(col)));
158      delete dateTime;
159    }
160    else {
161      if (PyType_Ready(item_type) == 0)
162        PyErr_Format(PyExc_TypeError, "Can't convert <%s> into a datetime!", item_type->tp_name);
163      return 1;
164    }
165    break;
166  case Table::Time:
167    if (sipCanConvertToType(item, sipType_QTime, 0)) {
168      int isErr = 0;
169      QTime* time = reinterpret_cast<QTime*>(sipConvertToType(item, sipType_QTime,
170                            0/*sipTransferObj*/, 0/*flags*/, 0/*state*/, &isErr));
171      if (isErr)
172        return 1;
173      table->setText(row, col, time->toString(table->columnFormat(col)));
174      delete time;
175    }
176    else {
177      if (PyType_Ready(item_type) == 0)
178        PyErr_Format(PyExc_TypeError, "Can't convert <%s> into a time!", item_type->tp_name);
179      return 1;
180    }
181    break;
182  case Table::Month:
183    item = PyNumber_Int(item);
184    if (item) {
185      int m = PyInt_AS_LONG(item) % 12; // no type checking required since we casted above
186      if (!m)
187        m = 12;
188      QString format = table->columnFormat(col);
189      Py_DECREF(item);
190      if (format == "M")
191          table->setText(row, col, QDate::shortMonthName(m).left(1));
192      else if (format == "MMM")
193          table->setText(row, col, QDate::shortMonthName(m));
194      else if (format == "MMMM")
195          table->setText(row, col, QDate::longMonthName(m));
196    }
197    else {
198      if (PyType_Ready(item_type) == 0)
199        PyErr_Format(PyExc_TypeError, "Can't convert <%s> into a number!", item_type->tp_name);
200      return 1;
201    }
202    break;
203  case Table::Day:
204    item = PyNumber_Int(item);
205    if (item) {
206      int day = PyInt_AS_LONG(item) % 7; // no type checking required since we casted above
207      if (!day)
208        day = 7;
209      QString format = table->columnFormat(col);
210      Py_DECREF(item);
211      if (format == "d")
212          table->setText(row, col, QDate::shortDayName(day).left(1));
213      else if (format == "ddd")
214          table->setText(row, col, QDate::shortDayName(day));
215      else if (format == "dddd")
216          table->setText(row, col, QDate::longDayName(day));
217    }
218    else {
219      if (PyType_Ready(item_type) == 0)
220        PyErr_Format(PyExc_TypeError, "Can't convert <%s> into a number!", item_type->tp_name);
221      return 1;
222    }
223    break;
224  default:
225    PyErr_Format(PyExc_ValueError, "Type %d of column %d in table %s not supported!",
226                 table->columnType(col), col+1, table->name().ascii());
227    return 1;
228    break;
229  } // switch column type
230  return 0; // everything ok
231}
232
233static int cellDataHelper(Table* table, int row, int col, PyObject** item) {
234  switch (table->columnType(col)) {
235  case Table::Numeric:
236    if (table->text(row, col).isEmpty())
237      *item = Py_None;
238    else
239      *item = PyFloat_FromDouble(table->cell(row, col));
240    break;
241  case Table::Text:
242    *item = PyString_FromString(table->text(row, col));
243    break;
244  case Table::Date:
245    if (table->text(row, col).isEmpty())
246      *item = Py_None;
247    else {
248      if (!PyDateTimeAPI)
249        PyDateTime_IMPORT;
250      QDateTime dateTime = QDateTime::fromString(table->text(row, col), table->columnFormat(col));
251      QDate date = dateTime.date();
252      QTime time = dateTime.time();
253      *item = PyDateTime_FromDateAndTime(date.year(), date.month(), date.day(),
254                                         time.hour(), time.minute(), time.second(), time.msec()*1000);
255    }
256    break;
257  case Table::Time:
258    if (table->text(row, col).isEmpty())
259      *item = Py_None;
260    else {
261      if (!PyDateTimeAPI)
262        PyDateTime_IMPORT;
263      QTime time = QTime::fromString(table->text(row, col), table->columnFormat(col));
264      *item = PyTime_FromTime(time.hour(), time.minute(), time.second(), time.msec()*1000);
265    }
266    break;
267  case Table::Month:
268    if (table->text(row, col).isEmpty())
269      *item = Py_None;
270    else {
271      QDate date = QDate::fromString(table->text(row, col), table->columnFormat(col));
272      *item = PyInt_FromLong(date.month());
273    }
274    break;
275  case Table::Day:
276    if (table->text(row, col).isEmpty())
277      *item = Py_None;
278    else {
279      QDate date = QDate::fromString(table->text(row, col), table->columnFormat(col));
280      *item = PyInt_FromLong(date.dayOfWeek());
281    }
282    break;
283  default:
284    *item = NULL;
285    PyErr_Format(PyExc_ValueError, "Type %d of column %d in table %s not supported!",
286                 table->columnType(col), col+1, table->name().ascii());
287    return 1;
288    break;
289  } // switch column type
290  return 0; // everything ok
291}
292%End
293
294public:
295  enum PlotDesignation{None = 0, X = 1, Y = 2, Z = 3, xErr = 4, yErr = 5, Label = 6};
296  enum ImportMode{NewColumns, NewRows, Overwrite};
297  enum NumericFormat{Default = 0, Decimal = 1, Scientific = 2};
298
299  int numRows();
300  int __len__();
301%MethodCode
302  sipRes = sipCpp->numRows();
303%End
304  int numCols();
305  void setNumRows(int);
306  void setNumCols(int);
307
308  void deleteRows(int, int);
309  void __delitem__(int);
310%MethodCode
311  int len = sipCpp->numRows();
312  if ((a0 = (int)sipConvertFromSequenceIndex(a0, len)) < 0)
313    sipIsErr = 1;
314  else
315    sipCpp->deleteRows(a0 + 1, a0 + 1); // start and stop are equal, counting starts at 1
316%End
317  void __delitem__(SIP_PYSLICE);
318%MethodCode
319  SIP_SSIZE_T len, start, stop, step, slicelength;
320  len = sipCpp->numRows();
321  if (PySlice_GetIndicesEx((PySliceObject *)a0, len, &start, &stop, &step, &slicelength) < 0)
322    sipIsErr = 1;
323  else {
324    start += 1; // row index starts at 1 (python at 0); the stop is inclusive (python exclusive) so no need to change
325    if (step == 1)
326      sipCpp->deleteRows(start, stop);
327    else {
328      for (int i = 0; i < slicelength; i++) {
329        sipCpp->deleteRows(start, start);
330        start += step - 1; // the "- 1" is needed since the removal also shifts the index
331      }
332    }
333  }
334%End
335
336  SIP_PYOBJECT text(SIP_PYOBJECT, int);
337%MethodCode
338  sipIsErr = 0;
339  CHECK_TABLE_COL(a0);
340  CHECK_TABLE_ROW(a1);
341  if (sipIsErr == 0) {
342		PyObject *encstr = PyString_FromString(sipCpp->text(row, col).utf8());
343		if (encstr) {
344			sipRes = PyUnicode_FromEncodedObject(encstr, "utf8", 0);
345			Py_DECREF(encstr);
346		} else {
347			sipRes = NULL;
348			sipIsErr = 1;
349		}
350	}
351%End
352
353    void removeCol(SIP_PYOBJECT);
354%MethodCode
355    sipIsErr=0;
356    CHECK_TABLE_COL(a0);
357	if (sipIsErr == 0){
358        QStringList list;
359		list << sipCpp->colName(col);
360        sipCpp->removeCol(list);
361    }
362%End
363
364  double cell(SIP_PYOBJECT, int);
365%MethodCode
366  sipIsErr = 0;
367  CHECK_TABLE_COL(a0);
368  CHECK_TABLE_ROW(a1);
369	if (sipIsErr == 0){
370		if (sipCpp->text(row, col) != "")
371			sipRes = sipCpp->cell(row, col);
372		else {
373			sipRes = NULL;
374			PyErr_SetString(PyExc_ValueError, "Empty table cell");
375		}
376	}
377%End
378  SIP_PYOBJECT cellData(SIP_PYOBJECT, int);
379%MethodCode
380  sipIsErr = 0;
381  CHECK_TABLE_COL(a0);
382  CHECK_TABLE_ROW(a1);
383	if (sipIsErr == 0)
384    sipIsErr = cellDataHelper(sipCpp, row, col, &sipRes);
385%End
386  SIP_PYTUPLE rowData(int);
387%MethodCode
388  PyObject *item;
389  sipIsErr = 0;
390  CHECK_TABLE_ROW(a0);
391	if (sipIsErr == 0){
392    int size = sipCpp->numCols();
393    sipRes = PyTuple_New(size);
394    for(int col = 0; col < size; col++) {
395      sipIsErr = cellDataHelper(sipCpp, row, col, &item);
396      if (sipIsErr == 0)
397        PyTuple_SET_ITEM(sipRes, col, item);
398      else {
399        Py_DECREF(sipRes);
400        sipRes = NULL;
401        break;
402      }
403    } // for each col
404	} // if not sip error
405%End
406  SIP_PYTUPLE __getitem__(int); // this is operator[]
407%MethodCode
408  SIP_SSIZE_T idx = sipConvertFromSequenceIndex(a0, sipCpp->numRows());
409  if (idx < 0)
410    sipIsErr = 1;
411  else {
412    sipRes = PyObject_CallMethod(sipSelf, "rowData", "i", idx + 1); // rowData's index starts at 1
413    if (sipRes == NULL)
414      sipIsErr = 1;
415  }
416%End
417  SIP_PYTUPLE __getitem__(SIP_PYSLICE); // this is operator[]
418%MethodCode
419  SIP_SSIZE_T len, start, stop, step, slicelength;
420  len = sipCpp->numRows();
421  if (PySlice_GetIndicesEx((PySliceObject *)a0, len, &start, &stop, &step, &slicelength) < 0)
422    sipIsErr = 1;
423  else {
424    PyObject *item;
425    sipRes = PyList_New(slicelength);
426    for(int i = 0; i < slicelength; i++) {
427      item = PyObject_CallMethod(sipSelf, "rowData", "i", start + 1); // rowData's index starts at 1
428      start += step;
429      if (item)
430        PyList_SET_ITEM(sipRes, i, item);
431      else {
432        Py_DECREF(sipRes);
433        sipRes = NULL;
434        sipIsErr = 1;
435        break;
436      }
437    } // for
438  }
439%End
440  SIP_PYLIST colData(SIP_PYOBJECT);
441%MethodCode
442  PyObject *item;
443  sipIsErr = 0;
444  CHECK_TABLE_COL(a0);
445	if (sipIsErr == 0){
446    int size = sipCpp->numRows();
447    sipRes = PyList_New(size);
448    for(int row = 0; row < size; row++) {
449      sipIsErr = cellDataHelper(sipCpp, row, col, &item);
450      if (sipIsErr == 0)
451        PyList_SET_ITEM(sipRes, row, item);
452      else {
453        Py_DECREF(sipRes);
454        sipRes = NULL;
455        break;
456      }
457    } // for
458	} // if not sip error
459%End
460  void setRowData(int, SIP_PYTUPLE);
461%MethodCode
462  PyObject *item;
463  sipIsErr = 0;
464  CHECK_TABLE_ROW(a0);
465  int n = PyTuple_Size(a1);
466  int size = sipCpp->numCols();
467  if (n != size) {
468    sipIsErr = 1;
469    PyErr_SetString(PyExc_ValueError, "The argument length must match the table's column count!");
470  }
471	if (sipIsErr == 0){
472    for(int col = 0; col < size; col++) {
473      item = PyTuple_GET_ITEM(a1, col);
474      sipIsErr = setCellDataHelper(sipCpp, row, col, item);
475      if (sipIsErr)
476        break;
477    } // for each col
478	} // if not sip error
479%End
480  void __setitem__(int, SIP_PYTUPLE);
481%MethodCode
482  SIP_SSIZE_T idx = sipConvertFromSequenceIndex(a0, sipCpp->numRows());
483  if (idx < 0)
484    sipIsErr = 1;
485  else {
486    PyObject* methodName = PyString_FromString("setRowData");
487    PyObject* rowNumber = PyInt_FromLong(idx + 1); // setRowData's index starts at 1
488    PyObject* ret = PyObject_CallMethodObjArgs(sipSelf, methodName, rowNumber, a1, NULL);
489    if (ret == NULL)
490      sipIsErr = 1;
491    else
492      Py_DECREF(ret);
493    Py_DECREF(rowNumber);
494    Py_DECREF(methodName);
495  }
496%End
497  int appendRowData(SIP_PYTUPLE);
498%MethodCode
499  sipRes = sipCpp->numRows() + 1;
500  sipCpp->resizeRows(sipRes);
501  PyObject* methodName = PyString_FromString("setRowData");
502  PyObject* rowNumber = PyInt_FromLong(sipRes);
503  PyObject* ret = PyObject_CallMethodObjArgs(sipSelf, methodName, rowNumber, a0, NULL);
504  if (ret == NULL)
505    sipIsErr = 1;
506  else
507    Py_DECREF(ret);
508  Py_DECREF(rowNumber);
509  Py_DECREF(methodName);
510%End
511  void setColData(SIP_PYOBJECT, SIP_PYOBJECT, int=0); // a2 can be used as an offset
512%MethodCode
513  PyObject *item;
514  PyObject *iterator = PyObject_GetIter(a1);
515  sipIsErr = 0;
516  CHECK_TABLE_COL(a0);
517  int tableLength = sipCpp->numRows();
518  if (iterator == NULL) {
519    sipIsErr = 1;
520    PyErr_SetString(PyExc_TypeError, "Object needs to be iterable");
521  }
522  else {
523    while (a2 < 0) { // a negative offset should skip the first values in the iterator
524      if (item = PyIter_Next(iterator))
525        Py_DECREF(item); // not needed any more
526      else {
527        sipIsErr = 1;
528        if (! PyErr_Occurred())
529          PyErr_SetString(PyExc_StopIteration, "Iterator ended before any row could be filled!");
530      }
531      a2++;
532    } //while
533  }
534	if (sipIsErr == 0){
535    for(int row = a2; row < tableLength; row++) {
536      if (item = PyIter_Next(iterator)) {
537        sipIsErr = setCellDataHelper(sipCpp, row, col, item);
538        Py_DECREF(item);
539      }
540      else {
541        sipIsErr = 1;
542        if (! PyErr_Occurred())
543          PyErr_SetString(PyExc_StopIteration, "Iterator ended before all rows were filled!");
544      }
545      if (sipIsErr)
546        break;
547    } // for each row
548	} // if not sip error
549  if (iterator)
550    Py_DECREF(iterator);
551%End
552  void setText(SIP_PYOBJECT, int, const QString&);
553%MethodCode
554  sipIsErr = 0;
555  CHECK_TABLE_COL(a0);
556  CHECK_TABLE_ROW(a1);
557	if (sipIsErr == 0)
558		sipCpp->setText(row, col, *a2);
559%End
560  void setCell(SIP_PYOBJECT, int, double);
561%MethodCode
562  sipIsErr = 0;
563  CHECK_TABLE_COL(a0);
564  CHECK_TABLE_ROW(a1);
565	if (sipIsErr == 0)
566		sipCpp->setCell(row, col, a2);
567%End
568  void setCellData(SIP_PYOBJECT, int, SIP_PYOBJECT);
569%MethodCode
570  sipIsErr = 0;
571  CHECK_TABLE_COL(a0);
572  CHECK_TABLE_ROW(a1);
573	if (sipIsErr == 0)
574		sipIsErr = setCellDataHelper(sipCpp, row, col, a2);
575%End
576  SIP_PYOBJECT colName(int);
577%MethodCode
578   if (a0 < 1 || a0 > sipCpp->numCols()) {\
579		sipIsErr = 1;\
580		PyErr_SetString(PyExc_ValueError, "Invalid column argument");\
581	} else
582		sipRes = PyString_FromString(sipCpp->colLabel(a0-1));
583%End
584  SIP_PYTUPLE colNames();
585%MethodCode
586  QStringList l = sipCpp->colNames();
587  int size = l.count();
588  sipRes = PyTuple_New(size);
589  if(sipRes) {
590    for(int i=0; i<size; i++)
591      PyTuple_SET_ITEM(sipRes, i, PyString_FromString(l.at(i)));
592  } else
593    sipIsErr = 1;
594%End
595  void setColName(SIP_PYOBJECT, const QString&, bool=false);
596%MethodCode
597	sipIsErr = 0;
598   CHECK_TABLE_COL(a0);
599	if (sipIsErr == 0)
600		sipCpp->setColName(col, *a1, a2);
601%End
602  void setHeader(QStringList header)/PyName=setColNames/;
603  void notifyChanges();
604
605  void importASCII(const QString&, const QString&="\t", int=0, bool=false,
606  					bool=true, bool=false, bool=false, const QString&="#", bool=false,
607					ImportMode = Overwrite, const QLocale& = QLocale(), int = 0, int = -1, const QList<int>& = QList<int>(), const QStringList& = QStringList());
608  bool exportASCII(const QString&, const QString&="\t", bool=false, bool=false, bool=false);
609
610  void setDecimalSeparators(int,bool=true);
611%MethodCode
612	QLocale locale;
613    switch (a0){
614        case 0:
615            locale = QLocale::system();
616        break;
617        case 1:
618            locale = QLocale::c();
619        break;
620        case 2:
621            locale = QLocale(QLocale::German);
622        break;
623        case 3:
624            locale = QLocale(QLocale::French);
625        break;
626    }
627 	if (a1==true)
628		locale.setNumberOptions(QLocale::OmitGroupSeparator);
629
630    sipCpp->updateDecimalSeparators(locale);
631%End
632
633  void normalizeCol(SIP_PYOBJECT) /PyName=normalize/;
634%MethodCode
635	sipIsErr = 0;
636	CHECK_TABLE_COL(a0);
637	if (sipIsErr == 0)
638		sipCpp->normalizeCol(col);
639%End
640  void normalize();
641
642  void sortColumn(SIP_PYOBJECT, int order = 0);
643%MethodCode
644  	sipIsErr = 0;
645  	CHECK_TABLE_COL(a0);
646	if (sipIsErr == 0)
647		sipCpp->sortColumn(col, a1);
648%End
649  void sort(int type = 0, int order = 0, const QString& leadCol = QString());
650  void sortColumns(SIP_PYTUPLE, int=0, int=0, const QString&=QString());
651%MethodCode
652  QStringList l;
653  int n = PyTuple_Size(a0);
654  for (int i=0; i<n; i++) {
655    PyObject *str = PyObject_Str(PyTuple_GET_ITEM(a0,i));
656    if (str) {
657      l << PyString_AsString(str);
658		Py_DECREF(str);
659	 } else {
660      sipIsErr = 1;
661      break;
662    }
663  }
664  sipCpp->sortColumns(l, a1, a2, *a3);
665%End
666
667void setRandomValues(SIP_PYOBJECT, int startRow = 1, int endRow = -1);
668%MethodCode
669sipIsErr = 0;
670CHECK_TABLE_COL(a0);
671if (sipIsErr == 0)
672	sipCpp->setRandomValues(col, a1 - 1, a2 - 1);
673%End
674
675void setNormalRandomValues(SIP_PYOBJECT, int startRow = 1, int endRow = -1, double sd = 1.0);
676%MethodCode
677sipIsErr = 0;
678CHECK_TABLE_COL(a0);
679if (sipIsErr == 0)
680	sipCpp->setNormalRandomValues(col, a1 - 1, a2 - 1, a3);
681%End
682
683	void setCommand(SIP_PYOBJECT, const QString&);
684%MethodCode
685  	sipIsErr = 0;
686  	CHECK_TABLE_COL(a0);
687	if (sipIsErr == 0)
688		sipCpp->setCommand(col, *a1);
689%End
690  bool calculate(SIP_PYOBJECT col, int startRow = 1, int endRow = -1, bool forceMuParser = false, bool notifyChanges = true)/PyName=recalculate/;
691%MethodCode
692  sipIsErr = 0;
693  CHECK_TABLE_COL(a0);
694  if (a2 == -1)
695    a2 = sipCpp->numRows();
696  if (sipIsErr == 0)
697    sipCpp->calculate(col, a1 - 1, a2 - 1, a3, a4); // row indes starts at 0
698%End
699
700	QString comment(SIP_PYOBJECT);
701%MethodCode
702  	sipIsErr = 0;
703  	CHECK_TABLE_COL(a0);
704	if (sipIsErr == 0)
705		return Py_BuildValue("s", sipCpp->comment(col).toAscii().constData());
706%End
707
708	void setComment(SIP_PYOBJECT, const QString&);
709%MethodCode
710  	sipIsErr = 0;
711  	CHECK_TABLE_COL(a0);
712	if (sipIsErr == 0)
713		sipCpp->setColComment(col, *a1);
714%End
715
716	void showComments(bool on = true);
717
718    void setReadOnlyColumn(SIP_PYOBJECT, bool = true);
719%MethodCode
720  	sipIsErr = 0;
721  	CHECK_TABLE_COL(a0);
722	if (sipIsErr == 0)
723		sipCpp->setReadOnlyColumn(col, a1);
724%End
725
726    void setColumnRole(SIP_PYOBJECT, PlotDesignation);
727%MethodCode
728  	sipIsErr = 0;
729  	CHECK_TABLE_COL(a0);
730	if (sipIsErr == 0){
731		sipCpp->setColPlotDesignation(col, a1);
732		sipCpp->setHeaderColType();
733	}
734%End
735
736	void setColTextFormat(SIP_PYOBJECT);
737%MethodCode
738  	sipIsErr = 0;
739  	CHECK_TABLE_COL(a0);
740	if (sipIsErr == 0)
741		sipCpp->setTextFormat(col);
742%End
743
744	void setColNumericFormat(SIP_PYOBJECT, int, int,  bool = true);
745%MethodCode
746  	sipIsErr = 0;
747  	CHECK_TABLE_COL(a0);
748	if (sipIsErr == 0)
749		sipCpp->setColNumericFormat(a1, a2, col, a3);
750%End
751
752	void setColDateFormat(SIP_PYOBJECT, const QString&,  bool = true);
753%MethodCode
754  	sipIsErr = 0;
755  	CHECK_TABLE_COL(a0);
756	if (sipIsErr == 0)
757		sipCpp->setDateFormat(*a1, col, a2);
758%End
759
760	void setColTimeFormat(SIP_PYOBJECT, const QString&,  bool = true);
761%MethodCode
762  	sipIsErr = 0;
763  	CHECK_TABLE_COL(a0);
764	if (sipIsErr == 0)
765		sipCpp->setTimeFormat(*a1, col, a2);
766%End
767
768	void setColMonthFormat(SIP_PYOBJECT, const QString&,  bool = true);
769%MethodCode
770  	sipIsErr = 0;
771  	CHECK_TABLE_COL(a0);
772	if (sipIsErr == 0)
773		sipCpp->setMonthFormat(*a1, col, a2);
774%End
775
776	void setColDayFormat(SIP_PYOBJECT, const QString&,  bool = true);
777%MethodCode
778  	sipIsErr = 0;
779  	CHECK_TABLE_COL(a0);
780	if (sipIsErr == 0)
781		sipCpp->setDayFormat(*a1, col, a2);
782%End
783
784	void setColumnWidth(SIP_PYOBJECT, int);
785%MethodCode
786  	sipIsErr = 0;
787  	CHECK_TABLE_COL(a0);
788	if (sipIsErr == 0)
789		sipCpp->setColumnWidth(col, a1);
790%End
791
792	void showAllColumns();
793	void hideColumn(SIP_PYOBJECT, bool = true);
794%MethodCode
795  	sipIsErr = 0;
796  	CHECK_TABLE_COL(a0);
797	if (sipIsErr == 0)
798		sipCpp->hideColumn(col, a1);
799%End
800
801	bool isRowSelected(int, bool = false);
802%MethodCode
803  	sipIsErr = 0;
804  	CHECK_TABLE_ROW(a0);
805	if (sipIsErr == 0)
806		return Py_BuildValue("b",sipCpp->isRowSelected(row, a1));
807
808%End
809
810	bool isColumnSelected(SIP_PYOBJECT, bool = false)/PyName=isColSelected/;
811%MethodCode
812  	sipIsErr = 0;
813  	CHECK_TABLE_COL(a0);
814	if (sipIsErr == 0)
815		return Py_BuildValue("b",sipCpp->isColumnSelected(col, a1));
816%End
817
818    int firstSelectedColumn();
819	int numSelectedRows();
820
821	void setSelectedCol(SIP_PYOBJECT);
822%MethodCode
823  	sipIsErr = 0;
824  	CHECK_TABLE_COL(a0);
825	if (sipIsErr == 0)
826		sipCpp->setSelectedCol(col);
827%End
828
829	int selectedColumn();
830
831	void addCol(PlotDesignation pd = Y)/PyName=addColumn/;
832  int addRow();
833%MethodCode
834  sipRes = sipCpp->numRows() + 1;
835  sipCpp->resizeRows(sipRes);
836%End
837	void insertColumns(SIP_PYOBJECT, int);
838%MethodCode
839  	sipIsErr = 0;
840  	CHECK_TABLE_COL(a0);
841	if (sipIsErr == 0)
842		sipCpp->insertCols(col, a1);
843%End
844
845	void swapColumns(SIP_PYOBJECT, SIP_PYOBJECT);
846%MethodCode
847  	sipIsErr = 0;
848  	CHECK_TABLE_COL(a0);
849
850  	int col2;
851    if (PyInt_Check(a1)) {
852      col2 = (int)PyInt_AsLong(a1) - 1;
853		if (col2 < 0 || col2 >= sipCpp->numCols()) {
854			sipIsErr = 1;
855			PyErr_Format(PyExc_ValueError, "There's no column %d in table %s!", col2+1, sipCpp->name().ascii());
856		}
857	 } else {
858      PyObject *tmp = PyObject_Str(a1);
859		if (!tmp) {
860			sipIsErr = 1;
861			PyErr_Format(PyExc_TypeError, "Column argument must be either int or string.");
862		} else {
863			col2 = sipCpp->colNames().findIndex(PyString_AsString(tmp));
864			if (col2 < 0) {
865				sipIsErr = 1;
866				PyErr_Format(PyExc_ValueError, "There's no column named %s in table %s!", PyString_AsString(tmp),sipCpp->name().ascii());
867				Py_DECREF(tmp);
868			}
869		}
870	 }
871
872	if (sipIsErr == 0)
873		sipCpp->swapColumns(col, col2);
874%End
875
876void scrollToCell(SIP_PYOBJECT, int);
877%MethodCode
878  sipIsErr = 0;
879  CHECK_TABLE_COL(a0);
880  CHECK_TABLE_ROW(a1);
881  if (sipIsErr == 0)
882    sipCpp->table()->ensureCellVisible(row, col); // for some reason these indices seem to start at 1
883%End
884
885private:
886  Table(const Table&);
887};
888
889class QwtLinearColorMap
890{
891%TypeHeaderCode
892#include <qwt_color_map.h>
893%End
894public:
895
896  enum Format{RGB, Indexed};
897  enum Mode {FixedColors, ScaledColors};
898  QwtLinearColorMap(const QColor &, const QColor &, QwtLinearColorMap::Format=QwtColorMap::RGB);
899
900  void addColorStop (double, const QColor &);
901  void setMode (Mode);
902
903  void  setColorInterval (const QColor &, const QColor &);
904  QColor color1() const;
905  QColor color2() const;
906
907private:
908  QwtLinearColorMap(const QwtLinearColorMap&);
909};
910
911class LinearColorMap : QwtLinearColorMap
912{
913%TypeHeaderCode
914#include <LinearColorMap.h>
915%End
916public:
917
918  LinearColorMap();
919  LinearColorMap(const QColor &, const QColor &);
920  //! Set the intensity range
921  void setIntensityRange(double vmin, double vmax);
922  //! Get the lower range limit
923  double lowerBound();
924  //! Get the upper range limit
925  double upperBound();
926
927private:
928  LinearColorMap(const LinearColorMap&);
929};
930
931class Matrix: MdiSubWindow
932{
933%TypeHeaderCode
934#include "../src/matrix/Matrix.h"
935#define CHECK_MATRIX_COL(arg)\
936	int col = arg-1;\
937   if (col < 0 || col >= sipCpp->numCols()) {\
938		sipIsErr = 1;\
939		PyErr_Format(PyExc_ValueError, "There's no column %d in matrix %s!", col+1, sipCpp->name().ascii());\
940	}
941#define CHECK_MATRIX_ROW(arg)\
942   int row = arg-1;\
943	if (row < 0 || row >= sipCpp->numRows()) {\
944		sipIsErr = 1;\
945		PyErr_Format(PyExc_ValueError, "There's no row %d in matrix %s!", row+1, sipCpp->name().ascii());\
946	}
947%End
948public:
949  enum HeaderViewType{ColumnRow, XY};
950  enum ViewType{TableView, ImageView};
951  enum ImportMode{NewColumns, NewRows, Overwrite};
952  enum ResamplingMethod{Bilinear, Bicubic};
953
954  int numRows();
955  void setNumRows(int);
956  int numCols();
957  void setNumCols(int);
958  void setDimensions(int rows, int cols);
959  void resample(int rows, int cols, const ResamplingMethod& method = Matrix::Bilinear);
960  void smooth();
961
962  SIP_PYOBJECT text(int, int);
963%MethodCode
964	sipIsErr = 0;
965	CHECK_MATRIX_ROW(a0);
966	CHECK_MATRIX_COL(a1);
967	if (sipIsErr == 0)
968		sipRes = PyString_FromString(sipCpp->text(row, col));
969%End
970  double cell(int, int);
971%MethodCode
972	sipIsErr = 0;
973	CHECK_MATRIX_ROW(a0);
974	CHECK_MATRIX_COL(a1);
975	if (sipIsErr == 0)
976		sipRes = sipCpp->cell(row, col);
977%End
978  void setText(int, int, const QString&);
979%MethodCode
980	sipIsErr = 0;
981	CHECK_MATRIX_ROW(a0);
982	CHECK_MATRIX_COL(a1);
983	if (sipIsErr == 0)
984		sipCpp->setText(row, col, *a2);
985%End
986  void setCell(int, int, double);
987%MethodCode
988	sipIsErr = 0;
989	CHECK_MATRIX_ROW(a0);
990	CHECK_MATRIX_COL(a1);
991	if (sipIsErr == 0)
992		sipCpp->setCell(row, col, a2);
993%End
994
995	double dx();
996	double dy();
997    double xStart();
998	double xEnd();
999	double yStart();
1000	double yEnd();
1001    void setCoordinates(double xs, double xe, double ys, double ye);
1002
1003    void setFormula(const QString &);
1004    bool calculate(int startRow = 0, int endRow = -1, int startCol = 0, int endCol = -1, bool muParser = true);
1005
1006    void setNumericPrecision(int prec);
1007
1008    void transpose();
1009	void invert();
1010	void flipVertically();
1011	void flipHorizontally();
1012	void rotate90(bool = true);
1013	double determinant();
1014	double integrate();
1015
1016	void setViewType(ViewType, bool renderImage = true);
1017	void setHeaderViewType(HeaderViewType);
1018
1019	void setDefaultColorMap();
1020	void setGrayScale();
1021	void setRainbowColorMap();
1022	LinearColorMap *colorMapPointer()/PyName=colorMap/;
1023	void setColorMap(const LinearColorMap&);
1024
1025	void resetView();
1026
1027	QImage image();
1028	void importImage(const QString&);
1029	void exportRasterImage(const QString&, int = 100, int dpi = 0, int compression = 0);
1030	void exportToFile(const QString&)  /PyName=export/;
1031	void exportVector(const QString&, int = 0, bool = true);
1032
1033	void importASCII(const QString&, const QString&="\t", int=0, bool=false, bool=false,
1034			const QString&="#", ImportMode = Overwrite, const QLocale& = QLocale(), int = 0, int = -1);
1035	bool exportASCII(const QString&, const QString&="\t", bool=false);
1036
1037private:
1038  Matrix(const Matrix&);
1039};
1040
1041class ArrowMarker // : QwtPlotMarker
1042{
1043%TypeHeaderCode
1044#include "../src/plot2D/ArrowMarker.h"
1045%End
1046public:
1047
1048  ArrowMarker();
1049
1050  void setStartPoint(double, double) /PyName=setStart/;
1051  void setEndPoint(double, double) /PyName=setEnd/;
1052
1053  void setStyle(Qt::PenStyle);
1054  void setColor(const QColor&);
1055  void setWidth(double);
1056  void drawStartArrow(bool = true);
1057  void drawEndArrow(bool = true);
1058  void setHeadLength(int);
1059  void setHeadAngle(int);
1060  void fillArrowHead(bool = true);
1061
1062private:
1063  ArrowMarker(const ArrowMarker&);
1064};
1065
1066class FrameWidget : QWidget  /PyName=Frame/
1067{
1068%TypeHeaderCode
1069#include "../src/plot2D/FrameWidget.h"
1070%End
1071
1072public:
1073    enum FrameStyle{None = 0, Line = 1, Shadow = 2};
1074    enum Unit{Inch = 0, Millimeter, Centimeter, Point, Pixel, Scale};
1075
1076    double xValue();
1077	double yValue();
1078	void setOriginCoord(double, double);
1079	void setOrigin(int x, int y);
1080	void move(const QPoint&);
1081
1082	QRectF boundingRect();
1083	void setCoordinates(double left, double top, double right, double bottom);
1084    void setSize(int w, int h);
1085    void setSize(const QSize& newSize);
1086	void setRect(int x, int y, int w, int h);
1087
1088	double right();
1089	double bottom();
1090
1091	int frameStyle();
1092	void setFrameStyle(int);
1093
1094	QPen framePen();
1095	void setFramePen(const QPen&);
1096
1097	Qt::PenStyle frameLineStyle();
1098	void setFrameLineStyle(const Qt::PenStyle&);
1099
1100	QColor frameColor();
1101	void setFrameColor(const QColor&);
1102
1103	double frameWidth();
1104	void setFrameWidth(double);
1105
1106	QColor backgroundColor();
1107	void setBackgroundColor(const QColor&);
1108
1109	QBrush brush();
1110	void setBrush(const QBrush& );
1111
1112private:
1113  FrameWidget(const FrameWidget&);
1114};
1115
1116class ImageWidget : FrameWidget /PyName=Image/
1117{
1118%TypeHeaderCode
1119#include "../src/plot2D/ImageWidget.h"
1120%End
1121public:
1122
1123  ImageWidget(Graph *, const QString&);
1124  QString fileName();
1125  bool load(const QString& fn);
1126
1127private:
1128  ImageWidget(const ImageWidget&);
1129};
1130
1131class LegendWidget : FrameWidget /PyName=Legend/
1132{
1133%TypeHeaderCode
1134#include "../src/plot2D/LegendWidget.h"
1135%End
1136public:
1137
1138  void setText(const QString&);
1139  void setTextColor(const QColor&);
1140  void setFont(const QFont&);
1141  void setAngle(int);
1142  int angle();
1143
1144  bool isAutoUpdateEnabled();
1145  void setAutoUpdate(bool);
1146
1147private:
1148  LegendWidget(const LegendWidget&);
1149};
1150
1151class RectangleWidget : FrameWidget /PyName=Rectangle/
1152{
1153%TypeHeaderCode
1154#include "../src/plot2D/RectangleWidget.h"
1155%End
1156public:
1157
1158  RectangleWidget(Graph *);
1159
1160private:
1161  RectangleWidget(const RectangleWidget&);
1162};
1163
1164class EllipseWidget : FrameWidget /PyName=Ellipse/
1165{
1166%TypeHeaderCode
1167#include "../src/plot2D/EllipseWidget.h"
1168%End
1169public:
1170
1171  EllipseWidget(Graph *);
1172
1173private:
1174  EllipseWidget(const EllipseWidget&);
1175};
1176
1177class QwtSymbol /PyName = PlotSymbol/
1178{
1179%TypeHeaderCode
1180#include <qwt_symbol.h>
1181%End
1182	public:
1183	enum Style
1184	{
1185		NoSymbol = -1,
1186		Ellipse,
1187		Rect,
1188		Diamond,
1189		Triangle,
1190		DTriangle,
1191		UTriangle,
1192		LTriangle,
1193		RTriangle,
1194		Cross,
1195		XCross,
1196		HLine,
1197		VLine,
1198		Star1,
1199		Star2,
1200		Hexagon,
1201
1202		StyleCnt
1203	};
1204
1205	QwtSymbol();
1206	QwtSymbol(Style st, const QBrush &bd, const QPen &pn, const QSize &s);
1207
1208	void setSize(const QSize &s);
1209	void setSize(int a, int b = -1);
1210	void setBrush(const QBrush& b);
1211	void setPen(const QPen &p);
1212	void setStyle (Style s);
1213
1214	const QBrush& brush() const;
1215	const QPen& pen() const;
1216	const QSize& size() const;
1217	Style style() const;
1218
1219	private:
1220		QwtSymbol(const QwtSymbol&);
1221};
1222
1223class ImageSymbol: QwtSymbol
1224{
1225%TypeHeaderCode
1226#include <ImageSymbol.h>
1227%End
1228
1229public:
1230	ImageSymbol(const QString& fileName);
1231	ImageSymbol(const QPixmap& pixmap, const QString& fileName = QString());
1232
1233	QPixmap pixmap();
1234	QString imagePath();
1235
1236private:
1237	ImageSymbol(const ImageSymbol&);
1238};
1239
1240class QwtPlotCurve
1241{
1242%TypeHeaderCode
1243#include <qwt_plot_curve.h>
1244%End
1245	public:
1246		int dataSize() const;
1247		double x(int i) const;
1248		double y(int i) const;
1249		double minXValue() const;
1250		double maxXValue() const;
1251		double minYValue() const;
1252		double maxYValue() const;
1253
1254		void setPen(const QPen &);
1255		const QPen &pen() const;
1256
1257		void setBrush(const QBrush &);
1258		const QBrush &brush() const;
1259
1260		void setSymbol(const QwtSymbol &s);
1261		const QwtSymbol& symbol() const;
1262
1263		void setVisible(bool on);
1264		bool isVisible();
1265
1266		void setTitle (const QString &title);
1267
1268	private:
1269		QwtPlotCurve(const QwtPlotCurve&);
1270};
1271
1272class PlotCurve : QwtPlotCurve
1273{
1274%TypeHeaderCode
1275#include "../src/plot2D/PlotCurve.h"
1276%End
1277public:
1278	PlotCurve(const QString& name = QString());
1279
1280	int skipSymbolsCount();
1281	void setSkipSymbolsCount(int);
1282
1283private:
1284	PlotCurve(const PlotCurve&);
1285};
1286
1287class FunctionCurve : PlotCurve
1288{
1289%TypeHeaderCode
1290#include "../src/plot2D/FunctionCurve.h"
1291%End
1292public:
1293	enum FunctionType{Normal = 0, Parametric = 1, Polar = 2};
1294
1295	FunctionCurve(const QString& name = QString());
1296
1297	double startRange();
1298	double endRange();
1299	void setRange(double, double);
1300
1301	QStringList formulas();
1302	void setFormula(const QString& s);
1303	void setFormulas(const QString&, const QString&);
1304%MethodCode
1305		QStringList l;
1306		l << *a0;
1307		l << *a1;
1308		sipCpp->setFormulas(l);
1309%End
1310
1311	QString variable();
1312	void setVariable(const QString& s);
1313
1314	FunctionType functionType();
1315	void setFunctionType(const FunctionType& t);
1316
1317	//! Returns the number of parameters in your function formula
1318	int parametersCount();
1319	//! Returns the name of the parameter of rang index
1320	QString parameterName(int index);
1321	//! Returns the value of the parameter of rang index
1322	double parameterValue(int index);
1323	//! Returns the value of the name parameter
1324	double parameterValue(const QString& name);
1325
1326	bool loadData(int points = 0, bool xLog10Scale = false);
1327
1328private:
1329	FunctionCurve(const FunctionCurve&);
1330};
1331
1332class DataCurve : PlotCurve
1333{
1334%TypeHeaderCode
1335#include "../src/plot2D/PlotCurve.h"
1336%End
1337public:
1338	DataCurve(Table *t, const QString& xColName, const QString& name, int startRow = 0, int endRow = -1);
1339
1340	bool hasLabels();
1341	QString labelsColumnName();
1342	void setLabelsColumnName(const QString& name);
1343
1344    int labelsAlignment();
1345    void setLabelsAlignment(int flags);
1346
1347    int labelsXOffset();
1348    int labelsYOffset();
1349    void setLabelsOffset(int x, int y);
1350
1351    double labelsRotation();
1352    void setLabelsRotation(double angle);
1353
1354    QFont labelsFont();
1355    void setLabelsFont(const QFont& font);
1356
1357    QColor labelsColor();
1358    void setLabelsColor(const QColor& c);
1359
1360    bool labelsWhiteOut();
1361    void setLabelsWhiteOut(bool whiteOut = true);
1362
1363	Table* table();
1364
1365	int startRow();
1366	int endRow();
1367	void setRowRange(int startRow, int endRow);
1368
1369	bool isFullRange();
1370	void setFullRange();
1371
1372	bool updateData(Table *t, const QString& colName);
1373	void loadData();
1374
1375	//! The list of attached error bars.
1376	QList<ErrorBarsCurve *> errorBarsList();
1377	//! Remove a single error bars curve from the list of attached error bars.
1378	void removeErrorBars(ErrorBarsCurve *);
1379	//! Clears the list of attached error bars.
1380	void clearErrorBars();
1381
1382	void clearLabels();
1383
1384private:
1385	DataCurve(const DataCurve&);
1386};
1387
1388class ErrorBarsCurve : DataCurve
1389{
1390%TypeHeaderCode
1391#include "../src/plot2D/ErrorBarsCurve.h"
1392%End
1393public:
1394	enum Orientation{Horizontal = 0, Vertical = 1};
1395
1396	ErrorBarsCurve(int orientation, Table *t, const QString& name);
1397	ErrorBarsCurve(Table *t, const QString& name);
1398
1399	double errorValue(int i);
1400
1401	int capLength();
1402	void setCapLength(int t);
1403
1404	double width();
1405	void setWidth(double w);
1406
1407	QColor color();
1408	void setColor(const QColor& c);
1409
1410	int direction();
1411	void setDirection(int);
1412
1413	bool xErrors();
1414	void setXErrors(bool);
1415
1416	bool throughSymbol();
1417	void drawThroughSymbol(bool);
1418
1419	bool plusSide();
1420	void drawPlusSide(bool);
1421
1422	bool minusSide();
1423	void drawMinusSide(bool);
1424
1425	//! Returns the master curve to which this error bars curve is attached.
1426	DataCurve* masterCurve();
1427	void setMasterCurve(DataCurve *);
1428
1429	//! Causes the master curve to delete this curve from its managed error bars list.
1430	void detachFromMasterCurve();
1431
1432	void loadData();
1433
1434private:
1435	ErrorBarsCurve(const ErrorBarsCurve&);
1436};
1437
1438class PieCurve : DataCurve
1439{
1440%TypeHeaderCode
1441#include "../src/plot2D/PieCurve.h"
1442%End
1443public:
1444	PieCurve(Table *t, const QString& name, int startRow, int endRow);
1445	void clone(PieCurve* c);
1446
1447	double viewAngle();
1448	void setViewAngle(double);
1449
1450	double thickness();
1451	void setThickness(double);
1452
1453	double horizontalOffset();
1454	void setHorizontalOffset(double);
1455
1456	bool counterClockwise();
1457	void setCounterClockwise(bool);
1458
1459	double startAzimuth();
1460	void setStartAzimuth(double);
1461
1462	double labelsEdgeDistance();
1463	void setLabelsEdgeDistance(double);
1464
1465	bool labelsAutoFormat();
1466	void setLabelsAutoFormat(bool);
1467
1468	bool labelsValuesFormat();
1469	void setLabelValuesFormat(bool);
1470
1471	bool labelsPercentagesFormat();
1472	void setLabelPercentagesFormat(bool);
1473
1474	bool labelCategories();
1475	void setLabelCategories(bool);
1476
1477	bool fixedLabelsPosition();
1478	void setFixedLabelsPosition(bool);
1479
1480	QColor color(int i) const;
1481
1482	int radius();
1483	void setRadius(int);
1484
1485	Qt::BrushStyle pattern();
1486	void setBrushStyle(const Qt::BrushStyle&);
1487
1488	void setFirstColor(int);
1489	int firstColor();
1490
1491	void loadData();
1492	void clearLabels();
1493
1494	private:
1495		PieCurve(const PieCurve&);
1496};
1497
1498class VectorCurve : DataCurve
1499{
1500%TypeHeaderCode
1501#include "../src/plot2D/VectorCurve.h"
1502%End
1503public:
1504	enum VectorStyle{XYXY, XYAM};
1505	enum Position{Tail, Middle, Head};
1506
1507	VectorCurve(VectorStyle style, Table *t, const QString& xColName, const char *name,
1508				const QString& endCol1, const QString& endCol2, int startRow, int endRow);
1509
1510	QString vectorEndXAColName();
1511	QString vectorEndYMColName();
1512	void setVectorEnd(const QString& xColName, const QString& yColName);
1513
1514	double width();
1515	void setWidth(double);
1516
1517	QColor color();
1518	void setColor(const QColor&);
1519
1520	int headLength();
1521	void setHeadLength(int);
1522
1523	int headAngle();
1524	void setHeadAngle(int);
1525
1526	bool filledArrowHead();
1527	void fillArrowHead(bool);
1528
1529	int position();
1530	void setPosition(int);
1531
1532	int vectorStyle();
1533	void setVectorStyle(int);
1534
1535	void loadData();
1536
1537	QPen vectorPen();
1538	void setVectorPen(const QPen&);
1539
1540	private:
1541		VectorCurve(const VectorCurve&);
1542};
1543
1544class QwtHistogram : DataCurve /PyName=Histogram/
1545{
1546%TypeHeaderCode
1547#include "../src/plot2D/QwtHistogram.h"
1548%End
1549public:
1550	QwtHistogram(Table *t, const QString& name, int startRow = 0, int endRow = -1);
1551	QwtHistogram(Matrix *m);
1552
1553	void setBinning(double size, double begin, double end);
1554	void setAutoBinning(bool autoBin = true);
1555	double begin();
1556	double end();
1557	double binSize();
1558
1559	void loadData();
1560
1561	double mean();
1562	double standardDeviation();
1563	double minimum();
1564	double maximum();
1565
1566	Matrix* matrix();
1567
1568private:
1569	QwtHistogram(const QwtHistogram&);
1570};
1571
1572class BoxCurve : DataCurve
1573{
1574%TypeHeaderCode
1575#include "../src/plot2D/BoxCurve.h"
1576%End
1577public:
1578	enum BoxStyle{NoBox, Rect, Diamond, WindBox, Notch};
1579	enum Range{None, SD, SE, r25_75, r10_90, r5_95, r1_99, MinMax, UserDef};
1580
1581	BoxCurve(Table *t, const QString& name, int startRow = 0, int endRow = -1);
1582
1583	QwtSymbol::Style minStyle();
1584	void setMinStyle(QwtSymbol::Style s);
1585
1586	QwtSymbol::Style maxStyle();
1587	void setMaxStyle(QwtSymbol::Style s);
1588
1589	void setMeanStyle(QwtSymbol::Style s);
1590	QwtSymbol::Style meanStyle();
1591
1592	void setP99Style(QwtSymbol::Style s);
1593	QwtSymbol::Style p99Style();
1594
1595	void setP1Style(QwtSymbol::Style s);
1596	QwtSymbol::Style p1Style();
1597
1598	int boxStyle();
1599	void setBoxStyle(int);
1600
1601	int boxWidth();
1602	void setBoxWidth(int);
1603
1604	double boxRange();
1605	int boxRangeType();
1606	void setBoxRange(int type, double coeff);
1607
1608	double whiskersRange();
1609	int whiskersRangeType();
1610	void setWhiskersRange(int type, double coeff = 0.0);
1611
1612	void loadData();
1613
1614	QString statistics();
1615	double median();
1616	double quantile(double);
1617
1618private:
1619	BoxCurve(const BoxCurve&);
1620};
1621
1622class QwtPlotSpectrogram // : QwtPlotItem
1623{
1624%TypeHeaderCode
1625#include <qwt_plot_spectrogram.h>
1626%End
1627public:
1628	enum DisplayMode {
1629		ImageMode = 1,
1630		ContourMode = 2
1631	};
1632
1633	QwtPlotSpectrogram (const QString &title = QString::null);
1634	void setDefaultContourPen (const QPen &);
1635	void setDisplayMode (DisplayMode mode, bool on = true);
1636
1637private:
1638	QwtPlotSpectrogram(const QwtPlotSpectrogram&);
1639};
1640
1641class Spectrogram : QwtPlotSpectrogram
1642{
1643%TypeHeaderCode
1644#include "../src/plot2D/Spectrogram.h"
1645%End
1646public:
1647
1648	Spectrogram(Graph *graph, Matrix *m);
1649
1650	Matrix * matrix();
1651	bool setMatrix(Matrix *, bool = false);
1652
1653	int levels();
1654	void setLevelsNumber(int);
1655	void setContourLevels (SIP_PYTUPLE);
1656%MethodCode
1657  QList<double> l;
1658  int n = PyTuple_Size(a0);
1659  for (int i=0; i<n; i++) {
1660    PyObject *element = PyTuple_GET_ITEM(a0,i);
1661    if (element) {
1662		l << PyFloat_AS_DOUBLE(element);
1663		Py_DECREF(element);
1664	 } else {
1665		sipIsErr = 1;
1666		break;
1667    }
1668  }
1669  sipCpp->setContourLevels(l);
1670%End
1671
1672	bool hasColorScale();
1673	int colorScaleAxis();
1674	void showColorScale(int axis, bool on = true);
1675
1676	int colorBarWidth();
1677	void setColorBarWidth(int width);
1678
1679	void setGrayScale();
1680	void setDefaultColorMap();
1681
1682	LinearColorMap *colorMapPointer()/PyName=colorMap/;
1683	void setCustomColorMap(const LinearColorMap& map);
1684
1685	bool hasLabels();
1686	void showContourLineLabels(bool show = true);
1687
1688	QFont labelsFont();
1689	void setLabelsFont(const QFont& font);
1690
1691	QColor labelsColor();
1692	void setLabelsColor(const QColor& c);
1693
1694	bool labelsWhiteOut();
1695	void setLabelsWhiteOut(bool whiteOut = true);
1696
1697	double labelsXOffset();
1698    double labelsYOffset();
1699    void setLabelsOffset(double x, double y);
1700
1701	double labelsRotation();
1702    void setLabelsRotation(double angle);
1703
1704    bool useMatrixFormula();
1705    bool setUseMatrixFormula(bool on = true);
1706
1707    void setColorMapPen(bool on = true);
1708    void setContourLinePen(int, const QPen &);
1709	void updateData();
1710
1711private:
1712	Spectrogram(const Spectrogram&);
1713};
1714
1715class Grid // : QwtPlotGrid
1716{
1717%TypeHeaderCode
1718#include "../src/plot2D/Grid.h"
1719%End
1720public:
1721
1722	Grid();
1723
1724	void enableX(bool = true) /PyName=enableXMax/;
1725	bool xEnabled() /PyName=xMaxEnabled/;
1726	void enableXMin(bool = true);
1727	bool xMinEnabled();
1728
1729	void enableY(bool = true) /PyName=enableYMax/;
1730	bool yEnabled() /PyName=yMaxEnabled/;
1731	void enableYMin(bool = true);
1732	bool yMinEnabled();
1733
1734	bool xZeroLineEnabled();
1735	void enableZeroLineX(bool = true);
1736	bool yZeroLineEnabled();
1737	void enableZeroLineY(bool = true);
1738	const QPen& xZeroLinePen();
1739	void setXZeroLinePen(const QPen &p);
1740	const QPen& yZeroLinePen();
1741	void setYZeroLinePen(const QPen &p);
1742
1743	void setMajPenX(const QPen &p);
1744	const QPen& majPenX();
1745
1746	void setMinPenX(const QPen &p);
1747	const QPen& minPenX();
1748
1749	void setMajPenY(const QPen &p);
1750	const QPen& majPenY();
1751
1752	void setMinPenY(const QPen &p);
1753	const QPen& minPenY();
1754
1755private:
1756	Grid(const Grid&);
1757};
1758
1759class QwtPlot : QFrame
1760{
1761%TypeHeaderCode
1762#include "qwt_plot.h"
1763%End
1764
1765private:
1766  QwtPlot(const QwtPlot&);
1767};
1768
1769class Graph : QwtPlot /PyName=Layer/
1770{
1771%TypeHeaderCode
1772#include "../src/plot2D/Graph.h"
1773#include "../src/plot2D/LegendWidget.h"
1774%End
1775public:
1776  enum Scale{Linear, Log10, Ln, Log2, Reciprocal, Probability, Logit};
1777  enum Axis{Left, Right, Bottom, Top};
1778  enum TicksStyle{NoTicks = 0, Out = 1, InOut = 2, In = 3};
1779  enum CurveType{Line, Scatter, LineSymbols, VerticalBars, Area, Pie, VerticalDropLines,
1780			Spline, HorizontalSteps, Histogram, HorizontalBars, VectXYXY, ErrorBars,
1781			Box, VectXYAM, VerticalSteps, ColorMap, GrayScale, Contour, Function, ImagePlot,
1782			StackBar, StackColumn};
1783
1784  bool isPiePlot();
1785  SIP_PYOBJECT pieLegendText() /PyName=pieLegend/;
1786%MethodCode
1787  sipRes = PyString_FromString(sipCpp->pieLegendText());
1788%End
1789
1790  DataCurve* insertCurve(Table*, const QString&, int style = 1, int startRow = 0, int endRow = -1);
1791  DataCurve* insertCurve(Table*, const QString&, const QString&, int style = 1, int startRow = 0, int endRow = -1);
1792  bool addCurves(Table*, SIP_PYTUPLE, int=0, double=1, int=3, int=0, int=-1);
1793%MethodCode
1794  QStringList l;
1795  int n = PyTuple_Size(a1);
1796  for (int i=0; i<n; i++) {
1797    PyObject *str = PyObject_Str(PyTuple_GET_ITEM(a1,i));
1798    if (str) {
1799      l << PyString_AsString(str);
1800		Py_DECREF(str);
1801	 } else {
1802      sipIsErr = 1;
1803      break;
1804    }
1805  }
1806  sipRes = sipCpp->addCurves(a0, l, a2, a3, a4, a5, a6);
1807%End
1808
1809  bool addCurve(Table*, const QString&, int=0, double=1, int=3, int=0, int=-1);
1810%MethodCode
1811	if (a0 == 0) {
1812	   sipIsErr = 1;
1813	   PyErr_Format(PyExc_ValueError, "Invalid table in addCurve().");
1814	} else {
1815	  QStringList l;
1816	  l << *a1;
1817	  sipRes = sipCpp->addCurves(a0, l, a2, a3, a4, a5, a6);
1818	}
1819%End
1820  void removeCurve(int);
1821  void removeCurve(const QString&);
1822  void removeCurve(QwtPlotCurve*);
1823  void deleteFitCurves();
1824  int curveCount() /PyName=numCurves/;
1825  PlotCurve* curve(int index);
1826  PlotCurve* curve(const QString &title);
1827  QString curveTitle(int);
1828  DataCurve* dataCurve(int index);
1829
1830  void plotBox(Table *, const QStringList& names, int startRow = 0, int endRow = -1);
1831  BoxCurve * boxCurve(int index);
1832
1833  void changeCurveIndex(int fromIndex, int toIndex);
1834  void reverseCurveOrder();
1835
1836  void setCurveLineColor(int, int);
1837  void setCurveLineColor(int, QColor);
1838  void setCurveLineStyle(int, Qt::PenStyle);
1839  void setCurveLineWidth(int, double);
1840
1841  void showMissingDataGap(bool on = true, bool update = true);
1842  bool isMissingDataGapEnabled();
1843
1844  void setGrayScale();
1845  void setIndexedColors();
1846
1847	FunctionCurve * functionCurve(int index);
1848	FunctionCurve* addFunction(const QString&, double, double, int=100);
1849%MethodCode
1850  QStringList l;
1851  l << *a0;
1852  sipRes = sipCpp->addFunction(l, a1, a2, a3);
1853%End
1854	FunctionCurve* addPolarFunction(const QString&, const QString&, double, double, int=100, const QString & = "t");
1855%MethodCode
1856  QStringList l;
1857  l << *a0;
1858  l << *a1;
1859  sipRes = sipCpp->addFunction(l, a2, a3, a4, *a5, 2);
1860%End
1861	FunctionCurve* addParametricFunction(const QString&, const QString&, double, double, int=100, const QString & = "m");
1862%MethodCode
1863  QStringList l;
1864  l << *a0;
1865  l << *a1;
1866  sipRes = sipCpp->addFunction(l, a2, a3, a4, *a5, 1);
1867%End
1868
1869  ErrorBarsCurve* addErrorBars(const QString&, Table *, const QString&,
1870		  int type = 1, double width = 1, int cap = 8, const QColor& color = QColor(Qt::black),
1871		  bool through = true, bool minus = true, bool plus = true);
1872  ErrorBarsCurve* addErrorBars(DataCurve *, Table *, const QString&,
1873		  int type = 1, double width = 1, int cap = 8, const QColor& color = QColor(Qt::black),
1874		  bool through = true, bool minus = true, bool plus = true);
1875
1876  QwtHistogram* addHistogram(Matrix*);
1877  Spectrogram* plotSpectrogram(Matrix *m, CurveType type);
1878  Spectrogram* spectrogram(Matrix *m);
1879
1880  PieCurve* plotPie(Table*,const QString&, int startRow = 0, int endRow = -1);
1881  VectorCurve* plotVectors(Table*, const QStringList& colList, int style, int startRow = 0, int endRow = -1);
1882
1883  ArrowMarker* addArrow(ArrowMarker*);
1884  void remove(ArrowMarker*);
1885  QList<ArrowMarker *> arrowsList();
1886  int numArrows();
1887
1888  ImageWidget* addImage(ImageWidget*);
1889  ImageWidget* addImage(const QString&);
1890  ImageWidget* addImage(const QImage&);
1891  void remove(ImageWidget*);
1892
1893  void setTitle(const QString& t);
1894  void setTitleFont(const QFont &fnt);
1895  void setTitleColor(const QColor &c);
1896  void setTitleAlignment(int align);
1897  void removeTitle();
1898
1899  LegendWidget* newLegend(const QString& = QString());
1900  void setLegend(const QString&);
1901
1902  LegendWidget* legend();
1903  void removeLegend();
1904
1905  LegendWidget* addText(LegendWidget*);
1906  void remove(LegendWidget*);
1907
1908  LegendWidget* addTimeStamp();
1909
1910  FrameWidget* add(FrameWidget*, bool = true);
1911  void remove(FrameWidget*);
1912
1913  void setXAxisTitle(const QString& text) /PyName=setXTitle/;
1914  void setYAxisTitle(const QString& text) /PyName=setYTitle/;
1915
1916  void enableAxis(int axis, bool on = true);
1917  void setAxisColor(int axis, const QColor& color);
1918  void setAxisFont(int axis, const QFont &fnt);
1919
1920  void setAxisTitle(int axis, const QString& text);
1921  void setAxisTitleFont(int axis,const QFont &fnt);
1922  void setAxisTitleColor(int axis, const QColor& c);
1923  void setAxisTitleAlignment(int axis, int align);
1924
1925  int axisTitleDistance(int axis);
1926  void setAxisTitleDistance(int axis, int dist);
1927
1928  void setAxisTicksLength(int axis, int majTicksType, int minTicksType, int minLength, int majLength);
1929  void setAxisLabelRotation(int axis, int rotation);
1930
1931  void setAxesLinewidth(int width);
1932  void drawAxesBackbones(bool yes);
1933  void setTicksLength(int minLength, int majLength);
1934
1935  void setMajorTicksType(int axis, int type);
1936  void setMinorTicksType(int axis, int type);
1937
1938  void enableAxisLabels(int axis, bool on);
1939  void setAxisLabelsColor(int axis, const QColor& color);
1940  void setLabelsNumericFormat(int axis, int format, int = 6, const QString& = QString()) /PyName=setAxisNumericFormat/;
1941  void setScale(int axis, double start, double end, double step = 0.0,
1942                int majorTicks = 5, int minorTicks = 5, int type = 0, bool inverted = false,
1943				double left_break = -DBL_MAX, double right_break = DBL_MAX, int pos = 50,
1944				double stepBeforeBreak = 0.0, double stepAfterBreak = 0.0, int minTicksBeforeBreak = 4,
1945				int minTicksAfterBreak = 4, bool log10AfterBreak = false, int breakWidth = 4, bool breakDecoration = true);
1946  void setAutoScale();
1947  void setMargin(int);
1948  void setFrame(int width = 1, const QColor& color = QColor(Qt::black));
1949  void setCanvasFrame(int width = 1, const QColor& color =  QColor(Qt::black));
1950  void setBackgroundColor(const QColor& color);
1951  void setCanvasBackground(const QColor& color) /PyName=setCanvasColor/;
1952
1953  QPixmap backgroundPixmap();
1954  QString canvasBackgroundFileName();
1955  void setCanvasBackgroundImage (const QString & = QString(), bool = true);
1956
1957  void setCanvasGeometry(int x, int y, int w, int h);
1958  void setCanvasGeometry(const QRect &canvasRect);
1959  void setCanvasSize(int w, int h);
1960  void setCanvasSize(const QSize &size);
1961
1962  Grid* grid();
1963  void showGrid(int);
1964  void showGrid();
1965  void setGridOnTop(bool on = true, bool update = true);
1966  bool hasGridOnTop();
1967
1968  void replot();
1969
1970  void exportTeX(const QString& fname, bool color = true, bool escapeStrings = true, bool fontSizes = true,
1971				const QSizeF& customSize = QSizeF(), int unit = FrameWidget::Pixel, double fontsFactor = 1.0)/PyName=exportTex/;
1972  void exportImage(const QString& fileName, int quality = 100, bool transparent = false, int dpi = 0,
1973		const QSizeF& customSize = QSizeF(), int unit = FrameWidget::Pixel, double fontsFactor = 1.0, int compression = 0);
1974  void exportVector(const QString&, int = 0, bool = true,
1975				const QSizeF& customSize = QSizeF(), int unit = FrameWidget::Pixel, double fontsFactor = 1.0);
1976  void exportToFile(const QString& fileName) /PyName=export/;
1977
1978  void enableAutoscaling(bool = true);
1979  void setAutoscaleFonts(bool = true);
1980  void setAntialiasing(bool on = true, bool update = true);
1981
1982    void setCurveAxes(int,int,int);
1983%MethodCode
1984	sipIsErr = 0;
1985	if ((a1)>1 || (a1<0) || (a2>1) || (a2<0))
1986    {
1987         sipIsErr=1;
1988         PyErr_Format(PyExc_ValueError, "Invalid axis attachment!");\
1989    }
1990	if (a0>=sipCpp->curveCount())
1991	{
1992         sipIsErr=1;
1993         PyErr_Format(PyExc_ValueError, "Invalid curve index! is %d, should be less than %d",a0,sipCpp->curveCount());\
1994	}
1995	if (sipIsErr == 0)
1996	{
1997        QwtPlotItem* pItem;
1998		pItem = sipCpp->plotItem(a0);
1999		pItem->setAxis(a1 + 2, a2);
2000		sipCpp->setAutoScale();
2001	}
2002%End
2003
2004  void setWaterfallSideLines(bool = true);
2005  void setWaterfallFillColor(const QColor&);
2006  void setWaterfallOffset(int x, int y, bool = true);
2007
2008private:
2009  Graph(const Graph&);
2010};
2011
2012class MultiLayer : MdiSubWindow /PyName=Graph/
2013{
2014%TypeHeaderCode
2015#include "../src/plot2D/MultiLayer.h"
2016%End
2017public:
2018
2019  enum HorAlignement{HCenter, Left, Right};
2020  enum VertAlignement{VCenter, Top, Bottom};
2021  enum AlignPolicy{AlignLayers = 0, AlignCanvases};
2022
2023  Graph *activeLayer();
2024  void setActiveLayer(Graph*);
2025  int numLayers();
2026  void setNumLayers(int n);
2027  Graph* layer(int num);
2028  QList<Graph *> layersList();
2029  Graph* addLayer(int = 0, int = 0, int = 0, int = 0, bool = false);
2030
2031  bool removeLayer(Graph *g);
2032  bool removeActiveLayer();
2033
2034  void setCols(int);
2035  void setRows(int);
2036  void setSpacing (int, int);
2037  void setMargins (int, int, int, int);
2038  void setLayerCanvasSize (int, int);
2039  void setAlignement (int, int);
2040  void arrangeLayers(bool fit = true, bool userSize = false);
2041  bool swapLayers(int, int);
2042
2043  void setScaleLayersOnResize(bool = true);
2044  void setEqualSizedLayers();
2045
2046  void setAlignPolicy(const AlignPolicy& policy);
2047  void setCommonLayerAxes(bool verticalAxis = true, bool horizontalAxis = true);
2048  void linkXLayerAxes(bool = true);
2049
2050  void exportToFile(const QString& fileName) /PyName=export/;
2051  void exportImage(const QString& fileName, int quality = 100, bool transparent = false,
2052		int dpi = 0, const QSizeF& customSize = QSizeF(), int unit = FrameWidget::Pixel,
2053		double fontsFactor = 1.0, int compression = 0);
2054  void exportVector(const QString&, int = 0, bool = true,
2055		const QSizeF& customSize = QSizeF(), int unit = FrameWidget::Pixel, double fontsFactor = 1.0);
2056  void exportTeX(const QString& fname, bool color = true, bool escapeStrings = true, bool fontSizes = true,
2057		const QSizeF& customSize = QSizeF(), int unit = FrameWidget::Pixel, double fontsFactor = 1.0)/PyName=exportTex/;
2058
2059  void reverseWaterfallOrder();
2060
2061private:
2062  MultiLayer(const MultiLayer&);
2063};
2064
2065class Note: MdiSubWindow
2066{
2067%TypeHeaderCode
2068#include "../src/scripting/Note.h"
2069%End
2070public:
2071  bool autoexec() const;
2072  void setAutoexec(bool = true);
2073
2074  QString text();
2075  void setText(const QString &s);
2076
2077  void exportPDF(const QString& fileName);
2078  QString exportASCII(const QString &file=QString::null)/PyName=saveAs/;
2079  QString importASCII(const QString &file=QString::null);
2080
2081  void showLineNumbers(bool = true);
2082
2083  void setFont(const QFont& f);
2084  void setTabStopWidth(int length);
2085
2086  int tabs();
2087  void addTab();
2088  void removeTab(int = -1);
2089  void renameTab(int, const QString&);
2090
2091  int indexOf(ScriptEdit*);
2092  ScriptEdit* editor(int index);
2093  ScriptEdit* currentEditor();
2094
2095private:
2096  Note(const Note&);
2097};
2098
2099class Graph3D: MdiSubWindow
2100{
2101%TypeHeaderCode
2102#include "../src/plot3D/Graph3D.h"
2103%End
2104public:
2105	enum PlotType{Scatter = 0, Trajectory = 1, Bars = 2, Ribbon = 3};
2106	enum AxisNumericFormat{Default = 0, Decimal = 1, Scientific = 2, Engineering = 3};
2107
2108    void exportToFile(const QString& fileName) /PyName=export/;
2109    void exportVector(const QString& fileName, int = 0, int = 1,
2110		const QSizeF& customSize = QSizeF(), int unit = FrameWidget::Pixel, double fontsFactor = 1.0);
2111	void exportImage(const QString& fileName, int quality = 100, bool transparent = false, int dpi = 0,
2112		const QSizeF& customSize = QSizeF(), int unit = FrameWidget::Pixel, double fontsFactor = 1.0, int compression = 0);
2113
2114    void setRotation(double xVal, double yVal, double zVal);
2115	void setScale(double xVal, double yVal, double zVal);
2116	void setShift(double xVal, double yVal, double zVal);
2117    void setZoom(double val);
2118    void setOrthogonal(bool = true);
2119    void setMeshLineWidth(int);
2120	void setMeshColor(const QColor&);
2121	void setAxesColor(const QColor&);
2122	void setNumbersColor(const QColor&);
2123	void setLabelsColor(const QColor&);
2124    void setLabelsDistance(int);
2125	void setBackgroundColor(const QColor&);
2126	void setGridColor(const QColor&);
2127    void setDataColors(const QColor&, const QColor&);
2128	QString colorMapFile();
2129    void setDataColorMap(const QString& fileName);
2130	LinearColorMap *colorMapPointer()/PyName=colorMap/;
2131	void setDataColorMap(const LinearColorMap&);
2132
2133    void changeTransparency(double) /PyName=setOpacity/;
2134    void setResolution(int);
2135    void showColorLegend(bool = true) /PyName=showLegend/;
2136    void setTitle(const QString&, const QColor& color = QColor(Qt::black), const QFont& font = QFont());
2137    void setAntialiasing(bool = true);
2138    void setLeftGrid(bool = true);
2139	void setRightGrid(bool = true);
2140	void setCeilGrid(bool = true);
2141	void setFloorGrid(bool = true);
2142	void setFrontGrid(bool = true);
2143	void setBackGrid(bool = true);
2144
2145    void setFramed();
2146	void setBoxed();
2147	void setNoAxes();
2148
2149	void setFloorData() /PyName=showFloorProjection/;
2150	void setFloorIsolines() /PyName=showFloorIsolines/;
2151	void setEmptyFloor();
2152
2153    void setPolygonStyle();
2154	void setHiddenLineStyle();
2155	void setWireframeStyle();
2156	void setFilledMeshStyle();
2157	void setDotStyle();
2158	void setBarStyle();
2159    void setConeStyle();
2160    void setCrossStyle();
2161
2162    void setConeOptions(double rad, int quality);
2163    void setCrossOptions(double rad, double linewidth, bool smooth, bool boxed);
2164    void setDotOptions(double size, bool smooth);
2165    void setBarRadius(double rad);
2166    void setBarLines(bool lines = true);
2167    void setFilledBars(bool filled = true);
2168
2169    void animate(bool = true);
2170    void findBestLayout();
2171
2172    void changeDataColumn(Table* table, const QString& colName, int = 0) /PyName=setData/;
2173    void addMatrixData(Matrix* ) /PyName=setMatrix/;
2174    void addFunction(const QString&, double, double, double, double, double, double, int = 40, int = 40) /PyName=setFunction/;
2175    void addParametricSurface(const QString&, const QString&, const QString&, double,
2176                        double, double, double, int=40, int=40, bool=true, bool=true) /PyName=setParametricSurface/;
2177
2178    void update();
2179
2180    void setXAxisLabel(const QString&);
2181    void setYAxisLabel(const QString&);
2182	void setZAxisLabel(const QString&);
2183
2184	void setXAxisTickLength(double majorLength, double minorLength);
2185    void setYAxisTickLength(double majorLength, double minorLength);
2186	void setZAxisTickLength(double majorLength, double minorLength);
2187
2188	void setScales(double xl, double xr, double yl, double yr, double zl, double zr, int axis = -1);
2189
2190	int axisNumericFormat(int axis);
2191	int axisNumericPrecision(int axis);
2192	void setAxisNumericFormat(int axis, int format, int precision);
2193	void setXAxisNumericFormat(int format, int precision);
2194%MethodCode
2195	sipCpp->setAxisNumericFormat(0, a0, a1);
2196%End
2197
2198 void setYAxisNumericFormat(int format, int precision);
2199%MethodCode
2200	sipCpp->setAxisNumericFormat(1, a0, a1);
2201%End
2202
2203 void setZAxisNumericFormat(int format, int precision);
2204%MethodCode
2205	sipCpp->setAxisNumericFormat(2, a0, a1);
2206%End
2207
2208private:
2209  Graph3D(const Graph3D&);
2210};
2211
2212class ApplicationWindow: QMainWindow
2213{
2214%TypeHeaderCode
2215#include "../src/core/ApplicationWindow.h"
2216%End
2217%ConvertToSubClassCode
2218// we have to do this to override casting in qt/qobject.sip
2219 sipClass = sipFindClass(sipCpp->className());
2220%End
2221
2222public:
2223  enum MatrixToTableConversion{Direct, XYZ, YXZ};
2224
2225  Table* table(const QString&);
2226%MethodCode
2227  sipRes = sipCpp->current_folder->table(*a0, false);
2228  if(!sipRes)
2229    sipRes = sipCpp->projectFolder()->table(*a0, true);
2230%End
2231  Table* newTable();
2232  Table* currentTable();
2233  Table* newTable(const QString&, int=30, int=2);
2234%MethodCode
2235  sipRes = sipCpp->newTable(*a0, a1, a2);
2236%End
2237  Matrix* matrix(const QString&);
2238%MethodCode
2239  sipRes = sipCpp->current_folder->matrix(*a0, false);
2240  if(!sipRes)
2241    sipRes = sipCpp->projectFolder()->matrix(*a0, true);
2242%End
2243  Matrix* newMatrix();
2244  Matrix* currentMatrix();
2245  Matrix* newMatrix(const QString&, int=32, int=32);
2246  MultiLayer *plot(const QString&) /PyName=graph/;
2247%MethodCode
2248  sipRes = sipCpp->current_folder->graph(*a0, false);
2249  if(!sipRes)
2250    sipRes = sipCpp->projectFolder()->graph(*a0, true);
2251%End
2252  MultiLayer* currentPlot() /PyName=currentGraph/;
2253
2254  MultiLayer* newGraph(const QString& = "Graph1", int = 1, int = 1, int = 1);
2255%MethodCode
2256	if (a1 == 1)
2257		sipRes = sipCpp->newGraph(*a0);
2258	else
2259		sipRes = sipCpp->multilayerPlot(*a0, a1, a2, a3);
2260%End
2261
2262  Note *note(const QString&);
2263%MethodCode
2264  sipRes = sipCpp->current_folder->note(*a0, false);
2265  if(!sipRes)
2266    sipRes = sipCpp->projectFolder()->note(*a0, true);
2267%End
2268  Note* newNote(const QString& = QString::null);
2269  Note* currentNote();
2270  MultiLayer *multilayerPlot(Table*, SIP_PYTUPLE, int=1) /PyName=plot/;
2271%MethodCode
2272	if (a0 == 0) {
2273	   sipIsErr = 1;
2274	   PyErr_Format(PyExc_ValueError, "Invalid table in argument to plot().");
2275	} else {
2276	  QStringList l;
2277	  int n = PyTuple_Size(a1);
2278	  for (int i=0; i<n; i++) {
2279		PyObject *str = PyObject_Str(PyTuple_GET_ITEM(a1,i));
2280		if (str) {
2281		  l << PyString_AsString(str);
2282			Py_DECREF(str);
2283		 } else {
2284		  sipIsErr = 1;
2285		  break;
2286		}
2287	  }
2288	  sipRes = sipCpp->multilayerPlot(a0, l, a2);
2289	}
2290%End
2291  MultiLayer *multiLayerPlot(Table*, const QString&, int=1) /PyName=plot/;
2292%MethodCode
2293	if (a0 == 0) {
2294	   sipIsErr = 1;
2295	   PyErr_Format(PyExc_ValueError, "Invalid table in argument to plot().");
2296	} else {
2297	  QStringList l;
2298	  l << *a1;
2299	  sipRes = sipCpp->multilayerPlot(a0, l, a2);
2300	}
2301%End
2302
2303	MultiLayer *waterfallPlot(Table*, SIP_PYTUPLE);
2304%MethodCode
2305	if (a0 == 0) {
2306	   sipIsErr = 1;
2307	   PyErr_Format(PyExc_ValueError, "Invalid table in argument to waterfallPlot().");
2308	} else {
2309	  QStringList l;
2310	  int n = PyTuple_Size(a1);
2311	  for (int i=0; i<n; i++) {
2312		PyObject *str = PyObject_Str(PyTuple_GET_ITEM(a1,i));
2313		if (str) {
2314		  l << PyString_AsString(str);
2315			Py_DECREF(str);
2316		 } else {
2317		  sipIsErr = 1;
2318		  break;
2319		}
2320	  }
2321	  sipRes = sipCpp->waterfallPlot(a0, l);
2322	}
2323%End
2324
2325	Matrix* importImage(const QString&, bool);
2326	MultiLayer* plotSpectrogram(Matrix*, Graph::CurveType = Graph::ColorMap) /PyName=plot/;
2327	MultiLayer* plotImageProfiles(Matrix*);
2328	MultiLayer* plot(const QString&, double, double, int = 100);
2329%MethodCode
2330  QStringList l;
2331  l << *a0;
2332  sipRes = sipCpp->newFunctionPlot(l, a1, a2, a3);
2333%End
2334
2335  Graph3D *plot3D(const QString&);
2336%MethodCode
2337  sipRes = sipCpp->current_folder->plot3D(*a0, false);
2338  if(!sipRes)
2339    sipRes = sipCpp->projectFolder()->plot3D(*a0, true);
2340%End
2341
2342    Graph3D* newPlot3D(const QString& = QString());
2343    Graph3D* plotXYZ(Table* table, const QString&, int = 0) /PyName=plot3D/;
2344	Graph3D* plot3DMatrix(Matrix *, int style = 5) /PyName=plot3D/;
2345    Graph3D* plotSurface(const QString&, double xl, double xr, double yl, double yr,
2346			double zl, double zr, int=40, int=40) /PyName=plot3D/;
2347    Graph3D* plotParametricSurface(const QString&, const QString&, const QString&,
2348            double, double, double, double, int=40, int=40, bool=true, bool=true) /PyName=plot3D/;
2349
2350  QList<MdiSubWindow*> windowsList() /PyName=windows/;
2351
2352  // folders
2353  Folder *activeFolder() /NoDerived/;
2354%MethodCode
2355  sipRes = sipCpp->current_folder;
2356%End
2357
2358  Folder* appendProject(const QString& file_name, Folder* parentFolder = 0);
2359  void saveFolder(Folder *folder, const QString& fn, bool=false);
2360  Folder* projectFolder() /PyName=rootFolder/;
2361
2362  Folder* addFolder(QString name, Folder* parent = 0);
2363  bool deleteFolder(Folder *);
2364  bool changeFolder(Folder *, bool force = false);
2365  bool copyFolder(Folder *src, Folder *dest);
2366
2367  MdiSubWindow* openTemplate(const QString&);
2368  void saveAsTemplate(MdiSubWindow*, const QString&);
2369
2370  void setWindowName(MdiSubWindow *, const QString &);
2371  void setPreferences(Graph*);
2372
2373  void saveProjectAs(const QString& fileName = QString(), bool = false);
2374  MdiSubWindow* clone(MdiSubWindow*);
2375
2376  Matrix* tableToMatrix(Table* t);
2377  Matrix* tableToMatrixRegularXYZ(Table* t, const QString& colName);
2378  Table* matrixToTable(Matrix* m, MatrixToTableConversion = Direct);
2379
2380  QTextEdit *resultsLog();
2381  void displayInfo(const QString& text);
2382  QLineEdit *infoLineEdit();
2383  QString stemPlot(Table *t, const QString& colName, int power = 1001, int startRow = 0, int endRow = -1);
2384
2385  QMdiArea* workspace();
2386  Table* importOdfSpreadsheet(const QString& = QString::null, int = -1);
2387  Table* importExcel(const QString& = QString::null, int = -1);
2388  Table* importWaveFile();
2389
2390private:
2391  ApplicationWindow(const ApplicationWindow&);
2392};
2393
2394class Fit : Filter
2395{
2396%TypeHeaderCode
2397#include "../src/analysis/Fit.h"
2398%End
2399public:
2400  enum Algorithm{ScaledLevenbergMarquardt, UnscaledLevenbergMarquardt, NelderMeadSimplex};
2401  enum WeightingMethod{NoWeighting, Instrumental, Statistical, Dataset, Direct};
2402
2403  Fit(ApplicationWindow* /TransferThis/, Graph*=0, const char*=0);
2404  ~Fit();
2405
2406  virtual void fit();
2407  virtual bool run();
2408
2409  bool setWeightingData(WeightingMethod, const QString&=QString::null);
2410  bool setDataFromTable(Table *, const QString&, const QString&, int = 1, int = -1, bool = false);
2411  void setInterval(double from, double to);
2412
2413  QString formula();
2414  QString resultFormula();
2415  int numParameters();
2416  QStringList parameterNames();
2417
2418  void setInitialGuess(int, double) /PyName=setInitialValue/;
2419  void setInitialGuesses(...) /PyName=setInitialValues/;
2420%MethodCode
2421int n = PyTuple_GET_SIZE(a0);
2422double *values = new double[n];
2423for (int i=0; i<n; i++) {
2424  PyObject *item = PyTuple_GET_ITEM(a0, i);
2425  if (PyNumber_Check(item)) {
2426    item=PyNumber_Float(item);
2427    if (!item) {
2428      sipIsErr=1;
2429      break;
2430    }
2431    values[i] = PyFloat_AS_DOUBLE(item);
2432    Py_DECREF(item);
2433  } else
2434    values[i] = 0;
2435}
2436sipCpp->setInitialGuesses(values);
2437delete values;
2438%End
2439
2440  virtual void guessInitialValues();
2441  void setParameterRange(int, double, double);
2442
2443  void setAlgorithm(Algorithm);
2444  void setOutputPrecision(int);
2445  void generateFunction(bool, int=100);
2446
2447  void showLegend();
2448  virtual QString legendInfo();
2449
2450  void scaleErrors(bool yes = true);
2451
2452  SIP_PYTUPLE results();
2453%MethodCode
2454double *results = sipCpp->results();
2455int size=sipCpp->numParameters();
2456sipRes = PyTuple_New(size);
2457if(sipRes)
2458{
2459  for(int i=0; i<size; i++)
2460    PyTuple_SET_ITEM(sipRes, i, PyFloat_FromDouble(results[i]));
2461} else
2462  sipIsErr = 1;
2463%End
2464
2465  SIP_PYTUPLE errors();
2466%MethodCode
2467double *errors = sipCpp->errors();
2468int size=sipCpp->numParameters();
2469sipRes = PyTuple_New(size);
2470if(sipRes)
2471{
2472  for(int i=0; i<size; i++)
2473    PyTuple_SET_ITEM(sipRes, i, PyFloat_FromDouble(errors[i]));
2474} else
2475  sipIsErr = 1;
2476%End
2477
2478	SIP_PYTUPLE residuals();
2479%MethodCode
2480double *residuals = sipCpp->residuals();
2481int size = sipCpp->dataSize();
2482sipRes = PyTuple_New(size);
2483if(sipRes)
2484{
2485  for(int i=0; i<size; i++)
2486    PyTuple_SET_ITEM(sipRes, i, PyFloat_FromDouble(residuals[i]));
2487} else
2488  sipIsErr = 1;
2489%End
2490
2491  double chiSquare();
2492  double rSquare();
2493  double adjustedRSquare();
2494  double rss();
2495  double rmse();
2496
2497  void showPredictionLimits(double);
2498  void showConfidenceLimits(double);
2499  double lcl(int, double);
2500  double ucl(int, double);
2501
2502  Table* parametersTable(const QString&);
2503  Matrix* covarianceMatrix(const QString&);
2504};
2505
2506%ModuleCode
2507ApplicationWindow *sipqti_app()
2508{
2509  int iserr = 0;
2510  PyObject *me = PyImport_ImportModule("qti");
2511  PyObject *mydict = PyModule_GetDict(me);
2512  PyObject *pyapp = PyDict_GetItemString(mydict,"app");
2513  Py_DECREF(me);
2514  if (sipCanConvertToInstance(pyapp, sipClass_ApplicationWindow, SIP_NOT_NONE))
2515    return (ApplicationWindow*) sipConvertToInstance(pyapp, sipClass_ApplicationWindow, NULL, SIP_NOT_NONE, NULL, &iserr);
2516  else
2517    return NULL;
2518}
2519%End
2520%ModuleHeaderCode
2521class ApplicationWindow;
2522ApplicationWindow *sipqti_app();
2523#define SIPQTI_APP(sipcppexpr)\
2524ApplicationWindow *app = sipqti_app();\
2525if (app) sipCpp = sipcppexpr;\
2526else { sipCpp = NULL; }
2527%End
2528
2529class ExponentialFit : Fit
2530{
2531%TypeHeaderCode
2532#include "../src/analysis/ExponentialFit.h"
2533%End
2534public:
2535  ExponentialFit(ApplicationWindow * /TransferThis/, Table *, const QString&, const QString&, int, int, bool);
2536  ExponentialFit(Table *, const QString&, const QString&, int = 1, int = -1, bool = false) /NoDerived/;
2537%MethodCode
2538  SIPQTI_APP(new sipExponentialFit(app, a0, *a1, *a2, a3, a4, a5))
2539%End
2540
2541  ExponentialFit(ApplicationWindow * /TransferThis/, QwtPlotCurve *, bool=false);
2542  ExponentialFit(ApplicationWindow * /TransferThis/, QwtPlotCurve *, double, double, bool=false);
2543  ExponentialFit(ApplicationWindow * /TransferThis/, Graph *, const QString&, bool=false);
2544  ExponentialFit(ApplicationWindow * /TransferThis/, Graph *, const QString&, double, double, bool=false);
2545  ExponentialFit(QwtPlotCurve *, bool=false) /NoDerived/;
2546%MethodCode
2547  SIPQTI_APP(new sipExponentialFit(app, a0, a1))
2548%End
2549  ExponentialFit(QwtPlotCurve *, double, double, bool=false) /NoDerived/;
2550%MethodCode
2551  SIPQTI_APP(new sipExponentialFit(app, a0, a1, a2, a3))
2552%End
2553  ExponentialFit(Graph *, const QString&, bool=false) /NoDerived/;
2554%MethodCode
2555  SIPQTI_APP(new sipExponentialFit(app, a0, *a1, a2))
2556%End
2557  ExponentialFit(Graph *, const QString&, double, double, bool=false) /NoDerived/;
2558%MethodCode
2559  SIPQTI_APP(new sipExponentialFit(app, a0, *a1, a2, a3, a4))
2560%End
2561};
2562
2563class TwoExpFit : Fit
2564{
2565%TypeHeaderCode
2566#include "../src/analysis/ExponentialFit.h"
2567%End
2568public:
2569  TwoExpFit(ApplicationWindow * /TransferThis/, Table *, const QString&, const QString&, int, int);
2570  TwoExpFit(Table *, const QString&, const QString&, int = 1, int = -1) /NoDerived/;
2571%MethodCode
2572  SIPQTI_APP(new sipTwoExpFit(app, a0, *a1, *a2, a3, a4))
2573%End
2574
2575  TwoExpFit(ApplicationWindow * /TransferThis/, QwtPlotCurve *);
2576  TwoExpFit(ApplicationWindow * /TransferThis/, QwtPlotCurve *, double, double);
2577  TwoExpFit(ApplicationWindow * /TransferThis/, Graph *, const QString&);
2578  TwoExpFit(ApplicationWindow * /TransferThis/, Graph *, const QString&, double, double);
2579  TwoExpFit(QwtPlotCurve *) /NoDerived/;
2580%MethodCode
2581  SIPQTI_APP(new sipTwoExpFit(app, a0))
2582%End
2583  TwoExpFit(QwtPlotCurve *, double, double) /NoDerived/;
2584%MethodCode
2585  SIPQTI_APP(new sipTwoExpFit(app, a0, a1, a2))
2586%End
2587  TwoExpFit(Graph *, const QString&) /NoDerived/;
2588%MethodCode
2589  SIPQTI_APP(new sipTwoExpFit(app, a0, *a1))
2590%End
2591  TwoExpFit(Graph *, const QString&, double, double) /NoDerived/;
2592%MethodCode
2593  SIPQTI_APP(new sipTwoExpFit(app, a0, *a1, a2, a3))
2594%End
2595};
2596
2597class ThreeExpFit : Fit
2598{
2599%TypeHeaderCode
2600#include "../src/analysis/ExponentialFit.h"
2601%End
2602public:
2603  ThreeExpFit(ApplicationWindow * /TransferThis/, Table *, const QString&, const QString&, int, int);
2604  ThreeExpFit(Table *, const QString&, const QString&, int = 1, int = -1) /NoDerived/;
2605%MethodCode
2606  SIPQTI_APP(new sipThreeExpFit(app, a0, *a1, *a2, a3, a4))
2607%End
2608
2609  ThreeExpFit(ApplicationWindow * /TransferThis/, QwtPlotCurve *);
2610  ThreeExpFit(ApplicationWindow * /TransferThis/, QwtPlotCurve *, double, double);
2611  ThreeExpFit(ApplicationWindow * /TransferThis/, Graph *, const QString&);
2612  ThreeExpFit(ApplicationWindow * /TransferThis/, Graph *, const QString&, double, double);
2613  ThreeExpFit(QwtPlotCurve *) /NoDerived/;
2614%MethodCode
2615  SIPQTI_APP(new sipThreeExpFit(app, a0))
2616%End
2617  ThreeExpFit(QwtPlotCurve *, double, double) /NoDerived/;
2618%MethodCode
2619  SIPQTI_APP(new sipThreeExpFit(app, a0, a1, a2))
2620%End
2621  ThreeExpFit(Graph *, const QString&) /NoDerived/;
2622%MethodCode
2623  SIPQTI_APP(new sipThreeExpFit(app, a0, *a1))
2624%End
2625  ThreeExpFit(Graph *, const QString&, double, double) /NoDerived/;
2626%MethodCode
2627  SIPQTI_APP(new sipThreeExpFit(app, a0, *a1, a2, a3))
2628%End
2629};
2630
2631class SigmoidalFit : Fit
2632{
2633%TypeHeaderCode
2634#include "../src/analysis/SigmoidalFit.h"
2635%End
2636public:
2637  SigmoidalFit(ApplicationWindow * /TransferThis/, Table *, const QString&, const QString&, int, int);
2638  SigmoidalFit(Table *, const QString&, const QString&, int = 1, int = -1) /NoDerived/;
2639%MethodCode
2640  SIPQTI_APP(new sipSigmoidalFit(app, a0, *a1, *a2, a3, a4))
2641%End
2642
2643  SigmoidalFit(ApplicationWindow * /TransferThis/, QwtPlotCurve *);
2644  SigmoidalFit(ApplicationWindow * /TransferThis/, QwtPlotCurve *, double, double);
2645  SigmoidalFit(ApplicationWindow * /TransferThis/, Graph *, const QString&);
2646  SigmoidalFit(ApplicationWindow * /TransferThis/, Graph *, const QString&, double, double);
2647  SigmoidalFit(QwtPlotCurve *) /NoDerived/;
2648%MethodCode
2649  SIPQTI_APP(new sipSigmoidalFit(app, a0))
2650%End
2651  SigmoidalFit(QwtPlotCurve *, double, double) /NoDerived/;
2652%MethodCode
2653  SIPQTI_APP(new sipSigmoidalFit(app, a0, a1, a2))
2654%End
2655  SigmoidalFit(Graph *, const QString&) /NoDerived/;
2656%MethodCode
2657  SIPQTI_APP(new sipSigmoidalFit(app, a0, *a1))
2658%End
2659  SigmoidalFit(Graph *, const QString&, double, double) /NoDerived/;
2660%MethodCode
2661  SIPQTI_APP(new sipSigmoidalFit(app, a0, *a1, a2, a3))
2662%End
2663
2664  void guessInitialValues();
2665};
2666
2667class LogisticFit : Fit
2668{
2669%TypeHeaderCode
2670#include "../src/analysis/LogisticFit.h"
2671%End
2672public:
2673  LogisticFit(ApplicationWindow * /TransferThis/, Table *, const QString&, const QString&, int, int);
2674  LogisticFit(Table *, const QString&, const QString&, int = 1, int = -1) /NoDerived/;
2675%MethodCode
2676  SIPQTI_APP(new sipLogisticFit(app, a0, *a1, *a2, a3, a4))
2677%End
2678
2679  LogisticFit(ApplicationWindow * /TransferThis/, QwtPlotCurve *);
2680  LogisticFit(ApplicationWindow * /TransferThis/, QwtPlotCurve *, double, double);
2681  LogisticFit(ApplicationWindow * /TransferThis/, Graph *, const QString&);
2682  LogisticFit(ApplicationWindow * /TransferThis/, Graph *, const QString&, double, double);
2683  LogisticFit(QwtPlotCurve *) /NoDerived/;
2684%MethodCode
2685  SIPQTI_APP(new sipLogisticFit(app, a0))
2686%End
2687  LogisticFit(QwtPlotCurve *, double, double) /NoDerived/;
2688%MethodCode
2689  SIPQTI_APP(new sipLogisticFit(app, a0, a1, a2))
2690%End
2691  LogisticFit(Graph *, const QString&) /NoDerived/;
2692%MethodCode
2693  SIPQTI_APP(new sipLogisticFit(app, a0, *a1))
2694%End
2695  LogisticFit(Graph *, const QString&, double, double) /NoDerived/;
2696%MethodCode
2697  SIPQTI_APP(new sipLogisticFit(app, a0, *a1, a2, a3))
2698%End
2699
2700  void guessInitialValues();
2701};
2702
2703class GaussAmpFit : Fit
2704{
2705%TypeHeaderCode
2706#include "../src/analysis/MultiPeakFit.h"
2707%End
2708public:
2709  GaussAmpFit(ApplicationWindow * /TransferThis/, Table *, const QString&, const QString&, int, int);
2710  GaussAmpFit(Table *, const QString&, const QString&, int = 1, int = -1) /NoDerived/;
2711%MethodCode
2712  SIPQTI_APP(new sipGaussAmpFit(app, a0, *a1, *a2, a3, a4))
2713%End
2714
2715  GaussAmpFit(ApplicationWindow * /TransferThis/, QwtPlotCurve *);
2716  GaussAmpFit(ApplicationWindow * /TransferThis/, QwtPlotCurve *, double, double);
2717  GaussAmpFit(ApplicationWindow * /TransferThis/, Graph *, const QString&);
2718  GaussAmpFit(ApplicationWindow * /TransferThis/, Graph *, const QString&, double, double);
2719  GaussAmpFit(QwtPlotCurve *) /NoDerived/;
2720%MethodCode
2721  SIPQTI_APP(new sipGaussAmpFit(app, a0))
2722%End
2723  GaussAmpFit(QwtPlotCurve *, double, double) /NoDerived/;
2724%MethodCode
2725  SIPQTI_APP(new sipGaussAmpFit(app, a0, a1, a2))
2726%End
2727  GaussAmpFit(Graph *, const QString&) /NoDerived/;
2728%MethodCode
2729  SIPQTI_APP(new sipGaussAmpFit(app, a0, *a1))
2730%End
2731  GaussAmpFit(Graph *, const QString&, double, double) /NoDerived/;
2732%MethodCode
2733  SIPQTI_APP(new sipGaussAmpFit(app, a0, *a1, a2, a3))
2734%End
2735
2736  void guessInitialValues();
2737};
2738
2739class NonLinearFit : Fit
2740{
2741%TypeHeaderCode
2742#include "../src/analysis/NonLinearFit.h"
2743%End
2744public:
2745  NonLinearFit(ApplicationWindow * /TransferThis/, Table *, const QString&, const QString&, int, int);
2746  NonLinearFit(Table *, const QString&, const QString&, int = 1, int = -1) /NoDerived/;
2747%MethodCode
2748  SIPQTI_APP(new sipNonLinearFit(app, a0, *a1, *a2, a3, a4))
2749%End
2750
2751  NonLinearFit(ApplicationWindow * /TransferThis/, QwtPlotCurve *);
2752  NonLinearFit(ApplicationWindow * /TransferThis/, QwtPlotCurve *, double, double);
2753  NonLinearFit(ApplicationWindow * /TransferThis/, Graph *, const QString&);
2754  NonLinearFit(ApplicationWindow * /TransferThis/, Graph *, const QString&, double, double);
2755  NonLinearFit(QwtPlotCurve *) /NoDerived/;
2756%MethodCode
2757  SIPQTI_APP(new sipNonLinearFit(app, a0))
2758%End
2759  NonLinearFit(QwtPlotCurve *, double, double) /NoDerived/;
2760%MethodCode
2761  SIPQTI_APP(new sipNonLinearFit(app, a0, a1, a2))
2762%End
2763  NonLinearFit(Graph *, const QString&) /NoDerived/;
2764%MethodCode
2765  SIPQTI_APP(new sipNonLinearFit(app, a0, *a1))
2766%End
2767  NonLinearFit(Graph *, const QString&, double, double) /NoDerived/;
2768%MethodCode
2769  SIPQTI_APP(new sipNonLinearFit(app, a0, *a1, a2, a3))
2770%End
2771  void setParameters(...);
2772%MethodCode
2773  QStringList l;
2774  char *item;
2775  for (int i=0; i<PyTuple_GET_SIZE(a0); i++)
2776    if (item = PyString_AsString(PyTuple_GET_ITEM(a0, i)))
2777      l << item;
2778    else
2779      sipIsErr = 1;
2780
2781  sipCpp->setParametersList(l);
2782%End
2783  // TODO: make it accept Python callables
2784  bool setFormula(const QString&, bool = true);
2785  bool save(const QString&);
2786  bool load(const QString&);
2787};
2788
2789class PluginFit : Fit
2790{
2791%TypeHeaderCode
2792#include "../src/analysis/PluginFit.h"
2793%End
2794public:
2795  PluginFit(ApplicationWindow * /TransferThis/, Table *, const QString&, const QString&, int, int);
2796  PluginFit(Table *, const QString&, const QString&, int = 1, int = -1) /NoDerived/;
2797%MethodCode
2798  SIPQTI_APP(new sipPluginFit(app, a0, *a1, *a2, a3, a4))
2799%End
2800
2801  PluginFit(ApplicationWindow * /TransferThis/, QwtPlotCurve *);
2802  PluginFit(ApplicationWindow * /TransferThis/, QwtPlotCurve *, double, double);
2803  PluginFit(ApplicationWindow * /TransferThis/, Graph *, const QString&);
2804  PluginFit(ApplicationWindow * /TransferThis/, Graph *, const QString&, double, double);
2805  PluginFit(QwtPlotCurve *) /NoDerived/;
2806%MethodCode
2807  SIPQTI_APP(new sipPluginFit(app, a0))
2808%End
2809  PluginFit(QwtPlotCurve *, double, double) /NoDerived/;
2810%MethodCode
2811  SIPQTI_APP(new sipPluginFit(app, a0, a1, a2))
2812%End
2813  PluginFit(Graph *, const QString&) /NoDerived/;
2814%MethodCode
2815  SIPQTI_APP(new sipPluginFit(app, a0, *a1))
2816%End
2817  PluginFit(Graph *, const QString&, double, double) /NoDerived/;
2818%MethodCode
2819  SIPQTI_APP(new sipPluginFit(app, a0, *a1, a2, a3))
2820%End
2821  bool load(const QString&);
2822};
2823
2824class MultiPeakFit : Fit
2825{
2826%TypeHeaderCode
2827#include "../src/analysis/MultiPeakFit.h"
2828%End
2829public:
2830  enum PeakProfile{Gauss, Lorentz};
2831  MultiPeakFit(ApplicationWindow * /TransferThis/, QwtPlotCurve *, PeakProfile=Gauss, int=1);
2832  MultiPeakFit(ApplicationWindow * /TransferThis/, Graph *, PeakProfile=Gauss, int=1);
2833
2834  int peaks() /PyName=numPeaks/;
2835  void setNumPeaks(int);
2836
2837  void enablePeakCurves(bool);
2838  void setPeakCurvesColor(int);
2839
2840  static QString generateFormula(int, PeakProfile);
2841  static QStringList generateParameterList(int);
2842
2843  void guessInitialValues();
2844};
2845
2846class LorentzFit : MultiPeakFit
2847{
2848%TypeHeaderCode
2849#include "../src/analysis/MultiPeakFit.h"
2850%End
2851public:
2852  LorentzFit(ApplicationWindow * /TransferThis/, Table *, const QString&, const QString&, int, int);
2853  LorentzFit(Table *, const QString&, const QString&, int = 1, int = -1) /NoDerived/;
2854%MethodCode
2855  SIPQTI_APP(new sipLorentzFit(app, a0, *a1, *a2, a3, a4))
2856%End
2857
2858  LorentzFit(ApplicationWindow * /TransferThis/, QwtPlotCurve *);
2859  LorentzFit(ApplicationWindow * /TransferThis/, QwtPlotCurve *, double, double);
2860  LorentzFit(ApplicationWindow * /TransferThis/, Graph *, const QString&);
2861  LorentzFit(ApplicationWindow * /TransferThis/, Graph *, const QString&, double, double);
2862  LorentzFit(QwtPlotCurve *) /NoDerived/;
2863%MethodCode
2864  SIPQTI_APP(new sipLorentzFit(app, a0))
2865%End
2866  LorentzFit(QwtPlotCurve *, double, double) /NoDerived/;
2867%MethodCode
2868  SIPQTI_APP(new sipLorentzFit(app, a0, a1, a2))
2869%End
2870  LorentzFit(Graph *, const QString&) /NoDerived/;
2871%MethodCode
2872  SIPQTI_APP(new sipLorentzFit(app, a0, *a1))
2873%End
2874  LorentzFit(Graph *, const QString&, int, int) /NoDerived/;
2875%MethodCode
2876  SIPQTI_APP(new sipLorentzFit(app, a0, *a1, a2, a3))
2877%End
2878};
2879
2880class GaussFit : MultiPeakFit
2881{
2882%TypeHeaderCode
2883#include "../src/analysis/MultiPeakFit.h"
2884%End
2885public:
2886  GaussFit(ApplicationWindow * /TransferThis/, Table *, const QString&, const QString&, int, int);
2887  GaussFit(Table *, const QString&, const QString&, int = 1, int = -1) /NoDerived/;
2888%MethodCode
2889  SIPQTI_APP(new sipGaussFit(app, a0, *a1, *a2, a3, a4))
2890%End
2891
2892  GaussFit(ApplicationWindow * /TransferThis/, QwtPlotCurve *);
2893  GaussFit(ApplicationWindow * /TransferThis/, QwtPlotCurve *, double, double);
2894  GaussFit(ApplicationWindow * /TransferThis/, Graph *, const QString&);
2895  GaussFit(ApplicationWindow * /TransferThis/, Graph *, const QString&, double, double);
2896  GaussFit(QwtPlotCurve *) /NoDerived/;
2897%MethodCode
2898  SIPQTI_APP(new sipGaussFit(app, a0))
2899%End
2900  GaussFit(QwtPlotCurve *, double, double) /NoDerived/;
2901%MethodCode
2902  SIPQTI_APP(new sipGaussFit(app, a0, a1, a2))
2903%End
2904  GaussFit(Graph *, const QString&) /NoDerived/;
2905%MethodCode
2906  SIPQTI_APP(new sipGaussFit(app, a0, *a1))
2907%End
2908  GaussFit(Graph *, const QString&, double, double) /NoDerived/;
2909%MethodCode
2910  SIPQTI_APP(new sipGaussFit(app, a0, *a1, a2, a3))
2911%End
2912};
2913
2914class PolynomialFit : Fit
2915{
2916%TypeHeaderCode
2917#include "../src/analysis/PolynomialFit.h"
2918%End
2919public:
2920  PolynomialFit(ApplicationWindow * /TransferThis/, Table *, const QString&, const QString&, int, int, int, bool);
2921  PolynomialFit(Table *, const QString&, const QString&, int = 1, int = -1, int = 2, bool = false) /NoDerived/;
2922%MethodCode
2923  SIPQTI_APP(new sipPolynomialFit(app, a0, *a1, *a2, a3, a4, a5, a6))
2924%End
2925
2926  PolynomialFit(ApplicationWindow * /TransferThis/, QwtPlotCurve *, int=2, bool=false);
2927  PolynomialFit(ApplicationWindow * /TransferThis/, QwtPlotCurve *, double, double, int=2, bool=false);
2928  PolynomialFit(ApplicationWindow * /TransferThis/, Graph *, QString&, int=2, bool=false);
2929  PolynomialFit(ApplicationWindow * /TransferThis/, Graph *, QString&, double, double, int=2, bool=false);
2930  PolynomialFit(QwtPlotCurve *, int=2, bool=false) /NoDerived/;
2931%MethodCode
2932  SIPQTI_APP(new sipPolynomialFit(app, a0, a1, a2))
2933%End
2934  PolynomialFit(QwtPlotCurve *, double, double, int=2, bool=false) /NoDerived/;
2935%MethodCode
2936  SIPQTI_APP(new sipPolynomialFit(app, a0, a1, a2, a3, a4))
2937%End
2938  PolynomialFit(Graph *, QString&, int=2, bool=false) /NoDerived/;
2939%MethodCode
2940  SIPQTI_APP(new sipPolynomialFit(app, a0, *a1, a2, a3))
2941%End
2942  PolynomialFit(Graph *, QString&, double, double, int=2, bool=false) /NoDerived/;
2943%MethodCode
2944  SIPQTI_APP(new sipPolynomialFit(app, a0, *a1, a2, a3, a4, a5))
2945%End
2946
2947  virtual QString legendInfo();
2948  void fit();
2949
2950  static QString generateFormula(int);
2951  static QStringList generateParameterList(int);
2952};
2953
2954class LinearFit : Fit
2955{
2956%TypeHeaderCode
2957#include "../src/analysis/PolynomialFit.h"
2958%End
2959public:
2960  LinearFit(ApplicationWindow * /TransferThis/, Table *, const QString&, const QString&, int, int);
2961  LinearFit(Table *, const QString&, const QString&, int = 1, int = -1) /NoDerived/;
2962%MethodCode
2963  SIPQTI_APP(new sipLinearFit(app, a0, *a1, *a2, a3, a4))
2964%End
2965
2966  LinearFit(ApplicationWindow * /TransferThis/, QwtPlotCurve *);
2967  LinearFit(ApplicationWindow * /TransferThis/, QwtPlotCurve *, double, double);
2968  LinearFit(ApplicationWindow * /TransferThis/, Graph *, const QString&);
2969  LinearFit(ApplicationWindow * /TransferThis/, Graph *, const QString&, double, double);
2970  LinearFit(QwtPlotCurve *) /NoDerived/;
2971%MethodCode
2972  SIPQTI_APP(new sipLinearFit(app, a0))
2973%End
2974  LinearFit(QwtPlotCurve *, double, double) /NoDerived/;
2975%MethodCode
2976  SIPQTI_APP(new sipLinearFit(app, a0, a1, a2))
2977%End
2978  LinearFit(Graph *, const QString&) /NoDerived/;
2979%MethodCode
2980  SIPQTI_APP(new sipLinearFit(app, a0, *a1))
2981%End
2982  LinearFit(Graph *, const QString&, double, double) /NoDerived/;
2983%MethodCode
2984  SIPQTI_APP(new sipLinearFit(app, a0, *a1, a2, a3))
2985%End
2986  void fit();
2987};
2988
2989class Filter : QObject
2990{
2991%TypeHeaderCode
2992#include "../src/analysis/Filter.h"
2993%End
2994public:
2995  Filter(ApplicationWindow* /TransferThis/, Graph*=0, const char*=0);
2996  ~Filter();
2997
2998  void setOutputPoints(int);
2999  void setTolerance(double);
3000  void setMaximumIterations(int);
3001
3002  void setColor(int);
3003  void setColor(const QString&);
3004  void setColor(const QColor&);
3005
3006  bool setDataFromCurve(QwtPlotCurve *c);
3007  bool setDataFromCurve(QwtPlotCurve *c, double from, double to);
3008  bool setDataFromCurve(const QString&, Graph*=0);
3009  bool setDataFromCurve(const QString& curveTitle, double from, double to, Graph *g = 0);
3010  virtual bool setDataFromTable(Table *t, const QString& xColName, const QString& yColName, int from = 1, int to = -1, bool = false);
3011
3012  Table *resultTable();
3013
3014  virtual void enableGraphicsDisplay(bool on = true, Graph *g = 0);
3015  virtual bool run();
3016};
3017
3018class Differentiation : Filter
3019{
3020%TypeHeaderCode
3021#include "../src/analysis/Differentiation.h"
3022%End
3023public:
3024  Differentiation(ApplicationWindow * /TransferThis/, Table *, const QString&, const QString&, int, int);
3025  Differentiation(Table *, const QString&, const QString&, int = 1, int = -1) /NoDerived/;
3026%MethodCode
3027  SIPQTI_APP(new sipDifferentiation(app, a0, *a1, *a2, a3, a4))
3028%End
3029
3030  Differentiation(ApplicationWindow * /TransferThis/, QwtPlotCurve *);
3031  Differentiation(ApplicationWindow * /TransferThis/, QwtPlotCurve *, double, double);
3032  Differentiation(ApplicationWindow * /TransferThis/, Graph *, const QString&);
3033  Differentiation(ApplicationWindow * /TransferThis/, Graph *, const QString&, double, double);
3034  Differentiation(QwtPlotCurve *, double, double) /NoDerived/;
3035%MethodCode
3036  SIPQTI_APP(new sipDifferentiation(app, a0, a1, a2))
3037%End
3038  Differentiation(QwtPlotCurve *) /NoDerived/;
3039%MethodCode
3040  SIPQTI_APP(new sipDifferentiation(app, a0))
3041%End
3042  Differentiation(Graph *, const QString&) /NoDerived/;
3043%MethodCode
3044  SIPQTI_APP(new sipDifferentiation(app, a0, *a1))
3045%End
3046  Differentiation(Graph *, const QString&, double, double) /NoDerived/;
3047%MethodCode
3048  SIPQTI_APP(new sipDifferentiation(app, a0, *a1, a2, a3))
3049%End
3050  bool run();
3051};
3052
3053class Integration : Filter
3054{
3055%TypeHeaderCode
3056#include "../src/analysis/Integration.h"
3057%End
3058public:
3059  Integration(ApplicationWindow * /TransferThis/, Table *, const QString&, const QString&, int, int, bool);
3060  Integration(Table *, const QString&, const QString&, int = 1, int = -1, bool = false) /NoDerived/;
3061%MethodCode
3062  SIPQTI_APP(new sipIntegration(app, a0, *a1, *a2, a3, a4, a5))
3063%End
3064
3065  Integration(ApplicationWindow * /TransferThis/, QwtPlotCurve *);
3066  Integration(ApplicationWindow * /TransferThis/, QwtPlotCurve *, double, double);
3067  Integration(ApplicationWindow * /TransferThis/, Graph *, const QString&);
3068  Integration(ApplicationWindow * /TransferThis/, Graph *, const QString&, double, double);
3069  Integration(QwtPlotCurve *) /NoDerived/;
3070%MethodCode
3071  SIPQTI_APP(new sipIntegration(app, a0))
3072%End
3073  Integration(QwtPlotCurve *, double, double) /NoDerived/;
3074%MethodCode
3075  SIPQTI_APP(new sipIntegration(app, a0, a1, a2))
3076%End
3077  Integration(Graph *, const QString&) /NoDerived/;
3078%MethodCode
3079  SIPQTI_APP(new sipIntegration(app, a0, *a1))
3080%End
3081  Integration(Graph *, const QString&, double, double) /NoDerived/;
3082%MethodCode
3083  SIPQTI_APP(new sipIntegration(app, a0, *a1, a2, a3))
3084%End
3085
3086  void enableGraphicsDisplay(bool on = true, Graph *g = 0);
3087  bool run();
3088
3089  double area();
3090};
3091
3092class Interpolation : Filter
3093{
3094%TypeHeaderCode
3095#include "../src/analysis/Interpolation.h"
3096%End
3097public:
3098  enum InterpolationMethod{Linear, Cubic, Akima};
3099
3100  Interpolation(ApplicationWindow * /TransferThis/, Table *, const QString&, const QString&, int, int, int);
3101  Interpolation(Table *, const QString&, const QString&, int = 1, int = -1, int = 0) /NoDerived/;
3102%MethodCode
3103  SIPQTI_APP(new sipInterpolation(app, a0, *a1, *a2, a3, a4, a5))
3104%End
3105
3106  Interpolation(ApplicationWindow * /TransferThis/, QwtPlotCurve *, int=0);
3107  Interpolation(ApplicationWindow * /TransferThis/, QwtPlotCurve *, double, double, int=0);
3108  Interpolation(ApplicationWindow * /TransferThis/, Graph *, const QString&, int=0);
3109  Interpolation(ApplicationWindow * /TransferThis/, Graph *, const QString&, double, double, int=0);
3110  Interpolation(QwtPlotCurve *, int=0) /NoDerived/;
3111%MethodCode
3112  SIPQTI_APP(new sipInterpolation(app, a0, a1))
3113%End
3114  Interpolation(QwtPlotCurve *, double, double, int=0) /NoDerived/;
3115%MethodCode
3116  SIPQTI_APP(new sipInterpolation(app, a0, a1, a2, a3))
3117%End
3118  Interpolation(Graph *, const QString&, int=0) /NoDerived/;
3119%MethodCode
3120  SIPQTI_APP(new sipInterpolation(app, a0, *a1, a2))
3121%End
3122  Interpolation(Graph *, const QString&, double, double, int=0) /NoDerived/;
3123%MethodCode
3124  SIPQTI_APP(new sipInterpolation(app, a0, *a1, a2, a3, a4))
3125%End
3126
3127  void setMethod(int n);
3128  bool run();
3129};
3130
3131class SmoothFilter : Filter
3132{
3133%TypeHeaderCode
3134#include "../src/analysis/SmoothFilter.h"
3135%End
3136public:
3137  enum SmoothMethod{SavitzkyGolay = 1, FFT = 2, Average = 3, Lowess = 4};
3138
3139  SmoothFilter(ApplicationWindow * /TransferThis/, Table *, const QString&, const QString&, int, int, int);
3140  SmoothFilter(Table *, const QString&, const QString&, int = 1, int = -1, int = 3) /NoDerived/;
3141%MethodCode
3142  SIPQTI_APP(new sipSmoothFilter(app, a0, *a1, *a2, a3, a4, a5))
3143%End
3144
3145  SmoothFilter(ApplicationWindow * /TransferThis/, QwtPlotCurve *, int = 3);
3146  SmoothFilter(ApplicationWindow * /TransferThis/, QwtPlotCurve *, double, double, int = 3);
3147  SmoothFilter(ApplicationWindow * /TransferThis/, Graph *, const QString&, int=3);
3148  SmoothFilter(ApplicationWindow * /TransferThis/, Graph *, const QString&, double, double, int=3);
3149  SmoothFilter(QwtPlotCurve *, int=3) /NoDerived/;
3150%MethodCode
3151  SIPQTI_APP(new sipSmoothFilter(app, a0, a1))
3152%End
3153  SmoothFilter(QwtPlotCurve *, double, double, int=3) /NoDerived/;
3154%MethodCode
3155  SIPQTI_APP(new sipSmoothFilter(app, a0, a1, a2, a3))
3156%End
3157  SmoothFilter(Graph *, const QString&, int=3) /NoDerived/;
3158%MethodCode
3159  SIPQTI_APP(new sipSmoothFilter(app, a0, *a1, a2))
3160%End
3161  SmoothFilter(Graph *, const QString&, double, double, int=3) /NoDerived/;
3162%MethodCode
3163  SIPQTI_APP(new sipSmoothFilter(app, a0, *a1, a2, a3, a4))
3164%End
3165
3166  void setMethod(int);
3167  void setSmoothPoints(int, int = 0);
3168  void setPolynomOrder(int);
3169  void setLowessParameter(double f, int iterations);
3170  bool run();
3171};
3172
3173class FFTFilter : Filter
3174{
3175%TypeHeaderCode
3176#include "../src/analysis/FFTFilter.h"
3177%End
3178public:
3179  enum FilterType{LowPass = 1, HighPass = 2, BandPass = 3, BandBlock = 4};
3180
3181  FFTFilter(ApplicationWindow * /TransferThis/, Table *, const QString&, const QString&, int, int, int);
3182  FFTFilter(Table *, const QString&, const QString&, int = 1, int = -1, int = 1) /NoDerived/;
3183%MethodCode
3184  SIPQTI_APP(new sipFFTFilter(app, a0, *a1, *a2, a3, a4, a5))
3185%End
3186
3187  FFTFilter(ApplicationWindow * /TransferThis/, QwtPlotCurve *, int = 1);
3188  FFTFilter(ApplicationWindow * /TransferThis/, QwtPlotCurve *, double, double, int = 1);
3189  FFTFilter(ApplicationWindow * /TransferThis/, Graph *, const QString&, int=1);
3190  FFTFilter(ApplicationWindow * /TransferThis/, Graph *, const QString&, double, double, int=1);
3191  FFTFilter(QwtPlotCurve *, int=1) /NoDerived/;
3192%MethodCode
3193  SIPQTI_APP(new sipFFTFilter(app, a0, a1))
3194%End
3195  FFTFilter(QwtPlotCurve *, double, double, int=1) /NoDerived/;
3196%MethodCode
3197  SIPQTI_APP(new sipFFTFilter(app, a0, a1, a2, a3))
3198%End
3199  FFTFilter(Graph *, const QString&, int=1) /NoDerived/;
3200%MethodCode
3201  SIPQTI_APP(new sipFFTFilter(app, a0, *a1, a2))
3202%End
3203  FFTFilter(Graph *, const QString&, double, double, int=1) /NoDerived/;
3204%MethodCode
3205  SIPQTI_APP(new sipFFTFilter(app, a0, *a1, a2, a3, a4))
3206%End
3207
3208  void setFilterType(int);
3209  void setCutoff(double);
3210  void setBand(double, double);
3211  void enableOffset(bool=true);
3212
3213  bool run();
3214};
3215
3216class FFT : Filter
3217{
3218%TypeHeaderCode
3219#include "../src/analysis/FFT.h"
3220%End
3221public:
3222
3223  FFT(ApplicationWindow * /TransferThis/, Table *, const QString&, const QString& = QString(), int = 1, int = -1);
3224  FFT(ApplicationWindow * /TransferThis/, Graph *, const QString&, double, double);
3225  FFT(ApplicationWindow * /TransferThis/, Graph *, const QString&);
3226  FFT(ApplicationWindow * /TransferThis/, QwtPlotCurve *);
3227  FFT(ApplicationWindow * /TransferThis/, QwtPlotCurve *, double, double);
3228  FFT(ApplicationWindow * /TransferThis/, Matrix *, Matrix * = NULL, bool = false, bool = true, bool = false, bool = true);
3229
3230  FFT(Matrix *, Matrix * = NULL, bool = false, bool = true, bool = false, bool = true) /NoDerived/;
3231%MethodCode
3232  SIPQTI_APP(new sipFFT(app, a0, a1, a2, a3, a4, a5))
3233%End
3234  FFT(Table *, const QString&, const QString& = QString(), int = 1, int = -1) /NoDerived/;
3235%MethodCode
3236  SIPQTI_APP(new sipFFT(app, a0, *a1, *a2, a3, a4))
3237%End
3238  FFT(Graph *, const QString&) /NoDerived/;
3239%MethodCode
3240  SIPQTI_APP(new sipFFT(app, a0, *a1))
3241%End
3242  FFT(Graph *, const QString&, double, double) /NoDerived/;
3243%MethodCode
3244  SIPQTI_APP(new sipFFT(app, a0, *a1, a2, a3))
3245%End
3246  FFT(QwtPlotCurve *&) /NoDerived/;
3247%MethodCode
3248  SIPQTI_APP(new sipFFT(app, a0))
3249%End
3250  FFT(QwtPlotCurve *&, double, double) /NoDerived/;
3251%MethodCode
3252  SIPQTI_APP(new sipFFT(app, a0, a1, a2))
3253%End
3254
3255  void setInverseFFT(bool=true);
3256  void setSampling(double);
3257  void normalizeAmplitudes(bool=true);
3258  void shiftFrequencies(bool=true);
3259
3260  Matrix *amplitudesMatrix();
3261  Matrix *realOutputMatrix();
3262  Matrix *imaginaryOutputMatrix();
3263
3264  bool run();
3265};
3266
3267class Correlation : Filter
3268{
3269%TypeHeaderCode
3270#include "../src/analysis/Correlation.h"
3271%End
3272public:
3273
3274  Correlation(ApplicationWindow * /TransferThis/, Table *, const QString&, const QString&, int, int);
3275  Correlation(Table *, const QString&, const QString&, int = 1, int = -1) /NoDerived/;
3276%MethodCode
3277  SIPQTI_APP(new sipCorrelation(app, a0, *a1, *a2, a3, a4))
3278%End
3279
3280  bool setDataFromTable(Table *, const QString&, const QString&, int = 1, int = -1);
3281  bool run();
3282};
3283
3284class Convolution : Filter
3285{
3286%TypeHeaderCode
3287#include "../src/analysis/Convolution.h"
3288%End
3289public:
3290
3291  Convolution(ApplicationWindow * /TransferThis/, Table *, const QString&, const QString&);
3292  Convolution(Table *, const QString&, const QString&) /NoDerived/;
3293%MethodCode
3294  SIPQTI_APP(new sipConvolution(app, a0, *a1, *a2))
3295%End
3296
3297  void setDataFromTable(Table *, const QString&, const QString&);
3298  bool run();
3299};
3300
3301class Deconvolution : Filter
3302{
3303%TypeHeaderCode
3304#include "../src/analysis/Convolution.h"
3305%End
3306public:
3307
3308  Deconvolution(ApplicationWindow * /TransferThis/, Table *, const QString&, const QString&);
3309  Deconvolution(Table *, const QString&, const QString&) /NoDerived/;
3310%MethodCode
3311  SIPQTI_APP(new sipDeconvolution(app, a0, *a1, *a2))
3312%End
3313
3314  void setDataFromTable(Table *, const QString&, const QString&);
3315  bool run();
3316};
3317
3318class Statistics : QObject
3319{
3320%TypeHeaderCode
3321#include <Statistics.h>
3322%End
3323public:
3324  Statistics(ApplicationWindow * /TransferThis/, const QString& = QString());
3325  Statistics(const QString& = QString()) /NoDerived/;
3326%MethodCode
3327  SIPQTI_APP(new sipStatistics(app, *a0))
3328%End
3329  ~Statistics();
3330
3331  bool setData(const QString&);
3332  void showResultsLog(bool = true);
3333
3334  //! Returns the size of the input data set
3335  unsigned int dataSize();
3336  //! Returns the degrees of freedom
3337  virtual int dof();
3338
3339  double mean();
3340  double variance();
3341  double standardDeviation();
3342  double standardError();
3343
3344  QString logInfo(bool header = true);
3345  virtual bool run();
3346};
3347
3348class StatisticTest : Statistics
3349{
3350%TypeHeaderCode
3351#include <StatisticTest.h>
3352%End
3353public:
3354  StatisticTest(ApplicationWindow * /TransferThis/, double = 0.0, double = 0.05, const QString& = QString());
3355  StatisticTest(double = 0.0, double = 0.05, const QString& = QString()) /NoDerived/;
3356%MethodCode
3357  SIPQTI_APP(new sipStatisticTest(app, a0, a1, *a2))
3358%End
3359  enum Tail{Left = 0, Right = 1, Both = 2};
3360
3361  void setTail(const Tail&);
3362  void setTestValue(double);
3363  void setSignificanceLevel(double);
3364  void showDescriptiveStatistics(bool show = true);
3365
3366  Table* resultTable(const QString& = QString());
3367  virtual QString logInfo();
3368  virtual double statistic();
3369  virtual bool run();
3370};
3371
3372class tTest : StatisticTest
3373{
3374%TypeHeaderCode
3375#include <tTest.h>
3376%End
3377public:
3378
3379  tTest(ApplicationWindow * /TransferThis/, double, double, const QString& = QString(), const QString& = QString(), bool = false);
3380  tTest(double, double, const QString& = QString(), const QString& = QString(), bool = false) /NoDerived/;
3381%MethodCode
3382  SIPQTI_APP(new siptTest(app, a0, a1, *a2, *a3, a4))
3383%End
3384
3385  bool setSample1(const QString&);
3386  bool setSample2(const QString&, bool = false);
3387
3388  virtual QString logInfo();
3389  double t();
3390  double statistic();
3391  double pValue();
3392  int dof();
3393  double power(double alpha, int size = 0);
3394  //! Lower Confidence Limit
3395  double lcl(double);
3396  //! Upper Confidence Limit
3397  double ucl(double);
3398};
3399
3400class ChiSquareTest : StatisticTest
3401{
3402%TypeHeaderCode
3403#include <ChiSquareTest.h>
3404%End
3405public:
3406  ChiSquareTest(ApplicationWindow * /TransferThis/, double testValue, double level, const QString& = QString());
3407  ChiSquareTest(double testValue, double level, const QString& = QString()) /NoDerived/;
3408%MethodCode
3409  SIPQTI_APP(new sipChiSquareTest(app, a0, a1, *a2))
3410%End
3411
3412  virtual QString logInfo();
3413  double chiSquare();
3414  double statistic();
3415  double pValue();
3416};
3417
3418class ShapiroWilkTest : StatisticTest
3419{
3420%TypeHeaderCode
3421#include <ShapiroWilkTest.h>
3422%End
3423public:
3424  ShapiroWilkTest(ApplicationWindow * /TransferThis/, const QString& = QString());
3425  ShapiroWilkTest(const QString& = QString()) /NoDerived/;
3426%MethodCode
3427  SIPQTI_APP(new sipShapiroWilkTest(app, *a0))
3428%End
3429
3430  virtual QString logInfo();
3431  double w();
3432  double statistic();
3433  double pValue();
3434};
3435
3436class Anova : StatisticTest
3437{
3438%TypeHeaderCode
3439#include <Anova.h>
3440%End
3441public:
3442  Anova(ApplicationWindow * /TransferThis/, bool twoWay = false, double level = 0.05);
3443  Anova(bool twoWay = false, double level = 0.05) /NoDerived/;
3444%MethodCode
3445  SIPQTI_APP(new sipAnova(app, a0, a1))
3446%End
3447
3448  bool run();
3449  bool addSample(const QString& colName, int aLevel = 1, int bLevel = 1);
3450  void setAnovaTwoWayModel(int);
3451
3452  virtual QString logInfo();
3453  double fStat();
3454  double statistic();
3455  double pValue();
3456  //! Sum of squares
3457  double ssm();
3458  double sse();
3459  double sst();
3460  //! Mean square value
3461  double mse();
3462  //! F statistic for factor A
3463  double fStatA();
3464  //! F statistic for factor B
3465  double fStatB();
3466  //! F statistic for the interaction
3467  double fStatAB();
3468  //! P value for factor A
3469  double pValueA();
3470  //! P value for factor B
3471  double pValueB();
3472  //! P value for the interaction
3473  double pValueAB();
3474  //! Sum of squares for factor A
3475  double ssa();
3476  //! Sum of squares for factor B
3477  double ssb();
3478  //! Sum of squares for the interaction
3479  double ssab();
3480  //! Mean square value for factor A
3481  double msa();
3482  //! Mean square value for factor B
3483  double msb();
3484  //! Mean square value for the interaction
3485  double msab();
3486};
3487
3488// used for output redirection
3489class PythonScripting
3490{
3491%TypeHeaderCode
3492#include "../src/scripting/PythonScripting.h"
3493%End
3494public:
3495  void write(const QString&);
3496private:
3497  PythonScripting(const PythonScripting&);
3498};
3499class PythonScript
3500{
3501%TypeHeaderCode
3502#include "../src/scripting/PythonScript.h"
3503%End
3504public:
3505  void write(const QString&);
3506private:
3507  PythonScript(const PythonScript&);
3508};
3509
3510class Folder : QObject
3511{
3512%TypeHeaderCode
3513#include "../src/core/Folder.h"
3514%End
3515public:
3516  QList<MdiSubWindow*> windowsList() /PyName=windows/;
3517// TODO: implement signal Folder::nameChanged and make it update the project explorer; adjust renaming from GUI accordingly
3518//  void setFolderName(const QString&) /PyName=setName/;
3519  QString name();
3520  QString path();
3521
3522  QList<Folder*> folders();
3523  Folder *findSubfolder(const QString&, bool=true, bool=false)  /PyName=folder/;
3524  MdiSubWindow* findWindow(const QString&, bool=true, bool=true, bool=false, bool=true);
3525
3526  MdiSubWindow *window(const QString &name, const char *cls="MdiSubWindow", bool recursive=false);
3527  Table *table(const QString &name, bool recursive=false);
3528  Matrix *matrix(const QString &name, bool recursive=false);
3529  MultiLayer *graph(const QString &name, bool recursive=false);
3530  Note *note(const QString &name, bool recursive=false);
3531  Graph3D *plot3D(const QString &name, bool recursive=false);
3532
3533  Folder* rootFolder();
3534
3535  QString logInfo();
3536  void appendLogInfo(const QString&);
3537  void clearLogInfo();
3538
3539private:
3540  Folder(const Folder&);
3541};
3542