修改nothis错误

This commit is contained in:
wanglong 2024-09-29 15:12:03 +08:00
parent b053e070fe
commit 263ad7c526
3 changed files with 116 additions and 98 deletions

View File

@ -94,7 +94,7 @@ typedef struct _Read_Result_
jint b_r_record_count; jint b_r_record_count;
/* g_Efficiency Block */ /* g_Efficiency Block */
jobjectArray g_e_dev_name; // device name jobjectArray g_e_nuclide; // device name
jobjectArray g_e_energy; // ¦Ã -energy (keV) jobjectArray g_e_energy; // ¦Ã -energy (keV)
jobjectArray g_e_efficiency; // efficiency (counts in peak/photon emitted) jobjectArray g_e_efficiency; // efficiency (counts in peak/photon emitted)
jobjectArray g_e_uncertainty; // uncertainty (counts in peak/photon emitted) jobjectArray g_e_uncertainty; // uncertainty (counts in peak/photon emitted)

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject> <!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 4.9.1, 2024-09-29T11:24:08. --> <!-- Written by QtCreator 4.9.1, 2024-09-29T15:10:42. -->
<qtcreator> <qtcreator>
<data> <data>
<variable>EnvironmentId</variable> <variable>EnvironmentId</variable>

View File

@ -308,8 +308,8 @@ JNIEXPORT jobject JNICALL Java_org_jeecg_modules_native_1jni_EnergySpectrumHandl
cresult.g_e_efficiency = CplusToJava::QVectorD2jobjectArray(ngeff.efficiency, env); cresult.g_e_efficiency = CplusToJava::QVectorD2jobjectArray(ngeff.efficiency, env);
allSize["g_e_uncertainty"] = ngeff.uncertainty.size(); allSize["g_e_uncertainty"] = ngeff.uncertainty.size();
cresult.g_e_uncertainty = CplusToJava::QVectorD2jobjectArray(ngeff.uncertainty, env); cresult.g_e_uncertainty = CplusToJava::QVectorD2jobjectArray(ngeff.uncertainty, env);
allSize["g_e_dev_name"] = ngeff.dev_name.size(); allSize["g_e_nuclide"] = ngeff.dev_name.size();
cresult.g_e_dev_name = CplusToJava::QVectorQS2jobjectArray(ngeff.dev_name, env); cresult.g_e_nuclide = CplusToJava::QVectorQS2jobjectArray(ngeff.dev_name, env);
cresult.g_e_record_count = ngeff.record_count; cresult.g_e_record_count = ngeff.record_count;
} }
else { else {
@ -438,24 +438,24 @@ JNIEXPORT jobject JNICALL Java_org_jeecg_modules_native_1jni_EnergySpectrumHandl
cresult.b_counts = CplusToJava::QVectorLL2jobjectArray(b_spectrum.counts, env); cresult.b_counts = CplusToJava::QVectorLL2jobjectArray(b_spectrum.counts, env);
} }
// //Histogram内容获取 //Histogram内容获取
// order = ORDER_HISTOGRAM; order = ORDER_HISTOGRAM;
// variant = message.GetBlockData(order); variant = message.GetBlockData(order);
// if (!variant.isValid()) if (!variant.isValid())
// { {
//// printf((order.toStdString() + " get failed\n").c_str()); // printf((order.toStdString() + " get failed\n").c_str());
// Histogramflag = true; Histogramflag = true;
// } }
// else else
// { {
// RadionuclideData::HistogramBlock historgram = variant.value<RadionuclideData::HistogramBlock>(); RadionuclideData::HistogramBlock historgram = variant.value<RadionuclideData::HistogramBlock>();
// cresult.b_channels = historgram.b_channels; cresult.b_channels = historgram.b_channels;
// cresult.g_channels = historgram.g_channels; cresult.g_channels = historgram.g_channels;
// cresult.b_h_energy_span = historgram.b_energy_span; cresult.b_h_energy_span = historgram.b_energy_span;
// cresult.g_h_energy_span = historgram.g_energy_span; cresult.g_h_energy_span = historgram.g_energy_span;
// allSize["h_counts"] = historgram.counts.size(); allSize["h_counts"] = historgram.counts.size();
// cresult.h_counts = CplusToJava::QVectorLL2jobjectArray(historgram.counts, env); cresult.h_counts = CplusToJava::QVectorLL2jobjectArray(historgram.counts, env);
// } }
//Certificate内容获取 //Certificate内容获取
RadionuclideData::CertificateBlock certificateBlock; RadionuclideData::CertificateBlock certificateBlock;
@ -811,8 +811,8 @@ JNIEXPORT jobject JNICALL Java_org_jeecg_modules_native_1jni_EnergySpectrumHandl
if (g_Efficiencyflag) if (g_Efficiencyflag)
{ {
//设置成员变量g_e_name的值 //设置成员变量g_e_name的值
fieldID = env->GetFieldID(energySpectrumStructClass, "g_e_dev_name", SIG_LIST); fieldID = env->GetFieldID(energySpectrumStructClass, "g_e_nuclide", SIG_LIST);
fieldJobject = CplusToJava::Createjobject(env, allSize["g_e_dev_name"], cresult.g_e_dev_name); fieldJobject = CplusToJava::Createjobject(env, allSize["g_e_nuclide"], cresult.g_e_nuclide);
env->SetObjectField(result, fieldID, fieldJobject); env->SetObjectField(result, fieldID, fieldJobject);
//设置成员变量g_e_energy的值 //设置成员变量g_e_energy的值
@ -966,35 +966,35 @@ JNIEXPORT jobject JNICALL Java_org_jeecg_modules_native_1jni_EnergySpectrumHandl
env->SetObjectField(result, fieldID, fieldJobject); env->SetObjectField(result, fieldID, fieldJobject);
} }
// if (Histogramflag) if (Histogramflag)
// { {
// //设置成员变量b_channels的值 //设置成员变量b_channels的值
// fieldID = env->GetFieldID(energySpectrumStructClass, "b_channels", SIG_LONG); fieldID = env->GetFieldID(energySpectrumStructClass, "b_channels", SIG_LONG);
// env->SetLongField(result, fieldID, cresult.b_channels); env->SetLongField(result, fieldID, cresult.b_channels);
// //设置成员变量g_channels的值 //设置成员变量g_channels的值
// fieldID = env->GetFieldID(energySpectrumStructClass, "g_channels", SIG_LONG); fieldID = env->GetFieldID(energySpectrumStructClass, "g_channels", SIG_LONG);
// env->SetLongField(result, fieldID, cresult.g_channels); env->SetLongField(result, fieldID, cresult.g_channels);
// //设置成员变量b_h_energy_span的值 //设置成员变量b_h_energy_span的值
// fieldID = env->GetFieldID(energySpectrumStructClass, "b_h_energy_span", SIG_LONG); fieldID = env->GetFieldID(energySpectrumStructClass, "b_h_energy_span", SIG_LONG);
// env->SetLongField(result, fieldID, cresult.b_h_energy_span); env->SetLongField(result, fieldID, cresult.b_h_energy_span);
// //设置成员变量g_h_energy_span的值 //设置成员变量g_h_energy_span的值
// fieldID = env->GetFieldID(energySpectrumStructClass, "g_h_energy_span", SIG_LONG); fieldID = env->GetFieldID(energySpectrumStructClass, "g_h_energy_span", SIG_LONG);
// env->SetLongField(result, fieldID, cresult.g_h_energy_span); env->SetLongField(result, fieldID, cresult.g_h_energy_span);
// //设置成员变量h_counts的值 //设置成员变量h_counts的值
//// fieldID = env->GetFieldID(energySpectrumStructClass, "h_counts", SIG_LIST); // fieldID = env->GetFieldID(energySpectrumStructClass, "h_counts", SIG_LIST);
//// fieldJobject = CplusToJava::Createjobject(env, allSize["h_counts"], cresult.h_counts); // fieldJobject = CplusToJava::Createjobject(env, allSize["h_counts"], cresult.h_counts);
//// env->SetObjectField(result, fieldID, fieldJobject);
// //设置成员变量h_counts_arr的值
// fieldID = env->GetFieldID(energySpectrumStructClass, "h_count_arr", SIG_LONG_ARRAY);
// fieldJobject = CplusToJava::Create2Djobject(env, allSize["g_counts"], cresult.h_counts,cresult.g_channels, cresult.b_channels);
// env->SetObjectField(result, fieldID, fieldJobject); // env->SetObjectField(result, fieldID, fieldJobject);
// }
// //设置成员变量h_counts_arr的值
fieldID = env->GetFieldID(energySpectrumStructClass, "h_count_arr", SIG_LONG_ARRAY);
fieldJobject = CplusToJava::Create2Djobject(env, allSize["g_counts"], cresult.h_counts,cresult.g_channels, cresult.b_channels);
env->SetObjectField(result, fieldID, fieldJobject);
}
if (certificateflag) if (certificateflag)
{ {
//设置成员变量total_source_activity的值 //设置成员变量total_source_activity的值
@ -1099,7 +1099,7 @@ JNIEXPORT jobject JNICALL Java_org_jeecg_modules_native_1jni_EnergySpectrumHandl
fieldID = env->GetFieldID(energySpectrumStructClass, "lat", SIG_DOUBLE); fieldID = env->GetFieldID(energySpectrumStructClass, "lat", SIG_DOUBLE);
env->SetDoubleField(result, fieldID, cresult.lat); env->SetDoubleField(result, fieldID, cresult.lat);
} }
printf("func end\n");
return result; return result;
} }
@ -1115,11 +1115,10 @@ JNIEXPORT jobject JNICALL Java_org_jeecg_modules_native_1jni_EnergySpectrumHandl
//文件名转换 //文件名转换
QString qfilename = CplusToJava::jstring2QString(env, PHDfile); QString qfilename = CplusToJava::jstring2QString(env, PHDfile);
//文件解析 //文件解析
RadionuclideMessage message; RadionuclideMessage message;
printf("anals Start\n");
bool readflag = message.AnalysePHD_File(qfilename); bool readflag = message.AnalysePHD_File(qfilename);
printf("anals end\n");
if (!readflag) if (!readflag)
{ {
// **************** printf("THE PHDfile get failed:"); // **************** printf("THE PHDfile get failed:");
@ -1159,7 +1158,6 @@ JNIEXPORT jobject JNICALL Java_org_jeecg_modules_native_1jni_EnergySpectrumHandl
QString order; QString order;
QVariant variant; QVariant variant;
//header内容获取 //header内容获取
RadionuclideData::HeaderBlock headerBlock; RadionuclideData::HeaderBlock headerBlock;
order = ORDER_HEADER; order = ORDER_HEADER;
@ -1390,14 +1388,30 @@ JNIEXPORT jobject JNICALL Java_org_jeecg_modules_native_1jni_EnergySpectrumHandl
} }
else else
{ {
RadionuclideData::_g_Efficiency_Block_ g_efficiency = variant.value<RadionuclideData::_g_Efficiency_Block_>(); QString type = CplusToJava::jstring2QString(env, cresult.system_type);
allSize["g_e_energy"] = g_efficiency.g_energy.size(); if(type == 'C')
cresult.g_e_energy = CplusToJava::QVectorD2jobjectArray(g_efficiency.g_energy, env); {
allSize["g_e_efficiency"] = g_efficiency.efficiency.size(); RadionuclideData::n_G_EfficiencyBlock ngeff = variant.value<RadionuclideData::n_G_EfficiencyBlock>();
cresult.g_e_efficiency = CplusToJava::QVectorD2jobjectArray(g_efficiency.efficiency, env); allSize["g_e_energy"] = ngeff.g_energy.size();
allSize["g_e_uncertainty"] = g_efficiency.uncertainty.size(); cresult.g_e_energy = CplusToJava::QVectorD2jobjectArray(ngeff.g_energy, env);
cresult.g_e_uncertainty = CplusToJava::QVectorD2jobjectArray(g_efficiency.uncertainty, env); allSize["g_e_efficiency"] = ngeff.efficiency.size();
cresult.g_e_record_count = g_efficiency.record_count; cresult.g_e_efficiency = CplusToJava::QVectorD2jobjectArray(ngeff.efficiency, env);
allSize["g_e_uncertainty"] = ngeff.uncertainty.size();
cresult.g_e_uncertainty = CplusToJava::QVectorD2jobjectArray(ngeff.uncertainty, env);
allSize["g_e_nuclide"] = ngeff.dev_name.size();
cresult.g_e_nuclide = CplusToJava::QVectorQS2jobjectArray(ngeff.dev_name, env);
cresult.g_e_record_count = ngeff.record_count;
}
else {
RadionuclideData::_g_Efficiency_Block_ g_efficiency = variant.value<RadionuclideData::_g_Efficiency_Block_>();
allSize["g_e_energy"] = g_efficiency.g_energy.size();
cresult.g_e_energy = CplusToJava::QVectorD2jobjectArray(g_efficiency.g_energy, env);
allSize["g_e_efficiency"] = g_efficiency.efficiency.size();
cresult.g_e_efficiency = CplusToJava::QVectorD2jobjectArray(g_efficiency.efficiency, env);
allSize["g_e_uncertainty"] = g_efficiency.uncertainty.size();
cresult.g_e_uncertainty = CplusToJava::QVectorD2jobjectArray(g_efficiency.uncertainty, env);
cresult.g_e_record_count = g_efficiency.record_count;
}
} }
//roi_limits内容获取 //roi_limits内容获取
@ -1514,24 +1528,24 @@ JNIEXPORT jobject JNICALL Java_org_jeecg_modules_native_1jni_EnergySpectrumHandl
cresult.b_counts = CplusToJava::QVectorLL2jobjectArray(b_spectrum.counts, env); cresult.b_counts = CplusToJava::QVectorLL2jobjectArray(b_spectrum.counts, env);
} }
//Histogram内容获取 // //Histogram内容获取
order = ORDER_HISTOGRAM; // order = ORDER_HISTOGRAM;
variant = message.GetBlockData(order); // variant = message.GetBlockData(order);
if (!variant.isValid()) // if (!variant.isValid())
{ // {
// printf((order.toStdString() + " get failed\n").c_str()); //// printf((order.toStdString() + " get failed\n").c_str());
Histogramflag = true; // Histogramflag = true;
} // }
else // else
{ // {
RadionuclideData::HistogramBlock historgram = variant.value<RadionuclideData::HistogramBlock>(); // RadionuclideData::HistogramBlock historgram = variant.value<RadionuclideData::HistogramBlock>();
cresult.b_channels = historgram.b_channels; // cresult.b_channels = historgram.b_channels;
cresult.g_channels = historgram.g_channels; // cresult.g_channels = historgram.g_channels;
cresult.b_h_energy_span = historgram.b_energy_span; // cresult.b_h_energy_span = historgram.b_energy_span;
cresult.g_h_energy_span = historgram.g_energy_span; // cresult.g_h_energy_span = historgram.g_energy_span;
allSize["h_counts"] = historgram.counts.size(); // allSize["h_counts"] = historgram.counts.size();
cresult.h_counts = CplusToJava::QVectorLL2jobjectArray(historgram.counts, env); // cresult.h_counts = CplusToJava::QVectorLL2jobjectArray(historgram.counts, env);
} // }
//Certificate内容获取 //Certificate内容获取
RadionuclideData::CertificateBlock certificateBlock; RadionuclideData::CertificateBlock certificateBlock;
@ -1888,6 +1902,11 @@ JNIEXPORT jobject JNICALL Java_org_jeecg_modules_native_1jni_EnergySpectrumHandl
if (g_Efficiencyflag) if (g_Efficiencyflag)
{ {
//设置成员变量g_e_name的值
fieldID = env->GetFieldID(energySpectrumStructClass, "g_e_nuclide", SIG_LIST);
fieldJobject = CplusToJava::Createjobject(env, allSize["g_e_nuclide"], cresult.g_e_nuclide);
env->SetObjectField(result, fieldID, fieldJobject);
//设置成员变量g_e_energy的值 //设置成员变量g_e_energy的值
fieldID = env->GetFieldID(energySpectrumStructClass, "g_e_energy", SIG_LIST); fieldID = env->GetFieldID(energySpectrumStructClass, "g_e_energy", SIG_LIST);
fieldJobject = CplusToJava::Createjobject(env, allSize["g_e_energy"], cresult.g_e_energy); fieldJobject = CplusToJava::Createjobject(env, allSize["g_e_energy"], cresult.g_e_energy);
@ -2038,33 +2057,33 @@ JNIEXPORT jobject JNICALL Java_org_jeecg_modules_native_1jni_EnergySpectrumHandl
fieldJobject = CplusToJava::Createjobject(env, allSize["b_counts"], cresult.b_counts); fieldJobject = CplusToJava::Createjobject(env, allSize["b_counts"], cresult.b_counts);
env->SetObjectField(result, fieldID, fieldJobject); env->SetObjectField(result, fieldID, fieldJobject);
} }
printf("aaaaaaaaaaaa %d\n", Histogramflag ? 1 : 2);
if (Histogramflag)
{
//设置成员变量b_channels的值
fieldID = env->GetFieldID(energySpectrumStructClass, "b_channels", SIG_LONG);
env->SetLongField(result, fieldID, cresult.b_channels);
//设置成员变量g_channels的值 // if (Histogramflag)
fieldID = env->GetFieldID(energySpectrumStructClass, "g_channels", SIG_LONG); // {
env->SetLongField(result, fieldID, cresult.g_channels); // //设置成员变量b_channels的值
// fieldID = env->GetFieldID(energySpectrumStructClass, "b_channels", SIG_LONG);
// env->SetLongField(result, fieldID, cresult.b_channels);
//设置成员变量b_h_energy_span的值 // //设置成员变量g_channels的值
fieldID = env->GetFieldID(energySpectrumStructClass, "b_h_energy_span", SIG_LONG); // fieldID = env->GetFieldID(energySpectrumStructClass, "g_channels", SIG_LONG);
env->SetLongField(result, fieldID, cresult.b_h_energy_span); // env->SetLongField(result, fieldID, cresult.g_channels);
//设置成员变量g_h_energy_span的值 // //设置成员变量b_h_energy_span的值
fieldID = env->GetFieldID(energySpectrumStructClass, "g_h_energy_span", SIG_LONG); // fieldID = env->GetFieldID(energySpectrumStructClass, "b_h_energy_span", SIG_LONG);
env->SetLongField(result, fieldID, cresult.g_h_energy_span); // env->SetLongField(result, fieldID, cresult.b_h_energy_span);
// //设置成员变量g_h_energy_span的值
// fieldID = env->GetFieldID(energySpectrumStructClass, "g_h_energy_span", SIG_LONG);
// env->SetLongField(result, fieldID, cresult.g_h_energy_span);
//设置成员变量h_counts的值 //设置成员变量h_counts的值
// fieldID = env->GetFieldID(energySpectrumStructClass, "h_counts", SIG_LIST); // fieldID = env->GetFieldID(energySpectrumStructClass, "h_counts", SIG_LIST);
// fieldJobject = CplusToJava::Createjobject(env, allSize["h_counts"], cresult.h_counts); // fieldJobject = CplusToJava::Createjobject(env, allSize["h_counts"], cresult.h_counts);
// env->SetObjectField(result, fieldID, fieldJobject); // env->SetObjectField(result, fieldID, fieldJobject);
fieldID = env->GetFieldID(energySpectrumStructClass, "h_count_arr", SIG_LONG_ARRAY); // fieldID = env->GetFieldID(energySpectrumStructClass, "h_count_arr", SIG_LONG_ARRAY);
fieldJobject = CplusToJava::Create2Djobject(env, allSize["g_counts"], cresult.h_counts,cresult.g_channels, cresult.b_channels); // fieldJobject = CplusToJava::Create2Djobject(env, allSize["g_counts"], cresult.h_counts,cresult.g_channels, cresult.b_channels);
env->SetObjectField(result, fieldID, fieldJobject); // env->SetObjectField(result, fieldID, fieldJobject);
} // }
if (certificateflag) if (certificateflag)
{ {
@ -2170,7 +2189,6 @@ JNIEXPORT jobject JNICALL Java_org_jeecg_modules_native_1jni_EnergySpectrumHandl
fieldID = env->GetFieldID(energySpectrumStructClass, "lat", SIG_DOUBLE); fieldID = env->GetFieldID(energySpectrumStructClass, "lat", SIG_DOUBLE);
env->SetDoubleField(result, fieldID, cresult.lat); env->SetDoubleField(result, fieldID, cresult.lat);
} }
return result; return result;
} }