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


C++ QwtDoubleInterval函数代码示例

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


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

示例1: range

    virtual QwtDoubleInterval range() const
    {
        if (m_raster) {
            float min, max;
            for (int i = 0; i < m_raster->width(); i++) {
                for (int j = 0; j < m_raster->height(); j++) {
                    float v = m_raster->get(i, j, 0);
                    min = (i == 0) ? v : fmin(min, v);
                    max = (i == 0) ? v : fmax(max, v);
                }
            }

            double dmin = min;
            double dmax = max;
            double del = max == min ? 1.0 : max - min;
            if (!settings.autoRange) {
                double minblend = settings.minSlider / (double) settings.precSlider;
                double maxblend = settings.maxSlider / (double) settings.precSlider;

                dmin = min + minblend * del;
                dmax = min + maxblend * del;
            }

            return QwtDoubleInterval(dmin, dmax);
        } else {
            return QwtDoubleInterval(0, 0);
        }
    }
开发者ID:cabeen,项目名称:hyperspectral-sections,代码行数:28,代码来源:sectionwindow.cpp

示例2: QwtDoubleInterval

/**
 * @param it :: IMDIterator of what to find
 * @return the min/max range, or INFINITY if not found
 */
QwtDoubleInterval SignalRange::getRange(Mantid::API::IMDIterator *it) {
  if ((it == nullptr) || (!it->valid()))
    return QwtDoubleInterval(0., 1.0);

  // Use the current normalization
  it->setNormalization(m_normalization);

  double minSignal = DBL_MAX;
  double maxSignal = -DBL_MAX;
  auto inf = std::numeric_limits<double>::infinity();
  do {
    double signal = it->getNormalizedSignal();
    // Skip any 'infs' as it screws up the color scale
    if (!std::isinf(signal)) {
      if (signal < minSignal)
        minSignal = signal;
      if (signal > maxSignal)
        maxSignal = signal;
    }
  } while (it->next());

  if (minSignal == DBL_MAX) {
    minSignal = inf;
    maxSignal = inf;
  }
  return QwtDoubleInterval(minSignal, maxSignal);
}
开发者ID:DanNixon,项目名称:mantid,代码行数:31,代码来源:SignalRange.cpp

示例3: QwtDoubleInterval

void ColorMapEditor::setColorMap(const QwtLinearColorMap& map)
{
scaleColorsBox->setChecked(map.mode() == QwtLinearColorMap::ScaledColors);

QwtArray <double> colors = map.colorStops();
int rows = (int)colors.size();
table->setRowCount(rows);
table->blockSignals(true);
	
for (int i = 0; i < rows; i++)
	{
	QwtDoubleInterval range = QwtDoubleInterval(min_val, max_val);
	double val = min_val + colors[i] * range.width();
		
	QTableWidgetItem *it = new QTableWidgetItem(QString::number(val));
    table->setItem(i, 0, it);
		
	QColor c = QColor(map.rgb(QwtDoubleInterval(0, 1), colors[i]));
	it = new QTableWidgetItem(c.name());
	it->setFlags(Qt::ItemFlags(!Qt::ItemIsEditable));
	it->setBackground(QBrush(c));
	it->setForeground(QBrush(c));
    table->setItem(i, 1, it);
	}
table->blockSignals(false);
	
color_map = map;
}
开发者ID:highperformancecoder,项目名称:scidavis,代码行数:28,代码来源:ColorMapEditor.cpp

示例4: range

