2014-08-28 13:09:47 +00:00
|
|
|
#include "WaterModeler.h"
|
|
|
|
|
|
|
|
#include "MainModelerWindow.h"
|
2015-08-17 20:55:30 +00:00
|
|
|
#include "Scenery.h"
|
|
|
|
#include "TerrainDefinition.h"
|
|
|
|
#include "FloatNode.h"
|
|
|
|
#include "Logs.h"
|
2014-08-28 13:09:47 +00:00
|
|
|
|
|
|
|
WaterModeler::WaterModeler(MainModelerWindow *main):
|
|
|
|
main(main)
|
|
|
|
{
|
|
|
|
QObject *item = main->findQmlObject("water_level");
|
|
|
|
if (item)
|
|
|
|
{
|
2015-08-17 20:55:30 +00:00
|
|
|
item->setProperty("value", propWaterHeight()->getValue() * 0.5 + 0.5);
|
2014-08-28 13:09:47 +00:00
|
|
|
connect(item, SIGNAL(changed(double)), this, SLOT(waterLevelChanged(double)));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-08-17 20:55:30 +00:00
|
|
|
void WaterModeler::waterLevelChanged(double value)
|
2014-08-28 13:09:47 +00:00
|
|
|
{
|
2015-08-17 20:55:30 +00:00
|
|
|
propWaterHeight()->setValue(value * 2.0 - 1.0);
|
|
|
|
}
|
|
|
|
|
|
|
|
FloatNode *WaterModeler::propWaterHeight() const
|
|
|
|
{
|
|
|
|
return main->getScenery()->getTerrain()->propWaterHeight();
|
2014-08-28 13:09:47 +00:00
|
|
|
}
|