1 /***************************************************************************
2     File                 : Plot3DDialog.h
3     Project              : SciDAVis
4     --------------------------------------------------------------------
5     Copyright            : (C) 2006 by Ion Vasilief, Tilman Benkert
6     Email (use @ for *)  : ion_vasilief*yahoo.fr, thzs*gmx.net
7     Description          : Surface plot options dialog
8 
9  ***************************************************************************/
10 
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  *  This program is distributed in the hope that it will be useful,        *
19  *  but WITHOUT ANY WARRANTY; without even the implied warranty of         *
20  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
21  *  GNU General Public License for more details.                           *
22  *                                                                         *
23  *   You should have received a copy of the GNU General Public License     *
24  *   along with this program; if not, write to the Free Software           *
25  *   Foundation, Inc., 51 Franklin Street, Fifth Floor,                    *
26  *   Boston, MA  02110-1301  USA                                           *
27  *                                                                         *
28  ***************************************************************************/
29 #ifndef PLOT3DDIALOG_H
30 #define PLOT3DDIALOG_H
31 
32 #include "Graph3D.h"
33 #include <QCheckBox>
34 
35 class QComboBox;
36 class QLabel;
37 class QLineEdit;
38 class QListWidget;
39 class QPushButton;
40 class QRadioButton;
41 class QSpinBox;
42 class QDoubleSpinBox;
43 class QTabWidget;
44 class QWidget;
45 class QStringList;
46 class QStackedWidget;
47 class QGroupBox;
48 
49 using namespace Qwt3D;
50 
51 //! Surface plot options dialog
52 class Plot3DDialog : public QDialog
53 {
54     Q_OBJECT
55 
56 public:
57     Plot3DDialog(QWidget *parent = 0, Qt::WindowFlags fl = Qt::Widget);
58     ~Plot3DDialog();
59 
60 public slots:
61     void accept();
62     bool updatePlot();
63 
64     QColor pickFromColor();
65     QColor pickToColor();
66     QColor pickMeshColor();
67     QColor pickAxesColor();
68     QColor pickTitleColor();
69     QColor pickNumberColor();
70     QColor pickBgColor();
71     QColor pickLabelColor();
72     QColor pickGridColor();
73 
74     void setColors(const QColor &title, const QColor &mesh, const QColor &axes, const QColor &num,
75                    const QColor &label, const QColor &bg, const QColor &grid);
76     void setDataColors(const QColor &minColor, const QColor &maxColor);
77     void setTransparency(double t);
78     void pickTitleFont();
79     void setTitle(const QString &title);
80     void setTitleFont(const QFont &font);
81 
82     void setResolution(int r);
83     void showLegend(bool show);
setOrthogonal(bool on)84     void setOrthogonal(bool on) { boxOrthogonal->setChecked(on); };
85 
86     void setAxesLabels(const QStringList &list);
87     void viewAxisOptions(int axis);
88 
89     void setAxesFonts(const QFont &xf, const QFont &yf, const QFont &zf);
90     QFont axisFont(int axis);
91     void pickAxisLabelFont();
92 
93     void pickNumbersFont();
setNumbersFonts(const QFont & f)94     void setNumbersFonts(const QFont &f) { numbersFont = f; };
95 
96     QStringList scaleOptions(int axis, double start, double end, const QString &majors,
97                              const QString &minors);
98     void setScales(const QStringList &list);
99     void viewScaleLimits(int axis);
100 
101     void setAxesTickLengths(const QStringList &list);
102     void setMeshLineWidth(double lw);
103     void setLabelsDistance(int dist);
104 
105     void disableAxesOptions();
106     void disableMeshOptions();
107     void disableLegend();
108     void disableGridOptions();
109     void showBarsTab(double rad);
110     void showPointsTab(double rad, bool smooth);
111     void showConesTab(double rad, int quality);
112     void showCrossHairTab(double rad, double linewidth, bool smooth, bool boxed);
113 
114     void customWorksheetBtn(const QString &text);
115     void worksheet();
116     void setZoom(double zoom);
117     void setScaling(double xVal, double yVal, double zVal);
118     void showTitleTab();
119     void showAxisTab();
120 
121     void initPointsOptionsStack();
122     void changeZoom(double);
123     void changeTransparency(int val);
124 
125     void showLowerGreek();
126     void showUpperGreek();
127     void addSymbol(const QString &letter);
128     void showGeneralTab();
129 
130     void pickDataColorMap();
setPlot(Graph3D * plot)131     void setPlot(Graph3D *plot) { d_plot = plot; };
132 
133 signals:
134     void showWorksheet();
135     void updatePoints(double, bool);
136     void updateBars(double);
137     void updateTransparency(double);
138     void updateDataColors(const QColor &, const QColor &);
139     void updateColors(const QColor &, const QColor &, const QColor &, const QColor &,
140                       const QColor &, const QColor &);
141     void updateTitle(const QString &, const QColor &, const QFont &);
142     void updateResolution(int);
143     void showColorLegend(bool);
144     void setOrtho(bool);
145     void updateLabel(int, const QString &, const QFont &);
146     void updateScale(int, const QStringList &);
147     void updateTickLength(int, double, double);
148     void adjustLabels(int);
149     void setNumbersFont(const QFont &);
150     void updateMeshLineWidth(int);
151     void updateZoom(double);
152     void updateScaling(double, double, double);
153     void updateCones(double, int);
154     void updateCross(double, double, bool, bool);
155     void setDataColorMap(const QString &);
156 
157 private:
158     void initScalesPage();
159     void initAxesPage();
160     void initTitlePage();
161     void initColorsPage();
162     void initGeneralPage();
163 
164     Graph3D *d_plot;
165     QFont titleFont, xAxisFont, yAxisFont, zAxisFont, numbersFont;
166     QStringList labels, scales, tickLengths;
167     QColor titleColor, meshColor, bgColor, axesColor, numColor, labelColor, gridColor;
168     QColor fromColor, toColor; // custom data colors
169 
170     QSpinBox *boxMeshLineWidth;
171     QPushButton *buttonApply;
172     QPushButton *buttonOk;
173     QPushButton *buttonCancel, *buttonLowerGreek, *buttonUpperGreek;
174     QPushButton *btnTitleColor, *btnTitleFont, *btnLabelFont, *btnGrid;
175     QPushButton *btnBackground, *btnMesh, *btnAxes, *btnTitle, *btnLabels, *btnNumbers;
176     QPushButton *btnNumbersFont, *btnFromColor, *btnToColor, *btnTable, *btnColorMap;
177     QPushButton *buttonAxisLowerGreek, *buttonAxisUpperGreek;
178     QTabWidget *generalDialog;
179     QWidget *scale, *colors, *general, *axes, *title, *bars, *points;
180     QLineEdit *boxTitle, *boxFrom, *boxTo, *boxLabel;
181     QSpinBox *boxMajors, *boxMinors;
182     QGroupBox *TicksGroupBox, *AxesColorGroupBox;
183     QSpinBox *boxResolution, *boxDistance, *boxTransparency;
184     QCheckBox *boxLegend, *boxSmooth, *boxBoxed, *boxCrossSmooth, *boxOrthogonal;
185     QListWidget *axesList, *axesList2;
186     QComboBox *boxType, *boxPointStyle;
187     QLineEdit *boxMajorLength, *boxMinorLength, *boxConesRad;
188     QDoubleSpinBox *boxZoom, *boxXScale, *boxYScale, *boxZScale;
189     QSpinBox *boxQuality;
190     QLineEdit *boxSize, *boxBarsRad, *boxCrossRad, *boxCrossLinewidth;
191     QStackedWidget *optionStack;
192     QWidget *dotsPage, *conesPage, *crossPage;
193 };
194 
195 #endif
196