prep for configurable options
This commit is contained in:
parent
627a784f72
commit
cc3e62af05
|
|
@ -56,6 +56,7 @@ add_executable(ParticleTrackTrace MACOSX_BUNDLE main.cpp
|
|||
layers/LGlyphLayer.h
|
||||
layers/Technique.cpp
|
||||
layers/Technique.h
|
||||
layers/enums.h
|
||||
Program.cpp
|
||||
Program.h
|
||||
commands/TimerCallbackCommand.h
|
||||
|
|
|
|||
|
|
@ -118,3 +118,8 @@ Program::~Program() {
|
|||
vtkSmartPointer<vtkCamera> Program::getCamera() {
|
||||
return this->cam;
|
||||
}
|
||||
|
||||
|
||||
std::vector<Technique *> Program::getTechniques() {
|
||||
return this->techniques;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -79,6 +79,8 @@ public:
|
|||
|
||||
vtkSmartPointer<vtkCamera> getCamera();
|
||||
|
||||
std::vector<Technique *> getTechniques();
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -15,6 +15,8 @@
|
|||
#include "../advection/UVGrid.h"
|
||||
#include "../advection/kernel/RK4AdvectionKernel.h"
|
||||
#include "../advection/kernel/SnapBoundaryConditionKernel.h"
|
||||
#include "../layers/enums.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
MainWindow::MainWindow(QWidget* parent)
|
||||
|
|
@ -59,8 +61,6 @@ void MainWindow::setupTechniques() {
|
|||
// technique2->addLayer(new LColLayer(uvGrid)); // TODO: add LColLayer
|
||||
technique2->addLayer(lGlyph);
|
||||
|
||||
cout << technique1->numberOfLayers() << endl;
|
||||
|
||||
program->addTechnique(technique1);
|
||||
program->addTechnique(technique2);
|
||||
|
||||
|
|
@ -81,98 +81,123 @@ void MainWindow::setupTechniques() {
|
|||
|
||||
void MainWindow::on_FirstButton_clicked(bool checked) {
|
||||
if (checked) {
|
||||
ui->program->setActiveTechnique(0);
|
||||
ui->program->setActiveTechnique(COLGLYPH);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::on_SecondButton_clicked(bool checked) {
|
||||
if (checked) {
|
||||
ui->program->setActiveTechnique(1);
|
||||
ui->program->setActiveTechnique(GLYPHCOL);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::on_ComplementaryButton_clicked(bool checked) {
|
||||
if (checked) {
|
||||
|
||||
for (Technique *t : ui->program->getTechniques()) {
|
||||
t->setColorMode(COMPLEMENTARY);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::on_ContrastingButton_clicked(bool checked) {
|
||||
if (checked) {
|
||||
|
||||
for (Technique *t : ui->program->getTechniques()) {
|
||||
t->setColorMode(CONTRASTING);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::on_MonochromaticButton_clicked(bool checked) {
|
||||
if (checked) {
|
||||
|
||||
for (Technique *t : ui->program->getTechniques()) {
|
||||
t->setColorMode(MONOCHROMATIC);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::on_SaturateButton_clicked(bool checked) {
|
||||
if (checked) {
|
||||
|
||||
for (Technique *t : ui->program->getTechniques()) {
|
||||
t->setSaturationMode(SATURATED);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::on_DesaturateButton_clicked(bool checked) {
|
||||
if (checked) {
|
||||
|
||||
for (Technique *t : ui->program->getTechniques()) {
|
||||
t->setSaturationMode(DESATURATED);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::on_CircleButton_clicked(bool checked) {
|
||||
if (checked) {
|
||||
|
||||
for (Technique *t : ui->program->getTechniques()) {
|
||||
t->setGlyphStyle(CIRCLE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::on_TriangleButton_clicked(bool checked) {
|
||||
if (checked) {
|
||||
|
||||
for (Technique *t : ui->program->getTechniques()) {
|
||||
t->setGlyphStyle(TRIANGLE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::on_SquareButton_clicked(bool checked) {
|
||||
if (checked) {
|
||||
|
||||
for (Technique *t : ui->program->getTechniques()) {
|
||||
t->setGlyphStyle(SQUARE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::on_HexagonButton_clicked(bool checked) {
|
||||
if (checked) {
|
||||
|
||||
for (Technique *t : ui->program->getTechniques()) {
|
||||
t->setGlyphStyle(HEXAGON);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::on_FullySampledButton_clicked(bool checked) {
|
||||
if (checked) {
|
||||
|
||||
for (Technique *t : ui->program->getTechniques()) {
|
||||
t->setSamplingMode(FULLYSAMPLED);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::on_RegularlySubsampledButton_clicked(bool checked) {
|
||||
if (checked) {
|
||||
|
||||
for (Technique *t : ui->program->getTechniques()) {
|
||||
t->setSamplingMode(REGULARLYSUBSAMPLED);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::on_IregularlySubsampledButton_clicked(bool checked) {
|
||||
if (checked) {
|
||||
|
||||
}}
|
||||
for (Technique *t : ui->program->getTechniques()) {
|
||||
t->setSamplingMode(IRREGULARLYSUBSAMPLED);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -9,18 +9,16 @@ vtkSmartPointer<vtkRenderer> Layer::getLayer() {
|
|||
return this->ren;
|
||||
}
|
||||
|
||||
void Layer::updateData(int t) {
|
||||
// By default, do nothing
|
||||
}
|
||||
|
||||
void Layer::addObservers(vtkSmartPointer<vtkRenderWindowInteractor> interactor) {
|
||||
// By default, do nothing
|
||||
}
|
||||
|
||||
void Layer::removeObservers(vtkSmartPointer<vtkRenderWindowInteractor> interactor) {
|
||||
// By default, do nothing
|
||||
}
|
||||
|
||||
void Layer::setCamera(vtkSmartPointer<vtkCamera> cam) {
|
||||
this->getLayer()->SetActiveCamera(cam.GetPointer());
|
||||
}
|
||||
|
||||
|
||||
void Layer::updateData(int t) {}
|
||||
void Layer::addObservers(vtkSmartPointer<vtkRenderWindowInteractor> interactor) {}
|
||||
void Layer::removeObservers(vtkSmartPointer<vtkRenderWindowInteractor> interactor) {}
|
||||
void Layer::setColorMode(ColourMode mode) {}
|
||||
void Layer::setSaturationMode(SaturationMode mode) {}
|
||||
void Layer::setGlyphStyle(GlyphStyle style) {}
|
||||
void Layer::setSamplingMode(SamplingMode mode) {}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
#ifndef LAYER_H
|
||||
#define LAYER_H
|
||||
|
||||
#include "enums.h"
|
||||
#include <vtkInteractorStyle.h>
|
||||
#include <vtkRenderer.h>
|
||||
|
||||
|
|
@ -38,6 +39,12 @@ public:
|
|||
* Used to share one camera between multiple layers.
|
||||
*/
|
||||
virtual void setCamera(vtkSmartPointer<vtkCamera> cam);
|
||||
|
||||
|
||||
virtual void setColorMode(ColourMode mode);
|
||||
virtual void setSaturationMode(SaturationMode mode);
|
||||
virtual void setGlyphStyle(GlyphStyle style);
|
||||
virtual void setSamplingMode(SamplingMode mode);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -48,3 +48,31 @@ void Technique::unbind(vtkSmartPointer<vtkRenderWindow> win, vtkSmartPointer<vtk
|
|||
}
|
||||
win->SetNumberOfLayers(0);
|
||||
}
|
||||
|
||||
|
||||
void Technique::setColorMode(ColourMode mode) {
|
||||
for (Layer *l : this->layers) {
|
||||
l->setColorMode(mode);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Technique::setSaturationMode(SaturationMode mode) {
|
||||
for (Layer *l : this->layers) {
|
||||
l->setSaturationMode(mode);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Technique::setGlyphStyle(GlyphStyle style) {
|
||||
for (Layer *l : this->layers) {
|
||||
l->setGlyphStyle(style);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Technique::setSamplingMode(SamplingMode mode) {
|
||||
for (Layer *l : this->layers) {
|
||||
l->setSamplingMode(mode);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,8 @@
|
|||
#include "Layer.h"
|
||||
#include <vtkGenericOpenGLRenderWindow.h>
|
||||
#include <vtkPolyData.h>
|
||||
#include "enums.h"
|
||||
|
||||
class Technique {
|
||||
private:
|
||||
std::vector<Layer *> layers;
|
||||
|
|
@ -18,6 +20,11 @@ public:
|
|||
void bind(vtkSmartPointer<vtkRenderWindow> win, vtkSmartPointer<vtkRenderWindowInteractor> intr);
|
||||
void unbind(vtkSmartPointer<vtkRenderWindow> win, vtkSmartPointer<vtkRenderWindowInteractor> intr);
|
||||
|
||||
void setColorMode(ColourMode mode);
|
||||
void setSaturationMode(SaturationMode mode);
|
||||
void setGlyphStyle(GlyphStyle style);
|
||||
void setSamplingMode(SamplingMode mode);
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,36 @@
|
|||
#ifndef ENUMS_H
|
||||
#define ENUMS_H
|
||||
|
||||
enum ActiveTechnique {
|
||||
COLGLYPH = 0,
|
||||
GLYPHCOL = 1,
|
||||
};
|
||||
|
||||
|
||||
enum ColourMode {
|
||||
COMPLEMENTARY = 0,
|
||||
CONTRASTING = 1,
|
||||
MONOCHROMATIC = 2,
|
||||
};
|
||||
|
||||
|
||||
enum SaturationMode {
|
||||
SATURATED = 0,
|
||||
DESATURATED = 1,
|
||||
};
|
||||
|
||||
|
||||
enum GlyphStyle {
|
||||
CIRCLE = 0,
|
||||
TRIANGLE = 1,
|
||||
SQUARE = 2,
|
||||
HEXAGON = 3,
|
||||
};
|
||||
|
||||
enum SamplingMode {
|
||||
FULLYSAMPLED = 0,
|
||||
REGULARLYSUBSAMPLED = 1,
|
||||
IRREGULARLYSUBSAMPLED = 2,
|
||||
};
|
||||
|
||||
#endif
|
||||
Loading…
Reference in New Issue