A scale map. More...
#include <qwt_scale_map.h>

Public Member Functions | |
| QwtScaleMap () | |
| Constructor. | |
| QwtScaleMap (const QwtScaleMap &) | |
| Copy constructor. | |
| ~QwtScaleMap () | |
| QwtScaleMap & | operator= (const QwtScaleMap &) |
| Assignment operator. | |
| void | setTransformation (QwtScaleTransformation *) |
| const QwtScaleTransformation * | transformation () const |
| Get the transformation. | |
| void | setPaintInterval (int p1, int p2) |
| Specify the borders of the paint device interval. | |
| void | setPaintXInterval (double p1, double p2) |
| Specify the borders of the paint device interval. | |
| void | setScaleInterval (double s1, double s2) |
| Specify the borders of the scale interval. | |
| int | transform (double x) const |
| double | invTransform (double i) const |
| double | xTransform (double x) const |
| double | p1 () const |
| double | p2 () const |
| double | s1 () const |
| double | s2 () const |
| double | pDist () const |
| double | sDist () const |
Public Attributes | |
| QT_STATIC_CONST double | LogMin = 1.0e-150 |
| QT_STATIC_CONST double | LogMax = 1.0e150 |
A scale map.
QwtScaleMap offers transformations from a scale into a paint interval and vice versa.
Definition at line 56 of file qwt_scale_map.h.
| QwtScaleMap::QwtScaleMap | ( | ) |
Constructor.
The scale and paint device intervals are both set to [0,1].
Definition at line 86 of file qwt_scale_map.cpp.
References QwtScaleTransformation::Linear.
:
d_s1(0.0),
d_s2(1.0),
d_p1(0.0),
d_p2(1.0),
d_cnv(1.0)
{
d_transformation = new QwtScaleTransformation(
QwtScaleTransformation::Linear);
}
| QwtScaleMap::QwtScaleMap | ( | const QwtScaleMap & | other ) |
Copy constructor.
Definition at line 98 of file qwt_scale_map.cpp.
References QwtScaleTransformation::copy().
:
d_s1(other.d_s1),
d_s2(other.d_s2),
d_p1(other.d_p1),
d_p2(other.d_p2),
d_cnv(other.d_cnv)
{
d_transformation = other.d_transformation->copy();
}
| QwtScaleMap::~QwtScaleMap | ( | ) |
| double QwtScaleMap::invTransform | ( | double | p ) | const [inline] |
Transform an paint device value into a value in the interval of the scale.
| p | Value relative to the coordinates of the paint device |
Definition at line 175 of file qwt_scale_map.h.
References QwtScaleTransformation::invXForm().
Referenced by QwtPainter::drawColorBar(), QwtSlider::getValue(), QwtPlotPicker::invTransform(), QwtPlotItem::invTransform(), QwtPlotPanner::moveCanvas(), and QwtPlotSpectrogram::renderImage().
{
return d_transformation->invXForm(p, d_p1, d_p2, d_s1, d_s2 );
}
| QwtScaleMap & QwtScaleMap::operator= | ( | const QwtScaleMap & | other ) |
Assignment operator.
Definition at line 117 of file qwt_scale_map.cpp.
References QwtScaleTransformation::copy().
{
d_s1 = other.d_s1;
d_s2 = other.d_s2;
d_p1 = other.d_p1;
d_p2 = other.d_p2;
d_cnv = other.d_cnv;
delete d_transformation;
d_transformation = other.d_transformation->copy();
return *this;
}
| double QwtScaleMap::p1 | ( | ) | const [inline] |
Definition at line 120 of file qwt_scale_map.h.
Referenced by QwtSlider::getScrollMode(), QwtPlotItem::paintRect(), QwtPlotSpectrogram::renderImage(), setPaintInterval(), and setPaintXInterval().
{
return d_p1;
}
| double QwtScaleMap::p2 | ( | ) | const [inline] |
Definition at line 128 of file qwt_scale_map.h.
Referenced by QwtSlider::getScrollMode(), QwtPlotSpectrogram::renderImage(), setPaintInterval(), and setPaintXInterval().
{
return d_p2;
}
| double QwtScaleMap::pDist | ( | ) | const [inline] |
Definition at line 136 of file qwt_scale_map.h.
References qwtAbs.
Referenced by QwtPlotItem::paintRect().
{
return qwtAbs(d_p2 - d_p1);
}
| double QwtScaleMap::s1 | ( | ) | const [inline] |
Definition at line 104 of file qwt_scale_map.h.
Referenced by QwtPlotSpectrogram::renderImage(), QwtPlotItem::scaleRect(), and setScaleInterval().
{
return d_s1;
}
| double QwtScaleMap::s2 | ( | ) | const [inline] |
Definition at line 112 of file qwt_scale_map.h.
Referenced by QwtPlotSpectrogram::renderImage(), and setScaleInterval().
{
return d_s2;
}
| double QwtScaleMap::sDist | ( | ) | const [inline] |
Definition at line 144 of file qwt_scale_map.h.
References qwtAbs.
Referenced by QwtPlotItem::scaleRect().
{
return qwtAbs(d_s2 - d_s1);
}
| void QwtScaleMap::setPaintInterval | ( | int | p1, |
| int | p2 | ||
| ) |
Specify the borders of the paint device interval.
| p1 | first border |
| p2 | second border |
Definition at line 184 of file qwt_scale_map.cpp.
References QwtScaleTransformation::Other, p1(), p2(), and QwtScaleTransformation::type().
Referenced by QwtPlot::canvasMap(), QwtPlotRasterItem::draw(), QwtPainter::drawColorBar(), QwtThermo::layoutThermo(), QwtRoundScaleDraw::QwtRoundScaleDraw(), QwtPlotSpectrogram::renderImage(), QwtRoundScaleDraw::setAngleRange(), and QwtPlotSvgItem::viewBox().
{
d_p1 = p1;
d_p2 = p2;
if ( d_transformation->type() != QwtScaleTransformation::Other )
newFactor();
}
| void QwtScaleMap::setPaintXInterval | ( | double | p1, |
| double | p2 | ||
| ) |
Specify the borders of the paint device interval.
| p1 | first border |
| p2 | second border |
Definition at line 198 of file qwt_scale_map.cpp.
References QwtScaleTransformation::Other, p1(), p2(), and QwtScaleTransformation::type().
Referenced by QwtSlider::layoutSlider(), and QwtPlot::print().
{
d_p1 = p1;
d_p2 = p2;
if ( d_transformation->type() != QwtScaleTransformation::Other )
newFactor();
}
| void QwtScaleMap::setScaleInterval | ( | double | s1, |
| double | s2 | ||
| ) |
Specify the borders of the scale interval.
| s1 | first border |
| s2 | second border |
Definition at line 157 of file qwt_scale_map.cpp.
References QwtScaleTransformation::Log10, LogMax, LogMin, QwtScaleTransformation::Other, s1(), s2(), and QwtScaleTransformation::type().
Referenced by QwtPlot::canvasMap(), QwtPlot::print(), QwtThermo::PrivateData::PrivateData(), QwtSlider::rangeChange(), QwtPlotSpectrogram::renderImage(), QwtThermo::setRange(), QwtAbstractScaleDraw::setScaleDiv(), setTransformation(), and QwtPlotSvgItem::viewBox().
{
if (d_transformation->type() == QwtScaleTransformation::Log10 )
{
if (s1 < LogMin)
s1 = LogMin;
else if (s1 > LogMax)
s1 = LogMax;
if (s2 < LogMin)
s2 = LogMin;
else if (s2 > LogMax)
s2 = LogMax;
}
d_s1 = s1;
d_s2 = s2;
if ( d_transformation->type() != QwtScaleTransformation::Other )
newFactor();
}
| void QwtScaleMap::setTransformation | ( | QwtScaleTransformation * | transformation ) |
Initialize the map with a transformation
Definition at line 134 of file qwt_scale_map.cpp.
References setScaleInterval(), and transformation().
Referenced by QwtPlot::canvasMap(), QwtPlot::print(), QwtThermo::setRange(), and QwtAbstractScaleDraw::setTransformation().
{
if ( transformation == NULL )
return;
delete d_transformation;
d_transformation = transformation;
setScaleInterval(d_s1, d_s2);
}
| int QwtScaleMap::transform | ( | double | s ) | const [inline] |
Transform a point related to the scale interval into an point related to the interval of the paint device and round it to an integer. (In Qt <= 3.x paint devices are integer based. )
| s | Value relative to the coordinates of the scale |
Definition at line 188 of file qwt_scale_map.h.
References xTransform().
Referenced by QwtPlotCurve::closePolyline(), QwtPlotScaleItem::draw(), QwtPlotMarker::draw(), QmitkHistogram::draw(), QwtPlotSpectrogram::drawContourLines(), QwtPlotCurve::drawDots(), QwtRoundScaleDraw::drawLabel(), QwtPlotCurve::drawLines(), QwtPlotCurve::drawSteps(), QwtPlotCurve::drawSticks(), QwtPlotCurve::drawSymbols(), QwtRoundScaleDraw::drawTick(), QwtRoundScaleDraw::extent(), QwtScaleDraw::labelPosition(), QwtPlotPanner::moveCanvas(), QwtPlotPicker::transform(), QwtPlotItem::transform(), and QwtSlider::xyPosition().
{
return qRound(xTransform(s));
}
| const QwtScaleTransformation * QwtScaleMap::transformation | ( | ) | const |
Get the transformation.
Definition at line 146 of file qwt_scale_map.cpp.
Referenced by QwtPlotScaleItem::draw(), QwtScaleWidget::setScaleDiv(), and setTransformation().
{
return d_transformation;
}
| double QwtScaleMap::xTransform | ( | double | s ) | const [inline] |
Transform a point related to the scale interval into an point related to the interval of the paint device
| s | Value relative to the coordinates of the scale |
Definition at line 155 of file qwt_scale_map.h.
References QwtScaleTransformation::Linear, QuadProgPP::log(), QwtScaleTransformation::Log10, QwtScaleTransformation::type(), and QwtScaleTransformation::xForm().
Referenced by QwtPlotCurve::closestPoint(), QwtPlotCurve::drawLines(), transform(), and QwtPlotSvgItem::viewBox().
{
// try to inline code from QwtScaleTransformation
if ( d_transformation->type() == QwtScaleTransformation::Linear )
return d_p1 + (s - d_s1) * d_cnv;
if ( d_transformation->type() == QwtScaleTransformation::Log10 )
return d_p1 + log(s / d_s1) * d_cnv;
return d_transformation->xForm(s, d_s1, d_s2, d_p1, d_p2 );
}
| QT_STATIC_CONST_IMPL double QwtScaleMap::LogMax = 1.0e150 |
Definition at line 88 of file qwt_scale_map.h.
Referenced by setScaleInterval().
| QT_STATIC_CONST_IMPL double QwtScaleMap::LogMin = 1.0e-150 |
Definition at line 87 of file qwt_scale_map.h.
Referenced by setScaleInterval().
1.7.2