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


C++ QwtDoubleRect类代码示例

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


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

示例1: rasterHint

/** Return how many pixels this area should be rendered as
 *
 * @param area :: area under view
 * @return # of pixels in each direction
 */
QSize QwtRasterDataMD::rasterHint(const QwtDoubleRect &area) const {
  if (!m_ws || !m_X || !m_Y)
    return QSize();
  // Slow mode? Don't give a raster hint. This will be 1 pixel per point
  if (!m_fast)
    return QSize();

  // Fast mode: use the bin size to guess at the pixel density
  coord_t binX = m_X->getBinWidth();
  coord_t binY = m_Y->getBinWidth();

  // Use the overlay workspace, if any, and if its bins are smaller
  if (m_overlayWS && m_overlayInSlice) {
    coord_t temp;
    temp = m_overlayWS->getDimension(m_dimX)->getBinWidth();
    if (temp < binX)
      binX = temp;
    temp = m_overlayWS->getDimension(m_dimY)->getBinWidth();
    if (temp < binY)
      binY = temp;
  }

  int w = 3 * int(area.width() / binX);
  int h = 3 * int(area.height() / binY);
  if (w < 10)
    w = 10;
  if (h < 10)
    h = 10;
  return QSize(w, h);
}
开发者ID:Mantid-Test-Account,项目名称:mantid,代码行数:35,代码来源:QwtRasterDataMD.cpp

示例2: setPaintAttributes

/*!
  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

示例3: boundingRect

QwtDoubleRect Plot::boundingRect ()
{
QMapIterator<int, QwtPlotCurve *> it = d_curves.begin();
QwtPlotCurve *c = (QwtPlotCurve *)it.data();

double minX = c->minXValue();
double minY = c->minYValue();
double maxX = c->maxXValue();
double maxY = c->maxYValue();

it++;

for (it; it != d_curves.end(); ++it) 
	{
	QwtPlotCurve *c = (QwtPlotCurve *)it.data();
	if (!c)
		continue;

	minX = (c->minXValue() < minX) ? c->minXValue() : minX;
	maxX = (c->maxXValue() > maxX) ? c->maxXValue() : maxX;
	minY = (c->minYValue() < minY) ? c->minYValue() : minY;
	maxY = (c->maxYValue() > maxY) ? c->maxYValue() : maxY;
	}

QwtDoubleRect r;
r.setLeft(minX);
r.setRight(maxX);
r.setTop(minY);
r.setBottom(maxY);
return r;
}
开发者ID:BackupTheBerlios,项目名称:qtiplot-svn,代码行数:31,代码来源:plot.cpp

示例4: boundingRect

 virtual QwtDoubleRect boundingRect() const {
     QwtDoubleRect retval = QwtData::boundingRect();
     double halfspan = std::max(std::max(fabs(retval.top()), fabs(retval.bottom())), 1e-2);
     retval.setTop(-halfspan);
     retval.setHeight(halfspan*2.0);
     return retval;
 }
开发者ID:metasim,项目名称:ews,代码行数:7,代码来源:AmplitudePlot.cpp

示例5: minZoomSize

/*!
  Expand the selected rectangle to minZoomSize() and zoom in
  if accepted.

  \sa QwtPlotZoomer::accept()a, QwtPlotZoomer::minZoomSize()
*/
bool QwtPlotZoomer::end(bool ok)
{
    ok = QwtPlotPicker::end(ok);
    if (!ok)
        return false;

    QwtPlot *plot = QwtPlotZoomer::plot();
    if ( !plot )
        return false;

    const QwtPolygon &pa = selection();
    if ( pa.count() < 2 )
        return false;

    QRect rect = QRect(pa[0], pa[int(pa.count() - 1)]);
#if QT_VERSION < 0x040000
    rect = rect.normalize();
#else
    rect = rect.normalized();
#endif


    QwtDoubleRect zoomRect = invTransform(rect).normalized();

    const QwtDoublePoint center = zoomRect.center();
    zoomRect.setSize(zoomRect.size().expandedTo(minZoomSize()));
    zoomRect.moveCenter(center);

    zoom(zoomRect);

    return true;
}
开发者ID:DMachuca,项目名称:ar2tech-SGeMS-public,代码行数:38,代码来源:qwt_plot_zoomer.cpp

示例6: boundingInterval

