ccCameraParamEditDlg::ccCameraParamEditDlg(QWidget* parent)
	: ccOverlayDialog(parent)
	, Ui::CameraParamDlg()
{
	setupUi(this);

	//Slider中的值变化,则SpinBox的值也随之发生变化,同时更新透视矩阵
	connect(phiSlider,				SIGNAL(valueChanged(int)),		this,	SLOT(iPhiValueChanged(int)));
	connect(thetaSlider,			SIGNAL(valueChanged(int)),		this,	SLOT(iThetaValueChanged(int)));
	connect(psiSlider,				SIGNAL(valueChanged(int)),		this,	SLOT(iPsiValueChanged(int)));

	//SpinBox中的值发生变化,则Slider的值也随之发生变化,同时更新透视矩阵
	connect(phiSpinBox,				SIGNAL(valueChanged(double)),	this,	SLOT(dPhiValueChanged(double)));
	connect(thetaSpinBox,			SIGNAL(valueChanged(double)),	this,	SLOT(dThetaValueChanged(double)));
	connect(psiSpinBox,				SIGNAL(valueChanged(double)),	this,	SLOT(dPsiValueChanged(double)));

	//rotation center//旋转中心发生变化
	connect(rcxDoubleSpinBox,		SIGNAL(valueChanged(double)),	this,	SLOT(pivotChanged()));
	connect(rcyDoubleSpinBox,		SIGNAL(valueChanged(double)),	this,	SLOT(pivotChanged()));
	connect(rczDoubleSpinBox,		SIGNAL(valueChanged(double)),	this,	SLOT(pivotChanged()));

	//camera center//相机中心发生变化
	connect(exDoubleSpinBox,		SIGNAL(valueChanged(double)),	this,	SLOT(cameraCenterChanged()));
	connect(eyDoubleSpinBox,		SIGNAL(valueChanged(double)),	this,	SLOT(cameraCenterChanged()));
	connect(ezDoubleSpinBox,		SIGNAL(valueChanged(double)),	this,	SLOT(cameraCenterChanged()));

	//视角变化
	connect(fovDoubleSpinBox,		SIGNAL(valueChanged(double)),	this,	SLOT(fovChanged(double)));

	//相机近平面发生变化
	connect(zNearHorizontalSlider,	SIGNAL(sliderMoved(int)),		this,	SLOT(zNearSliderMoved(int)));

	//设置视角
	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()));
	connect(viewIso1ToolButton,		SIGNAL(clicked()),				this,	SLOT(setIso1View()));
	connect(viewIso2ToolButton,		SIGNAL(clicked()),				this,	SLOT(setIso2View()));

	//保存当前矩阵
	connect(pushMatrixToolButton,	SIGNAL(clicked()),				this,	SLOT(pushCurrentMatrix()));
	connect(revertMatrixToolButton,	SIGNAL(clicked()),				this,	SLOT(revertToPushedMatrix()));

	//选择点作为旋转球中心
	connect(pivotPickingToolButton,	SIGNAL(clicked()),				this,	SLOT(pickPointAsPivot()));
}
ccCameraParamEditDlg::ccCameraParamEditDlg(QWidget* parent) : QDialog(parent), Ui::CameraParamDlg()
{
    setupUi(this);

    /*QDoubleValidator* validator = new QDoubleValidator(this);
    txLineEdit->setValidator(validator);
    tyLineEdit->setValidator(validator);
    tzLineEdit->setValidator(validator);
    //*/
    /*connect(txLineEdit,     SIGNAL(editingFinished()),  this,   SLOT(reflectParamChange()));
    connect(tyLineEdit,     SIGNAL(editingFinished()),  this,   SLOT(reflectParamChange()));
    connect(tzLineEdit,     SIGNAL(editingFinished()),  this,   SLOT(reflectParamChange()));
    //*/

    connect(phiSlider,      SIGNAL(valueChanged(int)),  this,   SLOT(iPhiValueChanged(int)));
    connect(thetaSlider,    SIGNAL(valueChanged(int)),  this,   SLOT(iThetaValueChanged(int)));
    connect(psiSlider,      SIGNAL(valueChanged(int)),  this,   SLOT(iPsiValueChanged(int)));
    connect(phiSpinBox,     SIGNAL(valueChanged(double)),  this,   SLOT(dPhiValueChanged(double)));
    connect(thetaSpinBox,   SIGNAL(valueChanged(double)),  this,   SLOT(dThetaValueChanged(double)));
    connect(psiSpinBox,     SIGNAL(valueChanged(double)),  this,   SLOT(dPsiValueChanged(double)));

    connect(txDoubleSpinBox,     SIGNAL(valueChanged(double)),  this,   SLOT(translationChanged(double)));
    connect(tyDoubleSpinBox,     SIGNAL(valueChanged(double)),  this,   SLOT(translationChanged(double)));
    connect(tzDoubleSpinBox,     SIGNAL(valueChanged(double)),  this,   SLOT(translationChanged(double)));

    connect(fovDoubleSpinBox,     SIGNAL(valueChanged(double)),  this,   SLOT(fovChanged(double)));

    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()));

    connect(pushMatrixToolButton,   SIGNAL(clicked()),    this,       SLOT(pushCurrentMatrix()));
    connect(revertMatrixToolButton, SIGNAL(clicked()),    this,       SLOT(revertToPushedMatrix()));

	connect(centerPointPickingToolButton, SIGNAL(clicked()),    this,       SLOT(pickPointAsPivot()));

    associatedWin = 0;
}
ccCameraParamEditDlg::ccCameraParamEditDlg(QWidget* parent)
	: ccOverlayDialog(parent)
	, Ui::CameraParamDlg()
{
    setupUi(this);

    connect(phiSlider,				SIGNAL(valueChanged(int)),		this,   SLOT(iPhiValueChanged(int)));
    connect(thetaSlider,			SIGNAL(valueChanged(int)),		this,   SLOT(iThetaValueChanged(int)));
    connect(psiSlider,				SIGNAL(valueChanged(int)),		this,   SLOT(iPsiValueChanged(int)));
    connect(phiSpinBox,				SIGNAL(valueChanged(double)),	this,   SLOT(dPhiValueChanged(double)));
    connect(thetaSpinBox,			SIGNAL(valueChanged(double)),	this,   SLOT(dThetaValueChanged(double)));
    connect(psiSpinBox,				SIGNAL(valueChanged(double)),	this,   SLOT(dPsiValueChanged(double)));

	//rotation center
    connect(rcxDoubleSpinBox,		SIGNAL(valueChanged(double)),	this,   SLOT(pivotChanged()));
    connect(rcyDoubleSpinBox,		SIGNAL(valueChanged(double)),	this,   SLOT(pivotChanged()));
    connect(rczDoubleSpinBox,		SIGNAL(valueChanged(double)),	this,   SLOT(pivotChanged()));

	//camera center
    connect(exDoubleSpinBox,		SIGNAL(valueChanged(double)),	this,   SLOT(cameraCenterChanged()));
    connect(eyDoubleSpinBox,		SIGNAL(valueChanged(double)),	this,   SLOT(cameraCenterChanged()));
    connect(ezDoubleSpinBox,		SIGNAL(valueChanged(double)),	this,   SLOT(cameraCenterChanged()));

    connect(fovDoubleSpinBox,		SIGNAL(valueChanged(double)),	this,	SLOT(fovChanged(double)));

    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()));
    connect(viewIso1ToolButton,		SIGNAL(clicked()),				this,	SLOT(setIso1View()));
    connect(viewIso2ToolButton,		SIGNAL(clicked()),				this,	SLOT(setIso2View()));

    connect(pushMatrixToolButton,	SIGNAL(clicked()),				this,	SLOT(pushCurrentMatrix()));
    connect(revertMatrixToolButton,	SIGNAL(clicked()),				this,	SLOT(revertToPushedMatrix()));

	connect(pivotPickingToolButton,	SIGNAL(clicked()),				this,	SLOT(pickPointAsPivot()));
}