scidavis  2.3.0
About: SciDAVis is a free application for Scientific Data Analysis and Visualization (a fork off of QtiPlot).
  Fossies Dox: scidavis-2.3.0.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

SurfaceDialog Class Reference

Define surface plot dialog. More...

#include <SurfaceDialog.h>

Inheritance diagram for SurfaceDialog:
[legend]
Collaboration diagram for SurfaceDialog:
[legend]

Public Slots

void accept ()
 
void insertFunctionsList (const QStringList &list)
 
void clearList ()
 
void setFunction (const QString &s)
 
void setLimits (double xs, double xe, double ys, double ye, double zs, double ze)
 

Signals

void options (const QString &, double, double, double, double, double, double)
 
void clearFunctionsList ()
 
void custom3DToolBar ()
 

Public Member Functions

 SurfaceDialog (QWidget *parent=0, Qt::WindowFlags fl=0)
 
 ~SurfaceDialog ()
 

Private Attributes

QPushButton * buttonOk
 
QPushButton * buttonCancel
 
QPushButton * buttonClear
 
QComboBox * boxFunction
 
QLineEdit * boxXFrom
 
QLineEdit * boxXTo
 
QLineEdit * boxYFrom
 
QLineEdit * boxYTo
 
QLineEdit * boxZFrom
 
QLineEdit * boxZTo
 

Detailed Description

Define surface plot dialog.

Definition at line 40 of file SurfaceDialog.h.

Constructor & Destructor Documentation

◆ SurfaceDialog()

SurfaceDialog::SurfaceDialog ( QWidget *  parent = 0,
Qt::WindowFlags  fl = 0 
)

File : SurfaceDialog.cpp

Project : SciDAVis

Copyright : (C) 2006 by Ion Vasilief Email (use @ for *) : ion_vasilief*yahoo.fr Description : Define surface plot dialog

  • This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. *
    • This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. *
    • You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA *

Definition at line 41 of file SurfaceDialog.cpp.

42  : QDialog( parent, fl )
43 {
44  setWindowTitle(tr("Define surface plot"));
45  setSizeGripEnabled( true );
46 
47  boxFunction = new QComboBox();
48  boxFunction->setEditable(true);
49 
50  QBoxLayout *bl1 = new QBoxLayout (QBoxLayout::LeftToRight);
51  bl1->addWidget(new QLabel( tr("f(x,y)=")), 1);
52  bl1->addWidget(boxFunction, 10);
53 
54  QGroupBox *gb1 = new QGroupBox(tr("X - axis"));
55 
56  boxXFrom = new QLineEdit();
57  boxXFrom->setText(tr("-1"));
58 
59  boxXTo = new QLineEdit();
60  boxXTo->setText(tr("1"));
61 
62  QGridLayout *gl1 = new QGridLayout();
63  gl1->addWidget(new QLabel( tr("From")), 0, 0);
64  gl1->addWidget(boxXFrom, 0, 1);
65  gl1->addWidget(new QLabel(tr("To")), 1, 0);
66  gl1->addWidget(boxXTo, 1, 1);
67  gl1->setRowStretch(2, 1);
68  gb1->setLayout(gl1);
69 
70  QGroupBox *gb2 = new QGroupBox(tr("Y - axis"));
71  boxYFrom = new QLineEdit();
72  boxYFrom->setText(tr("-1"));
73 
74  boxYTo = new QLineEdit();
75  boxYTo->setText(tr("1"));
76 
77  QGridLayout *gl2 = new QGridLayout();
78  gl2->addWidget(new QLabel( tr("From")), 0, 0);
79  gl2->addWidget(boxYFrom, 0, 1);
80  gl2->addWidget(new QLabel(tr("To")), 1, 0);
81  gl2->addWidget(boxYTo, 1, 1);
82  gl2->setRowStretch(2, 1);
83  gb2->setLayout(gl2);
84 
85  QGroupBox *gb3 = new QGroupBox(tr("Z - axis"));
86  boxZFrom = new QLineEdit();
87  boxZFrom->setText(tr("-1"));
88 
89  boxZTo = new QLineEdit();
90  boxZTo->setText(tr("1"));
91 
92  QGridLayout *gl3 = new QGridLayout();
93  gl3->addWidget(new QLabel( tr("From")), 0, 0);
94  gl3->addWidget(boxZFrom, 0, 1);
95  gl3->addWidget(new QLabel(tr("To")), 1, 0);
96  gl3->addWidget(boxZTo, 1, 1);
97  gl3->setRowStretch(2, 1);
98  gb3->setLayout(gl3);
99 
100  QBoxLayout *bl3 = new QBoxLayout (QBoxLayout::LeftToRight);
101  bl3->addWidget(gb1);
102  bl3->addWidget(gb2);
103  bl3->addWidget(gb3);
104 
105  buttonClear = new QPushButton(tr("Clear &list"));
106  buttonOk = new QPushButton(tr("&OK"));
107  buttonOk->setDefault(true);
108  buttonCancel = new QPushButton(tr("&Close"));
109 
110  QBoxLayout *bl2 = new QBoxLayout ( QBoxLayout::LeftToRight);
111  bl2->addStretch();
112  bl2->addWidget(buttonOk);
113  bl2->addWidget(buttonClear);
114  bl2->addWidget(buttonCancel);
115  bl2->addStretch();
116 
117  QVBoxLayout* vl = new QVBoxLayout(this);
118  vl->addLayout(bl1);
119  vl->addLayout(bl3);
120  vl->addLayout(bl2);
121 
122  resize(vl->minimumSize());
123  setFocusProxy(boxFunction);
124 
125  connect( buttonClear, SIGNAL( clicked() ), this, SLOT(clearList() ) );
126  connect( buttonOk, SIGNAL( clicked() ), this, SLOT( accept() ) );
127  connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
128 }

