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


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

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


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

示例1: normalize

/**
 * Normalize the value to the range[0,1]
 * @param interval :: The data range
 * @param value :: The data value
 * @returns The fraction along the given interval using the current scale type
 */
double MantidColorMap::normalize(const QwtDoubleInterval &interval,
                                 double value) const {
  // nan numbers have the property that nan != nan, treat nan as being invalid
  if (interval.isNull() || m_num_colors == 0 || boost::math::isnan(value))
    return m_nan;

  const double width = interval.width();
  if (width <= 0.0 || value <= interval.minValue())
    return 0.0;

  if (value >= interval.maxValue())
    return 1.0;

  double ratio(0.0);
  if (m_scale_type == GraphOptions::Linear) {
    ratio = (value - interval.minValue()) / width;
  } else if (m_scale_type == GraphOptions::Power) {
    ratio = (pow(value, m_nth_power) - pow(interval.minValue(), m_nth_power)) /
            (pow(interval.maxValue(), m_nth_power) -
             pow(interval.minValue(), m_nth_power));
  } else {
    // Assume log10 type
    // Have to deal with the possibility that a user has entered 0 as a minimum
    double minValue = interval.minValue();
    if (minValue < LOG_ZERO_CUTOFF) {
      minValue = 1.0;
    }
    ratio = std::log10(value / minValue) /
            std::log10(interval.maxValue() / minValue);
  }
  return ratio;
}
开发者ID:liyulun,项目名称:mantid,代码行数:38,代码来源:MantidColorMap.cpp

示例2: align

