
Originally Posted by
bigjoeystud
Is there something equivalent that I can do now to determine if an axis is log scaled?
Note that QwtTransform is different to QwtScaleTransformation:
QwtScaleTransformation implemented the mapping between scale and paint device coordinates, while QwtTransform implements some "stretch" function, that can be used to manipulate the mapping implemented in QwtScaleMap. You might have noticed, that I have added QwtPowerTransform - an implementation using pow() - and in playground you find the scaleengine example that shows a transformation that extents the scales for an interval of interest ( here 300 - 500 ). Click on the legend to see what all these transformations do.
I have dropped the inlining in QwtScaleMap for logarithmic scales ( because log/exp are too expensive calls and the effect was it not worth ) to have a cleaner API without having an additional RTTI flag ( what the type enum was ). Instead QwtScaleMap implements an inlined linear mapping, when it has no transformation ( QwtLinearScaleEngine::transformation() returns NULL now ! ).
Note that the modification is not 100% in SVN yet. QwtLog10ScaleEngine will become QwtLogScaleEngine( double base ) - f.e for log2 based scales.
Back to your question - you can do the following:
bool axisLog = qwtplot->axisScaleEngine (axisId)->transformation () != NULL;
bool axisLog = qwtplot->axisScaleEngine (axisId)->transformation () != NULL;
To copy to clipboard, switch view to plain text mode
Of course the code above implies, that non linear transformations are always logarithmic - so, when you are allowed to use C++ rtti it would be better to write someting like this:
bool axisLog = dynamic_cast<const QwtLogTransform *>( qwtplot->axisScaleEngine (axisId)->transformation () ) != NULL;
bool axisLog = dynamic_cast<const QwtLogTransform *>( qwtplot->axisScaleEngine (axisId)->transformation () ) != NULL;
To copy to clipboard, switch view to plain text mode
Uwe
Bookmarks