2018-06-28 01:23:16 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// Copyright (C) 2018- Equinor ASA
|
2019-09-06 03:40:57 -05:00
|
|
|
//
|
2018-06-28 01:23:16 -05:00
|
|
|
// ResInsight is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
|
|
// (at your option) any later version.
|
2019-09-06 03:40:57 -05:00
|
|
|
//
|
2018-06-28 01:23:16 -05:00
|
|
|
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
|
|
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
// FITNESS FOR A PARTICULAR PURPOSE.
|
2019-09-06 03:40:57 -05:00
|
|
|
//
|
|
|
|
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
2018-06-28 01:23:16 -05:00
|
|
|
// for more details.
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#include "RiuQwtLinearScaleEngine.h"
|
|
|
|
|
2022-03-18 07:16:07 -05:00
|
|
|
#include "qwt_interval.h"
|
|
|
|
|
2018-06-28 01:23:16 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2023-02-26 03:48:40 -06:00
|
|
|
QwtScaleDiv RiuQwtLinearScaleEngine::divideScaleWithExplicitIntervals( double x1, double x2, double majorStepInterval, double minorStepInterval )
|
2018-06-28 01:23:16 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
QwtInterval interval( x1, x2 );
|
2023-08-04 02:04:14 -05:00
|
|
|
QwtInterval roundedInterval = align( interval, majorStepInterval );
|
|
|
|
QList<double> majorTicks = buildMajorTicks( roundedInterval, majorStepInterval );
|
|
|
|
QList<double> minorTicks = buildMajorTicks( roundedInterval, minorStepInterval );
|
2018-06-28 01:23:16 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
return QwtScaleDiv( x1, x2, minorTicks, minorTicks, majorTicks );
|
2018-06-28 01:23:16 -05:00
|
|
|
}
|
2020-04-21 01:56:27 -05:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
QwtScaleDiv RiuQwtLinearScaleEngine::divideScaleWithExplicitIntervalsAndRange( double tickStart,
|
|
|
|
double tickEnd,
|
|
|
|
double majorStepInterval,
|
|
|
|
double minorStepInterval,
|
|
|
|
double rangeStart,
|
|
|
|
double rangeEnd )
|
|
|
|
{
|
|
|
|
QwtInterval tickInterval( tickStart, tickEnd );
|
2023-08-04 02:04:14 -05:00
|
|
|
QList<double> majorTicks = buildMajorTicks( tickInterval, majorStepInterval );
|
|
|
|
QList<double> minorTicks = buildMajorTicks( tickInterval, minorStepInterval );
|
2020-04-21 01:56:27 -05:00
|
|
|
|
|
|
|
return QwtScaleDiv( rangeStart, rangeEnd, minorTicks, minorTicks, majorTicks );
|
|
|
|
}
|