110 lines
2.9 KiB
C#
110 lines
2.9 KiB
C#
/*
|
|
* Copyright (c) 2025 LG Electronics Inc.
|
|
* SPDX-License-Identifier: LicenseRef-LGE-Proprietary
|
|
*/
|
|
using Aurora;
|
|
using Aurora.Api;
|
|
using VisionCommon;
|
|
using System.Windows;
|
|
using System.Windows.Controls;
|
|
using System;
|
|
using VisionCommonUI;
|
|
using VisionUI.Pattern;
|
|
|
|
#if USE_COGNEX
|
|
using CogUI;
|
|
#else
|
|
using MilUI;
|
|
#endif
|
|
|
|
namespace VisionUI.CamCalibration {
|
|
/// <summary>
|
|
/// 패턴 등록 뷰
|
|
/// PatternRegistrationView.xaml behind code
|
|
/// </summary>
|
|
public partial class CamCalibrationView : UserControl, IUpdateRecipe, IDisposable {
|
|
private Logger _Logger = new Logger(typeof(CamCalibrationView).Name);
|
|
|
|
private UserControl _CameraView;
|
|
private FovInfo _FovInfo;
|
|
/// <summary>
|
|
/// 생성자
|
|
/// </summary>
|
|
/// <param name="fovInfo">Fov 정보</param>
|
|
public CamCalibrationView(FovInfo fovInfo) {
|
|
_FovInfo = fovInfo;
|
|
|
|
InitializeComponent();
|
|
}
|
|
|
|
private void Init() {
|
|
CreateCameraView();
|
|
CreateCameraCalibrationSettingView();
|
|
}
|
|
|
|
private void CreateCameraView() {
|
|
_CameraView = IpViewManager.CreateCameraView(_FovInfo, eDisplayType.Pattern);
|
|
gridCameraView.Children.Add(_CameraView);
|
|
}
|
|
|
|
private void CreateCameraCalibrationSettingView() {
|
|
#if USE_COGNEX
|
|
|
|
|
|
#else
|
|
var calview = new CamCalSettingView(_FovInfo, _CameraView);
|
|
gridCamCalibrationParam.Children.Add(calview);
|
|
#endif
|
|
|
|
}
|
|
|
|
private void UserControl_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e) {
|
|
bool isVisible = (bool)e.NewValue;
|
|
if (isVisible == true) {
|
|
RefreshVisionRecipes();
|
|
Init();
|
|
}
|
|
else {
|
|
Dispose();
|
|
}
|
|
}
|
|
|
|
public void RefreshVisionRecipes() {
|
|
_FovInfo = VisionRecipeManager.GetFovInfo(_FovInfo);
|
|
}
|
|
|
|
public void UpdateRecipeFromFile() {
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
public void UpdateRecipeFromUI() {
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
#region Dispose
|
|
public void Dispose() {
|
|
RemoveCameraView();
|
|
RemovePatternListView();
|
|
}
|
|
|
|
private void RemoveCameraView() {
|
|
foreach (var child in gridCameraView.Children) {
|
|
if (child is UserControl view) {
|
|
IpViewManager.DisposeCameraView(view);
|
|
}
|
|
}
|
|
gridCameraView.Children.Clear();
|
|
}
|
|
|
|
private void RemovePatternListView() {
|
|
foreach (var child in gridCamCalibrationParam.Children) {
|
|
if (child is PatternListView patternListView) {
|
|
patternListView = null;
|
|
}
|
|
}
|
|
gridCamCalibrationParam.Children.Clear();
|
|
}
|
|
#endregion
|
|
}
|
|
}
|