2026-01-26 18:56:53 +09:00

88 lines
2.9 KiB
C#

/*
* Copyright (c) 2025 LG Electronics Inc.
* SPDX-License-Identifier: LicenseRef-LGE-Proprietary
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.ComponentModel;
using System.Collections.ObjectModel;
using VisionCommon;
namespace VisionCommon {
public enum eFovId {
None = -1,
Fov1 = 0, Fov2, Fov3, Fov4,
Max
}
public enum eFovIdPair {
None = -1,
Fov1_2, Fov1_3, Fov1_4,
Fov2_3, Fov2_4,
Fov3_4,
}
/// <summary>
/// 메인 카메라뷰 FOV UI Row/Column 위치
/// (EX : RC_02 -> 0행 2열)
/// (EX : RC_10 -> 1행 0열)
/// </summary>
public enum eFovUiPos {
None = -1,
// 5 x 5
RC_00, RC_01, RC_02, RC_03, RC_04,
RC_10, RC_11, RC_12, RC_13, RC_14,
RC_20, RC_21, RC_22, RC_23, RC_24,
RC_30, RC_31, RC_32, RC_33, RC_34,
RC_40, RC_41, RC_42, RC_43, RC_44
}
public class FovRecipe : ICloneCopy<FovRecipe> {
public eFovId FovId { get; set; }
public string FovName { get; set; }
public ObservableCollection<MainUiRecipe> MainUiRecipes { get; set; } = new ObservableCollection<MainUiRecipe>();
public CamRecipe CamRecipe { get; set; } = new CamRecipe();
public PatternRecipe PatternRecipe { get; set; } = new PatternRecipe();
public CalFovRecipe CalFovRecipe { get; set; } = new CalFovRecipe();
public RefPointRecipe RefPointRecipe { get; set; } = new RefPointRecipe();
public FovSetupRecipe FovSetupRecipe { get; set; } = new FovSetupRecipe();
public CamCalibrationRecipe CamCalibrationRecipe { get; set; } = new CamCalibrationRecipe();
public static (int, int) GetFovUiPosRowCol(eFovUiPos fovUiPos) {
if (fovUiPos == eFovUiPos.None) {
return (-1, -1);
}
int cols = 5;
int row = (int)fovUiPos / cols;
int col = (int)fovUiPos % cols;
return (row, col);
}
public FovRecipe Clone() {
return ((ICloneable)this).Clone() as FovRecipe;
}
object ICloneable.Clone() {
var cloneObj = new FovRecipe();
CopyTo(cloneObj);
return cloneObj;
}
public void CopyTo(FovRecipe target) {
target.FovId = this.FovId;
target.FovName = this.FovName;
target.MainUiRecipes = new ObservableCollection<MainUiRecipe>(this.MainUiRecipes.Select(x => x.Clone()).ToList());
target.CamRecipe = this.CamRecipe.Clone() as CamRecipe;
target.PatternRecipe = this.PatternRecipe.Clone();
target.CalFovRecipe = this.CalFovRecipe.Clone();
target.RefPointRecipe = this.RefPointRecipe.Clone();
if (this.FovSetupRecipe != null) {
target.FovSetupRecipe = this.FovSetupRecipe.Clone();
}
}
}
}