去除了his解析
This commit is contained in:
		
							parent
							
								
									526cef4f95
								
							
						
					
					
						commit
						a76b353166
					
				|  | @ -101,6 +101,25 @@ jobject CplusToJava::Createjobject(JNIEnv* env, jint esize, jobjectArray array) | |||
|     return arrayList; | ||||
| } | ||||
| 
 | ||||
| jobject CplusToJava::Create2Djobject(JNIEnv *env, jint esize, jobjectArray array, jint row, jint col) | ||||
| { | ||||
|     jclass byteArrayClass = env->FindClass("[J"); | ||||
|     jobjectArray result = env->NewObjectArray(row, byteArrayClass, NULL); | ||||
|     for (int r = 0; r < row; r++) { | ||||
|         jlongArray innerArray = env->NewLongArray(col); | ||||
|         jlong longArray[col]; | ||||
|         for (int c = 0; c < col; c++) { | ||||
|             jint pos = r * col + c; | ||||
|             jobject element = env->GetObjectArrayElement(array, pos); | ||||
|             jlong v = env->CallLongMethod(element, env->GetMethodID(env->FindClass("java/lang/Long"), "longValue", "()J")); | ||||
|             longArray[c] = v; | ||||
|         } | ||||
|         env->SetLongArrayRegion(innerArray, 0, col, longArray); | ||||
|         env->SetObjectArrayElement(result, r, innerArray); | ||||
|     } | ||||
|     return result; | ||||
| } | ||||
| 
 | ||||
| jobjectArray CplusToJava::jobject2jobjectArray(JNIEnv* env, jobject array) | ||||
| { | ||||
|     jclass listClass = env->FindClass("java/util/List"); | ||||
|  |  | |||
|  | @ -4,13 +4,14 @@ | |||
| #include <QVector> | ||||
| 
 | ||||
| //变量名与java中sig对应
 | ||||
| #define SIG_STRING    "Ljava/lang/String;" | ||||
| #define SIG_LIST      "Ljava/util/List;" | ||||
| #define SIG_DOUBLE    "D" | ||||
| #define SIG_INT       "I" | ||||
| #define SIG_LONG      "J" | ||||
| #define SIG_SHORT     "S" | ||||
| #define SIG_BOOL      "Z" | ||||
| #define SIG_STRING          "Ljava/lang/String;" | ||||
| #define SIG_LIST            "Ljava/util/List;" | ||||
| #define SIG_DOUBLE          "D" | ||||
| #define SIG_INT             "I" | ||||
| #define SIG_LONG            "J" | ||||
| #define SIG_SHORT           "S" | ||||
| #define SIG_BOOL            "Z" | ||||
| #define SIG_LONG_ARRAY      "[[J" | ||||
| 
 | ||||
| enum BindType { BIND_NONE, BIND_STRING, BIND_CHAR, BIND_DOUBLE, BIND_INT }; | ||||
| 
 | ||||
|  | @ -370,6 +371,8 @@ public: | |||
|     static jobjectArray QVectorS2jobjectArray(QVector<short> vec, JNIEnv* env); | ||||
|     //生成jobject
 | ||||
|     static jobject Createjobject(JNIEnv* env, jint esize, jobjectArray array); | ||||
|     //Éú³É2djobject
 | ||||
|     static jobject Create2Djobject(JNIEnv* env, jint esize, jobjectArray array, jint row, jint col); | ||||
|     //jobject转换为jobjectArray
 | ||||
|     static jobjectArray jobject2jobjectArray(JNIEnv* env, jobject array); | ||||
|     //将jobjectArray转换为QVector<double>
 | ||||
|  |  | |||
|  | @ -35,6 +35,8 @@ | |||
| #define ORDER_CALIBRATION   QLatin1String("#Calibration") | ||||
| #define ORDER_CERTIFICATE   QLatin1String("#Certificate") | ||||
| #define ORDER_GPS           QLatin1String("#GPS") | ||||
| #define ORDER_BSELF         QLatin1String("#b_self_Attenuation") | ||||
| #define ORDER_NB_GEFFICIENCY QLatin1String("#b_Efficiency") | ||||
| #define ORDER_STOP          QLatin1String("STOP") | ||||
| #define ORDER_BEGIN         QLatin1String("BEGIN") | ||||
| #define DATATYPE_QCPHD      QLatin1String("QCPHD") | ||||
|  | @ -506,6 +508,36 @@ namespace RadionuclideData | |||
|         double lat;                   // 纬度
 | ||||
|     } | ||||
|     GpsBlock, *PtGpsBlock; | ||||
| 
 | ||||
