feat: technique overhaul

This commit is contained in:
2024-05-26 14:21:06 +02:00
parent 211a219431
commit 86ec78f831
16 changed files with 222 additions and 144 deletions

View File

@@ -18,32 +18,11 @@
using namespace std;
MainWindow::MainWindow(QWidget* parent)
: QMainWindow(parent)
, ui(new Ui::MainWindow)
: 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->program;
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();
ui->setupUi(this);
this->setupTechniques();
}
MainWindow::~MainWindow() {
@@ -51,6 +30,50 @@ MainWindow::~MainWindow() {
}
void MainWindow::setupTechniques() {
cout << "Reading data..." << endl;
string dataPath = "../../../../data";
shared_ptr<UVGrid> uvGrid = make_shared<UVGrid>(dataPath);
// initialize techniques
Program *program = this->ui->program;
auto technique1 = new Technique(program->getCamera());
auto technique2 = new Technique(program->getCamera());
// add bg layer
auto bg = new BackgroundImage(dataPath + "/map_qgis_1035.png");
technique1->addLayer(bg);
technique2->addLayer(bg);
// add Euler layers
technique1->addLayer(new EColLayer(uvGrid));
technique2->addLayer(new EGlyphLayer(uvGrid));
// setup LGlyphLayer
auto kernelRK4 = make_unique<RK4AdvectionKernel>(uvGrid);
auto kernelRK4BoundaryChecked = make_unique<SnapBoundaryConditionKernel>(std::move(kernelRK4), uvGrid);
auto lGlyph = new LGlyphLayer(uvGrid, std::move(kernelRK4BoundaryChecked));
lGlyph->setDt(3600);
technique1->addLayer(lGlyph);
// technique2->addLayer(new LColLayer(uvGrid)); // TODO: add LColLayer
technique2->addLayer(lGlyph);
cout << technique1->numberOfLayers() << endl;
program->addTechnique(technique1);
program->addTechnique(technique2);
program->setActiveTechnique(0);
// TODO: implement feature to call this function on widget
// l->spoofPoints();
// l->cycleGlyphStyle();
}
/* --------------------------------------------------------------------
* + QTWidget callbacks +
* --------------------------------------------------------------------*/

View File

@@ -2,17 +2,18 @@
#define MAINWINDOW_H
#include <QMainWindow>
#include "../advection/UVGrid.h"
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow {
Q_OBJECT
Q_OBJECT
public:
explicit MainWindow(QWidget* parent = 0);
~MainWindow();
explicit MainWindow(QWidget* parent = 0);
~MainWindow();
private slots:
void on_FirstButton_clicked(bool checked);
@@ -31,7 +32,9 @@ private slots:
void on_IregularlySubsampledButton_clicked(bool checked);
private:
Ui::MainWindow* ui;
Ui::MainWindow* ui;
void setupTechniques();
};
#endif