ccClippingBoxTool::ccClippingBoxTool(QWidget* parent)
	: ccOverlayDialog(parent)
	, Ui::ClippingBoxDlg()
	, m_clipBox(0)
{
	setupUi(this);

	setWindowFlags(Qt::FramelessWindowHint | Qt::Tool);

	connect(editBoxToolButton,				SIGNAL(clicked()), this, SLOT(editBox()));
	connect(extractContourToolButton,		SIGNAL(clicked()), this, SLOT(extractContour()));
	connect(removeLastContourToolButton,	SIGNAL(clicked()), this, SLOT(removeLastContour()));
	connect(exportButton,					SIGNAL(clicked()), this, SLOT(exportCloud()));
	connect(exportMultButton,				SIGNAL(clicked()), this, SLOT(exportMultCloud()));
	connect(resetButton,					SIGNAL(clicked()), this, SLOT(reset()));
	connect(closeButton,					SIGNAL(clicked()), this, SLOT(closeDialog()));

	connect(showInteractorsCheckBox, SIGNAL(toggled(bool)), this, SLOT(toggleInteractors(bool)));

	connect(thickXDoubleSpinBox, SIGNAL(valueChanged(double)), this, SLOT(thicknessChanged(double)));
	connect(thickYDoubleSpinBox, SIGNAL(valueChanged(double)), this, SLOT(thicknessChanged(double)));
	connect(thickZDoubleSpinBox, SIGNAL(valueChanged(double)), this, SLOT(thicknessChanged(double)));

	connect(minusXShiftToolButton,	SIGNAL(clicked()), this, SLOT(shiftXMinus()));
	connect(plusXShiftToolButton,	SIGNAL(clicked()), this, SLOT(shiftXPlus()));
	connect(minusYShiftToolButton,	SIGNAL(clicked()), this, SLOT(shiftYMinus()));
	connect(plusYShiftToolButton,	SIGNAL(clicked()), this, SLOT(shiftYPlus()));
	connect(minusZShiftToolButton,	SIGNAL(clicked()), this, SLOT(shiftZMinus()));
	connect(plusZShiftToolButton,	SIGNAL(clicked()), this, SLOT(shiftZPlus()));

	viewButtonsFrame->setEnabled(true);
    connect(viewUpToolButton,		SIGNAL(clicked()),	this,	SLOT(setTopView()));
    connect(viewDownToolButton,		SIGNAL(clicked()),	this,	SLOT(setBottomView()));
    connect(viewFrontToolButton,	SIGNAL(clicked()),	this,	SLOT(setFrontView()));
    connect(viewBackToolButton,		SIGNAL(clicked()),	this,	SLOT(setBackView()));
    connect(viewLeftToolButton,		SIGNAL(clicked()),	this,	SLOT(setLeftView()));
    connect(viewRightToolButton,	SIGNAL(clicked()),	this,	SLOT(setRightView()));

	s_maxEdgeLength = -1.0;
	//s_lastContourUniqueIDs.clear();
	removeLastContourToolButton->setEnabled(false);
}
void cloudExport(int sig)
{
  exportCloud(&keyframes);
  printf("Exiting renderer...\n");
  exit(0);
}