|     typedef struct _N_BG_Efficiency_Block_ | ||||
|     { | ||||
|         /* b-gEfficiency Block */ | ||||
|         QVector<QString> nuclide_name;              // nuclide name
 | ||||
|         QVector<double> bg_efficiency;              // β-γ coincidence efficiency (counts in ROI/β-γ pair emitted)
 | ||||
|         QVector<double> uncertainty;                // uncertainty (counts in ROI/β-γ pair emitted)
 | ||||
|         int record_count; | ||||
|     } | ||||
|     NBG_EfficiencyBlock, *PtNBG_EfficiencyBlock; | ||||
| 
 | ||||
|     typedef struct _b_self_Attenuation_block_ | ||||
|     { | ||||
|         /* b_self_Attenuation Block */ | ||||
|         QVector<QString> devNames; | ||||
|         QVector<std::array<double, 3>> xenon; | ||||
|         QVector<std::array<double, 3>> nitrogen; | ||||
|     } | ||||
|     BSelfAttenuationBlock, *PtBSelfAttenuationBlock; | ||||
|     typedef struct _n_g_Efficiency_Block_ | ||||
|     { | ||||
|         /* g_Efficiency Block */ | ||||
|         QVector<QString> dev_name; | ||||
|         QVector<double> g_energy;                   // γ -energy (keV)
 | ||||
|         QVector<double> efficiency;                 // efficiency (counts in peak/photon emitted)
 | ||||
|         QVector<double> uncertainty;                // uncertainty (counts in peak/photon emitted)
 | ||||
|         int record_count; | ||||
|     } | ||||
|     n_G_EfficiencyBlock, *Pt_n_G_EfficiencyBlock; | ||||
| 
 | ||||
| } | ||||
| Q_DECLARE_METATYPE(RadionuclideData::HeaderBlock) | ||||
| Q_DECLARE_METATYPE(RadionuclideData::AcquisitionBlock) | ||||
|  | @ -526,6 +558,9 @@ 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::NBG_EfficiencyBlock) | ||||
| Q_DECLARE_METATYPE(RadionuclideData::BSelfAttenuationBlock) | ||||
| Q_DECLARE_METATYPE(RadionuclideData::n_G_EfficiencyBlock) | ||||
| Q_DECLARE_METATYPE(RadionuclideData::GpsBlock) | ||||
| 
 | ||||
| namespace MetData | ||||
|  |  | |||
|  | @ -2,6 +2,7 @@ | |||
| #include <QFile> | ||||
| #include <QTextStream> | ||||
| #include <QDebug> | ||||
| #include <sstream> | ||||
| 
 | ||||
| #define SECOND  1 | ||||
| #define HOUR    3600 | ||||
|  | @ -116,6 +117,8 @@ void RadionuclideMessage::InitBlockFlagInfo() | |||
|     block_flag.append(QLatin1String("BEGIN"));          // [ BEGIN ]
 | ||||
|     block_flag.append(QLatin1String("#Spectrum"));      // [ 22 ]
 | ||||
|     block_flag.append(QLatin1String("#GPS"));      // [ 23 ]
 | ||||
|     block_flag.append(QLatin1String("#b_self_Attenuation"));      // [ 24 ]
 | ||||
|     block_flag.append(QLatin1String("#b_Efficiency"));      // [ 25 ]
 | ||||
| } | ||||
| 
 | ||||
