~ubuntu-branches/ubuntu/precise/kalzium/precise

« back to all changes in this revision

Viewing changes to src/elementdataviewer.h

  • Committer: Bazaar Package Importer
  • Author(s): Philip Muškovac
  • Date: 2011-07-03 12:28:58 UTC
  • Revision ID: james.westby@ubuntu.com-20110703122858-q1yyxncs89e4w0hs
Tags: upstream-4.6.90+repack
Import upstream version 4.6.90+repack

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef ELEMENTDATAVIEWER_H
 
2
#define ELEMENTDATAVIEWER_H
 
3
/***************************************************************************
 
4
    copyright            : (C) 2004, 2005, 2006 by Carsten Niehaus
 
5
    email                : cniehaus@kde.org
 
6
 ***************************************************************************/
 
7
 
 
8
/***************************************************************************
 
9
 *                                                                         *
 
10
 *   This program is free software; you can redistribute it and/or modify  *
 
11
 *   it under the terms of the GNU General Public License as published by  *
 
12
 *   the Free Software Foundation; either version 2 of the License, or     *
 
13
 *   (at your option) any later version.                                   *
 
14
 *                                                                         *
 
15
 ***************************************************************************/
 
16
 
 
17
#include <kdialog.h>
 
18
#include "ui_plotsetupwidget.h"
 
19
#include "kalziumdataobject.h"
 
20
#include "kalziumutils.h"
 
21
 
 
22
class QTimer;
 
23
class KActionCollection;
 
24
 
 
25
typedef QList<double> DoubleList;
 
26
 
 
27
/**
 
28
 * @short the values of an axis
 
29
 * @author Carsten Niehaus
 
30
 */
 
31
class AxisData
 
32
{
 
33
public:
 
34
    /**
 
35
     * This represents the possible datasets.
 
36
     */
 
37
    enum PAXISDATA {
 
38
        NUMBER = 0,
 
39
        MASS,
 
40
        EN,
 
41
        MELTINGPOINT,
 
42
        BOILINGPOINT,
 
43
        ATOMICRADIUS,
 
44
        COVALENTRADIUS
 
45
    };
 
46
 
 
47
    enum AXISTYPE {
 
48
        X = 0,
 
49
        Y
 
50
    };
 
51
 
 
52
    AxisData( AxisData::AXISTYPE );
 
53
 
 
54
    /**
 
55
     * @return the value of the selected dataset of element @p element
 
56
     */
 
57
    double value( int element ) const;
 
58
 
 
59
    /**
 
60
     * the dataList contains the values off all elements
 
61
     * but only of the currently selected data type. This
 
62
     * means that it eg contains all boiling points
 
63
     */
 
64
    DoubleList dataList;
 
65
 
 
66
    QString unit;
 
67
 
 
68
    int currentDataType;
 
69
 
 
70
    ChemicalDataObject::BlueObelisk kind;
 
71
 
 
72
    AXISTYPE type() const {
 
73
        return m_type;
 
74
    }
 
75
 
 
76
private:
 
77
    AXISTYPE m_type;
 
78
};
 
79
 
 
80
 
 
81
/**
 
82
 * @short This widget shows the plot and the widget
 
83
 * where you can setup the plot
 
84
 * @author Carsten Niehaus
 
85
 */
 
86
class ElementDataViewer : public KDialog
 
87
{
 
88
    Q_OBJECT
 
89
 
 
90
public:
 
91
    ElementDataViewer( QWidget *parent = 0 );
 
92
 
 
93
    ~ElementDataViewer();
 
94
 
 
95
    /**
 
96
     * the AxixData for the y-Axis
 
97
     */
 
98
    AxisData *m_yData;
 
99
 
 
100
    /**
 
101
     * the AxixData for the x-Axis
 
102
     */
 
103
    AxisData *m_xData;
 
104
 
 
105
 
 
106
protected:
 
107
    virtual void keyPressEvent(QKeyEvent *e);
 
108
 
 
109
private:
 
110
    Ui::PlotSetupWidget ui;
 
111
 
 
112
    void getMinMax(double& min, double& max, AxisData * data);
 
113
 
 
114
    QStringList         names;
 
115
    QStringList         symbols;
 
116
    QStringList         elecConfig;     //Electronic configuration of elements
 
117
    QStringList             block;      //Indicates the periodic table block s,p,d,f...
 
118
    QTimer *m_timer;
 
119
 
 
120
    KActionCollection* m_actionCollection;
 
121
 
 
122
    void initData();
 
123
    void setupAxisData( AxisData * data );
 
124
 
 
125
    void setLimits();
 
126
 
 
127
protected slots:
 
128
    /**
 
129
     * invoke the help of the correct chapter
 
130
     */
 
131
    virtual void slotHelp();
 
132
 
 
133
private slots:
 
134
    void rangeChanged();
 
135
    void fullRange();
 
136
 
 
137
public slots:
 
138
    void slotZoomIn();
 
139
    void slotZoomOut();
 
140
 
 
141
    /**
 
142
     * draws the plot
 
143
     */
 
144
    void drawPlot();
 
145
};
 
146
 
 
147
#endif // ELEMENTDATAVIEWER_H
 
148