2011-12-26 21:53:29 +00:00
|
|
|
#include "preview.h"
|
2011-12-25 21:19:32 +00:00
|
|
|
#include "formwater.h"
|
|
|
|
#include "ui_formwater.h"
|
2011-12-26 21:53:29 +00:00
|
|
|
#include <QColor>
|
|
|
|
|
|
|
|
#include "../lib_paysages/water.h"
|
|
|
|
#include "../lib_paysages/shared/functions.h"
|
|
|
|
|
|
|
|
class PreviewCoverage:private Preview
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
PreviewCoverage(QWidget* parent):
|
|
|
|
Preview(parent)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
protected:
|
|
|
|
QColor getColor(double x, double y)
|
|
|
|
{
|
|
|
|
double height;
|
|
|
|
|
|
|
|
height = terrainGetHeight(x, y);
|
|
|
|
if (height > 0.0)
|
|
|
|
{
|
|
|
|
height = terrainGetHeightNormalized(x, y);
|
|
|
|
return QColor((int)(255.0 * height), (int)(255.0 * height), (int)(255.0 * height));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return QColor(0, 0, 255);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
2011-12-25 21:19:32 +00:00
|
|
|
|
|
|
|
FormWater::FormWater(QWidget *parent) :
|
|
|
|
QWidget(parent),
|
|
|
|
ui(new Ui::FormWater)
|
|
|
|
{
|
2011-12-26 21:53:29 +00:00
|
|
|
PreviewCoverage* previewCoverage;
|
|
|
|
|
2011-12-25 21:19:32 +00:00
|
|
|
ui->setupUi(this);
|
2011-12-25 21:32:00 +00:00
|
|
|
|
|
|
|
this->findChild<QToolBox*>("water_configs")->setCurrentIndex(0);
|
2011-12-26 21:53:29 +00:00
|
|
|
|
|
|
|
previewCoverage = new PreviewCoverage(this->findChild<QWidget*>("water_preview_coverage"));
|
2011-12-25 21:19:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
FormWater::~FormWater()
|
|
|
|
{
|
|
|
|
delete ui;
|
|
|
|
}
|