/*!
   Interval, that is necessary to display the item
   This interval can be useful for operations like clipping or autoscaling

   \param scaleId Scale index
   \return bounding interval

   \sa QwtData::boundingRect()
*/
QwtDoubleInterval QwtPolarCurve::boundingInterval( int scaleId ) const
{
  const QwtDoubleRect boundingRect = d_points->boundingRect();
  if ( scaleId == QwtPolar::ScaleAzimuth )
    return QwtDoubleInterval( boundingRect.left(), boundingRect.right() );
  else  if ( scaleId == QwtPolar::ScaleRadius )
    return QwtDoubleInterval( boundingRect.top(), boundingRect.bottom() );

  return QwtDoubleInterval();
}
开发者ID:ACorradini,项目名称:QGIS,代码行数:19,代码来源:qwt_polar_curve.cpp

示例7: boundingRect

/// Get the bounding rect including all plotted data.
QwtDoubleRect DatasetPlotData::boundingRect() const {
  QwtDoubleRect rect = m_dataCurve->boundingRect();
  if (m_calcCurve) {
    rect = rect.united(m_calcCurve->boundingRect());
  }
  if (m_diffCurve) {
    rect = rect.united(m_diffCurve->boundingRect());
  }
  return rect;
}
开发者ID:liyulun,项目名称:mantid,代码行数:11,代码来源:MDFDatasetPlotData.cpp

示例8: zoomToRange

/// Set zooming to the current fitting range.
void PlotController::zoomToRange()
{
    QwtDoubleRect rect = m_zoomer->zoomRect();
    rect.setX( m_rangeSelector->getMinimum() );
    rect.setRight( m_rangeSelector->getMaximum() );
    // In case the scales were set by the panning tool we need to
    // reset the zoomer first.
    m_zoomer->zoom(-1);
    // Set new zoom level.
    m_zoomer->zoom(rect);
}
开发者ID:nimgould,项目名称:mantid,代码行数:12,代码来源:MDFPlotController.cpp

示例9: transform

/*!
    Translate a rectangle from plot into pixel coordinates
    \return Rectangle in pixel coordinates
    \sa QwtPlotPicker::invTransform()
*/
QRect QwtPlotPicker::transform(const QwtDoubleRect &rect) const
{
    QwtScaleMap xMap = plot()->canvasMap(d_xAxis);
    QwtScaleMap yMap = plot()->canvasMap(d_yAxis);

    const int left = xMap.transform(rect.left());
    const int right = xMap.transform(rect.right());
    const int top = yMap.transform(rect.top());
    const int bottom = yMap.transform(rect.bottom());

    return QRect(left, top, right - left, bottom - top);
}
开发者ID:376473984,项目名称:pvb,代码行数:17,代码来源:qwt_plot_picker.cpp

示例10: transform

/*!
    Translate a rectangle from plot into pixel coordinates
    \return Rectangle in pixel coordinates
    \sa QwtPlotPicker::invTransform()
*/
QRect QwtPlotPicker::transform(const QwtDoubleRect &rect) const
{
    QwtDiMap xMap = plot()->canvasMap(d_xAxis);
    QwtDiMap yMap = plot()->canvasMap(d_yAxis);

    const int x1 = xMap.transform(rect.x1());
    const int x2 = xMap.transform(rect.x2());
    const int y1 = yMap.transform(rect.y1());
    const int y2 = yMap.transform(rect.y2());

    return QRect(x1, y1, x2 - x1, y2 - y1);
}
开发者ID:BackupTheBerlios,项目名称:qtiplot-svn,代码行数:17,代码来源:qwt_plot_picker.cpp

示例11: setBoundingRect

void ImageMarker::setBoundingRect(const QwtDoubleRect& rect)
{
if (d_rect == rect)
	return;

d_rect = rect;

const QwtScaleMap &xMap = plot()->canvasMap(xAxis());
const QwtScaleMap &yMap = plot()->canvasMap(yAxis());

d_pos = QPoint(xMap.transform(rect.left()), yMap.transform(rect.top()));
}
开发者ID:BackupTheBerlios,项目名称:qtiplot-svn,代码行数:12,代码来源:ImageMarker.cpp

示例12: plot

/*!
  Return normalized bounding rect of the axes

  \warning Calling QwtPlot::setAxisScale() while QwtPlot::autoReplot() is FALSE
           leaves the axis in an 'intermediate' state.
           In this case, to prevent buggy behaviour, you must call
           QwtPlot::replot() before calling QwtPlotPicker::scaleRect().
           This quirk will be removed in a future release.

  \sa QwtPlot::autoReplot(), QwtPlot::replot().
*/
QwtDoubleRect QwtPlotPicker::scaleRect() const
{
    const QwtPlot *plt = plot();

    const QwtDoubleRect rect(
        plt->axisScale(xAxis())->lBound(),
        plt->axisScale(xAxis())->hBound(),
        plt->axisScale(yAxis())->lBound(),
        plt->axisScale(yAxis())->hBound()
    );

    return rect.normalize();
}
开发者ID:BackupTheBerlios,项目名称:qtiplot-svn,代码行数:24,代码来源:qwt_plot_picker.cpp

