61 lines
2.0 KiB
C#
61 lines
2.0 KiB
C#
using VisionCommon;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
|
|
namespace VisionCalibrator {
|
|
/// <summary>
|
|
/// 켈리브레이터를 관리하는 매니저
|
|
/// </summary>
|
|
public static class CalibratorManager {
|
|
private static object _lock = new object();
|
|
private static Dictionary<FovInfo, Calibrator> _calibrators = new Dictionary<FovInfo, Calibrator>();
|
|
|
|
/// <summary>
|
|
/// 켈리브레이터를 Set한다.
|
|
/// </summary>
|
|
/// <param name="fovInfo">FovInfo</param>
|
|
/// <param name="calibrationAgent">Calibrator</param>
|
|
public static void SetCalibrator(FovInfo fovInfo, Calibrator calibrationAgent) {
|
|
lock (_lock) {
|
|
if (!_calibrators.ContainsKey(fovInfo)) {
|
|
_calibrators.Add(fovInfo, calibrationAgent);
|
|
|
|
if (CalAdapter.Instance.CalManager == null) {
|
|
CalAdapter.Instance.CalManager = new CalManager();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
[Obsolete]
|
|
public static Calibrator GetCalibrator(SubSysInfo subSysInfo, eFovId fovId) {
|
|
return GetCalibrator(new FovInfo(subSysInfo, fovId, string.Empty));
|
|
}
|
|
|
|
/// <summary>
|
|
/// 켈리브레이터를 Get한다.
|
|
/// </summary>
|
|
/// <param name="fovInfo">FovInfo</param>
|
|
/// <returns>Calibrator</returns>
|
|
public static Calibrator GetCalibrator(FovInfo fovInfo) {
|
|
lock (_lock) {
|
|
if (_calibrators.ContainsKey(fovInfo)) {
|
|
return _calibrators[fovInfo];
|
|
}
|
|
}
|
|
|
|
return null;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 모든 켈리브레이터를 Get한다.
|
|
/// </summary>
|
|
/// <returns>캘리브레이터 딕셔너리</returns>
|
|
public static Dictionary<FovInfo, Calibrator> GetCalibrators() {
|
|
lock (_lock) {
|
|
return new Dictionary<FovInfo, Calibrator>(_calibrators);
|
|
}
|
|
}
|
|
}
|
|
}
|