22 #include <QtGui/QDialog> 
   23 #include <QtGui/QHBoxLayout> 
   24 #include <QtGui/QLabel> 
   25 #include <QtGui/QVBoxLayout> 
   26 #include <QtGui/QResizeEvent> 
   27 #include <QtGui/QIntValidator> 
   29 #include <SeExpr2/ExprBuiltins.h> 
   36     emit 
resizeSignal(event->size().width(), 
event->size().height());
 
   55     setSceneRect(-9, -7, width, height);
 
   99     QString flowDirection = val.remove(0,1);
 
  100     flowDirection = flowDirection.remove(flowDirection.size()-1,1);
 
  101     QStringList 
components = flowDirection.split(
",");
 
  162         _curvePoly = addPolygon(QPolygonF(), QPen(Qt::black, 1.0), QBrush(Qt::darkGray));
 
  166     poly.append(QPointF(
_width, 0));
 
  167     poly.append(QPointF(0, 0));
 
  168     for (
int i = 0; i < 1000; i++) {
 
  172     poly.append(QPointF(
_width, 0));
 
  189 ExprDeepWater::ExprDeepWater(QWidget* parent) : QWidget(parent), _scene(0), _resolutionEdit(0), _tileSizeEdit(0), _lengthCutoffEdit(0), _amplitudeEdit(0), _windAngleEdit(0), _windSpeedEdit(0), _flowDirectionEdit(0), _directionalFactorExponentEdit(0), _directionalReflectionDampingEdit(0), _sharpenEdit(0)
 
  191     QHBoxLayout *mainLayout = 
new QHBoxLayout();
 
  192     mainLayout->setSpacing(2);
 
  193     mainLayout->setMargin(4);
 
  195     QWidget *edits = 
new QWidget;
 
  196     QVBoxLayout *editsLayout = 
new QVBoxLayout;
 
  197     editsLayout->setAlignment(Qt::AlignTop);
 
  198     editsLayout->setSpacing(0);
 
  199     editsLayout->setMargin(0);
 
  200     edits->setLayout(editsLayout);
 
  202     int editWidth = QFontMetrics(font()).width(
"[0,0,0]")+8;
 
  204     QWidget *resolution = 
new QWidget;
 
  205     QHBoxLayout *resolutionLayout = 
new QHBoxLayout;
 
  206     resolutionLayout->setSpacing(1);
 
  207     resolutionLayout->setMargin(1);
 
  208     resolution->setLayout(resolutionLayout);
 
  211     QIntValidator *resolutionValidator = 
new QIntValidator(
_resolutionEdit);
 
  212     resolutionValidator->setBottom(1);
 
  215     resolutionLayout->addStretch(50);
 
  216     QLabel *resolutionLabel = 
new QLabel(
"R");
 
  217     resolutionLabel->setToolTip(
"Resolution");
 
  218     resolutionLayout->addWidget(resolutionLabel);
 
  221     QWidget *tileSize = 
new QWidget;
 
  222     QHBoxLayout *tileSizeLayout = 
new QHBoxLayout;
 
  223     tileSizeLayout->setSpacing(1);
 
  224     tileSizeLayout->setMargin(1);
 
  225     tileSize->setLayout(tileSizeLayout);
 
  229     tileSizeLayout->addStretch(50);
 
  230     QLabel *tileSizeLabel = 
new QLabel(
"TS");
 
  231     tileSizeLabel->setToolTip(
"Tile Size");
 
  232     tileSizeLayout->addWidget(tileSizeLabel);
 
  235     QWidget *lengthCutoff = 
new QWidget;
 
  236     QHBoxLayout *lengthCutoffLayout = 
new QHBoxLayout;
 
  237     lengthCutoffLayout->setSpacing(1);
 
  238     lengthCutoffLayout->setMargin(1);
 
  239     lengthCutoff->setLayout(lengthCutoffLayout);
 
  243     lengthCutoffLayout->addStretch(50);
 
  244     QLabel *lengthCutoffLabel = 
new QLabel(
"LC");
 
  245     lengthCutoffLabel->setToolTip(
"Length Cutoff");
 
  246     lengthCutoffLayout->addWidget(lengthCutoffLabel);
 
  249     QWidget *amplitude = 
new QWidget;
 
  250     QHBoxLayout *amplitudeLayout = 
new QHBoxLayout;
 
  251     amplitudeLayout->setSpacing(1);
 
  252     amplitudeLayout->setMargin(1);
 
  253     amplitude->setLayout(amplitudeLayout);
 
  257     amplitudeLayout->addStretch(50);
 
  258     QLabel *amplitudeLabel = 
new QLabel(
"A");
 
  259     amplitudeLabel->setToolTip(
"Amplitude");
 
  260     amplitudeLayout->addWidget(amplitudeLabel);
 
  263     QWidget *windAngle = 
new QWidget;
 
  264     QHBoxLayout *windAngleLayout = 
new QHBoxLayout;
 
  265     windAngleLayout->setSpacing(1);
 
  266     windAngleLayout->setMargin(1);
 
  267     windAngle->setLayout(windAngleLayout);
 
  271     windAngleLayout->addStretch(50);
 
  272     QLabel *windAngleLabel = 
new QLabel(
"WA");
 
  273     windAngleLabel->setToolTip(
"Wind Angle");
 
  274     windAngleLayout->addWidget(windAngleLabel);
 
  277     QWidget *windSpeed = 
new QWidget;
 
  278     QHBoxLayout *windSpeedLayout = 
new QHBoxLayout;
 
  279     windSpeedLayout->setSpacing(1);
 
  280     windSpeedLayout->setMargin(1);
 
  281     windSpeed->setLayout(windSpeedLayout);
 
  285     windSpeedLayout->addStretch(50);
 
  286     QLabel *windSpeedLabel = 
new QLabel(
"WS");
 
  287     windSpeedLabel->setToolTip(
"Wind Speed");
 
  288     windSpeedLayout->addWidget(windSpeedLabel);
 
  291     QWidget *directionalFactorExponent = 
new QWidget;
 
  292     QHBoxLayout *directionalFactorExponentLayout = 
new QHBoxLayout;
 
  293     directionalFactorExponentLayout->setSpacing(1);
 
  294     directionalFactorExponentLayout->setMargin(1);
 
  295     directionalFactorExponent->setLayout(directionalFactorExponentLayout);
 
  299     directionalFactorExponentLayout->addStretch(50);
 
  300     QLabel *directionalFactorExponentLabel = 
new QLabel(
"DFE");
 
  301     directionalFactorExponentLabel->setToolTip(
"Directional Factor Exponent");
 
  302     directionalFactorExponentLayout->addWidget(directionalFactorExponentLabel);
 
  305     QWidget *directionalReflectionDamping = 
new QWidget;
 
  306     QHBoxLayout *directionalReflectionDampingLayout = 
new QHBoxLayout;
 
  307     directionalReflectionDampingLayout->setSpacing(1);
 
  308     directionalReflectionDampingLayout->setMargin(1);
 
  309     directionalReflectionDamping->setLayout(directionalReflectionDampingLayout);
 
  313     directionalReflectionDampingLayout->addStretch(50);
 
  314     QLabel *directionalReflectionDampingLabel = 
new QLabel(
"DRD");
 
  315     directionalReflectionDampingLabel->setToolTip(
"Directional Reflection Damping");
 
  316     directionalReflectionDampingLayout->addWidget(directionalReflectionDampingLabel);
 
  319     QWidget *flowDirection = 
new QWidget;
 
  320     QHBoxLayout *flowDirectionLayout = 
new QHBoxLayout;
 
  321     flowDirectionLayout->setSpacing(1);
 
  322     flowDirectionLayout->setMargin(1);
 
  323     flowDirection->setLayout(flowDirectionLayout);
 
  327     flowDirectionLayout->addStretch(50);
 
  328     QLabel *flowDirectionLabel = 
new QLabel(
"FD");
 
  329     flowDirectionLabel->setToolTip(
"Flow Direction");
 
  330     flowDirectionLayout->addWidget(flowDirectionLabel);
 
  333     QWidget *sharpen = 
new QWidget;
 
  334     QHBoxLayout *sharpenLayout = 
new QHBoxLayout;
 
  335     sharpenLayout->setSpacing(1);
 
  336     sharpenLayout->setMargin(1);
 
  337     sharpen->setLayout(sharpenLayout);
 
  341     sharpenLayout->addStretch(50);
 
  342     QLabel *sharpenLabel = 
new QLabel(
"S");
 
  343     sharpenLabel->setToolTip(
"Sharpen");
 
  344     sharpenLayout->addWidget(sharpenLabel);
 
  347     QFrame *curveFrame = 
new QFrame;
 
  348     curveFrame->setFrameShape(QFrame::Panel);
 
  349     curveFrame->setFrameShadow(QFrame::Sunken);
 
  350     curveFrame->setLineWidth(1);
 
  351     QHBoxLayout *curveFrameLayout = 
new QHBoxLayout;
 
  352     curveFrameLayout->setMargin(0);
 
  354     curveView->setFrameShape(QFrame::Panel);
 
  355     curveView->setFrameShadow(QFrame::Sunken);
 
  356     curveView->setLineWidth(1);
 
  357     curveView->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
 
  358     curveView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
 
  360     curveView->setScene(
_scene);
 
  361     curveView->setTransform(QTransform().scale(1, -1));
 
  362     curveView->setRenderHints(QPainter::Antialiasing);
 
  363     curveFrameLayout->addWidget(curveView);
 
  364     curveFrame->setLayout(curveFrameLayout);
 
  366     editsLayout->addWidget(resolution);
 
  367     editsLayout->addWidget(tileSize);
 
  368     editsLayout->addWidget(lengthCutoff);
 
  369     editsLayout->addWidget(amplitude);
 
  370     editsLayout->addWidget(windSpeed);
 
  371     editsLayout->addWidget(directionalFactorExponent);
 
  372     QFrame* line = 
new QFrame();
 
  373     line->setToolTip(
"Parameters below this do not affect spectrum");
 
  374     line->setFrameShape(QFrame::HLine);
 
  375     line->setFrameShadow(QFrame::Sunken);
 
  376     editsLayout->addWidget(line);
 
  377     editsLayout->addWidget(windAngle);
 
  378     editsLayout->addWidget(flowDirection);
 
  379     editsLayout->addWidget(directionalReflectionDamping);
 
  380     editsLayout->addWidget(sharpen);
 
  382     mainLayout->addWidget(edits);
 
  383     mainLayout->addWidget(curveFrame);
 
  384     mainLayout->setStretchFactor(curveFrame,100);
 
  385     setLayout(mainLayout);
 
  421     connect(curveView, SIGNAL(resizeSignal(
int, 
int)), 
_scene, SLOT(resize(
int, 
int)));
 
  492     QString flowDirection = 
"[";
 
  493     flowDirection += QString::number(params.
flowDirection[0]) + 
"," 
DeepWaterLineEdit * _amplitudeEdit
DeepWaterLineEdit * _sharpenEdit
void lengthCutoffChanged(double val)
void windAngleChangedSignal(double val)
DeepWaterLineEdit * _windSpeedEdit
void amplitudeChanged(double val)
virtual void resizeEvent(QResizeEvent *event)
QGraphicsRectItem * _baseRect
QGraphicsRectItem * _gridRect
DeepWaterLineEdit * _lengthCutoffEdit
void windSpeedChangedSignal(double val)
void flowDirectionChanged(QString val)
void windAngleChanged(double val)
void setParams(const SeDeepWaterParams ¶msIn)
void resolutionChangedSignal(int val)
void flowDirectionChanged()
DeepWaterLineEdit * _resolutionEdit
DeepWaterLineEdit * _flowDirectionEdit
void directionalFactorExponentChanged()
QGraphicsPolygonItem * _curvePoly
void directionalReflectionDampingChangedSignal(double val)
Vec< double, 3, false > Vec3d
SeExpr2::Vec3d flowDirection
double directionalReflectionDamping
DeepWaterLineEdit * _windAngleEdit
double directionalFactorExponent
void directionalReflectionDampingChanged(double val)
void sharpenChanged(double val)
void windSpeedChanged(double val)
void sharpenChangedSignal(double val)
void resize(const int width, const int height)
DeepWaterLineEdit * _directionalReflectionDampingEdit
</pre >< h3 > A simple variable reference</h3 > This is not a very interesting subclass of expression until we add some additional variables Variables on some applications may be very dynamic In this we only need x
void resolutionChanged(int val)
ExprDeepWater(QWidget *parent=0)
SeDeepWater< double > T_CURVE
void tileSizeChangedSignal(double val)
void setParams(const SeDeepWaterParams ¶ms)
void flowDirectionChangedSignal(QString val)
T getValue(double param) const 
Evaluates curve and returns full value. 
DeepWaterLineEdit * _directionalFactorExponentEdit
void directionalFactorExponentChangedSignal(double val)
void resizeSignal(int width, int height)
void lengthCutoffChanged()
DeepWaterLineEdit * _tileSizeEdit
If a scalar is used in a vector it is replicated into the three components(e.g.0.5 becomes[0.5, 0.5, 0.5]). 
void directionalReflectionDampingChanged()
void tileSizeChanged(double val)
void emitDeepWaterChanged()
void setParams(const SeDeepWaterParams ¶msIn)
void amplitudeChangedSignal(double val)
void lengthCutoffChangedSignal(double val)
void directionalFactorExponentChanged(double val)