예제 #1
0
void RCDraw::mousePressEvent ( QMouseEvent *e )
{
	if (e->button() == Qt::MidButton)
	{
		translating = true;
		backPos = e->pos();
		return;
	}
	else if ( (e->button() == Qt::RightButton) or (e->button() == Qt::LeftButton) )
	{
		inicio.setX ( e->x() );
		inicio.setY ( e->y() );

		emit iniMouseCoor( QPoint(e->x(), e->y()) );
		double xratio = ((double)effWin.width()) /((double)((QWidget*)this)->width());
		double zratio = -((double)effWin.height())/((double)((QWidget*)this)->height());
		float fx = ((float)effWin.left())   + xratio*e->x() + visibleCenter.x();
		float fz = ((float)effWin.bottom()) + zratio*e->y() + visibleCenter.y();
		emit newCoor( QPointF(fx, fz) );
		emit press(QPointF(fx, fz));

		if (e->button() == Qt::LeftButton)
			emit newLeftCoor( QPointF(fx, fz) );
		else
			emit newRightCoor( QPointF(fx, fz) );
		return;
	}
}
/**
* \brief Default constructor
*/
Worker::Worker(RoboCompKinect::KinectPrx kinectprx, QObject *parent) : Ui_evaluacionForm()
{
	kinect = kinectprx;
	mutex = new QMutex();
	ippSetNumThreads(1);
	setupUi(this);
	imgAlto=480;imgAncho=640;
	maxDepth=10.0;minDepth=0.5;
	ippSizeImage.height=imgAlto;
	ippSizeImage.width=imgAncho;
	
	qImgRGB = new QImage(imgAncho,imgAlto,QImage::Format_RGB888 );
	qImgRGBZ = new QImage(imgAncho,imgAlto,QImage::Format_RGB888 );
	qImgZ = new QImage(imgAncho,imgAlto,QImage::Format_Indexed8 );
	imgZ =ippsMalloc_8u(imgAlto*imgAncho);
	

	rcdRGB =  new RCDraw (imgAncho,imgAlto,qImgRGB,this->frameRGB);
	rcdRGBZ =  new RCDraw (imgAncho,imgAlto,qImgRGBZ,this->frameRGBZ);
	rcdZ =  new RCDraw (imgAncho,imgAlto,qImgZ,this->frameZ);
	roiGrab.setCoords(0,0,640,480);
	grab=false;capture=false;
	
	show();
	connect(&timer, SIGNAL(timeout()), this, SLOT(compute()));
	connect(rcdZ,SIGNAL(newCoor(QPointF)),this,SLOT(mousePress(QPointF)));
	connect(rcdZ,SIGNAL(endCoor(QPointF)),this,SLOT(mouseRelase(QPointF)));
	Period = BASIC_PERIOD;
	timer.start(Period);
}
예제 #3
0
void RCDraw::mouseReleaseEvent ( QMouseEvent *e )
{
	emit endMouseCoor( QPoint(e->x(), e->y()) );
	emit endCoor(e->posF());
	inicio.setX ( e->x() );
	inicio.setY ( e->y() );

	double xratio = ((double)effWin.width()) /((double)((QWidget*)this)->width());
	double zratio = -((double)effWin.height())/((double)((QWidget*)this)->height());
	float fx = ((float)effWin.left())   + xratio*e->x() + visibleCenter.x();
	float fz = ((float)effWin.bottom()) + zratio*e->y() + visibleCenter.y();
	emit newCoor( QPointF(fx, fz) );
	emit release(QPointF(fx, fz));

	if (e->button() == Qt::RightButton)
	{
		translating = false;
// 		printf("Translating %d\n", translating);
		return;
	}
	
}