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.

226 lines
9.0 KiB

#ifndef DBMPROBEPROPERTIES_H
#define DBMPROBEPROPERTIES_H
#include <QMetaType>
#include <QString>
#include <QObject>
#include <QtSql>
#include <QDebug>
#include "model/databaseManager/utils/initializationUtils.h"
/*************************************************************************************************/
/**
* @brief Database dto dtructure for Probe properties
* @author Mohammad Mohsen Talaie
* @details
* @date 20 sep 2020
*/
/*************************************************************************************************/
typedef struct DbmDtoProbeProperties
{
public:
int ID;
QString globalId;
QString name;
QString image;
bool scan;
int type;
bool geometry;
QList<int> supportedModes;
double pitch;
double radius;
int subAzimuthNo;
int subElevationNo;
int elementNo;
double elementWidth;
double elementHeight;
double fov;
QList<double> impulseResponse;
QList<int> angleValues;
QList<double> focusValues;
QList<double> hiFocusValues;
int multiFocusStep;
QList<int> otiC0Values;
QList<QList<double> > ffcValues;
QList<double> depthValues;
QList<int> frequencyValues;
QList<int> hiFrequencyValues;
QList<int> dFrequencyValues;
QList<int> pwFrequencyValues;
QList<QList<double> > criSteeringAngles;
double rxGain;
double txGain;
QList<double> lineDensityValues;
QList<double> dLineDensityValues;
int halfCycleNoValues;
int ffcHalfCycleNoValues;
QList<int> hiHalfCycleNoValues;
QList<int> dopplerHalfCycleNoValues;
QList<double> priExtensionValue;
double dPriExtensionValue;
double txResolution;
double rxResolution;
double mLinesPri;
int simultPwFrameRate;
QList<double> virtualConvexLineDensityValues;
double vcMaxTheta;
QList<int> piValues;
QList<QString> hiNames;
QList<double> AtgcB;
QList<double> AtgcD;
QList<double> AtgcPW;
QList<double> AtgcReserve;
}DbmDtoProbeProperties;
Q_DECLARE_METATYPE(DbmDtoProbeProperties)
/*************************************************************************************************/
/**
* @brief Database class for Probe properties
* @author Mohammad Mohsen Talaie
* @details
* @date 20 sep 2020
*/
/*************************************************************************************************/
class DbmProbeProperties
{
public:
static bool getProbeParameters(QSqlTableModel* tableModel, QList<DbmDtoProbeProperties>& probes)
{
tableModel->setTable("Probe");
bool ret = tableModel->select();
DbmDtoProbeProperties probeIns;
for(int i = 0; i < tableModel->rowCount(); ++i)
{
INIT_SINGLE(probeIns, tableModel, ID, Int, i);
INIT_SINGLE(probeIns, tableModel, globalId, String, i);
INIT_SINGLE(probeIns, tableModel, image, String, i);
INIT_SINGLE(probeIns, tableModel, name, String, i);
INIT_SINGLE(probeIns, tableModel, scan, Bool, i);
INIT_SINGLE(probeIns, tableModel, type, Int, i);
INIT_SINGLE(probeIns, tableModel, geometry, Bool, i);
INIT_SINGLE(probeIns, tableModel, pitch, Double, i);
INIT_SINGLE(probeIns, tableModel, radius, Double, i);
INIT_SINGLE(probeIns, tableModel, subAzimuthNo, Int, i);
INIT_SINGLE(probeIns, tableModel, subElevationNo, Int, i);
INIT_SINGLE(probeIns, tableModel, elementNo, Int, i);
INIT_SINGLE(probeIns, tableModel, elementHeight, Double, i);
INIT_SINGLE(probeIns, tableModel, elementWidth, Double, i);
INIT_SINGLE(probeIns, tableModel, fov, Double, i);
INIT_SINGLE(probeIns, tableModel, multiFocusStep, Int, i);
INIT_SINGLE(probeIns, tableModel, rxGain, Double, i);
INIT_SINGLE(probeIns, tableModel, txGain, Double, i);
INIT_SINGLE(probeIns, tableModel, halfCycleNoValues, Int, i);
INIT_SINGLE(probeIns, tableModel, ffcHalfCycleNoValues, Int, i);
INIT_SINGLE(probeIns, tableModel, dPriExtensionValue, Int, i);
INIT_SINGLE(probeIns, tableModel, txResolution, Double, i);
INIT_SINGLE(probeIns, tableModel, rxResolution, Double, i);
INIT_SINGLE(probeIns, tableModel, mLinesPri, Double, i);
INIT_SINGLE(probeIns, tableModel, simultPwFrameRate, Int, i);
INIT_SINGLE(probeIns, tableModel, vcMaxTheta, Double, i);
INIT_LIST(probeIns, tableModel, virtualConvexLineDensityValues, Double, i);
INIT_LIST(probeIns, tableModel, impulseResponse, Double, i);
INIT_LIST(probeIns, tableModel, hiFocusValues, Double, i);
INIT_LIST(probeIns, tableModel, supportedModes, Int, i);
INIT_LIST(probeIns, tableModel, angleValues, Int, i);
INIT_LIST(probeIns, tableModel, focusValues, Double, i);
INIT_LIST(probeIns, tableModel, depthValues, Double, i);
INIT_LIST(probeIns, tableModel, frequencyValues, Int, i);
INIT_LIST(probeIns, tableModel, otiC0Values, Int, i);
INIT_LIST(probeIns, tableModel, hiFrequencyValues, Int, i);
INIT_LIST(probeIns, tableModel, dFrequencyValues, Int, i);
INIT_LIST(probeIns, tableModel, lineDensityValues, Double, i);
INIT_LIST(probeIns, tableModel, dLineDensityValues, Double, i);
INIT_LIST(probeIns, tableModel, hiHalfCycleNoValues, Int, i);
INIT_LIST(probeIns, tableModel, dopplerHalfCycleNoValues, Int, i);
INIT_LIST(probeIns, tableModel, priExtensionValue, Double, i);
INIT_LIST(probeIns, tableModel, piValues, Int, i);
INIT_LIST(probeIns, tableModel, pwFrequencyValues, Int, i);
INIT_LIST(probeIns, tableModel, AtgcB, Double, i);
INIT_LIST(probeIns, tableModel, AtgcD, Double, i);
INIT_LIST(probeIns, tableModel, AtgcPW, Double, i);
INIT_LIST(probeIns, tableModel, AtgcReserve, Double, i);
INIT_LIST_STR(probeIns, tableModel, hiNames, i);
INTI_LIST_LIST(probeIns, tableModel, ffcValues, double, Double, i);
INTI_LIST_LIST(probeIns, tableModel, criSteeringAngles, double, Double, i);
probes.append(probeIns);
}
return ret;
}
/*************************************************************************************************/
/**
* @brief Get a Prob properties by Global Id.
* @details
* @return bool
*/
/*************************************************************************************************/
static bool getProbeParametersByGlobalId(QString name,
QSqlTableModel* tableModel,
DbmDtoProbeProperties& probe)
{
tableModel->setTable("Probe");
tableModel->setFilter(QString("globalId is '%1'").arg(name));
bool ret = tableModel->select();
qDebug() << tableModel->rowCount();
INIT_SINGLE(probe, tableModel, ID, Int, 0);
INIT_SINGLE(probe, tableModel, globalId, String, 0);
INIT_SINGLE(probe, tableModel, image, String, 0);
INIT_SINGLE(probe, tableModel, name, String, 0);
INIT_SINGLE(probe, tableModel, scan, Bool, 0);
INIT_SINGLE(probe, tableModel, type, Int, 0);
INIT_SINGLE(probe, tableModel, geometry, Bool, 0);
INIT_SINGLE(probe, tableModel, pitch, Double, 0);
INIT_SINGLE(probe, tableModel, radius, Double, 0);
INIT_SINGLE(probe, tableModel, subAzimuthNo, Int, 0);
INIT_SINGLE(probe, tableModel, subElevationNo, Int, 0);
INIT_SINGLE(probe, tableModel, elementNo, Int, 0);
INIT_SINGLE(probe, tableModel, elementHeight, Double, 0);
INIT_SINGLE(probe, tableModel, elementWidth, Double, 0);
INIT_SINGLE(probe, tableModel, fov, Double, 0);
INIT_SINGLE(probe, tableModel, multiFocusStep, Int, 0);
INIT_SINGLE(probe, tableModel, rxGain, Double, 0);
INIT_SINGLE(probe, tableModel, txGain, Double, 0);
INIT_SINGLE(probe, tableModel, halfCycleNoValues, Int, 0);
INIT_SINGLE(probe, tableModel, ffcHalfCycleNoValues, Int, 0);
INIT_SINGLE(probe, tableModel, dPriExtensionValue, Int, 0);
INIT_SINGLE(probe, tableModel, txResolution, Double, 0);
INIT_SINGLE(probe, tableModel, rxResolution, Double, 0);
INIT_SINGLE(probe, tableModel, mLinesPri, Double, 0);
INIT_SINGLE(probe, tableModel, simultPwFrameRate, Int, 0);
INIT_SINGLE(probe, tableModel, vcMaxTheta, Double, 0);
INIT_LIST(probe, tableModel, virtualConvexLineDensityValues, Double, 0);
INIT_LIST(probe, tableModel, impulseResponse, Double, 0);
INIT_LIST(probe, tableModel, hiFocusValues, Double, 0);
INIT_LIST(probe, tableModel, supportedModes, Int, 0);
INIT_LIST(probe, tableModel, angleValues, Int, 0);
INIT_LIST(probe, tableModel, focusValues, Double, 0);
INIT_LIST(probe, tableModel, depthValues, Double, 0);
INIT_LIST(probe, tableModel, frequencyValues, Int, 0);
INIT_LIST(probe, tableModel, otiC0Values, Int, 0);
INIT_LIST(probe, tableModel, hiFrequencyValues, Int, 0);
INIT_LIST(probe, tableModel, dFrequencyValues, Int, 0);
INIT_LIST(probe, tableModel, lineDensityValues, Double, 0);
INIT_LIST(probe, tableModel, dLineDensityValues, Double, 0);
INIT_LIST(probe, tableModel, hiHalfCycleNoValues, Int, 0);
INIT_LIST(probe, tableModel, dopplerHalfCycleNoValues, Int, 0);
INIT_LIST(probe, tableModel, priExtensionValue, Double, 0);
INIT_LIST(probe, tableModel, piValues, Int, 0);
INIT_LIST(probe, tableModel, pwFrequencyValues, Int, 0);
INIT_LIST(probe, tableModel, AtgcB, Double, 0);
INIT_LIST(probe, tableModel, AtgcD, Double, 0);
INIT_LIST(probe, tableModel, AtgcPW, Double, 0);
INIT_LIST(probe, tableModel, AtgcReserve, Double, 0);
INIT_LIST_STR(probe, tableModel, hiNames, 0);
INTI_LIST_LIST(probe, tableModel, ffcValues, double, Double, 0);
INTI_LIST_LIST(probe, tableModel, criSteeringAngles, double, Double, 0);
return ret;
}
};
#endif //DBMPROBEPROPERTIES_H