本文整理汇总了C++中QwtDoubleInterval函数的典型用法代码示例。如果您正苦于以下问题:C++ QwtDoubleInterval函数的具体用法?C++ QwtDoubleInterval怎么用?C++ QwtDoubleInterval使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了QwtDoubleInterval函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: QwtDoubleInterval
void ColorMapEditor::insertLevel()
{
int row = table->currentRow();
DoubleSpinBox *sb = (DoubleSpinBox*)table->cellWidget(row, 0);
if (!sb)
return;
double current_value = sb->value();
double previous_value = min_val;
sb = (DoubleSpinBox*)table->cellWidget(row - 1, 0);
if (sb)
previous_value = sb->value();
double val = 0.5*(current_value + previous_value);
QwtDoubleInterval range = QwtDoubleInterval(min_val, max_val);
double mapped_val = (val - min_val)/range.width();
QColor c = QColor(color_map.rgb(QwtDoubleInterval(0, 1), mapped_val));
table->blockSignals(true);
table->insertRow(row);
sb = new DoubleSpinBox();
sb->setLocale(d_locale);
sb->setDecimals(d_precision);
sb->setValue(val);
sb->setRange(min_val, max_val);
connect(sb, SIGNAL(valueChanged(double)), this, SLOT(updateColorMap()));
connect(sb, SIGNAL(activated(DoubleSpinBox *)), this, SLOT(spinBoxActivated(DoubleSpinBox *)));
table->setCellWidget(row, 0, sb);
QTableWidgetItem *it = new QTableWidgetItem(c.name());
// Avoid compiler warning
//#ifdef Q_CC_MSVC
it->setFlags(it->flags() & (~Qt::ItemIsEditable));
//#else
// it->setFlags(!Qt::ItemIsEditable);
//#endif
it->setBackground(QBrush(c));
it->setForeground(QBrush(c));
table->setItem(row, 1, it);
table->blockSignals(false);
enableButtons(table->currentRow());
updateColorMap();
}
开发者ID:Mantid-Test-Account,项目名称:mantid,代码行数:46,代码来源:ColorMapEditor.cpp
示例17: QwtDoubleInterval
void FloodPlot::dataAutoRange()
{
m_dataRange = m_spectrogram->data().range();
if (m_dataRange.minValue() == m_dataRange.maxValue())
m_dataRange = QwtDoubleInterval(m_dataRange.minValue(), m_dataRange.minValue() + 1.0);
m_colorLevels=linspace(m_dataRange.minValue(), m_dataRange.maxValue(),m_colorMapLength);
}
开发者ID:Zicao,项目名称:OpenStudio,代码行数:8,代码来源:FloodPlot.cpp
示例18: log10
/*!
\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
示例19: QwtDoubleInterval
/**
* Get the range of a workspace dataset for a single iterator. Code the same as in SignalRange.cpp
* @param it :: IMDIterator of what to find
* @returns the min/max range, or INFINITY if not found
*/
QwtDoubleInterval MetaDataExtractorUtils::getRange(Mantid::API::IMDIterator * it)
{
if (!it)
return QwtDoubleInterval(defaultMin, defaultMax);
if (!it->valid())
return QwtDoubleInterval(defaultMin, defaultMax);
// Use no normalization
it->setNormalization(Mantid::API::VolumeNormalization);
double minSignal = DBL_MAX;
double minSignalZeroCheck = 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 (signal != inf)
{
if (signal == 0.0) minSignalZeroCheck = signal;
if (signal < minSignal && signal >0.0) minSignal = signal;
if (signal > maxSignal) maxSignal = signal;
}
} while (it->next());
if (minSignal == DBL_MAX)
{
if (minSignalZeroCheck != DBL_MAX)
{
minSignal = defaultMin;
maxSignal = defaultMax;
}
else
{
minSignal = inf;
maxSignal = inf;
}
}
return QwtDoubleInterval(minSignal, maxSignal);
}
开发者ID:nimgould,项目名称:mantid,代码行数:48,代码来源:MetaDataExtractorUtils.cpp
示例20: log2
/*!
\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
注:本文中的QwtDoubleInterval函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论