-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #269 from PauloCarvalhoRJ/NextRelease_20210711
New release: 6.12
- Loading branch information
Showing
64 changed files
with
1,776 additions
and
285 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
#include "subgriddialog.h" | ||
#include "ui_subgriddialog.h" | ||
|
||
#include "domain/cartesiangrid.h" | ||
#include "domain/application.h" | ||
#include "domain/project.h" | ||
#include "imagejockey/widgets/ijquick3dviewer.h" | ||
#include "widgets/variableselector.h" | ||
|
||
SubgridDialog::SubgridDialog(CartesianGrid *cg, QWidget *parent) : | ||
QDialog(parent), | ||
ui(new Ui::SubgridDialog), | ||
m_cg( cg ) | ||
{ | ||
assert( cg && "SubgridDialog::SubgridDialog(): Cartesian grid cannot be null." ); | ||
|
||
ui->setupUi(this); | ||
|
||
//deletes dialog from memory upon user closing it | ||
this->setAttribute(Qt::WA_DeleteOnClose); | ||
|
||
this->setWindowTitle( "Make subgrid" ); | ||
|
||
ui->spinMaxI->setMinimum( 0 ); | ||
ui->spinMaxI->setMaximum( cg->getNI()-1 ); | ||
ui->spinMaxI->setValue( cg->getNI()-1 ); | ||
|
||
ui->spinMinI->setMinimum( 0 ); | ||
ui->spinMinI->setMaximum( cg->getNI()-1 ); | ||
ui->spinMinI->setValue( 0 ); | ||
|
||
ui->spinMaxJ->setMinimum( 0 ); | ||
ui->spinMaxJ->setMaximum( cg->getNJ()-1 ); | ||
ui->spinMaxJ->setValue( cg->getNJ()-1 ); | ||
|
||
ui->spinMinJ->setMinimum( 0 ); | ||
ui->spinMinJ->setMaximum( cg->getNJ()-1 ); | ||
ui->spinMinJ->setValue( 0 ); | ||
|
||
ui->spinMaxK->setMinimum( 0 ); | ||
ui->spinMaxK->setMaximum( cg->getNK()-1 ); | ||
ui->spinMaxK->setValue( cg->getNK()-1 ); | ||
|
||
ui->spinMinK->setMinimum( 0 ); | ||
ui->spinMinK->setMaximum( cg->getNK()-1 ); | ||
ui->spinMinK->setValue( 0 ); | ||
|
||
ui->txtGridName->setText( cg->getName() + "_subgrid" ); | ||
|
||
m_previewWidget = new IJQuick3DViewer(); | ||
ui->frmDisplay->layout()->addWidget( m_previewWidget ); | ||
m_previewWidget->hideDismissButton(); | ||
|
||
//The list with the secondary data grid variables; | ||
m_variableForPreview = new VariableSelector(); | ||
ui->frmCmbVariable->layout()->addWidget( m_variableForPreview ); | ||
m_variableForPreview->onListVariables( m_cg ); | ||
|
||
adjustSize(); | ||
} | ||
|
||
SubgridDialog::~SubgridDialog() | ||
{ | ||
delete ui; | ||
} | ||
|
||
void SubgridDialog::onSave() | ||
{ | ||
CartesianGrid* subgrid = m_cg->makeSubGrid( ui->spinMinI->value(), ui->spinMaxI->value(), | ||
ui->spinMinJ->value(), ui->spinMaxJ->value(), | ||
ui->spinMinK->value(), ui->spinMaxK->value() ); | ||
|
||
//save the physical files | ||
subgrid->setPath( Application::instance()->getProject()->getPath() + | ||
'/' + ui->txtGridName->text() ); | ||
subgrid->updateMetaDataFile(); | ||
subgrid->writeToFS(); | ||
|
||
//adds the new grid to the project | ||
Application::instance()->getProject()->addDataFile( subgrid ); | ||
Application::instance()->refreshProjectTree(); | ||
|
||
//closes the dialog | ||
accept(); | ||
} | ||
|
||
void SubgridDialog::onPreview() | ||
{ | ||
CartesianGrid* subgrid = m_cg->makeSubGrid( ui->spinMinI->value(), ui->spinMaxI->value(), | ||
ui->spinMinJ->value(), ui->spinMaxJ->value(), | ||
ui->spinMinK->value(), ui->spinMaxK->value() ); | ||
|
||
uint dataColumn = m_variableForPreview->getSelectedVariableGEOEASIndex() - 1; | ||
|
||
spectral::array* data = subgrid->createSpectralArray( dataColumn ); | ||
|
||
double min = subgrid->min( dataColumn ); | ||
double max = subgrid->max( dataColumn ); | ||
|
||
m_previewWidget->display( *data, min, max, subgrid->getDX(), subgrid->getDY(), subgrid->getDZ() ); | ||
|
||
delete data; | ||
delete subgrid; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#ifndef SUBGRIDDIALOG_H | ||
#define SUBGRIDDIALOG_H | ||
|
||
#include <QDialog> | ||
|
||
class CartesianGrid; | ||
class IJQuick3DViewer; | ||
class VariableSelector; | ||
|
||
namespace Ui { | ||
class SubgridDialog; | ||
} | ||
|
||
class SubgridDialog : public QDialog | ||
{ | ||
Q_OBJECT | ||
|
||
public: | ||
explicit SubgridDialog( CartesianGrid* cg, QWidget *parent = nullptr); | ||
~SubgridDialog(); | ||
|
||
private: | ||
Ui::SubgridDialog *ui; | ||
CartesianGrid* m_cg; | ||
IJQuick3DViewer* m_previewWidget; | ||
VariableSelector* m_variableForPreview; | ||
|
||
private Q_SLOTS: | ||
|
||
void onSave(); | ||
void onPreview(); | ||
}; | ||
|
||
#endif // SUBGRIDDIALOG_H |
Oops, something went wrong.