#ifndef DP_GLOBALS_H
#define DP_GLOBALS_H

enum DataPanelType
{
    lineChart = 0, //曲线图
    //curveChart, //曲线图
    barChart, //柱状图
    dotChart, //点图
    pieChart, //饼图
    heatMap, //热力图
    dial, //仪表图
    table, //数据表
    map //地图
};

enum RealTimeDataType
{
    power = 0, //功率
    voltage, //电压
    current, //电流
    temperature //温度
};

enum AxisArrangementMode //坐标轴排列方式
{
    AlternateSides = 0, //左右交替排列
    AllRight //右侧排列
};

enum BarOrientation //直方图方向
{
    Vertical = 0,
    Horizontal
};

#include <QStandardItemModel>
struct AxisCfgInfo
{
    QString name;
    QString unit;
};
struct configurationResults
{
    QStandardItemModel* m_pModel_dataType;
    QStandardItemModel* m_pModel_dataSource;
    QString dataServiceIP;
    int dataServicePort;
    bool showLegend;
    bool groupByType;
    AxisArrangementMode axisArrangement;
    BarOrientation barOrientataion;
    QHash<RealTimeDataType, AxisCfgInfo> axisCfgMap; //可能有多个轴（数据类别）

    configurationResults()
    {
        m_pModel_dataType = nullptr;
        m_pModel_dataSource = nullptr;

        dataServiceIP = "127.0.0.1";
        dataServicePort = 1987;

        showLegend = false;
        groupByType = false;
        axisArrangement = AlternateSides;
        barOrientataion = Vertical;
    }

    void setModelParent(QObject* parent) //为QStandardItemModel对象构造对象树，从而利用QT的资源自动管理
    {
        m_pModel_dataType = new QStandardItemModel(parent);
        m_pModel_dataSource = new QStandardItemModel(parent);
    }
};

#define itemRole_tag 1
#define itemRole_stationID 2
#define itemRole_componentID 3
#define itemRole_pointID 4
#define itemRole_dataType 5

#endif