| bool RadionuclideMessage::AnalyseMessgeBody(QTextStream &content) | ||||
|  | @ -225,6 +228,14 @@ bool RadionuclideMessage::AnalyseMessgeBody(QTextStream &content) | |||
|         { | ||||
|             bRet &= Analyse_Gps_Block(content, line); | ||||
|         } | ||||
|         else if ( 0==line.compare(block_flag.at(24)) && bRet) | ||||
|         { | ||||
|             bRet &= Analyse_b_self_Attenuation_Block(content, line); | ||||
|         } | ||||
|         else if ( 0==line.compare(block_flag.at(25)) && bRet) | ||||
|         { | ||||
|             bRet &= Analyse_b_Efficiency_Block(content, line); | ||||
|         } | ||||
|         else | ||||
|         {   // 数据错误,数据有效
 | ||||
|             bIsValid = false; | ||||
|  | @ -261,6 +272,7 @@ bool RadionuclideMessage::Analyse_Header_Block(QTextStream& content, QString& ne | |||
|     content >> Header.sample_ref_id; | ||||
|     content.readLine(); | ||||
| 
 | ||||
|     m_system_type = Header.system_type; | ||||
|     const MessageInfo& msg = AbstractSpectrumDataMessage::GetMessageInfo(); | ||||
|     if ( msg.verify_srid ) | ||||
|     { | ||||
|  | @ -513,6 +525,36 @@ bool RadionuclideMessage::Analyse_b_Resolution_Block(QTextStream& content, QStri | |||
| 
 | ||||
| bool RadionuclideMessage::Analyse_g_Efficiency_Block(QTextStream& content, QString& nextBlock) | ||||
| { | ||||
|     if(m_system_type == 'C') | ||||
|     { | ||||
|         n_G_EfficiencyBlock g_eff; | ||||
|         int row_count = 0; | ||||
|         nextBlock = content.readLine(); | ||||
|         QString temp_line = nextBlock.simplified(); | ||||
|         while (!block_flag.contains(temp_line) && !content.atEnd()) | ||||
|         { | ||||
|             double g_energy, efficiency, uncertainty; | ||||
|             QString name; | ||||
|             QTextStream line_content(&nextBlock); | ||||
|             line_content >> name >> g_energy >> efficiency >> uncertainty; | ||||
|             g_eff.dev_name.push_back(name); | ||||
|             g_eff.g_energy << g_energy; | ||||
|             g_eff.efficiency << efficiency; | ||||
|             g_eff.uncertainty << uncertainty; | ||||
| 
 | ||||
|             ++ row_count; | ||||
|             nextBlock = content.readLine(); | ||||
|             temp_line = nextBlock.simplified(); | ||||
|             if (line_content.status()==QTextStream::ReadCorruptData) | ||||
|             { | ||||
|                 return false; | ||||
|             } | ||||
|         } | ||||
|         g_eff.record_count = row_count; | ||||
|         radionuclide_msg_data.insert(block_flag.at(10), QVariant::fromValue(g_eff)); | ||||
| 
 | ||||
|         return (content.status()==QTextStream::Ok)?true:false; | ||||
|     } | ||||
|     G_EfficiencyBlock g_Efficiency; | ||||
|     int row_count = 0; | ||||
|     nextBlock = content.readLine(); | ||||
|  | @ -956,6 +998,74 @@ bool RadionuclideMessage::Analyse_Gps_Block(QTextStream &content, QString &nextB | |||
|     content.readLine(); | ||||
|     return (content.status()==QTextStream::Ok)?true:false; | ||||
| } | ||||
| 
 | ||||
| bool RadionuclideMessage::Analyse_b_self_Attenuation_Block(QTextStream &content, QString &nextBlock) | ||||
| { | ||||
|     BSelfAttenuationBlock bsel; | ||||
| 
 | ||||
|     QString buffer; | ||||
| 
 | ||||
|     buffer = content.readLine(); | ||||
|     while(buffer.at(0) != '#') | ||||
|     { | ||||
|         std::stringstream ss(buffer.toStdString()); | ||||
|         std::string name; | ||||
|         std::array<double, 3> data1, data2; | ||||
|         ss >> name; | ||||
|         for(int i = 0; i < 3; i++) | ||||
|         { | ||||
|             ss >> data1[i]; | ||||
|         } | ||||
| 
 | ||||
|         for(int i = 0; i < 3; i++) | ||||
|         { | ||||
|             ss >> data2[i]; | ||||
|         } | ||||
|         bsel.devNames.push_back(QString::fromStdString(name)); | ||||
|         bsel.xenon.push_back(data1); | ||||
|         bsel.nitrogen.push_back(data2); | ||||
| 
 | ||||
|         buffer = content.readLine(); | ||||
|     }; | ||||
| 
 | ||||
|     radionuclide_msg_data.insert(block_flag.at(24), QVariant::fromValue(bsel)); | ||||
| 
 | ||||
|     nextBlock = buffer; | ||||
| //    content.readLine();
 | ||||
|     return (content.status()==QTextStream::Ok)?true:false; | ||||
| } | ||||
| 
 | ||||
| bool RadionuclideMessage::Analyse_b_Efficiency_Block(QTextStream &content, QString &nextBlock) | ||||
| { | ||||
|     NBG_EfficiencyBlock bg_Efficiency; | ||||
|     int row_count = 0; | ||||
|     nextBlock = content.readLine(); | ||||
|     QString temp_line = nextBlock.simplified(); | ||||
|     while (!block_flag.contains(temp_line) && !content.atEnd()) | ||||
|     { | ||||
|         QString nuclide_name; | ||||
|         double bg_efficiency, uncertainty; | ||||
|         QTextStream line_content(&nextBlock); | ||||
|         line_content >> nuclide_name >> bg_efficiency >> uncertainty; | ||||
| 
 | ||||
|         bg_Efficiency.nuclide_name << nuclide_name; | ||||
|         bg_Efficiency.bg_efficiency << bg_efficiency; | ||||
|         bg_Efficiency.uncertainty << uncertainty; | ||||
| 
 | ||||
|         ++ row_count; | ||||
|         nextBlock = content.readLine(); | ||||
|         temp_line = nextBlock.simplified(); | ||||
| 
 | ||||
|         if (line_content.status()==QTextStream::ReadCorruptData) | ||||
|         { | ||||
|             return false; | ||||
|         } | ||||
|     } | ||||
|     bg_Efficiency.record_count = row_count; | ||||
|     radionuclide_msg_data.insert(block_flag.at(25), QVariant::fromValue(bg_Efficiency)); | ||||
|     return (content.status()==QTextStream::Ok)?true:false; | ||||
| } | ||||
| 
 | ||||
| bool RadionuclideMessage::Verity_SampleReferenceId(QString srid) | ||||
| { | ||||
|     bool bRet = true; | ||||
|  |  | |||
|  | @ -46,6 +46,8 @@ private: | |||
|     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 Analyse_b_self_Attenuation_Block(QTextStream& content, QString& nextBlock); | ||||
|     bool Analyse_b_Efficiency_Block(QTextStream& content, QString& nextBlock); | ||||
|     bool Verity_SampleReferenceId(QString srid); | ||||
| 
 | ||||
| private: | ||||
|  | @ -53,6 +55,7 @@ private: | |||
|     QStringList block_flag; | ||||
|     QVariantMap radionuclide_msg_data;  // 因解析的数据的结构不同,请其统一存储至QVariantMap容器中
 | ||||
|     RadionuclideData::AnalyseDataType analyse_data_type; | ||||
|     QString m_system_type = ""; | ||||
| }; | ||||
| 
 | ||||
| #endif // RADIONUCLIDEMESSAGE_H
 | ||||
|  |  | |||
|  | @ -1,6 +1,6 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | ||||
| <!DOCTYPE QtCreatorProject> | ||||
| <!-- Written by QtCreator 4.9.1, 2024-07-16T09:24:52. --> | ||||
| <!-- Written by QtCreator 4.9.1, 2024-09-03T09:31:22. --> | ||||
| <qtcreator> | ||||
|  <data> | ||||
|   <variable>EnvironmentId</variable> | ||||
|  |  | |||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							|  | @ -18,6 +18,14 @@ extern "C" { | |||
| 	//解析文件
 | ||||
|     JNIEXPORT jobject JNICALL Java_org_jeecg_modules_native_1jni_EnergySpectrumHandler_getSourceData | ||||
| 	(JNIEnv*, jclass, jstring); | ||||
| 
 | ||||
|     /*
 | ||||
|      * Class:     org_jeecg_modules_native_jni_EnergySpectrumHandler | ||||
|      * Method:    getSourceData_test | ||||
|      * Signature: (Ljava/lang/String;)Ljava/lang/String; | ||||
|      */ | ||||
|     JNIEXPORT jobject JNICALL Java_org_jeecg_modules_native_1jni_EnergySpectrumHandler_getSourceDataNotHis | ||||
|     (JNIEnv* env, jclass obj, jstring PHDfile); | ||||
| 	/*
 | ||||
| 	* Class:     org_jeecg_modules_native_jni_EnergySpectrumHandler | ||||
| 	* Method:    CalcBgBoundary | ||||
|  | @ -107,6 +115,8 @@ extern "C" { | |||
| 	JNIEXPORT jobject JNICALL Java_org_jeecg_modules_native_1jni_EnergySpectrumHandler_BetaGammaSpectrumAnalyzeFunc | ||||
| 	(JNIEnv*, jclass, jobject);*/ | ||||
| 
 | ||||
|     JNIEXPORT jstring JNICALL Java_org_jeecg_modules_native_1jni_EnergySpectrumHandler_selfBgAnalyse | ||||
|     (JNIEnv *, jclass, jstring, jstring); | ||||
| #ifdef __cplusplus | ||||
| } | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 wanglong
						wanglong