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


C++ QwtDoubleInterval::isValid方法代码示例

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


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

示例1: boundingRect

QwtDoubleRect QwtIntervalData::boundingRect() const
{
    double minX, maxX, minY, maxY;
    minX = maxX = minY = maxY = 0.0;

    bool isValid = false;

    const size_t sz = size();
    for ( size_t i = 0; i < sz; i++ )
    {
        const QwtDoubleInterval intv = interval(i);
        if ( !intv.isValid() )
            continue;

        const double v = value(i);

        if ( !isValid )
        {
            minX = intv.minValue();
            maxX = intv.maxValue();
            minY = maxY = v;

            isValid = true;
        }
        else
        {
            if ( intv.minValue() < minX )
                minX = intv.minValue();
            if ( intv.maxValue() > maxX )
                maxX = intv.maxValue();

            if ( v < minY )
                minY = v;
            if ( v > maxY )
                maxY = v;
        }
    }
    if ( !isValid )
        return QwtDoubleRect(1.0, 1.0, -2.0, -2.0); // invalid

    return QwtDoubleRect(minX, minY, maxX - minX, maxY - minY);
}
开发者ID:DMachuca,项目名称:ar2tech-SGeMS-public,代码行数:42,代码来源:qwt_interval_data.cpp

示例2: contains

/*!
  Check if an interval "contains" a value

  \param interval Interval
  \param value Value

  \sa QwtScaleArithmetic::compareEps()
*/
bool QwtScaleEngine::contains(
    const QwtDoubleInterval &interval, double value) const
{
    if (!interval.isValid() )
        return false;
    
    if ( QwtScaleArithmetic::compareEps(value, 
        interval.minValue(), interval.width()) < 0 )
    {
        return false;
    }

    if ( QwtScaleArithmetic::compareEps(value, 
        interval.maxValue(), interval.width()) > 0 )
    {
        return false;
    }

    return true;
}
开发者ID:376473984,项目名称:pvb,代码行数:28,代码来源:qwt_scale_engine.cpp

示例3: rgbtable

/**
 * Compute a lookup table
 *
 * @param interval :: The interval of values of the RGB component for
 * the table to cover
 */
QVector<QRgb>
MantidColorMap::colorTable(const QwtDoubleInterval &interval) const {
  // Swicth to linear scaling when computing the lookup table
  GraphOptions::ScaleType current_type = m_scale_type;
  m_scale_type = GraphOptions::Linear;

  short table_size = (m_num_colors > 1) ? m_num_colors : 2;
  QVector<QRgb> rgbtable(table_size + 1);
  if (interval.isValid()) {
    const double step = interval.width() / table_size;
    for (short i = 0; i < table_size; ++i) {
      rgbtable[i + 1] = rgb(interval, interval.minValue() + step * i);
    }
    // Special NAN at index 0
    rgbtable[0] = rgb(interval, m_nan);
  }

  // Restore scaling type
  m_scale_type = current_type;
  return rgbtable;
}
开发者ID:liyulun,项目名称:mantid,代码行数:27,代码来源:MantidColorMap.cpp

示例4: strip

/*!
  Remove ticks from a list, that are not inside an interval

  \param ticks Tick list
  \param interval Interval

  \return Stripped tick list
*/
QwtValueList QwtScaleEngine::strip( 
    const QwtValueList& ticks, 
    const QwtDoubleInterval &interval) const
{
    if ( !interval.isValid() || ticks.count() == 0 )
        return QwtValueList();

    if ( contains(interval, ticks.first())
        && contains(interval, ticks.last()) )
    {
        return ticks;
    }

    QwtValueList strippedTicks;
    for ( int i = 0; i < (int)ticks.count(); i++ )
    {
        if ( contains(interval, ticks[i]) )
            strippedTicks += ticks[i];
    }
    return strippedTicks;
}
开发者ID:376473984,项目名称:pvb,代码行数:29,代码来源:qwt_scale_engine.cpp

示例5: drawItems

