|
|
|
|
#pragma once
|
|
|
|
|
#include <QPen>
|
|
|
|
|
#include <QDir>
|
|
|
|
|
#include <QColor>
|
|
|
|
|
#include <qDebug>
|
|
|
|
|
#include <QVector>
|
|
|
|
|
#include <QDomDocument>
|
|
|
|
|
#include "Defines.h"
|
|
|
|
|
#include <ZxRenderItem.h>
|
|
|
|
|
|
|
|
|
|
#include "ZxDrawHelper.h"
|
|
|
|
|
|
|
|
|
|
#include "iPlotCurveT_global.h"
|
|
|
|
|
|
|
|
|
|
class ColorNode
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
ColorNode(float fPos,QColor clrColor)
|
|
|
|
|
{
|
|
|
|
|
m_fPos = fPos;
|
|
|
|
|
m_clrColor = clrColor;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
float m_fPos;
|
|
|
|
|
QColor m_clrColor;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class ColorScheme
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
ColorScheme()
|
|
|
|
|
{
|
|
|
|
|
m_strName = "";
|
|
|
|
|
m_fValMin = 0.0f;
|
|
|
|
|
m_fValMax = 0.0f;
|
|
|
|
|
m_vecColors.clear();
|
|
|
|
|
m_vecIntervals.clear();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString m_strName;
|
|
|
|
|
float m_fValMin;
|
|
|
|
|
float m_fValMax;
|
|
|
|
|
QVector<QColor> m_vecColors;
|
|
|
|
|
QVector<float> m_vecIntervals;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class I_PLOTCURVE_T_EXPORT ZxSubColorTable : public ZxRenderItem
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
ZX_DECLARE_DYNAMIC
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
enum COLOR_TYPE
|
|
|
|
|
{
|
|
|
|
|
STEP,GRADIENT,GRAY,ST_PROJECTION
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static const float COLOR_WIDTH;
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
|
|
ZxSubColorTable();
|
|
|
|
|
ZxSubColorTable(const QString& name);
|
|
|
|
|
ZxSubColorTable(const ZxSubColorTable & _r);
|
|
|
|
|
~ZxSubColorTable();
|
|
|
|
|
|
|
|
|
|
void init();
|
|
|
|
|
void initGradient();
|
|
|
|
|
|
|
|
|
|
virtual void paintBack(QPainter* painter, const ZxPaintParam& param);
|
|
|
|
|
virtual void onSerialize(ZxSerializer* ser);
|
|
|
|
|
virtual void onDeserialize(ZxSerializer* ser);
|
|
|
|
|
virtual void fillPtyPano(IxPtyPano* sheet);
|
|
|
|
|
|
|
|
|
|
void drawColorRect(QPainter* painter,QRectF rc);
|
|
|
|
|
|
|
|
|
|
void initSystemPalette();
|
|
|
|
|
void getAllPalette(QString strPath, QVector<QString> &vecPlates);
|
|
|
|
|
QStringList splitString(QString s);
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
// 名称
|
|
|
|
|
QString getName() const;
|
|
|
|
|
void setName(const QString& sName);
|
|
|
|
|
|
|
|
|
|
// 别名
|
|
|
|
|
QString getAlias() const;
|
|
|
|
|
void setAlias(QString name);
|
|
|
|
|
|
|
|
|
|
// 颜色表的单位
|
|
|
|
|
void setUnit(const QString &strUnit);
|
|
|
|
|
QString getUnit() const;
|
|
|
|
|
|
|
|
|
|
// 数据最值
|
|
|
|
|
float getMinValue() const;
|
|
|
|
|
void setMinValue(float fMin);
|
|
|
|
|
float getMaxValue() const;
|
|
|
|
|
void setMaxValue(float fMax);
|
|
|
|
|
|
|
|
|
|
// 颜色表的类型,梯度,渐变,灰度
|
|
|
|
|
int getColorType() const;
|
|
|
|
|
void setColorType(int nType);
|
|
|
|
|
|
|
|
|
|
QString getColorTypeSTR() const;
|
|
|
|
|
void setColorTypeSTR(QString strTypeName);
|
|
|
|
|
|
|
|
|
|
// 根据值得到对应的颜色
|
|
|
|
|
bool getColorForValue(float fValue,QColor &clr);
|
|
|
|
|
bool getValueForColor(QColor clr,float &fValue);
|
|
|
|
|
|
|
|
|
|
// 根据值得到对应的颜色
|
|
|
|
|
bool getColor(float pos,QColor &clr);
|
|
|
|
|
|
|
|
|
|
void setColorGrade(int nColorGrade);
|
|
|
|
|
int getColorGrade() const ;
|
|
|
|
|
|
|
|
|
|
QVector<QRgb> getColorTable();
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
|
|
QString m_strName;
|
|
|
|
|
QString m_strAlias;
|
|
|
|
|
QString m_sUnit;
|
|
|
|
|
float m_fMin;
|
|
|
|
|
float m_fMax;
|
|
|
|
|
|
|
|
|
|
int m_nColorType;
|
|
|
|
|
QString m_strColorType;
|
|
|
|
|
int m_nColorGrade; //颜色表大小,最大到65536个(真彩)
|
|
|
|
|
|
|
|
|
|
QVector<ColorNode*> m_vecColorNodes;
|
|
|
|
|
QVector<ColorScheme *> m_vecColorSchemes;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|