예제 #1
0
void MouseEvents::canvasReleaseEvent(QMouseEvent * e)
{
	//Debug("Button Pressed");
	QgsPoint point = mCanvas->getCoordinateTransform()->toMapCoordinates(e->x(), e->y());

  if(e->button() == Qt::RightButton && (e->state() & Qt::LeftButton) == 0) // restart
  {
    emit RightPoint(point);
  } 
  else if (e->button()== Qt::LeftButton)
  {
    emit LeftPoint(point);
  }
}
예제 #2
0
void  CVxDisplayArea::DrawGrid(QPainter& painter,int iW, int iH)
{
	float fW = 1.0 * iW/m_iCol;
	float fH = 1.0 * iH/(m_iRow + 1);

	//画竖直线。
	float fStartX = 0;
	for ( int i = 0; i < m_iCol; i ++ )
	{
		QPoint topPoint(fStartX, 0);
		QPoint bottomPoint(fStartX,iH);
		painter.drawLine(topPoint,bottomPoint);

		QString strDegree = QString("E ") + QString::number(120)+ GetDegreeStr() + QString::number(15.001) + GetMinuteStr();
		painter.drawText(fStartX + 5, 15, strDegree);

		fStartX += fW;
	}

	//画竖直线。
	float fStartY = 0;
	for ( int i = 0; i < m_iRow + 1 + 1; i ++ )//多画最底下一条和副显示区域之间的横线。
	{
		QPoint LeftPoint(0, fStartY);
		QPoint RightPoint(iW,fStartY);
		painter.drawLine(LeftPoint,RightPoint);

		if ( i < m_iRow)
		{
			QString strDegree = QString("N ") + QString::number(120)+ GetDegreeStr() + QString::number(15.001) + GetMinuteStr();
			painter.drawText( 5, fStartY + fH - 10, strDegree);
		}

		fStartY += fH;
	}
}