References accept(), boxFunction, boxXFrom, boxXTo, boxYFrom, boxYTo, boxZFrom, boxZTo, buttonCancel, buttonClear, buttonOk, and clearList().

Here is the call graph for this function:

◆ ~SurfaceDialog()

SurfaceDialog::~SurfaceDialog ( )

Definition at line 281 of file SurfaceDialog.cpp.

282 {
283 }

Member Function Documentation

◆ accept

void SurfaceDialog::accept ( )
slot

Definition at line 151 of file SurfaceDialog.cpp.

152 {
153 QString Xfrom=boxXFrom->text().toLower();
154 QString Xto=boxXTo->text().toLower();
155 QString Yfrom=boxYFrom->text().toLower();
156 QString Yto=boxYTo->text().toLower();
157 QString Zfrom=boxZFrom->text().toLower();
158 QString Zto=boxZTo->text().toLower();
159 
160 double fromX, toX, fromY,toY, fromZ,toZ;
161 try
162  {
163  MyParser parser;
164  parser.SetExpr(Xfrom);
165  fromX=parser.Eval();
166  }
167 catch(mu::ParserError &e)
168  {
169  QMessageBox::critical(0, tr("X Start limit error"), QStringFromString(e.GetMsg()));
170  boxXFrom->setFocus();
171  return;
172  }
173 try
174  {
175  MyParser parser;
176  parser.SetExpr(Xto);
177  toX=parser.Eval();
178  }
179 catch(mu::ParserError &e)
180  {
181  QMessageBox::critical(0, tr("X End limit error"), QStringFromString(e.GetMsg()));
182  boxXTo->setFocus();
183  return;
184  }
185 
186 try
187  {
188  MyParser parser;
189  parser.SetExpr(Yfrom);
190  fromY=parser.Eval();
191  }
192 catch(mu::ParserError &e)
193  {
194  QMessageBox::critical(0, tr("Y Start limit error"), QStringFromString(e.GetMsg()));
195  boxYFrom->setFocus();
196  return;
197  }
198 try
199  {
200  MyParser parser;
201  parser.SetExpr(Yto);
202  toY=parser.Eval();
203  }
204 catch(mu::ParserError &e)
205  {
206  QMessageBox::critical(0, tr("Y End limit error"), QStringFromString(e.GetMsg()));
207  boxYTo->setFocus();
208  return;
209  }
210 try
211  {
212  MyParser parser;
213  parser.SetExpr(Zfrom);
214  fromZ=parser.Eval();
215  }
216 catch(mu::ParserError &e)
217  {
218  QMessageBox::critical(0, tr("Z Start limit error"), QStringFromString(e.GetMsg()));
219  boxZFrom->setFocus();
220  return;
221  }
222 try
223  {
224  MyParser parser;
225  parser.SetExpr(Zto);
226  toZ=parser.Eval();
227  }
228 catch(mu::ParserError &e)
229  {
230  QMessageBox::critical(0, tr("Z End limit error"), QStringFromString(e.GetMsg()));
231  boxZTo->setFocus();
232  return;
233  }
234 
235 if (fromX >= toX || fromY >= toY || fromZ >= toZ)
236  {
237  QMessageBox::critical(0, tr("Input error"),
238  tr("Please enter limits that satisfy: from < end!"));
239  boxXTo->setFocus();
240  return;
241  }
242 
243 double x,y;
244 QString formula=boxFunction->currentText();
245 bool error=false;
246 try
247  {
248  MyParser parser;
249  parser.DefineVar(_T("x"), &x);
250  parser.DefineVar(_T("y"), &y);
251  parser.SetExpr(formula);
252 
253  x=fromX; y=fromY;
254  parser.Eval();
255  x=toX; y=toY;
256  parser.Eval();
257  }
258 catch(mu::ParserError &e)
259  {
260  QMessageBox::critical(0, tr("Input function error"), QStringFromString(e.GetMsg()));
261  boxFunction->setFocus();
262  error=true;
263  }
264 
265 if (!error)
266  {
267  emit options(boxFunction->currentText(),fromX, toX, fromY, toY, fromZ, toZ);
268  emit custom3DToolBar();
269 
270  ApplicationWindow *app = (ApplicationWindow *)this->parent();
271  app->updateSurfaceFuncList(boxFunction->currentText());
272  close();
273  }
274 }