/*!
  Redraw the canvas items.

  \param painter Painter used for drawing
  \param azimuthMap Maps azimuth values to values related to 0.0, M_2PI
  \param radialMap Maps radius values into painter coordinates.
  \param pole Position of the pole in painter coordinates
  \param radius Radius of the complete plot area in painter coordinates
  \param canvasRect Contents rect of the canvas in painter coordinates
*/
void QwtPolarPlot::drawItems( QPainter *painter,
                              const QwtScaleMap &azimuthMap, const QwtScaleMap &radialMap,
                              const QwtDoublePoint &pole, double radius,
                              const QwtDoubleRect &canvasRect ) const
{
  const QwtDoubleRect pr = plotRect( canvasRect.toRect() );

  const QwtPolarItemList& itmList = itemList();
  for ( QwtPolarItemIterator it = itmList.begin();
        it != itmList.end(); ++it )
  {
    QwtPolarItem *item = *it;
    if ( item && item->isVisible() )
    {
      painter->save();

      // Unfortunately circular clipping slows down
      // painting a lot. So we better try to avoid it.

      bool doClipping = false;
      if ( item->rtti() != QwtPolarItem::Rtti_PolarGrid )
      {
        const QwtDoubleInterval intv =
          item->boundingInterval( QwtPolar::Radius );

        if ( !intv.isValid() )
          doClipping = true;
        else
        {
          if ( radialMap.s1() < radialMap.s2() )
            doClipping = intv.maxValue() > radialMap.s2();
          else
            doClipping = intv.minValue() < radialMap.s2();
        }
      }

      if ( doClipping )
      {
        const int margin = item->marginHint();
        const QwtDoubleRect clipRect( pr.x() - margin, pr.y() - margin,
                                      pr.width() + 2 * margin, pr.height() + 2 * margin );

        if ( !clipRect.contains( canvasRect ) )
        {
          QRegion clipRegion( clipRect.toRect(), QRegion::Ellipse );
#if QT_VERSION >= 0x040000
          painter->setClipRegion( clipRegion, Qt::IntersectClip );
#else
          if ( painter->hasClipping() )
            clipRegion &= painter->clipRegion();

          painter->setClipRegion( clipRegion );
#endif
        }
      }

#if QT_VERSION >= 0x040000
      painter->setRenderHint( QPainter::Antialiasing,
                              item->testRenderHint( QwtPolarItem::RenderAntialiased ) );
#endif

      item->draw( painter, azimuthMap, radialMap,
                  pole, radius, canvasRect );
      painter->restore();
    }
  }

}
开发者ID:ACorradini,项目名称:QGIS,代码行数:78,代码来源:qwt_polar_plot.cpp

示例6: contourLines

    const QList<double> &levels, int flags) const
#else
QwtRasterData::ContourLines QwtRasterData::contourLines(
    const QwtDoubleRect &rect, const QSize &raster, 
    const QValueList<double> &levels, int flags) const
#endif
{   
    ContourLines contourLines;
    
    if ( levels.size() == 0 || !rect.isValid() || !raster.isValid() )
        return contourLines;

    const double dx = rect.width() / raster.width();
    const double dy = rect.height() / raster.height();

    const bool ignoreOnPlane =
        flags & QwtRasterData::IgnoreAllVerticesOnLevel;

    const QwtDoubleInterval range = this->range();
    bool ignoreOutOfRange = false;
    if ( range.isValid() )
        ignoreOutOfRange = flags & IgnoreOutOfRange;

    ((QwtRasterData*)this)->initRaster(rect, raster);

    for ( int y = 0; y < raster.height() - 1; y++ )
    {
        enum Position
        {
            Center,

            TopLeft,
            TopRight,
            BottomRight,
            BottomLeft,

            NumPositions
        };

        Contour3DPoint xy[NumPositions];

        for ( int x = 0; x < raster.width() - 1; x++ )
        {
            const QwtDoublePoint pos(rect.x() + x * dx, rect.y() + y * dy);

            if ( x == 0 )
            {
                xy[TopRight].setPos(pos.x(), pos.y());
                xy[TopRight].setZ(
                    value( xy[TopRight].x(), xy[TopRight].y())
                );

                xy[BottomRight].setPos(pos.x(), pos.y() + dy);
                xy[BottomRight].setZ(
                    value(xy[BottomRight].x(), xy[BottomRight].y())
                );
            }

            xy[TopLeft] = xy[TopRight];
            xy[BottomLeft] = xy[BottomRight];

            xy[TopRight].setPos(pos.x() + dx, pos.y());
            xy[BottomRight].setPos(pos.x() + dx, pos.y() + dy);

            xy[TopRight].setZ(
                value(xy[TopRight].x(), xy[TopRight].y())
            );
            xy[BottomRight].setZ(
                value(xy[BottomRight].x(), xy[BottomRight].y())
            );

            double zMin = xy[TopLeft].z();
            double zMax = zMin;
            double zSum = zMin;

            for ( int i = TopRight; i <= BottomLeft; i++ )
            {
                const double z = xy[i].z();

                zSum += z;
                if ( z < zMin )
                    zMin = z;
                if ( z > zMax )
                    zMax = z;
            }

            if ( ignoreOutOfRange )
            {
                if ( !range.contains(zMin) || !range.contains(zMax) )
                    continue;
            }

            if ( zMax < levels[0] ||
                zMin > levels[levels.size() - 1] )
            {
                continue;
            }

            xy[Center].setPos(pos.x() + 0.5 * dx, pos.y() + 0.5 * dy);
            xy[Center].setZ(0.25 * zSum);
//.........这里部分代码省略.........
开发者ID:DTUautopilot,项目名称:qgroundcontrol,代码行数:101,代码来源:qwt_raster_data.cpp


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