void ScaleEngine::autoScale (int maxNumSteps, double &x1, double &x2, double &stepSize) const { if (!hasBreak() || testAttribute(QwtScaleEngine::Inverted)){ QwtScaleEngine *engine; if (d_type == QwtScaleTransformation::Log10) engine = new QwtLog10ScaleEngine(); else engine = new QwtLinearScaleEngine(); engine->setAttributes(attributes()); engine->setReference(reference()); engine->setMargins(loMargin(), hiMargin()); engine->autoScale(maxNumSteps, x1, x2, stepSize); delete engine; } else { QwtScaleEngine *engine; if (d_type == QwtScaleTransformation::Log10) engine = new QwtLog10ScaleEngine(); else engine = new QwtLinearScaleEngine(); engine->setAttributes(attributes()); double breakLeft = d_break_left; engine->autoScale(maxNumSteps, x1, breakLeft, stepSize); delete engine; engine = new QwtLinearScaleEngine(); engine->setAttributes(attributes()); double breakRight = d_break_right; engine->autoScale(maxNumSteps, breakRight, x2, stepSize); delete engine; } }
void ScaleEngine::autoScale (int maxNumSteps, double &x1, double &x2, double &stepSize) const { if (!hasBreak() || testAttribute(QwtScaleEngine::Inverted)){ QwtScaleEngine *engine = newScaleEngine(); engine->setAttributes(attributes()); engine->setReference(reference()); engine->setMargins(lowerMargin(), upperMargin()); if (type() == ScaleTransformation::Log10 || type() == ScaleTransformation::Ln || type() == ScaleTransformation::Log2){ if (x1 <= 0.0) x1 = LOG_MIN; if (x2 <= 0.0) x2 = LOG_MIN; } engine->autoScale(maxNumSteps, x1, x2, stepSize); delete engine; } else { QwtScaleEngine *engine = newScaleEngine(); engine->setAttributes(attributes()); double breakLeft = d_break_left; engine->autoScale(maxNumSteps, x1, breakLeft, stepSize); delete engine; engine = new QwtLinearScaleEngine(); engine->setAttributes(attributes()); double breakRight = d_break_right; engine->autoScale(maxNumSteps, breakRight, x2, stepSize); delete engine; } }