DLA-Fire-Prediction-Thesis 1.0

MainWindow Class Reference

the main re-sizable window which contains a GLWindow widget used to hold our basic gl applications More...

#include <MainWindow.h>

Collaboration diagram for MainWindow:

List of all members.

Public Member Functions

 MainWindow (QWidget *_parent=0)
 ctor
 ~MainWindow ()
 dtor free up the GLWindow and all resources

Private Slots

void toggleTerrainButton ()
 here we add our GLWindow extending the base functionality of our class
void toggleGenerateButton ()
 a slot to toggle the new DLA form generating button
void toggleEditButton ()
 a slot to toggle the scene editing button
void toggleWind ()
 a slot to toggle the wind enabling
void setNewMoisture (double _currentTemp)
 a slot to calculate the moisture of the scene, considering with the scene temperature
void setNewObjMaximum (int _newObjAmount)
 a slot to set the new maximum of index object number spin box
void increaseFuelLength ()
 a slot to increase the fuel object radius or length
void increaseFuelHeight ()
 a slot to increase the fuel object height
void decreaseFuelLength ()
 a slot to decrease the fuel object radius or length
void decreaseFuelHeight ()
 a slot to decrease the fuel object height
void setNewMaximum (int _newMaximum)
 a slot to set the new maximum value of origin index box's selection

Private Attributes

Ui::MainWindow * m_ui
 a pointer to our user interface
GLWindowm_gl
 our gl window created in GLWindow.h (openGL widget)
double m_previousTemp
 the previous temperature of the scene before changing

Detailed Description

the main re-sizable window which contains a GLWindow widget used to hold our basic gl applications

Definition at line 27 of file MainWindow.h.


Constructor & Destructor Documentation

MainWindow::MainWindow ( QWidget *  _parent = 0) [explicit]

ctor

Parameters:
[in]parentthe parent window

Definition at line 11 of file MainWindow.cpp.