References boxFunction, boxXFrom, boxXTo, boxYFrom, boxYTo, boxZFrom, boxZTo, custom3DToolBar(), options(), QStringFromString(), MyParser::SetExpr(), and ApplicationWindow::updateSurfaceFuncList().

Referenced by SurfaceDialog().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ clearFunctionsList

void SurfaceDialog::clearFunctionsList ( )
signal

Referenced by clearList().

Here is the caller graph for this function:

◆ clearList

void SurfaceDialog::clearList ( )
slot

Definition at line 130 of file SurfaceDialog.cpp.

131 {
132 boxFunction->clear();
133 emit clearFunctionsList();
134 }

References boxFunction, and clearFunctionsList().

Referenced by SurfaceDialog().

Here is the caller graph for this function:

◆ custom3DToolBar

void SurfaceDialog::custom3DToolBar ( )
signal

Referenced by accept().

Here is the caller graph for this function:

◆ insertFunctionsList

void SurfaceDialog::insertFunctionsList ( const QStringList &  list)
slot

Definition at line 276 of file SurfaceDialog.cpp.

277 {
278 boxFunction->insertItems(1, list);
279 }

References boxFunction.

Referenced by ApplicationWindow::editSurfacePlot(), and ApplicationWindow::newSurfacePlot().

Here is the caller graph for this function:

◆ options

void SurfaceDialog::options ( const QString &  ,
double  ,
double  ,
double  ,
double  ,
double  ,
double   
)
signal

Referenced by accept().

Here is the caller graph for this function:

◆ setFunction

void SurfaceDialog::setFunction ( const QString &  s)
slot

Definition at line 136 of file SurfaceDialog.cpp.

137 {
138 boxFunction->setItemText(boxFunction->currentIndex(), s);
139 }

References boxFunction.

Referenced by ApplicationWindow::editSurfacePlot().

Here is the caller graph for this function:

◆ setLimits

void SurfaceDialog::setLimits ( double  xs,
double  xe,
double  ys,
double  ye,
double  zs,
double  ze 
)
slot

Definition at line 141 of file SurfaceDialog.cpp.

142 {
143  boxXFrom->setText(QString::number(xs));
144  boxXTo->setText(QString::number(xe));
145  boxYFrom->setText(QString::number(ys));
146  boxYTo->setText(QString::number(ye));
147  boxZFrom->setText(QString::number(zs));
148  boxZTo->setText(QString::number(ze));
149 }

References boxXFrom, boxXTo, boxYFrom, boxYTo, boxZFrom, and boxZTo.

