You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
64 lines
1.6 KiB
64 lines
1.6 KiB
4 years ago
|
#ifndef DBMGRAYMAP_H
|
||
|
#define DBMGRAYMAP_H
|
||
|
|
||
|
#include <QMetaType>
|
||
|
#include <QString>
|
||
|
#include <QObject>
|
||
|
#include <QtSql>
|
||
|
#include <QDebug>
|
||
|
|
||
|
#include "model/databaseManager/utils/initializationUtils.h"
|
||
|
|
||
|
#define GRAYMAP_COUNT 18
|
||
|
/*************************************************************************************************/
|
||
|
/**
|
||
|
* @brief Database dto structu for Graymap
|
||
|
* @author MMT
|
||
|
* @details
|
||
|
* @date 20 sep 2020
|
||
|
*/
|
||
|
/*************************************************************************************************/
|
||
|
typedef struct DbmDtoGrayMap
|
||
|
{
|
||
|
QList<QList<int> > grayMapData;
|
||
|
bool isActive;
|
||
|
}DbmDtoGrayMap;
|
||
|
|
||
|
Q_DECLARE_METATYPE(DbmDtoGrayMap)
|
||
|
|
||
|
/*************************************************************************************************/
|
||
|
/**
|
||
|
* @brief Database class for Graymap
|
||
|
* @author MMT
|
||
|
* @details
|
||
|
* @date 20 sep 2020
|
||
|
*/
|
||
|
/*************************************************************************************************/
|
||
|
class DbmGrayMap
|
||
|
{
|
||
|
public:
|
||
|
static bool getGrayMap(QSqlTableModel* tableModel, DbmDtoGrayMap& grayMap)
|
||
|
{
|
||
|
tableModel->setTable("GrayMap");
|
||
|
tableModel->setFilter(QString("isActive = 1"));
|
||
|
bool ret = tableModel->select();
|
||
|
for(int i = 0; i < GRAYMAP_COUNT; ++i)
|
||
|
{
|
||
|
auto __grayMapData =
|
||
|
tableModel->record(0).value("DATA" + QString::number(i + 1)).toString().split(',',
|
||
|
QString::SkipEmptyParts);
|
||
|
QList<int> temp;
|
||
|
for(int j = 0; j < __grayMapData.length(); ++j)
|
||
|
{
|
||
|
temp.append(__grayMapData[j].toInt());
|
||
|
}
|
||
|
grayMap.grayMapData.append(temp);
|
||
|
temp.clear();
|
||
|
}
|
||
|
|
||
|
return ret;
|
||
|
}
|
||
|
};
|
||
|
|
||
|
#endif //DBMGRAYMAP_H
|