References decreaseFuelHeight(), decreaseFuelLength(), increaseFuelHeight(), increaseFuelLength(), m_gl, m_previousTemp, m_ui, setNewMaximum(), setNewMoisture(), setNewObjMaximum(), GLWindow::showWindDir(), toggleEditButton(), toggleGenerateButton(), toggleTerrainButton(), and toggleWind().

                       :
                        QMainWindow(_parent),
                        m_ui(new Ui::MainWindow)
{
    // setup the user interface
    m_ui->setupUi(this);
    // create our GL window for drawing the scene
    m_gl=new GLWindow(this);
    // add the glWindow to the UI
    m_ui->s_mainWindowGridLayout->addWidget(m_gl,0,0,2,1);

    m_previousTemp = m_ui->m_sceneTemp->value();

    // ----- wireframe and appearance of the scene
    connect(m_ui->m_wireframe,SIGNAL(toggled(bool)),m_gl,SLOT(toggleWireframe(bool)));
    connect(m_ui->m_showMark, SIGNAL(toggled(bool)), m_gl, SLOT(toggleShowMark(bool)));
    connect(m_ui->m_lineShowingOnly,SIGNAL(toggled(bool)),m_gl,SLOT(toggleShowLine(bool)));


    // ----- camera
    connect(m_ui->m_cameraSelection,SIGNAL(currentIndexChanged(int)),m_gl,SLOT(pickCamera(int)));
    connect(m_ui->m_zoomIn, SIGNAL(clicked()),m_gl,SLOT(zoomIn()));
    connect(m_ui->m_zoomOut,SIGNAL(clicked()),m_gl,SLOT(zoomOut()));
    // ----- terrain
    connect(m_ui->m_mountain, SIGNAL(toggled(bool)),m_gl,SLOT(toggleTerrain(bool)));
    connect(m_ui->m_mountain, SIGNAL(toggled(bool)),this,SLOT(toggleTerrainButton()));
    if(m_ui->m_mountain->isChecked())
    {
        m_ui->m_heightDown->setEnabled(true);
        m_ui->m_heightUp->setEnabled(true);
        m_ui->m_mountainReset->setEnabled(true);
        m_ui->m_mountainIterationsNumber->setEnabled(true);
        m_ui->m_originAmount->setEnabled(true);
        m_ui->m_originIndex->setEnabled(true);

        connect(m_ui->m_mountainReset, SIGNAL(clicked()),m_gl,SLOT(resetMountain()));
        connect(m_ui->m_heightUp, SIGNAL(clicked()),m_gl,SLOT(increaseTerrainHeight()));
        connect(m_ui->m_heightDown, SIGNAL(clicked()),m_gl,SLOT(decreaseTerrainHeight()));
        connect(m_ui->m_mountainIterationsNumber, SIGNAL(valueChanged(int)),m_gl,SLOT(setNewMountainIterations(int)));
        connect(m_ui->m_originAmount, SIGNAL(valueChanged(int)), m_gl, SLOT(assignNewOrigin(int)));
        connect(m_ui->m_originAmount, SIGNAL(valueChanged(int)), this, SLOT(setNewMaximum(int)));
    }
    else
    {
        m_ui->m_heightDown->setEnabled(false);
        m_ui->m_heightUp->setEnabled(false);
        m_ui->m_mountainReset->setEnabled(false);
        m_ui->m_mountainIterationsNumber->setEnabled(false);
    }

    // ----- fire origin
    connect(m_ui->m_originIndex, SIGNAL(valueChanged(int)), m_gl, SLOT(selectMovingOrigin(int)));
    connect(m_ui->m_moveLeft, SIGNAL(clicked()),m_gl,SLOT(moveOriginLeft()));
    connect(m_ui->m_moveRight, SIGNAL(clicked()),m_gl,SLOT(moveOriginRight()));
    connect(m_ui->m_moveUp, SIGNAL(clicked()),m_gl,SLOT(moveOriginUp()));
    connect(m_ui->m_moveDown, SIGNAL(clicked()),m_gl,SLOT(moveOriginDown()));

    // ----- fire obstacle (non-flammable and flammable fuel)
    connect(m_ui->m_obstacleNumber, SIGNAL(valueChanged(int)), m_gl, SLOT(adjustObstacleAmount(int)));
    connect(m_ui->m_fuelObjectAmount, SIGNAL(valueChanged(int)), m_gl, SLOT(adjustFuelAmount(int)));
    connect(m_ui->m_fuelMoisture, SIGNAL(valueChanged(double)), m_gl, SLOT(changeObjMoisture(double)));
    connect(m_ui->m_fuelObjectAmount, SIGNAL(valueChanged(int)), this, SLOT(setNewObjMaximum(int)));
    connect(m_ui->m_fuelIndex, SIGNAL(valueChanged(int)), m_gl, SLOT(selectObjIndexToAdjustSize(int)));
    // size adjust
    connect(m_ui->m_increaseFuelLength, SIGNAL(clicked()), this, SLOT(increaseFuelLength()));
    connect(m_ui->m_decreaseFuelLength, SIGNAL(clicked()), this, SLOT(decreaseFuelLength()));
    connect(m_ui->m_increaseFuel, SIGNAL(clicked()), this, SLOT(increaseFuelHeight()));
    connect(m_ui->m_decreaseFuel, SIGNAL(clicked()), this, SLOT(decreaseFuelHeight()));

    // ----- play, pause, generate and edit button
    connect(m_ui->m_generateToggle, SIGNAL(clicked()), this, SLOT(toggleGenerateButton()));
    connect(m_ui->m_editSceneToggle, SIGNAL(clicked()), this, SLOT(toggleEditButton()));
    connect(m_ui->m_generateToggle, SIGNAL(clicked()), m_gl, SLOT(generateNewFirePath()));
    connect(m_ui->m_editSceneToggle, SIGNAL(clicked()), m_gl, SLOT(editDLA()));
    connect(m_ui->m_pause, SIGNAL(clicked()), m_gl, SLOT(pauseAnimation()));
    connect(m_ui->m_play, SIGNAL(clicked()), m_gl, SLOT(playAnimation()));

    // ----- wind
    connect(m_ui->m_windCheckBox, SIGNAL(toggled(bool)), m_gl, SLOT(enableWind(bool)));
    connect(m_ui->m_windCheckBox, SIGNAL(toggled(bool)), this, SLOT(toggleWind()));

    if(m_ui->m_windCheckBox->isChecked())
    {
        m_ui->m_windArrowShow->setEnabled(true);
        m_ui->m_windDialDir->setEnabled(true);
        m_ui->m_windSpeed->setEnabled(true);

        // label
        m_ui->m_winddirlabel->setEnabled(true);
        m_ui->m_windspeedlabel->setEnabled(true);

        if(m_ui->m_windArrowShow->isChecked())
            m_gl->showWindDir(true);

        connect(m_ui->m_windSpeed, SIGNAL(valueChanged(int)), m_gl, SLOT(assignWindSpeed(int)));
        connect(m_ui->m_windArrowShow, SIGNAL(toggled(bool)), m_gl, SLOT(showWindDir(bool)));
        connect(m_ui->m_windDialDir, SIGNAL(sliderMoved(int)), m_gl, SLOT(changeWindDirection(int)));
    }
    else
    {
        m_ui->m_windArrowShow->setEnabled(false);
        m_ui->m_windDialDir->setEnabled(false);
        m_ui->m_windSpeed->setEnabled(false);

        // label
        m_ui->m_winddirlabel->setEnabled(false);
        m_ui->m_windspeedlabel->setEnabled(false);
    }

    // Weather
    connect(m_ui->m_sceneMoisture, SIGNAL(valueChanged(double)), m_gl, SLOT(changeMoistureOfTheScene(double)));
    connect(m_ui->m_sceneTemp, SIGNAL(valueChanged(double)), m_gl, SLOT(changeTemperature(double)));
    connect(m_ui->m_sceneTemp, SIGNAL(valueChanged(double)), this, SLOT(setNewMoisture(double)));

}