/*!
  \brief Align an interval to a step size

  The limits of an interval are aligned that both are integer
  multiples of the step size.

  \param interval Interval
  \param stepSize Step size

  \return Aligned interval
*/
QwtDoubleInterval QwtLinearScaleEngine::align(
    const QwtDoubleInterval &interval, double stepSize) const
{
    double x1 = QwtScaleArithmetic::floorEps(interval.minValue(), stepSize);
    if ( QwtScaleArithmetic::compareEps(interval.minValue(), x1, stepSize) == 0 )
        x1 = interval.minValue();

    double x2 = QwtScaleArithmetic::ceilEps(interval.maxValue(), stepSize);
    if ( QwtScaleArithmetic::compareEps(interval.maxValue(), x2, stepSize) == 0 )
        x2 = interval.maxValue();

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

示例3: executeLoadMetadata

/**
 Executes any meta-data loading required.
*/
void MDHWInMemoryLoadingPresenter::executeLoadMetadata() {
  using namespace Mantid::API;

  Workspace_sptr ws = m_repository->fetchWorkspace(m_wsName);
  IMDHistoWorkspace_sptr histoWs =
      boost::dynamic_pointer_cast<Mantid::API::IMDHistoWorkspace>(ws);
  m_wsTypeName = histoWs->id();
  m_specialCoords = histoWs->getSpecialCoordinateSystem();

  MDHWLoadingPresenter::transposeWs(histoWs, m_cachedVisualHistoWs);

  // Set the minimum and maximum of the workspace data.
  QwtDoubleInterval minMaxContainer =
      m_metaDataExtractor->getMinAndMax(histoWs);
  m_metadataJsonManager->setMinValue(minMaxContainer.minValue());
  m_metadataJsonManager->setMaxValue(minMaxContainer.maxValue());

  // Set the instrument which is associated with the workspace.
  m_metadataJsonManager->setInstrument(
      m_metaDataExtractor->extractInstrument(m_cachedVisualHistoWs));

  // Set the special coordinates
  m_metadataJsonManager->setSpecialCoordinates(m_specialCoords);

  // Call base-class extraction method.
  this->extractMetadata(m_cachedVisualHistoWs);
}
开发者ID:spaceyatom,项目名称:mantid,代码行数:30,代码来源:MDHWInMemoryLoadingPresenter.cpp

示例4: align

/*!
  \brief Align an interval to a step size

  The limits of an interval are aligned that both are integer
  multiples of the step size.

  \param interval Interval
  \param stepSize Step size

  \return Aligned interval
*/
QwtDoubleInterval QwtLinearScaleEngine::align(
    const QwtDoubleInterval &interval, double stepSize) const
{
    const double x1 = 
        QwtScaleArithmetic::floorEps(interval.minValue(), stepSize);
    const double x2 = 
        QwtScaleArithmetic::ceilEps(interval.maxValue(), stepSize);

    return QwtDoubleInterval(x1, x2);
}
开发者ID:376473984,项目名称:pvb,代码行数:21,代码来源:qwt_scale_engine.cpp

示例5:

/*!
  \brief Align an interval to a step size

  The limits of an interval are aligned that both are integer
  multiples of the step size.

  \param interval Interval
  \param stepSize Step size

  \return Aligned interval
*/
QwtDoubleInterval QwtLog10ScaleEngine::align(
    const QwtDoubleInterval &interval, double stepSize) const
{
    const QwtDoubleInterval intv = log10(interval);

    const double x1 = QwtScaleArithmetic::floorEps(intv.minValue(), stepSize);
    const double x2 = QwtScaleArithmetic::ceilEps(intv.maxValue(), stepSize);

    return pow10(QwtDoubleInterval(x1, x2));
}
开发者ID:376473984,项目名称:pvb,代码行数:21,代码来源:qwt_scale_engine.cpp

示例6:

/*! 
  Construct QwtScaleDiv instance.

  \param interval Interval
  \param ticks List of major, medium and minor ticks
*/
QwtScaleDiv::QwtScaleDiv(
        const QwtDoubleInterval &interval, 
        QwtTickList ticks[NTickTypes]):
    d_lBound(interval.minValue()),
    d_hBound(interval.maxValue()),
    d_isValid(true)
{
    for ( int i = 0; i < NTickTypes; i++ )
        d_ticks[i] = ticks[i];
}
开发者ID:chongle,项目名称:prorata,代码行数:16,代码来源:qwt_scale_div.cpp

示例7: QwtDoubleInterval

/*!
  \brief Align an interval to a step size

  The limits of an interval are aligned that both are integer
  multiples of the step size.

  \param interval Interval
  \param stepSize Step size

  \return Aligned interval
*/
QwtDoubleInterval Log2ScaleEngine::align(
    const QwtDoubleInterval &interval, double stepSize) const
{
    const QwtDoubleInterval intv = log2(interval);

    const double x1 = QwtScaleArithmetic::floorEps(intv.minValue(), stepSize);
    const double x2 = QwtScaleArithmetic::ceilEps(intv.maxValue(), stepSize);

    return QwtDoubleInterval(pow(2, x1), pow(2, x2));
}
开发者ID:BackupTheBerlios,项目名称:qtiplot-svn,代码行数:21,代码来源:Log2ScaleEngine.cpp

示例8: 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

示例9: SetData

void EditColorMap::SetData (
    const QwtIntervalData& intervalData, double maxValue,
    const ColorBarModel& colorBarModel, bool gridEnabled)
{
    m_colorMap = colorBarModel;
    setCombos (m_colorMap.GetPalette ());
    widgetHistogram->SetDataAllBinsSelected (
	intervalData, maxValue, 
	m_colorMap.GetTitle ().c_str ());
    widgetHistogram->SetColorTransferFunction (
	m_colorMap.GetInterval (), m_colorMap.GetQwtColorMap ());
    widgetHistogram->SetGridEnabled (gridEnabled);
    QwtDoubleInterval interval = m_colorMap.GetInterval ();
    QwtDoubleInterval clampValues = m_colorMap.GetClampInterval ();
    if (clampValues.minValue () > interval.minValue ())
	widgetHistogram->SetItemsSelectionLow (false, clampValues.minValue ());
    if (clampValues.maxValue () < interval.maxValue ())
	widgetHistogram->SetItemsSelectionHigh (false, clampValues.maxValue ());
    setHighlightColors ();
 }
开发者ID:danlipsa,项目名称:foamvis,代码行数:20,代码来源:EditColorMap.cpp

示例10: divideScale

/*!
   \brief Calculate a scale division

   \param x1 First interval limit 
   \param x2 Second interval limit 
   \param maxMajSteps Maximum for the number of major steps
   \param maxMinSteps Maximum number of minor steps
   \param stepSize Step size. If stepSize == 0, the scaleEngine
                   calculates one.

   \sa QwtScaleEngine::stepSize, LogTimeScaleEngine::subDivide
*/
QwtScaleDiv LogTimeScaleEngine::divideScale(double x1, double x2,
    int maxMajSteps, int maxMinSteps, double stepSize) const
{
    QwtDoubleInterval interval = QwtDoubleInterval(x1, x2).normalized();
    interval = interval.limited(LOG_MIN, LOG_MAX);

    if (interval.width() <= 0 )
        return QwtScaleDiv();

    if (interval.maxValue() / interval.minValue() < 10.0)
    {
        // scale width is less than one decade -> build linear scale
    
        QwtLinearScaleEngine linearScaler;
        linearScaler.setAttributes(attributes());
        linearScaler.setReference(reference());
        linearScaler.setMargins(
                                #if (QWT_VERSION >= 0x050200)
				lowerMargin(), upperMargin()
				#else
				loMargin(), hiMargin()
				#endif
				);

        return linearScaler.divideScale(x1, x2, 
            maxMajSteps, maxMinSteps, stepSize);
    }

    stepSize = qwtAbs(stepSize);
    if ( stepSize == 0.0 )
    {
        if ( maxMajSteps < 1 )
            maxMajSteps = 1;

        stepSize = divideInterval(log10(interval).width(), maxMajSteps);
        if ( stepSize < 1.0 )
            stepSize = 1.0; // major step must be >= 1 decade
    }

    QwtScaleDiv scaleDiv;
    if ( stepSize != 0.0 )
    {
        QwtValueList ticks[QwtScaleDiv::NTickTypes];
        buildTicks(interval, stepSize, maxMinSteps, ticks);

        scaleDiv = QwtScaleDiv(interval, ticks);
    }

    if ( x1 > x2 )
        scaleDiv.invert();

    return scaleDiv;
}
开发者ID:bodylinksystems,项目名称:GoldenCheetah,代码行数:65,代码来源:LogTimeScaleEngine.cpp

示例11: insertLevel

void ContourLinesEditor::insertLevel()
{
	if (!d_spectrogram)
		return;

	int row = table->currentRow();
	DoubleSpinBox *sb = (DoubleSpinBox*)table->cellWidget(row, 0);
	if (!sb)
		return;

	QwtDoubleInterval range = d_spectrogram->data().range();
	double current_value = sb->value();
	double previous_value = range.minValue ();
	sb = (DoubleSpinBox*)table->cellWidget(row - 1, 0);
	if (sb)
		previous_value = sb->value();

	double val = 0.5*(current_value + previous_value);

	table->blockSignals(true);
	table->insertRow(row);

	sb = new DoubleSpinBox();
	sb->setLocale(d_locale);
	sb->setDecimals(d_precision);
	sb->setValue(val);
	sb->setRange(range.minValue (), range.maxValue ());
	connect(sb, SIGNAL(activated(DoubleSpinBox *)), this, SLOT(spinBoxActivated(DoubleSpinBox *)));
    table->setCellWidget(row, 0, sb);

	QPen pen = d_spectrogram->defaultContourPen();
	if (pen.style() == Qt::NoPen)
		pen = d_spectrogram->contourPen (val);

	int width = 80;
	int height = 20;
	QPixmap pix(width, height);
	pix.fill(Qt::white);
	QPainter paint(&pix);
	paint.setRenderHint(QPainter::Antialiasing);
	paint.setPen(pen);
	paint.drawLine(0, height/2, width, height/2);
	paint.end();

	QLabel *lbl = new QLabel();
	lbl->setPixmap(pix);

	table->setCellWidget(row, 1, lbl);
	table->blockSignals(false);

	enableButtons(table->currentRow());
	d_pen_list.insert(row, pen);
}
开发者ID:chaoqing,项目名称:qtiplot,代码行数:53,代码来源:ContourLinesEditor.cpp

示例12: qRound

QwtValueList Log2ScaleEngine::buildMajorTicks(
    const QwtDoubleInterval &interval, double stepSize) const
{
    double width = log2(interval).width();

    int numTicks = qRound(width / stepSize) + 1;
    if ( numTicks > 10000 )
        numTicks = 10000;

    const double lxmin = ::log2(interval.minValue());
    const double lxmax = ::log2(interval.maxValue());
    const double lstep = (lxmax - lxmin) / double(numTicks - 1);

    QwtValueList ticks;
    ticks += interval.minValue();

    for (int i = 1; i < numTicks; i++)
       ticks += pow(2, lxmin + double(i) * lstep);

    ticks += interval.maxValue();

    return ticks;
}
开发者ID:BackupTheBerlios,项目名称:qtiplot-svn,代码行数:23,代码来源:Log2ScaleEngine.cpp

示例13: updateScale

void QwtPolarPlot::updateScale( int scaleId )
{
  if ( scaleId < 0 || scaleId >= QwtPolar::ScaleCount )
    return;

  ScaleData &d = d_data->scaleData[scaleId];

  double minValue = d.minValue;
  double maxValue = d.maxValue;
  double stepSize = d.stepSize;

  if ( scaleId == QwtPolar::ScaleRadius && d.doAutoScale )
  {
    QwtDoubleInterval interval;

    const QwtPolarItemList& itmList = itemList();
    for ( QwtPolarItemIterator it = itmList.begin();
          it != itmList.end(); ++it )
    {
      const QwtPolarItem *item = *it;
      if ( item->testItemAttribute( QwtPolarItem::AutoScale ) )
        interval |= item->boundingInterval( scaleId );
    }

    minValue = interval.minValue();
    maxValue = interval.maxValue();

    d.scaleEngine->autoScale( d.maxMajor,
                              minValue, maxValue, stepSize );
    d.scaleDiv.invalidate();
  }

  if ( !d.scaleDiv.isValid() )
  {
    d.scaleDiv = d.scaleEngine->divideScale(
                   minValue, maxValue,
                   d.maxMajor, d.maxMinor, stepSize );
  }

  const QwtDoubleInterval interval = visibleInterval();

  const QwtPolarItemList& itmList = itemList();
  for ( QwtPolarItemIterator it = itmList.begin();
        it != itmList.end(); ++it )
  {
    QwtPolarItem *item = *it;
    item->updateScaleDiv( *scaleDiv( QwtPolar::Azimuth ),
                          *scaleDiv( QwtPolar::Radius ), interval );
  }
}
开发者ID:ACorradini,项目名称:QGIS,代码行数:50,代码来源:qwt_polar_plot.cpp

示例14: buildMajorTicks

QwtValueList QwtLinearScaleEngine::buildMajorTicks(
    const QwtDoubleInterval &interval, double stepSize) const
{
    int numTicks = qRound(interval.width() / stepSize) + 1;
    if ( numTicks > 10000 )
        numTicks = 10000;

    QwtValueList ticks;

    ticks += interval.minValue();
    for (int i = 1; i < numTicks - 1; i++)
        ticks += interval.minValue() + i * stepSize;
    ticks += interval.maxValue();

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

示例15: updateContents

void ContourLinesEditor::updateContents()
{
	if (!d_spectrogram)
		return;

	QwtValueList levels = d_spectrogram->contourLevels ();

	int rows = (int)levels.size();
	table->setRowCount(rows);
	table->blockSignals(true);

	QwtDoubleInterval range = d_spectrogram->data().range();
	for (int i = 0; i < rows; i++){
		DoubleSpinBox *sb = new DoubleSpinBox();
		sb->setLocale(d_locale);
		sb->setDecimals(d_precision);
		sb->setValue(levels[i]);
		sb->setRange(range.minValue (), range.maxValue ());
		connect(sb, SIGNAL(activated(DoubleSpinBox *)), this, SLOT(spinBoxActivated(DoubleSpinBox *)));
    	table->setCellWidget(i, 0, sb);

		QPen pen = d_spectrogram->defaultContourPen();
		if (pen.style() == Qt::NoPen)
			pen = d_spectrogram->contourPen (levels[i]);

		int width = 80;
		int height = 20;
    	QPixmap pix(width, height);
    	pix.fill(Qt::white);
    	QPainter paint(&pix);
    	paint.setRenderHint(QPainter::Antialiasing);
    	paint.setPen(pen);
    	paint.drawLine(0, height/2, width, height/2);
    	paint.end();

    	QLabel *lbl = new QLabel();
    	lbl->setPixmap(pix);

    	table->setCellWidget(i, 1, lbl);

    	d_pen_list << pen;
	}
	table->blockSignals(false);
}
开发者ID:spaceyatom,项目名称:mantid,代码行数:44,代码来源:ContourLinesEditor.cpp


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