- Canvas: 坐标轴、顶点坐标、框拖拽、角点缩放、点击选中高亮 - 路径规划改为弹窗覆盖层,编辑状态不丢失 - 展开任务状态持久化到 Pinia store - 扫描模式默认 OneWay - 保存时 startTime/endTime/durationMinutes 清空为 "" - exposureTime/frameRate/captureIntervalSeconds 默认 0 - 去除生成航线后的扫描线文字标注
30 lines
1.2 KiB
Rust
30 lines
1.2 KiB
Rust
use std::path::Path;
|
|
use crate::error::AppError;
|
|
use crate::models::MissionPlan;
|
|
|
|
pub fn write_mission(path: &Path, mission: &MissionPlan) -> Result<(), AppError> {
|
|
// Clear computed timing fields before saving
|
|
let mut cleaned = mission.clone();
|
|
for task in &mut cleaned.tasks {
|
|
task.duration_minutes = 0.0;
|
|
task.estimated_duration_minutes = 0.0;
|
|
task.start_time = Some("".to_string());
|
|
task.end_time = Some("".to_string());
|
|
for sub in &mut task.sub_tasks {
|
|
sub.duration_minutes = 0.0;
|
|
sub.estimated_duration_minutes = 0.0;
|
|
sub.start_time = Some("".to_string());
|
|
sub.end_time = Some("".to_string());
|
|
if sub.capture_interval_seconds.is_none() { sub.capture_interval_seconds = Some(0); }
|
|
if sub.exposure_time.is_none() { sub.exposure_time = Some(0); }
|
|
if sub.frame_rate.is_none() { sub.frame_rate = Some(0); }
|
|
}
|
|
}
|
|
let content = serde_json::to_string_pretty(&cleaned)?;
|
|
let content = content
|
|
.replace("\"durationMinutes\": 0.0", "\"durationMinutes\": \"\"")
|
|
.replace("\"estimatedDurationMinutes\": 0.0", "\"estimatedDurationMinutes\": \"\"");
|
|
std::fs::write(path, content)?;
|
|
Ok(())
|
|
}
|