本文整理汇总了C++中QwtDoubleInterval::isNull方法的典型用法代码示例。如果您正苦于以下问题:C++ QwtDoubleInterval::isNull方法的具体用法?C++ QwtDoubleInterval::isNull怎么用?C++ QwtDoubleInterval::isNull使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QwtDoubleInterval
的用法示例。
在下文中一共展示了QwtDoubleInterval::isNull方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: pixelDist
double QwtPlotRescaler::pixelDist(int axis, const QSize &size) const
{
const QwtDoubleInterval intv = intervalHint(axis);
double dist = 0.0;
if ( !intv.isNull() )
{
if ( axis == referenceAxis() )
dist = intv.width();
else
{
const double r = aspectRatio(axis);
if ( r > 0.0 )
dist = intv.width() * r;
}
}
if ( dist > 0.0 )
{
if ( orientation(axis) == Qt::Horizontal )
dist /= size.width();
else
dist /= size.height();
}
return dist;
}
示例2: 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;
}
示例3: rescale
//! Adjust the plot axes scales
void QwtPlotRescaler::rescale() const
{
#if 0
const int axis = referenceAxis();
if ( axis < 0 || axis >= QwtPlot::axisCnt )
return;
const QwtDoubleInterval hint = intervalHint(axis);
if ( !hint.isNull() )
{
QwtPlot *plt = (QwtPlot *)plot();
const bool doReplot = plt->autoReplot();
plt->setAutoReplot(false);
plt->setAxisScale(axis, hint.minValue(), hint.maxValue());
plt->setAutoReplot(doReplot);
plt->updateAxes();
}
#endif
const QSize size = canvas()->contentsRect().size();
rescale(size, size);
}