当前位置: 首页>>代码示例>>C++>>正文


C++ QwtDoubleRect::topLeft方法代码示例

本文整理汇总了C++中QwtDoubleRect::topLeft方法的典型用法代码示例。如果您正苦于以下问题:C++ QwtDoubleRect::topLeft方法的具体用法?C++ QwtDoubleRect::topLeft怎么用?C++ QwtDoubleRect::topLeft使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QwtDoubleRect的用法示例。


在下文中一共展示了QwtDoubleRect::topLeft方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: drawCanvas

/*!
  Draw the canvas

  Paints all plot items to the canvasRect, using QwtPolarPlot::drawCanvas
  and updates the paint cache.

  \sa QwtPolarPlot::drawCanvas, setPaintAttributes(), testPaintAttributes()
*/
void QwtPolarCanvas::drawCanvas( QPainter *painter,
                                 const QwtDoubleRect& canvasRect )
{
  if ( !canvasRect.isValid() )
    return;

  if ( testPaintAttribute( PaintCached ) && d_data->cache )
  {
    *d_data->cache = QPixmap( contentsRect().size() );

#ifdef Q_WS_X11
#if QT_VERSION >= 0x040000
    if ( d_data->cache->x11Info().screen() != x11Info().screen() )
      d_data->cache->x11SetScreen( x11Info().screen() );
#else
    if ( d_data->cache->x11Screen() != x11Screen() )
      d_data->cache->x11SetScreen( x11Screen() );
#endif
#endif

    d_data->cache->fill( this, d_data->cache->rect().topLeft() );

    QPainter cachePainter( d_data->cache );
    cachePainter.translate( -contentsRect().x(),
                            -contentsRect().y() );

    plot()->drawCanvas( &cachePainter, canvasRect );

    cachePainter.end();

    painter->drawPixmap( canvasRect.topLeft().toPoint(), *d_data->cache );
  }
  else
    plot()->drawCanvas( painter, canvasRect );
}
开发者ID:3liz,项目名称:Quantum-GIS,代码行数:43,代码来源:qwt_polar_canvas.cpp

示例2: drawCanvas

/*!
  Redraw the canvas.
  \param painter Painter used for drawing
  \param canvasRect Contents rect of the canvas
*/
void QwtPolarPlot::drawCanvas( QPainter *painter,
                               const QwtDoubleRect &canvasRect ) const
{
  const QwtDoubleRect cr = canvasRect;
  const QwtDoubleRect pr = plotRect( cr.toRect() );

  const double radius = pr.width() / 2.0;

  if ( d_data->canvasBrush.style() != Qt::NoBrush )
  {
    painter->save();
    painter->setPen( Qt::NoPen );
    painter->setBrush( d_data->canvasBrush );

    if ( qwtDistance( pr.center(), cr.topLeft() ) < radius &&
         qwtDistance( pr.center(), cr.topRight() ) < radius &&
         qwtDistance( pr.center(), cr.bottomRight() ) < radius &&
         qwtDistance( pr.center(), cr.bottomLeft() ) < radius )
    {
      QwtPainter::drawRect( painter, cr.toRect() );
    }
    else
    {
#if QT_VERSION < 0x040000
      QwtPainter::drawEllipse( painter, pr.toRect() );
#else
      painter->setRenderHint( QPainter::Antialiasing, true );
      QwtPainter::drawEllipse( painter, pr.toRect() );
#endif
    }
    painter->restore();
  }

  drawItems( painter,
             scaleMap( QwtPolar::Azimuth, radius ),
             scaleMap( QwtPolar::Radius, radius ),
             pr.center(), radius, canvasRect );
}
开发者ID:ACorradini,项目名称:QGIS,代码行数:43,代码来源:qwt_polar_plot.cpp

示例3: visibleInterval

/*!
   Calculate the bounding interval of the radial scale that is
   visible on the canvas.
*/
QwtDoubleInterval QwtPolarPlot::visibleInterval() const
{
  const QwtScaleDiv *sd = scaleDiv( QwtPolar::Radius );

  const QwtDoubleRect cRect = canvas()->contentsRect();
  const QwtDoubleRect pRect = plotRect( cRect.toRect() );
  if ( cRect.contains( pRect.toRect() ) || !cRect.intersects( pRect ) )
  {
#if QWT_VERSION < 0x050200
    return QwtDoubleInterval( sd->lBound(), sd->hBound() );
#else
    return QwtDoubleInterval( sd->lowerBound(), sd->upperBound() );
#endif
  }

  const QwtDoublePoint pole = pRect.center();
  const QwtDoubleRect scaleRect = pRect & cRect;

  const QwtScaleMap map = scaleMap( QwtPolar::Radius );

  double dmin = 0.0;
  double dmax = 0.0;
  if ( scaleRect.contains( pole ) )
  {
    dmin = 0.0;

    QwtDoublePoint corners[4];
    corners[0] = scaleRect.bottomRight();
    corners[1] = scaleRect.topRight();
    corners[2] = scaleRect.topLeft();
    corners[3] = scaleRect.bottomLeft();

    dmax = 0.0;
    for ( int i = 0; i < 4; i++ )
    {
      const double dist = qwtDistance( pole, corners[i] );
      if ( dist > dmax )
        dmax = dist;
    }
  }
  else
  {
    if ( pole.x() < scaleRect.left() )
    {
      if ( pole.y() < scaleRect.top() )
      {
        dmin = qwtDistance( pole, scaleRect.topLeft() );
        dmax = qwtDistance( pole, scaleRect.bottomRight() );
      }
      else if ( pole.y() > scaleRect.bottom() )
      {
        dmin = qwtDistance( pole, scaleRect.bottomLeft() );
        dmax = qwtDistance( pole, scaleRect.topRight() );
      }
      else
      {
        dmin = scaleRect.left() - pole.x();
        dmax = qwtMax( qwtDistance( pole, scaleRect.bottomRight() ),
                       qwtDistance( pole, scaleRect.topRight() ) );
      }
    }
    else if ( pole.x() > scaleRect.right() )
    {
      if ( pole.y() < scaleRect.top() )
      {
        dmin = qwtDistance( pole, scaleRect.topRight() );
        dmax = qwtDistance( pole, scaleRect.bottomLeft() );
      }
      else if ( pole.y() > scaleRect.bottom() )
      {
        dmin = qwtDistance( pole, scaleRect.bottomRight() );
        dmax = qwtDistance( pole, scaleRect.topLeft() );
      }
      else
      {
        dmin = pole.x() - scaleRect.right();
        dmax = qwtMax( qwtDistance( pole, scaleRect.bottomLeft() ),
                       qwtDistance( pole, scaleRect.topLeft() ) );
      }
    }
    else if ( pole.y() < scaleRect.top() )
    {
      dmin = scaleRect.top() - pole.y();
      dmax = qwtMax( qwtDistance( pole, scaleRect.bottomLeft() ),
                     qwtDistance( pole, scaleRect.bottomRight() ) );
    }
    else if ( pole.y() > scaleRect.bottom() )
    {
      dmin = pole.y() - scaleRect.bottom();
      dmax = qwtMax( qwtDistance( pole, scaleRect.topLeft() ),
                     qwtDistance( pole, scaleRect.topRight() ) );
    }
  }

  const double radius = pRect.width() / 2.0;
  if ( dmax > radius )
//.........这里部分代码省略.........
开发者ID:ACorradini,项目名称:QGIS,代码行数:101,代码来源:qwt_polar_plot.cpp


注:本文中的QwtDoubleRect::topLeft方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。