示例13: boundingRect

QwtDoubleRect QwtHistogram::boundingRect() const {
  QwtDoubleRect rect = QwtPlotCurve::boundingRect();
  rect.setLeft(rect.left() - x(1));
  rect.setRight(rect.right() + x(dataSize() - 1));
  rect.setTop(0);
  rect.setBottom(1.2 * rect.bottom());
  return rect;
}
开发者ID:liyulun,项目名称:mantid,代码行数:8,代码来源:QwtHistogram.cpp

示例14: invTransform

/*!
  Draw the SVG item

  \param painter Painter
  \param xMap X-Scale Map
  \param yMap Y-Scale Map
  \param canvasRect Contents rect of the plot canvas
*/
void QwtPlotSvgItem::draw(QPainter *painter,
    const QwtScaleMap &xMap, const QwtScaleMap &yMap,
    const QRect &canvasRect) const
{
    const QwtDoubleRect cRect = invTransform(xMap, yMap, canvasRect);
    const QwtDoubleRect bRect = boundingRect();
    if ( bRect.isValid() && cRect.isValid() )
    {
        QwtDoubleRect rect = bRect;
        if ( bRect.contains(cRect) )
            rect = cRect;

        render(painter, viewBox(rect),
            transform(xMap, yMap, rect) );
    }
}
开发者ID:BackupTheBerlios,项目名称:qtiplot-svn,代码行数:24,代码来源:qwt_plot_svgitem.cpp

示例15: drawRays

/*!
  Draw lines from the pole

  \param painter Painter
  \param canvasRect Contents rect of the canvas in painter coordinates
  \param pole Position of the pole in painter coordinates
  \param radius Length of the lines in painter coordinates
  \param azimuthMap Maps azimuth values to values related to 0.0, M_2PI
  \param values Azimuth values, indicating the direction of the lines
*/
void QwtPolarGrid::drawRays(
  QPainter *painter, const QwtDoubleRect &canvasRect,
  const QwtDoublePoint &pole, double radius,
  const QwtScaleMap &azimuthMap, const QwtValueList &values ) const
{
  for ( int i = 0; i < int( values.size() ); i++ )
  {
    double azimuth = azimuthMap.xTransform( values[i] );
    azimuth = ::fmod( azimuth, 2 * M_PI );

    bool skipLine = false;
    if ( testDisplayFlag( SmartScaleDraw ) )
    {
      const QwtAbstractScaleDraw::ScaleComponent bone =
        QwtAbstractScaleDraw::Backbone;
      if ( isClose( azimuth, 0.0 ) )
      {
        const AxisData &axis = d_data->axisData[QwtPolar::AxisRight];
        if ( axis.isVisible && axis.scaleDraw->hasComponent( bone ) )
          skipLine = true;
      }
      else if ( isClose( azimuth, M_PI / 2 ) )
      {
        const AxisData &axis = d_data->axisData[QwtPolar::AxisTop];
        if ( axis.isVisible && axis.scaleDraw->hasComponent( bone ) )
          skipLine = true;
      }
      else if ( isClose( azimuth, M_PI ) )
      {
        const AxisData &axis = d_data->axisData[QwtPolar::AxisLeft];
        if ( axis.isVisible && axis.scaleDraw->hasComponent( bone ) )
          skipLine = true;
      }
      else if ( isClose( azimuth, 3 * M_PI / 2.0 ) )
      {
        const AxisData &axis = d_data->axisData[QwtPolar::AxisBottom];
        if ( axis.isVisible && axis.scaleDraw->hasComponent( bone ) )
          skipLine = true;
      }
    }
    if ( !skipLine )
    {
      const QwtDoublePoint pos = qwtPolar2Pos( pole, radius, azimuth );

      /*
          Qt4 is horrible slow, when painting primitives,
          with coordinates far outside the visible area.
       */

      QwtPolygon pa( 2 );
      pa.setPoint( 0, pole.toPoint() );
      pa.setPoint( 1, pos.toPoint() );

      if ( testDisplayFlag( ClipGridLines ) )
        pa = QwtClipper::clipPolygon( canvasRect.toRect(), pa );

      QwtPainter::drawPolyline( painter, pa );
    }
  }
}
开发者ID:Adam-Brown,项目名称:Quantum-GIS,代码行数:70,代码来源:qwt_polar_grid.cpp


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