You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include "Defines.h"
|
|
|
|
|
#include "LlUtils_global.h"
|
|
|
|
|
|
|
|
|
|
/// @brief 坐标轴刻度的计算
|
|
|
|
|
class I_UTILSSHARED_EXPORT ZxScaleHelper
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
|
|
ZxScaleHelper();
|
|
|
|
|
~ZxScaleHelper();
|
|
|
|
|
|
|
|
|
|
/// @brief 求取坐标轴的刻度显示
|
|
|
|
|
/// @param fMin 左值,通常为最小值
|
|
|
|
|
/// @param fMax 右值,通常为最大值
|
|
|
|
|
/// @param bAxisX 是否X轴
|
|
|
|
|
/// @param bLinear 是否线性
|
|
|
|
|
/// @param bExpand 是否流量自动扩展一个tick
|
|
|
|
|
/// @param pVecScales结果存储位置
|
|
|
|
|
/// @note 1:通常 fMin < fMax; 对于fMin > fMax 的情况也做了相应处理(返回结果也是倒着)
|
|
|
|
|
bool calAxisScales(float& fMin, float& fMax, \
|
|
|
|
|
bool bAxisX, \
|
|
|
|
|
bool bLinear = true, \
|
|
|
|
|
bool bExpand = false, \
|
|
|
|
|
QVector<float>* pVecScales = NULL);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
|
|
// 内部接口(目前刻度计算函数,还有待较大完善空间)
|
|
|
|
|
bool checkReverse();
|
|
|
|
|
bool checkSameValue();
|
|
|
|
|
bool checkLogicalZero();
|
|
|
|
|
void adjustIncrease(float& f, float& fMin);
|
|
|
|
|
bool calScaleByLinear();
|
|
|
|
|
bool calScaleByLogical();
|
|
|
|
|
void finalAdjustP();
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
|
|
// 计算过程中涉及到的一些中间变量
|
|
|
|
|
float m_fMax;
|
|
|
|
|
float m_fMin;
|
|
|
|
|
float m_fMinRaw;
|
|
|
|
|
float m_fMaxRaw;
|
|
|
|
|
bool m_bAxisX;
|
|
|
|
|
bool m_bLinear;
|
|
|
|
|
bool m_bNeedTurn;
|
|
|
|
|
bool m_bExpand;
|
|
|
|
|
|
|
|
|
|
float m_fTickIncrease;
|
|
|
|
|
QVector<float>* m_pVecTicks;
|
|
|
|
|
};
|