QskIntervalF::width -> QskIntervalF::length

This commit is contained in:
Uwe Rathmann 2023-11-28 13:12:52 +01:00
parent 7197c89533
commit 3c505652a3
6 changed files with 16 additions and 16 deletions

View File

@ -66,7 +66,7 @@ QskIntervalF StackedChart::stackedInterval( int index ) const
if ( index >= 0 && index < m_data->samples.size() ) if ( index >= 0 && index < m_data->samples.size() )
{ {
interval.setLowerBound( m_data->cumulatedValues[index] ); interval.setLowerBound( m_data->cumulatedValues[index] );
interval.setWidth( m_data->samples[index].value() ); interval.setLength( m_data->samples[index].value() );
} }
return interval; return interval;

View File

@ -37,10 +37,10 @@ namespace Engine
if ( !interval.isValid() ) if ( !interval.isValid() )
return false; return false;
if ( fuzzyCompare( value, interval.lowerBound(), interval.width() ) < 0 ) if ( fuzzyCompare( value, interval.lowerBound(), interval.length() ) < 0 )
return false; return false;
if ( fuzzyCompare( value, interval.upperBound(), interval.width() ) > 0 ) if ( fuzzyCompare( value, interval.upperBound(), interval.length() ) > 0 )
return false; return false;
return true; return true;
@ -94,7 +94,7 @@ namespace Engine
QVector< qreal > buildMajorTicks( QVector< qreal > buildMajorTicks(
const QskIntervalF& interval, qreal stepSize ) const QskIntervalF& interval, qreal stepSize )
{ {
int numTicks = qRound( interval.width() / stepSize ) + 1; int numTicks = qRound( interval.length() / stepSize ) + 1;
if ( numTicks > 10000 ) if ( numTicks > 10000 )
numTicks = 10000; numTicks = 10000;
@ -187,13 +187,13 @@ QskTickmarks QskGraduation::divideInterval(
const auto interval = QskIntervalF::normalized( x1, x2 ); const auto interval = QskIntervalF::normalized( x1, x2 );
if ( interval.width() > std::numeric_limits< qreal >::max() ) if ( interval.length() > std::numeric_limits< qreal >::max() )
{ {
qWarning() << "QskGraduation::divideInterval: overflow"; qWarning() << "QskGraduation::divideInterval: overflow";
return tickmarks; return tickmarks;
} }
if ( interval.width() <= 0.0 || stepSize < 0.0 ) if ( interval.length() <= 0.0 || stepSize < 0.0 )
return tickmarks; return tickmarks;
if ( stepSize == 0.0 ) if ( stepSize == 0.0 )
@ -201,7 +201,7 @@ QskTickmarks QskGraduation::divideInterval(
if ( maxMajorSteps < 1 ) if ( maxMajorSteps < 1 )
maxMajorSteps = 1; maxMajorSteps = 1;
stepSize = QskGraduation::stepSize( interval.width(), maxMajorSteps ); stepSize = QskGraduation::stepSize( interval.length(), maxMajorSteps );
} }
if ( stepSize != 0.0 ) if ( stepSize != 0.0 )

View File

@ -255,7 +255,7 @@ QRectF QskIntervalF::toRect( const QskIntervalF& intervalX,
const QskIntervalF& intervalY ) noexcept const QskIntervalF& intervalY ) noexcept
{ {
return QRectF( intervalX.lowerBound(), intervalY.lowerBound(), return QRectF( intervalX.lowerBound(), intervalY.lowerBound(),
intervalX.width(), intervalY.width() ).normalized(); intervalX.length(), intervalY.length() ).normalized();
} }
#ifndef QT_NO_DEBUG_STREAM #ifndef QT_NO_DEBUG_STREAM

View File

@ -19,7 +19,7 @@ class QSK_EXPORT QskIntervalF
Q_PROPERTY( qreal lowerBound READ lowerBound WRITE setLowerBound ) Q_PROPERTY( qreal lowerBound READ lowerBound WRITE setLowerBound )
Q_PROPERTY( qreal upperBound READ upperBound WRITE setUpperBound ) Q_PROPERTY( qreal upperBound READ upperBound WRITE setUpperBound )
Q_PROPERTY( qreal width READ width ) Q_PROPERTY( qreal length READ length )
public: public:
constexpr QskIntervalF() noexcept = default; constexpr QskIntervalF() noexcept = default;
@ -39,8 +39,8 @@ class QSK_EXPORT QskIntervalF
void spanFromLowerBound( qreal ) noexcept; void spanFromLowerBound( qreal ) noexcept;
void spanFromUpperBound( qreal ) noexcept; void spanFromUpperBound( qreal ) noexcept;
constexpr qreal width() const noexcept; constexpr qreal length() const noexcept;
void setWidth( qreal ) noexcept; void setLength( qreal ) noexcept;
constexpr bool contains( qreal value ) const noexcept; constexpr bool contains( qreal value ) const noexcept;
constexpr bool contains( const QskIntervalF& ) const noexcept; constexpr bool contains( const QskIntervalF& ) const noexcept;
@ -135,14 +135,14 @@ inline constexpr qreal QskIntervalF::upperBound() const noexcept
return m_upperBound; return m_upperBound;
} }
inline constexpr qreal QskIntervalF::width() const noexcept inline constexpr qreal QskIntervalF::length() const noexcept
{ {
return ( m_upperBound > m_lowerBound ) ? ( m_upperBound - m_lowerBound ) : 0.0; return ( m_upperBound > m_lowerBound ) ? ( m_upperBound - m_lowerBound ) : 0.0;
} }
inline void QskIntervalF::setWidth( qreal width ) noexcept inline void QskIntervalF::setLength( qreal length ) noexcept
{ {
m_upperBound = m_lowerBound + width; m_upperBound = m_lowerBound + length;
} }
inline constexpr bool QskIntervalF::isValid() const noexcept inline constexpr bool QskIntervalF::isValid() const noexcept

View File

@ -254,7 +254,7 @@ QSGNode* QskScaleRenderer::updateLabelsNode(
const qreal length = ( m_data->orientation == Qt::Horizontal ) const qreal length = ( m_data->orientation == Qt::Horizontal )
? tickmarksRect.width() : tickmarksRect.height(); ? tickmarksRect.width() : tickmarksRect.height();
const qreal ratio = length / m_data->boundaries.width(); const qreal ratio = length / m_data->boundaries.length();
auto nextNode = node->firstChild(); auto nextNode = node->firstChild();

View File

@ -41,7 +41,7 @@ void QskTickmarksNode::update(
auto vertexData = geometry()->vertexDataAsPoint2D(); auto vertexData = geometry()->vertexDataAsPoint2D();
const qreal min = boundaries.lowerBound(); const qreal min = boundaries.lowerBound();
const qreal range = boundaries.width(); const qreal range = boundaries.length();
using TM = QskTickmarks; using TM = QskTickmarks;