test
This commit is contained in:
5
.gitignore
vendored
5
.gitignore
vendored
@ -35,3 +35,8 @@ dist-ssr
|
|||||||
/myis11/project/is3/cmake-build-release-visual-studio/
|
/myis11/project/is3/cmake-build-release-visual-studio/
|
||||||
/myis11/project/is11/cmake-build-release-visual-studio/
|
/myis11/project/is11/cmake-build-release-visual-studio/
|
||||||
/myis11/project/is11/cmake-build-release-visual-studio/
|
/myis11/project/is11/cmake-build-release-visual-studio/
|
||||||
|
/myis11/project/is3/cmake-build-release-visual-studio/
|
||||||
|
/myis11/project/is3/cmake-build-debug-visual-studio/
|
||||||
|
/myis11/project/is11/cmake-build-release-visual-studio/
|
||||||
|
/myis11/project/is11/cmake-build-release-visual-studio-2022/
|
||||||
|
/myis11/project/is3/cmake-build-release-visual-studio/
|
||||||
|
|||||||
@ -1 +1 @@
|
|||||||
{"pathofsave":null,"Filename":"testaa","caijiavgNumber":"1","useSG":false,"usehighpass":false,"Dispatcher":{"isenable":true,"begin":"09:28","end":"23:59"},"sensor_typeforset":"IS11"}
|
{"pathofsave":null,"Filename":"testaa","caijiavgNumber":"1","useSG":false,"usehighpass":false,"Dispatcher":{"isenable":true,"begin":"09:28","end":"23:59"},"sensor_typeforset":"IS3"}
|
||||||
@ -186,4 +186,80 @@ let filesavepath=filesave_date.clone()+".iris";
|
|||||||
|
|
||||||
"ok".to_string()
|
"ok".to_string()
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn save_reflectance_to_iris(reflectance_data: serde_json::Value, devinfo: serde_json::Value, filepath: String) -> String {
|
||||||
|
let mut oneirisdata: OneIRISData = OneIRISData::new();
|
||||||
|
let mut spectraldata_reflectance: SpectralData = SpectralData::new();
|
||||||
|
|
||||||
|
let fileName = reflectance_data["fileName"].as_str().unwrap_or("Unknown").to_string();
|
||||||
|
//将filename中的.替换为_ 并保存到新的变量里
|
||||||
|
let fileName1 = fileName.replace(".", "_");
|
||||||
|
spectraldata_reflectance.name = fileName1+&devinfo["name"].as_str().unwrap_or("Unknown").to_string() ;
|
||||||
|
spectraldata_reflectance.sensor_id = devinfo["sensor_id"].as_str().unwrap_or("Unknown").to_string() ;
|
||||||
|
// + &devinfo["serialnumber"].as_str().unwrap_or("Unknown").to_string();
|
||||||
|
|
||||||
|
let reflectance_values: Vec<f64> = reflectance_data["data"]
|
||||||
|
.as_array()
|
||||||
|
.unwrap_or(&vec![])
|
||||||
|
.iter()
|
||||||
|
.map(|x| x.as_f64().unwrap_or(0.0))
|
||||||
|
.collect::<Vec<f64>>();
|
||||||
|
|
||||||
|
spectraldata_reflectance.bands = reflectance_values.len() as u16;
|
||||||
|
spectraldata_reflectance.pixel_size = 8;
|
||||||
|
spectraldata_reflectance.data_type = DATA_TYPE_FLOAT64;
|
||||||
|
spectraldata_reflectance.fiber_id = 0;
|
||||||
|
spectraldata_reflectance.exposure = 0.0;
|
||||||
|
spectraldata_reflectance.gain = 0.0;
|
||||||
|
|
||||||
|
let datenow = chrono::Local::now();
|
||||||
|
let nowtime = TimeStruct {
|
||||||
|
time_zone: 50,
|
||||||
|
year: datenow.year() as u16,
|
||||||
|
month: datenow.month() as u8,
|
||||||
|
day: datenow.day() as u8,
|
||||||
|
hour: datenow.hour() as u8,
|
||||||
|
minute: datenow.minute() as u8,
|
||||||
|
second: datenow.second() as u8,
|
||||||
|
millisecond: datenow.timestamp_subsec_millis() as u16,
|
||||||
|
};
|
||||||
|
spectraldata_reflectance.collection_time = nowtime.clone();
|
||||||
|
spectraldata_reflectance.ground_type = Target_Spectral_Type_FlatRef;
|
||||||
|
spectraldata_reflectance.valid_flag = 1;
|
||||||
|
|
||||||
|
spectraldata_reflectance.Set_Spectral_Data(reflectance_values, DATA_TYPE_FLOAT64);
|
||||||
|
oneirisdata.spectral_data_section.push(spectraldata_reflectance);
|
||||||
|
|
||||||
|
let spectraldata_devinfo = json!({
|
||||||
|
"info_type": "devinfo",
|
||||||
|
"sensor_id": devinfo["sensor_id"].as_str().unwrap_or("Unknown").to_string(),
|
||||||
|
"wave_coeff": {
|
||||||
|
"a1": devinfo["bochangxishu"]["a0"].as_f64().unwrap_or(0.0),
|
||||||
|
"a2": devinfo["bochangxishu"]["a1"].as_f64().unwrap_or(0.0),
|
||||||
|
"a3": devinfo["bochangxishu"]["a2"].as_f64().unwrap_or(0.0),
|
||||||
|
"a4": devinfo["bochangxishu"]["a3"].as_f64().unwrap_or(0.0)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
println!("spectraldata_devinfo: {:?}", spectraldata_devinfo);
|
||||||
|
|
||||||
|
let environment_info = json!({
|
||||||
|
"info_type": "environment",
|
||||||
|
"date": format!("{}-{:02}-{:02} {:02}:{:02}:{:02}",
|
||||||
|
datenow.year(),
|
||||||
|
datenow.month(),
|
||||||
|
datenow.day(),
|
||||||
|
datenow.hour(),
|
||||||
|
datenow.minute(),
|
||||||
|
datenow.second()
|
||||||
|
)
|
||||||
|
});
|
||||||
|
|
||||||
|
oneirisdata.spectral_info_section.push(spectraldata_devinfo);
|
||||||
|
oneirisdata.spectral_info_section.push(environment_info);
|
||||||
|
|
||||||
|
match wirte_iris_data(&oneirisdata, &filepath) {
|
||||||
|
Ok(_) => "ok".to_string(),
|
||||||
|
Err(e) => format!("保存失败: {}", e)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -215,6 +215,11 @@ fn delete_file_by_path(filepath: String) -> String {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[tauri::command]
|
||||||
|
fn save_reflectance_to_iris(reflectance_data: serde_json::Value, devinfo: serde_json::Value, filepath: String) -> String {
|
||||||
|
irisdatamanager::save_reflectance_to_iris(reflectance_data, devinfo, filepath)
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// Learn more about Tauri commands at https://tauri.app/v1/guides/features/command
|
// Learn more about Tauri commands at https://tauri.app/v1/guides/features/command
|
||||||
|
|
||||||
@ -248,7 +253,8 @@ fn main() {
|
|||||||
algorithm::interpolate_spline_at_points,
|
algorithm::interpolate_spline_at_points,
|
||||||
algorithm::find_peek,
|
algorithm::find_peek,
|
||||||
algorithm::compute_weave_coeff,
|
algorithm::compute_weave_coeff,
|
||||||
getoneirisfile
|
getoneirisfile,
|
||||||
|
save_reflectance_to_iris
|
||||||
])
|
])
|
||||||
.setup(|app| {
|
.setup(|app| {
|
||||||
|
|
||||||
|
|||||||
@ -246,10 +246,10 @@ pub fn readforport()->Vec<u8>{
|
|||||||
if port_info.port_name == "NON" {
|
if port_info.port_name == "NON" {
|
||||||
return "Port is not set".as_bytes().to_vec();
|
return "Port is not set".as_bytes().to_vec();
|
||||||
}
|
}
|
||||||
let mut buf: Vec<u8> = vec![0; 1000];
|
let mut buf: Vec<u8> = vec![0; 5000];
|
||||||
match &mut port_info.port {
|
match &mut port_info.port {
|
||||||
Some(p) => {
|
Some(p) => {
|
||||||
p.set_timeout(Duration::from_millis(100)).unwrap();
|
p.set_timeout(Duration::from_millis(10)).unwrap();
|
||||||
let sizeread =match p.read(&mut buf){
|
let sizeread =match p.read(&mut buf){
|
||||||
Ok(size)=>{size},
|
Ok(size)=>{size},
|
||||||
Err(_e)=>{0}
|
Err(_e)=>{0}
|
||||||
|
|||||||
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
"package": {
|
"package": {
|
||||||
"productName": "SpectralPlot",
|
"productName": "SpectralPlot",
|
||||||
"version": "0.6.66"
|
"version": "0.6.81"
|
||||||
},
|
},
|
||||||
"tauri": {
|
"tauri": {
|
||||||
|
|
||||||
|
|||||||
@ -18,3 +18,4 @@
|
|||||||
* **v0.6.62** 修正了保存逻辑,并修复了波长倒置的问题。
|
* **v0.6.62** 修正了保存逻辑,并修复了波长倒置的问题。
|
||||||
* **v0.6.65** 增加了HH3定标功能。
|
* **v0.6.65** 增加了HH3定标功能。
|
||||||
* **v0.6.66** 增加了HH3波长定标所需的波长参数,并将寻峰最小值调整为3000。
|
* **v0.6.66** 增加了HH3波长定标所需的波长参数,并将寻峰最小值调整为3000。
|
||||||
|
* **v0.6.81** 解决了is3控制时偶尔会卡顿的问题
|
||||||
|
|||||||
@ -193,6 +193,7 @@ export default {
|
|||||||
btn.disabled = true;
|
btn.disabled = true;
|
||||||
this.buttoncolor.opencombutton="success";
|
this.buttoncolor.opencombutton="success";
|
||||||
EventBus.emit('showbox',{title:"设备",body:"打开串口成功"});
|
EventBus.emit('showbox',{title:"设备",body:"打开串口成功"});
|
||||||
|
this.$globalState.isDevOpen=true;
|
||||||
}else
|
}else
|
||||||
{
|
{
|
||||||
btn.disabled = false;
|
btn.disabled = false;
|
||||||
@ -211,6 +212,8 @@ export default {
|
|||||||
btnn.disabled = true;
|
btnn.disabled = true;
|
||||||
alert(await invoke("closecome"));
|
alert(await invoke("closecome"));
|
||||||
this.SerialInfo.isopen=false;
|
this.SerialInfo.isopen=false;
|
||||||
|
this.$globalState.isDevOpen=false;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|||||||
10
src/main.js
10
src/main.js
@ -24,7 +24,7 @@ import {
|
|||||||
import KonamiCode from "vue3-konami-code";
|
import KonamiCode from "vue3-konami-code";
|
||||||
import EventBus from "./eventBus.js";
|
import EventBus from "./eventBus.js";
|
||||||
import tauriApi from "./utils/tauriApi.js";
|
import tauriApi from "./utils/tauriApi.js";
|
||||||
|
import { reactive } from 'vue';
|
||||||
async function setWindowSize() {
|
async function setWindowSize() {
|
||||||
// const primaryMonitor = await screen.primaryMonitor();
|
// const primaryMonitor = await screen.primaryMonitor();
|
||||||
// const screenSize = primaryMonitor.size;
|
// const screenSize = primaryMonitor.size;
|
||||||
@ -61,5 +61,13 @@ app.component("Draggable", Draggable);
|
|||||||
// 注册全局 API
|
// 注册全局 API
|
||||||
app.config.globalProperties.$tauriApi = tauriApi;
|
app.config.globalProperties.$tauriApi = tauriApi;
|
||||||
|
|
||||||
|
// 创建响应式全局状态
|
||||||
|
const globalState = reactive({
|
||||||
|
isDevOpen: false,
|
||||||
|
// 其他全局状态
|
||||||
|
});
|
||||||
|
//设置全局变量
|
||||||
|
app.config.globalProperties.$globalState = globalState;
|
||||||
|
|
||||||
// app.use(BootstrapVueIcons);
|
// app.use(BootstrapVueIcons);
|
||||||
app.mount("#app");
|
app.mount("#app");
|
||||||
|
|||||||
Reference in New Issue
Block a user