Referenced by ApplicationWindow::editSurfacePlot().

Here is the caller graph for this function:

Member Data Documentation

◆ boxFunction

QComboBox* SurfaceDialog::boxFunction
private

Definition at line 64 of file SurfaceDialog.h.

Referenced by accept(), clearList(), insertFunctionsList(), setFunction(), and SurfaceDialog().

◆ boxXFrom

QLineEdit* SurfaceDialog::boxXFrom
private

Definition at line 65 of file SurfaceDialog.h.

Referenced by accept(), setLimits(), and SurfaceDialog().

◆ boxXTo

QLineEdit* SurfaceDialog::boxXTo
private

Definition at line 66 of file SurfaceDialog.h.

Referenced by accept(), setLimits(), and SurfaceDialog().

◆ boxYFrom

QLineEdit* SurfaceDialog::boxYFrom
private

Definition at line 67 of file SurfaceDialog.h.

Referenced by accept(), setLimits(), and SurfaceDialog().

◆ boxYTo

QLineEdit* SurfaceDialog::boxYTo
private

Definition at line 68 of file SurfaceDialog.h.

Referenced by accept(), setLimits(), and SurfaceDialog().

◆ boxZFrom

QLineEdit* SurfaceDialog::boxZFrom
private

Definition at line 69 of file SurfaceDialog.h.

Referenced by accept(), setLimits(), and SurfaceDialog().

◆ boxZTo

QLineEdit* SurfaceDialog::boxZTo
private

Definition at line 70 of file SurfaceDialog.h.

Referenced by accept(), setLimits(), and SurfaceDialog().

◆ buttonCancel

QPushButton* SurfaceDialog::buttonCancel
private

Definition at line 62 of file SurfaceDialog.h.

Referenced by SurfaceDialog().

◆ buttonClear

QPushButton* SurfaceDialog::buttonClear
private

Definition at line 63 of file SurfaceDialog.h.

Referenced by SurfaceDialog().

◆ buttonOk

QPushButton* SurfaceDialog::buttonOk
private

Definition at line 61 of file SurfaceDialog.h.

Referenced by SurfaceDialog().


The documentation for this class was generated from the following files:
QStringFromString
QString QStringFromString(const std::string &x)
Definition: QStringStdString.h:15
SurfaceDialog::buttonOk
QPushButton * buttonOk
Definition: SurfaceDialog.h:61
MyParser
Mathematical parser class based on muParser.
Definition: MyParser.h:52
SurfaceDialog::boxXTo
QLineEdit * boxXTo
Definition: SurfaceDialog.h:66
MyParser::SetExpr
void SetExpr(const QString &x)
Definition: MyParser.h:56
ApplicationWindow::updateSurfaceFuncList
void updateSurfaceFuncList(const QString &s)
Definition: ApplicationWindow.cpp:1906
SurfaceDialog::buttonClear
QPushButton * buttonClear
Definition: SurfaceDialog.h:63
SurfaceDialog::boxZFrom
QLineEdit * boxZFrom
Definition: SurfaceDialog.h:69
SurfaceDialog::options
void options(const QString &, double, double, double, double, double, double)
SurfaceDialog::boxXFrom
QLineEdit * boxXFrom
Definition: SurfaceDialog.h:65
SurfaceDialog::custom3DToolBar
void custom3DToolBar()
SurfaceDialog::boxYTo
QLineEdit * boxYTo
Definition: SurfaceDialog.h:68
ApplicationWindow
SciDAVis's main window.
Definition: ApplicationWindow.h:122
SurfaceDialog::buttonCancel
QPushButton * buttonCancel
Definition: SurfaceDialog.h:62
SurfaceDialog::boxFunction
QComboBox * boxFunction
Definition: SurfaceDialog.h:64
SurfaceDialog::clearList
void clearList()
Definition: SurfaceDialog.cpp:130
SurfaceDialog::clearFunctionsList
void clearFunctionsList()
SurfaceDialog::accept
void accept()
Definition: SurfaceDialog.cpp:151
SurfaceDialog::boxYFrom
QLineEdit * boxYFrom
Definition: SurfaceDialog.h:67
SurfaceDialog::boxZTo
QLineEdit * boxZTo
Definition: SurfaceDialog.h:70