/** Update the widget when the color map is changed */
void ColorBarWidget::updateColorMap()
{
  // The color bar alway shows the same range. Doesn't matter since the ticks don't show up
  QwtDoubleInterval range(1.0, 100.0);
  m_colorBar->setColorBarEnabled(true);
  m_colorBar->setColorMap( range, m_colorMap);
  m_colorBar->setColorBarWidth(15);
  m_colorBar->setEnabled(true);

  // Try to limit the number of steps based on the height of the color bar
  int maxMajorSteps = m_colorBar->height()/15; // 15 pixels per div looked about right
  //std::cout << "maxMajorSteps" << maxMajorSteps << std::endl;
  if (maxMajorSteps > 10) maxMajorSteps = 10;

  // Show the scale on the right
  double minValue = m_min;
  double maxValue = m_max;
  GraphOptions::ScaleType type = m_colorMap.getScaleType();
  if( type == GraphOptions::Linear )
  {
    QwtLinearScaleEngine linScaler;
    m_colorBar->setScaleDiv(linScaler.transformation(), linScaler.divideScale(minValue, maxValue, maxMajorSteps, 5));
    m_colorBar->setColorMap(QwtDoubleInterval(minValue, maxValue),m_colorMap);
  }
  else
 {
    QwtLog10ScaleEngine logScaler;
    m_colorBar->setScaleDiv(logScaler.transformation(), logScaler.divideScale(minValue, maxValue, maxMajorSteps, 5));
    m_colorBar->setColorMap(QwtDoubleInterval(minValue, maxValue), m_colorMap);
  }

}
开发者ID:jkrueger1,项目名称:mantid,代码行数:33,代码来源:ColorBarWidget.cpp

示例5: intervals

    /**
     * Set the minimum and maximum of the workspace data. Code essentially copied from SignalRange.cpp
     * @param workspace Rreference to an IMD workspace
     * @returns The minimum and maximum value of the workspace dataset.
     */
    QwtDoubleInterval MetaDataExtractorUtils::getMinAndMax(Mantid::API::IMDWorkspace_sptr workspace)
    {
      if (!workspace)
        throw std::invalid_argument("The workspace is empty.");

      auto iterators = workspace->createIterators(PARALLEL_GET_MAX_THREADS, 0);

      std::vector<QwtDoubleInterval> intervals(iterators.size());
      // cppcheck-suppress syntaxError
      PRAGMA_OMP( parallel for schedule(dynamic, 1))
      for (int i=0; i < int(iterators.size()); i++)
      {
        Mantid::API::IMDIterator * it = iterators[i];

        QwtDoubleInterval range = this->getRange(it);
        intervals[i] = range;
        // don't delete iterator in parallel. MSVC doesn't like it
        // when the iterator points to a mock object.
      }

      // Combine the overall min/max
      double minSignal = DBL_MAX;
      double maxSignal = -DBL_MAX;

      auto inf = std::numeric_limits<double>::infinity();
      for (size_t i=0; i < iterators.size(); i++)
      {
        delete iterators[i];
        
        double signal;
        signal = intervals[i].minValue();
        if (signal != inf && signal < minSignal) minSignal = signal;

        signal = intervals[i].maxValue();
        if (signal != inf && signal > maxSignal) maxSignal = signal;
      }

      // Set the lowest element to the smallest non-zero element.
      if (minSignal == DBL_MAX)
      {
        minSignal = defaultMin;
        maxSignal = defaultMax;
      } 

      QwtDoubleInterval minMaxContainer;

      if (minSignal < maxSignal)
        minMaxContainer = QwtDoubleInterval(minSignal, maxSignal);
      else
      {
        if (minSignal != 0)
          // Possibly only one value in range
          minMaxContainer = QwtDoubleInterval(minSignal*0.5, minSignal*1.5);
        else
          // Other default value
          minMaxContainer = QwtDoubleInterval(defaultMin, defaultMax);
      }

      return minMaxContainer;
    }
开发者ID:nimgould,项目名称:mantid,代码行数:65,代码来源:MetaDataExtractorUtils.cpp

示例6: QwtDoubleInterval

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

QwtDoubleInterval QwtScaleEngine::buildInterval(double v) const
{
#if 1
    const double delta = (v == 0.0) ? 0.5 : qwtAbs(0.5 * v);
    return QwtDoubleInterval(v - delta, v + delta);
#else
    if ( v == 0.0 )
        return QwtDoubleInterval(-0.5, 0.5);

    return QwtDoubleInterval(0.5 * v, 1.5 * v);
#endif
}
开发者ID:BackupTheBerlios,项目名称:qtiplot-svn,代码行数:12,代码来源:qwt_scale_engine.cpp

