本文整理汇总了C++中QwtLinearScaleEngine::transformation方法的典型用法代码示例。如果您正苦于以下问题:C++ QwtLinearScaleEngine::transformation方法的具体用法?C++ QwtLinearScaleEngine::transformation怎么用?C++ QwtLinearScaleEngine::transformation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QwtLinearScaleEngine
的用法示例。
在下文中一共展示了QwtLinearScaleEngine::transformation方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateScale
/**
* Update the colour scale after the range changes.
*/
void ColorMapWidget::updateScale()
{
double minValue = m_minValueBox->displayText().toDouble();
double maxValue = m_maxValueBox->displayText().toDouble();
GraphOptions::ScaleType type = (GraphOptions::ScaleType)m_scaleOptions->itemData(m_scaleOptions->currentIndex()).toUInt();
if (type == GraphOptions::Linear)
{
QwtLinearScaleEngine linScaler;
m_scaleWidget->setScaleDiv(linScaler.transformation(), linScaler.divideScale(minValue, maxValue, 20, 5));
}
else if (type == GraphOptions::Power)
{
PowerScaleEngine powerScaler;
m_scaleWidget->setScaleDiv(powerScaler.transformation(), powerScaler.divideScale(minValue, maxValue, 20, 5));
}
else
{
QwtLog10ScaleEngine logScaler;
double logmin(minValue);
if (logmin <= 0.0)
{
logmin = m_minPositiveValue;
}
m_scaleWidget->setScaleDiv(logScaler.transformation(), logScaler.divideScale(logmin, maxValue, 20, 5));
}
}
示例2: updateColorMap
/** 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);
}
}
示例3: updateScale
/*!
Update the scale with the current attributes
\sa QwtDial::setScale
*/
void QwtDial::updateScale()
{
if ( d_data->scaleDraw )
{
QwtLinearScaleEngine scaleEngine;
const QwtScaleDiv scaleDiv = scaleEngine.divideScale(
minValue(), maxValue(),
d_data->maxMajIntv, d_data->maxMinIntv, d_data->scaleStep);
d_data->scaleDraw->setTransformation(scaleEngine.transformation());
d_data->scaleDraw->setScaleDiv(scaleDiv);
}
}
示例4: setupColorBarScaling
/**
* 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);
}