moved kdeaccessibility kdeaddons kdeadmin kdeartwork kdebindings kdeedu kdegames...
[kdeedu.git] / kalzium / src / elementdataviewer.h
blobc86ad1f56dae6433778e7256b0ef805b3028d702
1 #ifndef ELEMENTDATAVIEWER_H
2 #define ELEMENTDATAVIEWER_H
3 /***************************************************************************
5 elementdataviewer.h - description
6 -------------------
7 copyright : (C) 2004 by Carsten Niehaus
8 email : cniehaus@kde.org
9 ***************************************************************************/
11 /***************************************************************************
12 * *
13 * This program is free software; you can redistribute it and/or modify *
14 * it under the terms of the GNU General Public License as published by *
15 * the Free Software Foundation; either version 2 of the License, or *
16 * (at your option) any later version. *
17 * *
18 ***************************************************************************/
20 #include <kdialogbase.h>
22 #include "element.h"
23 #include "plotwidget.h"
25 typedef QValueList<double> DoubleList;
27 class PlotSetupWidget;
29 /**
30 * @short the values of the y-Axis
31 * @author Carsten Niehaus
33 class AxisData
35 friend class ElementDataViewer;
37 public:
38 AxisData();
40 /**
41 * sets the dataList to @p list
43 void setDataList( DoubleList list ){
44 dataList = list;
47 /**
48 * @return the value of the selected dataset of element @p element
50 double value( int element ){
51 element--;
52 DoubleList::iterator it = dataList.at( element );
53 return (*it);
56 /**
57 * This represents the nine possible datasets.
58 * @li WEIGHT: the weight of the element
59 * @li MELTINGPOINT: the meanweight of the element
61 enum PAXISDATA { WEIGHT=0, MEANWEIGHT=1, DENSITY=2, IE1=3, IE2=4, EN=5, MELTINGPOINT=6, BOILINGPOINT=7, ATOMICRADIUS=8 };
63 /**
64 * @return the currently selected datatype
65 * @see AxisData::PAXISDATA
67 int currentDataType(){
68 return m_currentDataType;
71 private:
72 /**
73 * the dataList contains the values off all elements
74 * but only of the currently selected datatyp. This
75 * means that it eg contains all boilingpoints
77 DoubleList dataList;
79 int m_currentDataType;
82 /**
83 * @short This widget shows the plot and the widget
84 * where you can setup the plot
85 * @author Carsten Niehaus
87 class ElementDataViewer : public KDialogBase
89 Q_OBJECT
91 public:
92 ElementDataViewer( KalziumDataObject *data, QWidget *parent=0 , const char *name =0 );
94 /**
95 * the AxixData for the y-Axis
97 AxisData *yData;
99 public slots:
100 void slotZoomIn();
101 void slotZoomOut();
104 * draws the plot
106 void drawPlot();
108 void slotUser1();
110 protected:
111 virtual void paintEvent(QPaintEvent*);
112 virtual void keyPressEvent(QKeyEvent *e);
114 private:
115 void initData();
116 PlotWidget *m_pPlotWidget;
117 PlotSetupWidget *m_pPlotSetupWidget;
119 KalziumDataObject *d;
121 QStringList names;
123 void setupAxisData();
125 void setLimits(int, int);
129 #endif // ELEMENTDATAVIEWER_H