示例8: index

/*!
  Return interval of an axis
  \param axis Axis index ( see QwtPlot::AxisId )
*/
QwtDoubleInterval QwtPlotRescaler::interval(int axis) const
{
    if ( axis < 0 || axis >= QwtPlot::axisCnt )
        return QwtDoubleInterval();

    const QwtPlot *plt = plot();

    const double v1 = plt->axisScaleDiv(axis)->lowerBound();
    const double v2 = plt->axisScaleDiv(axis)->upperBound();

    return QwtDoubleInterval(v1, v2).normalized();
}
开发者ID:AlexKraemer,项目名称:RFID_ME_HW_GUI,代码行数:16,代码来源:qwt_plot_rescaler.cpp

示例9: QwtDoubleInterval

QwtDoubleInterval QwtPlotRescaler::intervalHint(int axis) const
{
    if ( axis >= 0 && axis < QwtPlot::axisCnt )
        return d_data->axisData[axis].intervalHint;

    return QwtDoubleInterval();
}
开发者ID:AlexKraemer,项目名称:RFID_ME_HW_GUI,代码行数:7,代码来源:qwt_plot_rescaler.cpp

示例10: QwtDoubleInterval

/*!
   \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.
*/
QwtScaleDiv ProbabilityScaleEngine::divideScale(double x1, double x2,
    int, int, double stepSize) const
{
    QwtDoubleInterval interval = QwtDoubleInterval(x1, x2).normalized();
    interval = interval.limited(1e-4, 99.999);

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

    stepSize = fabs(qRound(stepSize));
    if ( stepSize == 0.0 )
        stepSize = 1.0;

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

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

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

示例11: QwtDoubleInterval

QwtDoubleInterval Spectrogram::range()
{
	if (d_impose_range)
		return QwtDoubleInterval(d_min_value, d_max_value);

	return data().range();
}
开发者ID:BackupTheBerlios,项目名称:qtiplot-svn,代码行数:7,代码来源:Spectrogram.cpp

示例12: xValues

void QmitkHistogramWidget::SetHistogram(HistogramType::ConstPointer itkHistogram)
{
  HistogramType::SizeType size = itkHistogram->GetSize();
  HistogramType::IndexType index;
  HistogramType::MeasurementVectorType currentMeasurementVector;

  QwtArray<QwtDoubleInterval> xValues(size[0]);
  QwtArray<double> yValues(size[0]);

  for (unsigned int i = 0; i < size[0]; ++i)
  {
    index[0] = static_cast<HistogramType::IndexValueType> (i);
    currentMeasurementVector = itkHistogram->GetMeasurementVector(index);
    if (currentMeasurementVector[0] != 0.0)
    {
      xValues[i] = QwtDoubleInterval(Round(currentMeasurementVector[0]-1), Round(currentMeasurementVector[0]));
      yValues[i] = static_cast<double> (itkHistogram->GetFrequency(index));
    }
  }

  // rebuild the plot
  m_Plot->clear();

  m_Histogram = new QmitkHistogram();
  m_Histogram->setColor(Qt::darkCyan);
  m_Histogram->setData(QwtIntervalData(xValues, yValues));
  m_Histogram->attach(m_Plot);

  this->InitializeMarker();
  this->InitializeZoomer();

  m_Plot->replot();
}
开发者ID:zomboir,项目名称:MITK,代码行数:33,代码来源:QmitkHistogramWidget.cpp

示例13: QColor

LinearColorMap LinearColorMap::fromXmlStringList(const QStringList& lst)
{
	QStringList::const_iterator line = lst.begin();
	QString s = (*line).stripWhiteSpace();

	int mode = s.remove("<Mode>").remove("</Mode>").stripWhiteSpace().toInt();
	s = *(++line);
	QColor color1 = QColor(s.remove("<MinColor>").remove("</MinColor>").stripWhiteSpace());
	s = *(++line);
	QColor color2 = QColor(s.remove("<MaxColor>").remove("</MaxColor>").stripWhiteSpace());

	LinearColorMap colorMap = LinearColorMap(color1, color2);
	colorMap.setMode((QwtLinearColorMap::Mode)mode);

	s = *(++line);
	if (s.contains("<Range>")){
		QStringList l = QStringList::split("\t", s.trimmed().remove("<Range>").remove("</Range>"));
		if (l.size() == 2)
			colorMap.setIntensityRange(QwtDoubleInterval(l[0].toDouble(), l[1].toDouble()));
		 s = *(++line);
	}

	int stops = s.remove("<ColorStops>").remove("</ColorStops>").stripWhiteSpace().toInt();
	for (int i = 0; i < stops; i++){
		s = (*(++line)).stripWhiteSpace();
		QStringList l = QStringList::split("\t", s.remove("<Stop>").remove("</Stop>"));
		colorMap.addColorStop(l[0].toDouble(), QColor(l[1]));
	}

	return colorMap;
}
开发者ID:kuzavas,项目名称:qtiplot,代码行数:31,代码来源:LinearColorMap.cpp

示例14: QwtDoubleInterval

/*!
   \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(), QwtScaleEngine::subDivide()
*/
QwtScaleDiv QwtLinearScaleEngine::divideScale(double x1, double x2,
    int maxMajSteps, int maxMinSteps, double stepSize) const
{
    QwtDoubleInterval interval = QwtDoubleInterval(x1, x2).normalized();
    if (interval.width() <= 0 )
        return QwtScaleDiv();

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

        stepSize = divideInterval(interval.width(), maxMajSteps);
    }

    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:376473984,项目名称:pvb,代码行数:43,代码来源:qwt_scale_engine.cpp

示例15: if

/**
 * Set up a new colour map.
 * @param colorMap :: Reference to the new colour map.
 */
void ColorMapWidget::setupColorBarScaling(const MantidColorMap& colorMap)
{
  double minValue = m_minValueBox->displayText().toDouble();
  double maxValue = m_maxValueBox->displayText().toDouble();

  GraphOptions::ScaleType type = colorMap.getScaleType();
  if( type == GraphOptions::Linear )
  {
    QwtLinearScaleEngine linScaler;
    m_scaleWidget->setScaleDiv(linScaler.transformation(), linScaler.divideScale(minValue, maxValue,  20, 5));
    m_scaleWidget->setColorMap(QwtDoubleInterval(minValue, maxValue),colorMap);
  }
  else if( type == GraphOptions::Power )
  {
      PowerScaleEngine powerScaler;
      m_scaleWidget->setScaleDiv(powerScaler.transformation(), powerScaler.divideScale(minValue, maxValue,  20, 5));
      m_scaleWidget->setColorMap(QwtDoubleInterval(minValue, maxValue),colorMap);
  }
  else
 {
    QwtLog10ScaleEngine logScaler;    
    double logmin(minValue);
    if( logmin <= 0.0 )
    {
      logmin = m_minPositiveValue;
      m_minValueBox->blockSignals(true);
      setMinValue(logmin);
      m_minValueBox->blockSignals(false);
    }
    if (maxValue <= 0)
    {
      maxValue = 10.;
      m_maxValueBox->blockSignals(true);
      setMaxValue(maxValue);
      m_maxValueBox->blockSignals(false);
    }
    m_scaleWidget->setScaleDiv(logScaler.transformation(), logScaler.divideScale(logmin, maxValue, 20, 5));
    m_scaleWidget->setColorMap(QwtDoubleInterval(logmin, maxValue), colorMap);
  }
  m_scaleOptions->blockSignals(true);
  m_scaleOptions->setCurrentIndex(m_scaleOptions->findData(type));
  m_dspnN->setEnabled(false);
  if (m_scaleOptions->findData(type) == 2) {
    m_dspnN->setEnabled(true);
  }
  m_scaleOptions->blockSignals(false);
}
开发者ID:stothe2,项目名称:mantid,代码行数:51,代码来源:ColorMapWidget.cpp


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