Here is the call graph for this function:

MainWindow::~MainWindow ( )

dtor free up the GLWindow and all resources

Definition at line 130 of file MainWindow.cpp.

References m_ui.

{
    delete m_ui;
}

Member Function Documentation

void MainWindow::decreaseFuelHeight ( ) [private, slot]

a slot to decrease the fuel object height

Definition at line 284 of file MainWindow.cpp.

References GLWindow::adjustFuelSize(), and m_gl.

{
    m_gl->adjustFuelSize(3 , 2);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void MainWindow::decreaseFuelLength ( ) [private, slot]

a slot to decrease the fuel object radius or length

Definition at line 290 of file MainWindow.cpp.

References GLWindow::adjustFuelSize(), and m_gl.

{
    m_gl->adjustFuelSize(1 , 2);

}

Here is the call graph for this function:

Here is the caller graph for this function:

void MainWindow::increaseFuelHeight ( ) [private, slot]

a slot to increase the fuel object height

Definition at line 271 of file MainWindow.cpp.

References GLWindow::adjustFuelSize(), and m_gl.

{
    m_gl->adjustFuelSize(3 , 1);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void MainWindow::increaseFuelLength ( ) [private, slot]

a slot to increase the fuel object radius or length

Definition at line 277 of file MainWindow.cpp.

References GLWindow::adjustFuelSize(), and m_gl.

{
    m_gl->adjustFuelSize(1 , 1);

}

Here is the call graph for this function:

Here is the caller graph for this function:

void MainWindow::setNewMaximum ( int  _newMaximum) [private, slot]

a slot to set the new maximum value of origin index box's selection

Parameters:
[in]_newMaximumis the amount of origin

Definition at line 167 of file MainWindow.cpp.

References m_ui.

{
    m_ui->m_originIndex->setMaximum(_newMaximum);
}

Here is the caller graph for this function:

void MainWindow::setNewMoisture ( double  _currentTemp) [private, slot]

a slot to calculate the moisture of the scene, considering with the scene temperature

Parameters:
_currentTempis the current temperature of the scene

Definition at line 136 of file MainWindow.cpp.

References GLWindow::changeMoistureOfTheScene(), m_gl, m_previousTemp, and m_ui.

{
    double m_checkTemp = m_previousTemp - _currentTemp;
    double m_currentMoisture = m_ui->m_sceneMoisture->value();

    // it means the temperature has decreased
    if(m_checkTemp>0)
    {
        // according to the previous work, if the temperature has decreased every 20 Celsius, the moisture would be double increased.
        if(m_checkTemp>=20)
        {
            m_currentMoisture *= 2;
            m_previousTemp = _currentTemp;
            m_gl->changeMoistureOfTheScene(m_currentMoisture);
        }
    }
    else
    {
        // according to the previous work, if the temperature has increased every 20 Celsius, the moisture would be double decreased.
        if(m_checkTemp<=-20)
        {
            m_currentMoisture = m_currentMoisture/2;
            m_previousTemp = _currentTemp;
            m_gl->changeMoistureOfTheScene(m_currentMoisture);
        }
    }

    m_ui->m_sceneMoisture->setValue(m_currentMoisture);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void MainWindow::setNewObjMaximum ( int  _newObjAmount) [private, slot]

a slot to set the new maximum of index object number spin box

Parameters:
[in]_newObjAmountis the object amount

Definition at line 175 of file MainWindow.cpp.

References m_ui.

{
    if(_newObjAmount>0)
    {
        m_ui->m_fuelIndex->setEnabled(true);
        m_ui->m_fuelIndex->setMaximum(_newObjAmount);
    }
    else
    {
        m_ui->m_fuelIndex->setMaximum(1);
        m_ui->m_fuelIndex->setEnabled(false);
    }

}

Here is the caller graph for this function:

void MainWindow::toggleEditButton ( ) [private, slot]

a slot to toggle the scene editing button

Definition at line 201 of file MainWindow.cpp.

References m_ui.

{
    m_ui->m_tabMenu->setEnabled(true);
    m_ui->m_generateToggle->setEnabled(true);
    m_ui->m_editSceneToggle->setEnabled(false);
    m_ui->m_pause->setEnabled(false);
    m_ui->m_play->setEnabled(false);
}

Here is the caller graph for this function:

void MainWindow::toggleGenerateButton ( ) [private, slot]

a slot to toggle the new DLA form generating button

Definition at line 191 of file MainWindow.cpp.

References m_ui.

{
    m_ui->m_tabMenu->setEnabled(false);
    m_ui->m_generateToggle->setEnabled(false);
    m_ui->m_editSceneToggle->setEnabled(true);
    m_ui->m_pause->setEnabled(true);
    m_ui->m_play->setEnabled(true);
}

Here is the caller graph for this function:

void MainWindow::toggleTerrainButton ( ) [private, slot]

here we add our GLWindow extending the base functionality of our class

a slot to toggle the terrain generating button

Definition at line 211 of file MainWindow.cpp.

References m_gl, m_ui, and setNewMaximum().

{
    if(m_ui->m_mountain->isChecked())
    {
        m_ui->m_heightDown->setEnabled(true);
        m_ui->m_heightUp->setEnabled(true);
        m_ui->m_mountainReset->setEnabled(true);
        m_ui->m_mountainIterationsNumber->setEnabled(true);
        m_ui->m_originAmount->setEnabled(true);

        connect(m_ui->m_mountainReset, SIGNAL(clicked()),m_gl,SLOT(resetMountain()));
        connect(m_ui->m_heightUp, SIGNAL(clicked()),m_gl,SLOT(increaseTerrainHeight()));
        connect(m_ui->m_heightDown, SIGNAL(clicked()),m_gl,SLOT(decreaseTerrainHeight()));
        connect(m_ui->m_mountainIterationsNumber, SIGNAL(valueChanged(int)),m_gl,SLOT(setNewMountainIterations(int)));
        connect(m_ui->m_originAmount, SIGNAL(valueChanged(int)), m_gl, SLOT(assignNewOrigin(int)));
        connect(m_ui->m_originAmount, SIGNAL(valueChanged(int)), this, SLOT(setNewMaximum(int)));
    }
    else
    {
        m_ui->m_heightDown->setEnabled(false);
        m_ui->m_heightUp->setEnabled(false);
        m_ui->m_mountainReset->setEnabled(false);
        m_ui->m_mountainIterationsNumber->setEnabled(false);
        m_ui->m_originAmount->setEnabled(false);
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void MainWindow::toggleWind ( ) [private, slot]

a slot to toggle the wind enabling

Definition at line 239 of file MainWindow.cpp.

References m_gl, m_ui, and GLWindow::showWindDir().

{
    if(m_ui->m_windCheckBox->isChecked())
    {
        m_ui->m_windArrowShow->setEnabled(true);
        m_ui->m_windDialDir->setEnabled(true);
        m_ui->m_windSpeed->setEnabled(true);

        // label
        m_ui->m_winddirlabel->setEnabled(true);
        m_ui->m_windspeedlabel->setEnabled(true);

        if(m_ui->m_windArrowShow->isChecked())
            m_gl->showWindDir(true);

        connect(m_ui->m_windSpeed, SIGNAL(valueChanged(int)), m_gl, SLOT(assignWindSpeed(int)));
        connect(m_ui->m_windArrowShow, SIGNAL(toggled(bool)), m_gl, SLOT(showWindDir(bool)));
        connect(m_ui->m_windDialDir, SIGNAL(sliderMoved(int)), m_gl, SLOT(changeWindDirection(int)));
    }
    else
    {
        m_ui->m_windArrowShow->setEnabled(false);
        m_ui->m_windDialDir->setEnabled(false);
        m_ui->m_windSpeed->setEnabled(false);

        // label
        m_ui->m_winddirlabel->setEnabled(false);
        m_ui->m_windspeedlabel->setEnabled(false);
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

our gl window created in GLWindow.h (openGL widget)

Definition at line 111 of file MainWindow.h.

double MainWindow::m_previousTemp [private]

the previous temperature of the scene before changing

Definition at line 116 of file MainWindow.h.

Ui::MainWindow* MainWindow::m_ui [private]

a pointer to our user interface

Definition at line 106 of file MainWindow.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Enumerations Enumerator