添加gps谱解析

This commit is contained in:
wanglong 2024-07-16 09:29:13 +08:00
parent 2434b2a176
commit 526cef4f95
7 changed files with 58 additions and 3 deletions

View File

@ -163,6 +163,9 @@ typedef struct _Read_Result_
jobjectArray t_uncertainty; // uncertainty (counts/photon emitted)
jint t_record_count;
/*gps block*/
jdouble lon;
jdouble lat;
}ReadResult;
typedef struct _Generate_Result_

View File

@ -34,6 +34,7 @@
#define ORDER_HISTOGRAM QLatin1String("#Histogram")
#define ORDER_CALIBRATION QLatin1String("#Calibration")
#define ORDER_CERTIFICATE QLatin1String("#Certificate")
#define ORDER_GPS QLatin1String("#GPS")
#define ORDER_STOP QLatin1String("STOP")
#define ORDER_BEGIN QLatin1String("BEGIN")
#define DATATYPE_QCPHD QLatin1String("QCPHD")
@ -497,6 +498,14 @@ namespace RadionuclideData
}
}
CertificateBlock, *PtCertificateBlock;
typedef struct _Gps_Block_
{
/* gps Block */
double lon; // 经度
double lat; // 纬度
}
GpsBlock, *PtGpsBlock;
}
Q_DECLARE_METATYPE(RadionuclideData::HeaderBlock)
Q_DECLARE_METATYPE(RadionuclideData::AcquisitionBlock)
@ -517,6 +526,7 @@ Q_DECLARE_METATYPE(RadionuclideData::G_SpectrumBlock)
Q_DECLARE_METATYPE(RadionuclideData::B_SpectrumBlock)
Q_DECLARE_METATYPE(RadionuclideData::HistogramBlock)
Q_DECLARE_METATYPE(RadionuclideData::CertificateBlock)
Q_DECLARE_METATYPE(RadionuclideData::GpsBlock)
namespace MetData
{

View File

@ -115,6 +115,7 @@ void RadionuclideMessage::InitBlockFlagInfo()
block_flag.append(QLatin1String("STOP")); // [ STOP ]
block_flag.append(QLatin1String("BEGIN")); // [ BEGIN ]
block_flag.append(QLatin1String("#Spectrum")); // [ 22 ]
block_flag.append(QLatin1String("#GPS")); // [ 23 ]
}
bool RadionuclideMessage::AnalyseMessgeBody(QTextStream &content)
@ -220,6 +221,10 @@ bool RadionuclideMessage::AnalyseMessgeBody(QTextStream &content)
{
bRet &= Analyse_Certificate_Block(content, line);
}
else if ( 0==line.compare(block_flag.at(23)) && bRet)
{
bRet &= Analyse_Gps_Block(content, line);
}
else
{ // 数据错误,数据有效
bIsValid = false;
@ -941,6 +946,16 @@ bool RadionuclideMessage::Analyse_Certificate_Block(QTextStream& content, QStrin
return (content.status()==QTextStream::Ok)?true:false;
}
bool RadionuclideMessage::Analyse_Gps_Block(QTextStream &content, QString &nextBlock)
{
GpsBlock gps;
content >> gps.lon >> gps.lat;
radionuclide_msg_data.insert(block_flag.at(23), QVariant::fromValue(gps));
content >> nextBlock;
content.readLine();
return (content.status()==QTextStream::Ok)?true:false;
}
bool RadionuclideMessage::Verity_SampleReferenceId(QString srid)
{
bool bRet = true;

View File

@ -45,6 +45,7 @@ private:
bool Analyse_Histogram_Block(QTextStream& content, QString& nextBlock);
bool Analyse_Calibration_Block(QTextStream& content, QString& nextBlock);
bool Analyse_Certificate_Block(QTextStream& content, QString& nextBlock);
bool Analyse_Gps_Block(QTextStream& content, QString& nextBlock);
bool Verity_SampleReferenceId(QString srid);
private:

View File

@ -69,8 +69,8 @@ HEADERS += \
#FORMS += mainwindow.ui
win32:INCLUDEPATH += "C:/java64/jdk/include"
win32:INCLUDEPATH += "C:/java64/jdk/include/win32"
win32:INCLUDEPATH += "C:/Program Files/Java/jdk1.8.0_351/include"
win32:INCLUDEPATH += "C:/Program Files/Java/jdk1.8.0_351/include/win32"
QMAKE_LFLAGS += -Wl,--kill-at

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 4.9.1, 2024-05-10T10:35:27. -->
<!-- Written by QtCreator 4.9.1, 2024-07-16T09:24:52. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>

View File

@ -59,6 +59,7 @@ JNIEXPORT jobject JNICALL Java_org_jeecg_modules_native_1jni_EnergySpectrumHandl
bool b_Spectrumflag = true;
bool Histogramflag = true;
bool totalflag = true;
bool gpsflag = true;
QString order;
QVariant variant;
@ -504,6 +505,21 @@ JNIEXPORT jobject JNICALL Java_org_jeecg_modules_native_1jni_EnergySpectrumHandl
cresult.t_record_count = totleff.record_count;
}
//GPS block内容获取
order = ORDER_GPS;
variant = message.GetBlockData(order);
if (!variant.isValid())
{
printf((order.toStdString() + " get failed\n").c_str());
gpsflag = false;
}
else
{
RadionuclideData::GpsBlock gps = variant.value<RadionuclideData::GpsBlock>();
cresult.lat = gps.lat;
cresult.lon = gps.lon;
}
if ((!headerflag) || (!commentflag) || (!sampleflag) || (!certificateflag) || (!acquisitionflag) || (!collectionflag) || (!processflag)
|| (!calibrationflag) || (!g_energyflag) || (!b_energyflag) || (!g_Resolutionflag) || (!b_Resolutionflag) || (!g_Efficiencyflag)
|| (!roi_limitsflag) || (!b_gEfficiencyflag) || (!ratiosflag) || (!g_Spectrumflag) || (!b_Spectrumflag) || (!Histogramflag)
@ -1046,6 +1062,16 @@ JNIEXPORT jobject JNICALL Java_org_jeecg_modules_native_1jni_EnergySpectrumHandl
env->SetIntField(result, fieldID, cresult.t_record_count);
}
if(gpsflag)
{
//设置成员变量经度和纬度的值
fieldID = env->GetFieldID(energySpectrumStructClass, "lon", SIG_DOUBLE);
env->SetDoubleField(result, fieldID, cresult.lon);
fieldID = env->GetFieldID(energySpectrumStructClass, "lat", SIG_DOUBLE);
env->SetDoubleField(result, fieldID, cresult.lat);
}
return result;
}