From 526cef4f95ae90139151dae93fa0052db5240f27 Mon Sep 17 00:00:00 2001 From: wanglong <1553009806@qq.com> Date: Tue, 16 Jul 2024 09:29:13 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0gps=E8=B0=B1=E8=A7=A3?= =?UTF-8?q?=E6=9E=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CplusToJava.h | 3 +++ DataManager_Define.h | 10 +++++++ RadionuclideMessage.cpp | 15 +++++++++++ RadionuclideMessage.h | 1 + ReadPHDFile.pro | 4 +-- ReadPHDFile.pro.user | 2 +- ...dules_native_jni_EnergySpectrumHandler.cpp | 26 +++++++++++++++++++ 7 files changed, 58 insertions(+), 3 deletions(-) diff --git a/CplusToJava.h b/CplusToJava.h index 9f74aef..d9c2af5 100644 --- a/CplusToJava.h +++ b/CplusToJava.h @@ -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_ diff --git a/DataManager_Define.h b/DataManager_Define.h index 191288e..19bffe3 100644 --- a/DataManager_Define.h +++ b/DataManager_Define.h @@ -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 { diff --git a/RadionuclideMessage.cpp b/RadionuclideMessage.cpp index f99e844..8575074 100644 --- a/RadionuclideMessage.cpp +++ b/RadionuclideMessage.cpp @@ -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; diff --git a/RadionuclideMessage.h b/RadionuclideMessage.h index ea9aeac..f189202 100644 --- a/RadionuclideMessage.h +++ b/RadionuclideMessage.h @@ -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: diff --git a/ReadPHDFile.pro b/ReadPHDFile.pro index e8a67d6..3024930 100644 --- a/ReadPHDFile.pro +++ b/ReadPHDFile.pro @@ -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 diff --git a/ReadPHDFile.pro.user b/ReadPHDFile.pro.user index f1eb590..8eabdd3 100644 --- a/ReadPHDFile.pro.user +++ b/ReadPHDFile.pro.user @@ -1,6 +1,6 @@ - + EnvironmentId diff --git a/org_jeecg_modules_native_jni_EnergySpectrumHandler.cpp b/org_jeecg_modules_native_jni_EnergySpectrumHandler.cpp index 264a3b3..23207e9 100644 --- a/org_jeecg_modules_native_jni_EnergySpectrumHandler.cpp +++ b/org_jeecg_modules_native_jni_EnergySpectrumHandler.cpp @@ -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(); + 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; }