21#include <rtl/math.hxx>
22#include <osl/diagnose.h>
32using namespace ::rtl::math;
42 floor( approxSub( fMin, rIncrement.
BaseValue )
48 if( !approxEqual(fRet, fMin) )
61 floor( approxSub( fMax, rIncrement.
BaseValue )
67 if( !approxEqual(fRet, fMax) )
75 : m_rScale(
std::move( aScale ))
76 , m_rIncrement(
std::move( aIncrement ))
85 OSL_ENSURE(
m_xInverseScaling.is(),
"each Scaling needs to return an inverse Scaling" );
141 double* pfNextParentTick = aIter.
firstValue();
142 if(!pfNextParentTick)
144 double fLastParentTick = *pfNextParentTick;
146 if(!pfNextParentTick)
150 if(!nMaxSubTickCount)
154 auto pSubTicks = aSubTicks.getArray();
155 sal_Int32 nRealSubTickCount = 0;
158 double* pValue =
nullptr;
159 for(; pfNextParentTick; fLastParentTick=*pfNextParentTick, pfNextParentTick = aIter.
nextValue())
161 for( sal_Int32 nPartTick = 1; nPartTick<nIntervalCount; nPartTick++ )
164 , fLastParentTick, *pfNextParentTick );
168 pSubTicks[nRealSubTickCount] = *pValue;
173 aSubTicks.realloc(nRealSubTickCount);
174 rParentTicks.getArray()[nDepth] = aSubTicks;
198 if (!std::isfinite(fSub))
202 if (fIntervalCount > std::numeric_limits<sal_Int32>::max())
206 sal_Int32 nIntervalCount =
static_cast<sal_Int32
>(fIntervalCount);
209 for(sal_Int32 nN=0; nN<nDepth-1; nN++)
215 sal_Int32 nTickCount = nIntervalCount;
245 ,
double fStartParentTick,
double fNextParentTick )
const
250 if(fStartParentTick >= fNextParentTick)
264 double fAdaptedStartParent = fStartParentTick;
265 double fAdaptedNextParent = fNextParentTick;
318 if (nDepthCount <= 0 || nMaxMajorTickCount <= 0)
322 auto pAllTicks = aAllTicks.getArray();
323 pAllTicks[0].realloc(nMaxMajorTickCount);
324 auto pAllTicks0 = pAllTicks[0].getArray();
326 sal_Int32 nRealMajorTickCount = 0;
327 for( sal_Int32 nMajorTick=0; nMajorTick<nMaxMajorTickCount; nMajorTick++ )
332 pAllTicks0[nRealMajorTickCount] = *pValue;
333 nRealMajorTickCount++;
335 if(!nRealMajorTickCount)
337 pAllTicks[0].realloc(nRealMajorTickCount);
344 sal_Int32 nDepth = 0;
346 for( nDepth = 0; nDepth < nDepthCount; nDepth++)
348 sal_Int32 nInvisibleAtLowerBorder = 0;
349 sal_Int32 nInvisibleAtUpperBorder = 0;
351 sal_Int32 nCheckCount = 1;
352 for(sal_Int32 nN=0; nN<nDepth; nN++)
358 sal_Int32
nCount = rTicks.getLength();
360 for( nTick=0; nTick<nCheckCount && nTick<
nCount; nTick++)
363 nInvisibleAtLowerBorder++;
366 for( nTick=
nCount-1; nTick>
nCount-1-nCheckCount && nTick>=0; nTick--)
369 nInvisibleAtUpperBorder++;
372 if( !nInvisibleAtLowerBorder && !nInvisibleAtUpperBorder)
374 if( !nInvisibleAtLowerBorder )
375 rTicks.realloc(
nCount-nInvisibleAtUpperBorder);
378 sal_Int32 nNewCount =
nCount-nInvisibleAtUpperBorder-nInvisibleAtLowerBorder;
383 rTicks.realloc(nNewCount);
384 auto pTicks = rTicks.getArray();
385 for(nTick = 0; nTick<nNewCount; nTick++)
386 pTicks[nTick] = aOldTicks[nInvisibleAtLowerBorder+nTick];
391 rAllTickInfos.resize(aAllTicks.getLength());
392 for( nDepth=0 ;nDepth<aAllTicks.getLength(); nDepth++ )
394 sal_Int32
nCount = aAllTicks[nDepth].getLength();
397 rTickInfoVector.clear();
398 rTickInfoVector.reserve(
nCount );
399 for(sal_Int32 nN = 0; nN<
nCount; nN++)
403 rTickInfoVector.push_back(aTickInfo);
417 , sal_Int32 nMaxDepth )
418 : m_pSimpleTicks(&rTicks)
419 , m_pInfoTicks(nullptr)
420 , m_rIncrement(rIncrement)
423 , m_nCurrentDepth(-1),
m_nCurrentPos(-1), m_fCurrentValue( 0.0 )
425 initIter( nMaxDepth );
430 , sal_Int32 nMaxDepth )
431 : m_pSimpleTicks(nullptr)
432 , m_pInfoTicks(&rTicks)
433 , m_rIncrement(rIncrement)
436 , m_nCurrentDepth(-1),
m_nCurrentPos(-1), m_fCurrentValue( 0.0 )
447 sal_Int32 nDepth = 0;
465 sal_Int32 nPreParentCount = 0;
467 for(sal_Int32 nN = 0; nN<
nCount; nN++)
478 if( fNextParentValue < fParentValue )
479 fParentValue = fNextParentValue;
492 sal_Int32 nReturnDepth=0;
493 double fMinValue = DBL_MAX;
494 for(sal_Int32 nDepth = 0; nDepth<=
m_nMaxDepth ;nDepth++ )
500 if(fThisValue<fMinValue)
502 nReturnDepth = nDepth;
503 fMinValue = fThisValue;
542 if(!nIntervalCount || nIntervalCount == 1)
549 bool bRet =
nPos &&
nPos % (nIntervalCount-1) == 0;
563 for(sal_Int32 nDepth = 0; nDepth<=
m_nMaxDepth ;nDepth++ )
616 static_cast< sal_Int32
>(
double m_fOuterMajorTickBorderMin
css::uno::Reference< css::chart2::XScaling > m_xInverseScaling
ExplicitIncrementData m_rIncrement
double m_fScaledVisibleMin
static double getMinimumAtIncrement(double fMin, const ExplicitIncrementData &rIncrement)
bool isWithinOuterBorder(double fScaledValue) const
double m_fOuterMajorTickBorderMax
sal_Int32 getTickDepth() const
std::unique_ptr< double[]> m_pfCurrentValues
void getAllTicksShifted(TickInfoArraysType &rAllTickInfos) const
double * getMinorTick(sal_Int32 nTick, sal_Int32 nDepth, double fStartParentTick, double fNextParentTick) const
double m_fOuterMajorTickBorderMin_Scaled
ExplicitScaleData m_rScale
void addSubTicks(sal_Int32 nDepth, css::uno::Sequence< css::uno::Sequence< double > > &rParentTicks) const
static double getMaximumAtIncrement(double fMax, const ExplicitIncrementData &rIncrement)
double m_fScaledVisibleMax
bool isVisible(double fValue) const
EquidistantTickFactory(ExplicitScaleData aScale, ExplicitIncrementData aIncrement)
void getAllTicks(TickInfoArraysType &rAllTickInfos) const
double m_fOuterMajorTickBorderMax_Scaled
~EquidistantTickFactory()
sal_Int32 getMaxTickCount(sal_Int32 nDepth) const
double * getMajorTick(sal_Int32 nTick) const
sal_Int32 getIntervalCount(sal_Int32 nDepth)
double getTickValue(sal_Int32 nDepth, sal_Int32 nIndex) const
std::unique_ptr< sal_Int32[]> m_pnPreParentCount
virtual TickInfo * nextInfo() override
const ExplicitIncrementData & m_rIncrement
void initIter(sal_Int32 nMaxDepth)
virtual ~EquidistantTickIter() override
sal_Int32 getMaxDepth() const
EquidistantTickIter(const css::uno::Sequence< css::uno::Sequence< double > > &rTicks, const ExplicitIncrementData &rIncrement, sal_Int32 nMaxDepth)
virtual TickInfo * firstInfo() override
std::unique_ptr< sal_Int32[]> m_pnPositions
std::unique_ptr< bool[]> m_pbIntervalFinished
TickInfoArraysType * m_pInfoTicks
sal_Int32 m_nCurrentDepth
sal_Int32 getTickCount(sal_Int32 nDepth) const
sal_Int32 getStartDepth() const
std::vector< TickInfoArrayType > TickInfoArraysType
std::vector< TickInfo > TickInfoArrayType
describes how tickmarks are positioned on the scale of an axis.
std::vector< ExplicitSubIncrement > SubIncrements
<member>SubIncrements</member> describes the positioning of further sub tickmarks on the scale of an ...
double Distance
the other members are for not date-time axis
bool PostEquidistant
<member>PostEquidistant</member> rules whether the member <member>Distance</member> describes a dista...
double BaseValue
The <member>BaseValue</member> gives a starting point on the scale to which all further main tickmark...
This structure contains the explicit values for a scale like Minimum and Maximum.
css::uno::Reference< css::chart2::XScaling > Scaling