#include "dlg_down_sampling.h"
#include "paint_canvas.h"
#include "main_window.h"



DlgDownSampling::DlgDownSampling(QWidget *parent)
	: QDialog(parent)
{
	setupUi(this);

	mainWindow_ = dynamic_cast<MainWindow*>(parent);

	// default value
	lineEditSamplingResolution->setText("0.001");

	connect(previewButton, SIGNAL(clicked()), this, SLOT(preview()));
	connect(applyButton, SIGNAL(clicked()), this, SLOT(apply()));
}

DlgDownSampling::~DlgDownSampling()
{
}


void DlgDownSampling::preview() {
	float reso = lineEditSamplingResolution->text().toFloat();
	mainWindow_->canvas()->markPointForDesampling(reso);
}


void DlgDownSampling::apply() {
	float reso = lineEditSamplingResolution->text().toFloat();
	mainWindow_->canvas()->deleteSelectedPoints();
}