-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcontainer_manager.cpp
99 lines (77 loc) · 2.58 KB
/
container_manager.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#include "container_manager.h"
#include "inputhandler.h"
#include "simulation.h"
#include <QtDataVisualization/QValue3DAxis>
#include <QtDataVisualization/Q3DTheme>
#include <QtGui/QImage>
#include <QtCore/qmath.h>
using namespace QtDataVisualization;
ContainerManager::ContainerManager(QWidget *container_surface, Simulation *simulation, SurfaceGraph *surfaceGraph):
m_surface(container_surface),
m_simulation(simulation),
m_surfaceGraph(surfaceGraph)
{
}
ContainerManager::~ContainerManager()
{
}
void ContainerManager::showSurface(bool set)
{
qDebug() << "ShowSurface";
if(!set){
m_simulation->setVisualizationType(true);
m_surfaceGraph->clearData();
m_simulation->setDataSet(QString("velocity"));
}else{
m_simulation->setGridType(true);
m_surfaceGraph->generateData();
m_simulation->setVisualizationType(false);
m_simulation->setDataSet(QString("velocity"));
}
}
void ContainerManager::setGridType(QString type)
{
if(type == "uniform" && !m_simulation->isUniformGrid()){
qDebug() << "Uniform";
m_simulation->setUniformGrid(true);
m_surfaceGraph->clearData();
m_surfaceGraph->generateData();
}else if(type == "random" && m_simulation->isUniformGrid()){
qDebug() << "Random";
m_simulation->setUniformGrid(false);
m_surfaceGraph->clearData();
m_surfaceGraph->generateRandomGridData(pow(m_simulation->getGridSize(), 2));
}
}
void ContainerManager::setRandomGridAmountOfArrows(int amount){
m_surfaceGraph->clearData();
m_surfaceGraph->generateRandomGridData(amount);
}
void ContainerManager::setRandomArrows(double amount){
qDebug() << "Add Random arrows: " << amount;
m_surfaceGraph->clearData();
m_surfaceGraph->generateRandomGridData(amount);
}
void ContainerManager::setBlackToYellowGradient(){
m_surfaceGraph->setBlackToYellowGradient();
m_simulation->setColorMap(QString('blackyellow'));
}
void ContainerManager::setGreenToRedGradient(){
m_surfaceGraph->setGreenToRedGradient();
m_simulation->setColorMap(QString('greenred'));
}
void ContainerManager::heightGlyphs(double height){
m_surfaceGraph->setHeightArrows(height);
}
void ContainerManager::setGlypColor(bool value){
//qDebug() << " value: " << value;
m_simulation->setGlyphColorActive(value);
m_simulation->setColorMap(QString('greenred'));
if(value == false){
m_simulation->recolorToStandard();
}
}
void ContainerManager::setArrowSize(double scale){
qDebug() << "Scale " << scale;
m_simulation->setArrowScale(scale);
}