feat: qwidget layout
This commit is contained in:
1 parent
4a5b7c4712
commit
7d7e1a5b95
8 files changed
+801
-268
No files matched your search
@@ -1,4 +1,5 @@
|
||||
#include "MainWindow.h"
|
||||
#include "ui_mainwindow.h"
|
||||
|
||||
#include <QFile>
|
||||
#include <QFileDialog>
|
||||
@@ -6,52 +7,144 @@
|
||||
|
||||
#include <vtkDataSetReader.h>
|
||||
|
||||
#include "../layers/BackgroundImage.h"
|
||||
#include "../layers/EColLayer.h"
|
||||
#include "../layers/EGlyphLayer.h"
|
||||
#include "../layers/LGlyphLayer.h"
|
||||
#include "../Program.h"
|
||||
#include "../advection/UVGrid.h"
|
||||
#include "../advection/kernel/RK4AdvectionKernel.h"
|
||||
#include "../advection/kernel/SnapBoundaryConditionKernel.h"
|
||||
using namespace std;
|
||||
|
||||
MainWindow::MainWindow(QWidget* parent)
|
||||
: QMainWindow(parent)
|
||||
, ui(new Ui::MainWindow)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
cout << "Reading data..." << endl;
|
||||
string dataPath = "../../../../data";
|
||||
shared_ptr<UVGrid> uvGrid = make_shared<UVGrid>(dataPath);
|
||||
auto kernelRK4 = make_unique<RK4AdvectionKernel>(uvGrid);
|
||||
auto kernelRK4BoundaryChecked = make_unique<SnapBoundaryConditionKernel>(std::move(kernelRK4), uvGrid);
|
||||
cout << "Starting vtk..." << endl;
|
||||
|
||||
auto l = new LGlyphLayer(uvGrid, std::move(kernelRK4BoundaryChecked));
|
||||
// l->spoofPoints();
|
||||
l->setDt(3600);
|
||||
// TODO: implement feature to call this function on widget
|
||||
// l->cycleGlyphStyle();
|
||||
|
||||
Program *program = this->ui->getProgram();
|
||||
program->addLayer(new BackgroundImage(dataPath + "/map_qgis_1035.png"));
|
||||
// TODO: implement feature to cycle between layers thru QT
|
||||
program->addLayer(new EGlyphLayer(uvGrid));
|
||||
program->addLayer(new EColLayer(uvGrid));
|
||||
program->addLayer(l);
|
||||
|
||||
program->setupInteractions();
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow() { delete ui; }
|
||||
|
||||
void MainWindow::showAboutDialog()
|
||||
{
|
||||
QMessageBox::information(
|
||||
this, "About",
|
||||
"interactive particle in-fluid simulation program for surface level advection.");
|
||||
MainWindow::~MainWindow() {
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void MainWindow::showOpenFileDialog()
|
||||
{
|
||||
QString fileName = QFileDialog::getOpenFileName(this, tr("Open file"), "",
|
||||
"VTK Files (*.vtk)");
|
||||
|
||||
// Open file
|
||||
QFile file(fileName);
|
||||
file.open(QIODevice::ReadOnly);
|
||||
void MainWindow::on_FirstButton_clicked(bool checked) {
|
||||
if (checked) {
|
||||
|
||||
// Return on Cancel
|
||||
if (!file.exists())
|
||||
return;
|
||||
|
||||
openFile(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::openFile(const QString& fileName)
|
||||
{
|
||||
ui->sceneWidget->removeDataSet();
|
||||
|
||||
// Create reader
|
||||
vtkSmartPointer<vtkDataSetReader> reader = vtkSmartPointer<vtkDataSetReader>::New();
|
||||
reader->SetFileName(fileName.toStdString().c_str());
|
||||
void MainWindow::on_SecondButton_clicked(bool checked) {
|
||||
if (checked) {
|
||||
|
||||
// Read the file
|
||||
reader->Update();
|
||||
|
||||
// Add data set to 3D view
|
||||
vtkSmartPointer<vtkDataSet> dataSet = reader->GetOutput();
|
||||
if (dataSet != nullptr) {
|
||||
ui->sceneWidget->addDataSet(reader->GetOutput());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::on_ComplentaryButton_clicked(bool checked) {
|
||||
if (checked) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::on_ContrastingButton_clicked(bool checked) {
|
||||
if (checked) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::on_MonochromaticButton_clicked(bool checked) {
|
||||
if (checked) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::on_SaturateButton_clicked(bool checked) {
|
||||
if (checked) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::on_DesaturateButton_clicked(bool checked) {
|
||||
if (checked) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::on_CircleButton_clicked(bool checked) {
|
||||
if (checked) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::on_TriangleButton_clicked(bool checked) {
|
||||
if (checked) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::on_SquareButton_clicked(bool checked) {
|
||||
if (checked) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::on_HexagonButton_clicked(bool checked) {
|
||||
if (checked) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::on_FullySampledButton_clicked(bool checked) {
|
||||
if (checked) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::on_RegularlySubsampledButton_clicked(bool checked) {
|
||||
if (checked) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::on_IregularlySampledButton_clicked(bool checked) {
|
||||
if (checked) {
|
||||
|
||||
}}
|
||||
|
||||
|
||||