- 오토런 시작 시 RCC 패턴 폴더 변경 감지 → B2506 ON, PLC ACK(B2409) 수신 시 OFF - 서브 패턴 1~10, 패턴 목록에 서브 썸네일 표시(행 내 좌우 스크롤) - 서브 패턴 등록 직후 활성화 OFF - 패턴 파일이 다른 프로그램에서 열려 있으면 삭제하지 않고 안내 - 현장 소스 반영: Train ROI 슬라이더, KS 조명 밝기 저장/적용, 조명 ID 분리, 스캔 후 카메라 라이브 재시작, 레시피 21 RCC NG 우회, 오토런 상태 판단
149 lines
4.9 KiB
C#
149 lines
4.9 KiB
C#
/*
|
||
* Copyright (c) 2025 LG Electronics Inc.
|
||
* SPDX-License-Identifier: LicenseRef-LGE-Proprietary
|
||
*/
|
||
using Aurora.View;
|
||
using Newtonsoft.Json;
|
||
using System;
|
||
using System.ComponentModel;
|
||
using System.Drawing;
|
||
|
||
namespace VisionCommon {
|
||
public enum ePatternType {
|
||
None,
|
||
ImageModelFinder,
|
||
ShapeModelFinder,
|
||
PatternMatching,
|
||
LineFinder,
|
||
MultiLineFinder,
|
||
MultiOcr, // Multi Ocr
|
||
EdgeFinder,
|
||
Caliper,
|
||
Blob,
|
||
Code, // Barcode, QRCode, DataMatrix
|
||
Ocr, // String Read + OCR Read + Tesseract AI
|
||
Brightness,
|
||
LineIntersection = 20,
|
||
LineWidth,
|
||
MachinePattern_A = 30,
|
||
MachinePattern_B,
|
||
MachinePattern_C
|
||
}
|
||
|
||
public class PatternInfo : NotifyPropertyChangedBase, ICloneable {
|
||
private bool _IsActivated = true;
|
||
public bool IsActivated { get => _IsActivated; set => SetProperty(ref _IsActivated, value); }
|
||
|
||
public ePatternType PatternType { get; set; } = ePatternType.None;
|
||
public string PatternName { get; set; } = string.Empty;
|
||
public string Description { get; set; } = string.Empty;
|
||
public LightInfo LightInfo { get; set; } = new LightInfo();
|
||
|
||
public PreProcessingParam PreProcParam { get; set; } = new PreProcessingParam();
|
||
public FixtureSetting FixtureSetting { get; set; } = new FixtureSetting();
|
||
|
||
[JsonIgnore]
|
||
public PatternIndex PatternIndex { get; set; }
|
||
[JsonIgnore]
|
||
public int MilSystemId { get; set; }
|
||
[JsonIgnore]
|
||
public Bitmap Thumbnail { get; set; } = ThumbnailUtil.GetDefaultImage();
|
||
// Sub pattern list for display (pattern list thumbnails)
|
||
[JsonIgnore]
|
||
public System.Collections.Generic.List<PatternInfo> SubPatternInfos { get; set; } = new System.Collections.Generic.List<PatternInfo>();
|
||
|
||
public event PropertyChangedEventHandler PropertyChanged;
|
||
protected void OnPropertyChanged(string propertyName)
|
||
=> PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||
|
||
public string GetPatternDirectoryPath() {
|
||
return PatternIndex.GetPatternDirectoryPath();
|
||
}
|
||
|
||
public string GetSubPatternDirectoryPath() {
|
||
return PatternIndex.GetSubPatternDirectoryPath();
|
||
}
|
||
|
||
public PatternIndex GetPatternIndex() {
|
||
return PatternIndex;
|
||
}
|
||
|
||
public string GetFullId() {
|
||
return ToString();
|
||
}
|
||
|
||
public override string ToString() {
|
||
return PatternIndex.ToString();
|
||
}
|
||
|
||
public string GetPrefix() {
|
||
return PatternIndex.GetPrefix();
|
||
}
|
||
|
||
public string GetPatternIdPrefix() {
|
||
return PatternIndex.GetPatternIdPrefix();
|
||
}
|
||
|
||
public int GetPatternId() {
|
||
return PatternIndex.PatternId;
|
||
}
|
||
public void SetPatternId(int patternId) {
|
||
PatternIndex.PatternId = patternId;
|
||
}
|
||
|
||
public int GetPatternSubId() {
|
||
return PatternIndex.PatternSubId;
|
||
}
|
||
public void SetPatternSubId(int patternSubId) {
|
||
PatternIndex.PatternSubId = patternSubId;
|
||
}
|
||
|
||
public bool IsMainPattern(string idPrefix) {
|
||
return GetFullId().StartsWith(idPrefix) &&
|
||
PatternIndex.PatternSubId == PatternConstants.MAIN_PATTERN_INDEX;
|
||
}
|
||
|
||
public bool IsSubPattern(string idPrefix) {
|
||
return GetFullId().StartsWith(idPrefix) &&
|
||
PatternIndex.PatternSubId != PatternConstants.MAIN_PATTERN_INDEX;
|
||
}
|
||
|
||
public bool IsRegistered() {
|
||
return PatternType != ePatternType.None;
|
||
}
|
||
|
||
public object Clone() {
|
||
return new PatternInfo() {
|
||
IsActivated = IsActivated,
|
||
PatternType = PatternType,
|
||
PatternName = PatternName,
|
||
Description = Description,
|
||
LightInfo = LightInfo.Clone(),
|
||
PatternIndex = PatternIndex.Clone() as PatternIndex,
|
||
MilSystemId = MilSystemId,
|
||
PreProcParam = PreProcParam.Clone(),
|
||
FixtureSetting = FixtureSetting.Clone() as FixtureSetting,
|
||
};
|
||
}
|
||
|
||
/// <summary>
|
||
/// ContainsKey <20>ҵ<DEBC> <20><><EFBFBD><EFBFBD>, <20><>ü <20><EFBFBD> <20><><EFBFBD><EFBFBD> <20>ݵ<EFBFBD><DDB5><EFBFBD> override <20>ؾ<EFBFBD> <20><>.
|
||
/// </summary>
|
||
/// <returns><3E>ؽ<EFBFBD><D8BD>ڵ<EFBFBD></returns>
|
||
public override bool Equals(object obj) {
|
||
if (this.GetType() != obj.GetType()) {
|
||
return false;
|
||
}
|
||
return PatternIndex.Equals(((PatternInfo)obj).PatternIndex);
|
||
}
|
||
|
||
/// <summary>
|
||
/// ContainsKey <20>ҵ<DEBC> <20><><EFBFBD><EFBFBD>, <20><>ü <20><EFBFBD> <20><><EFBFBD><EFBFBD> <20>ݵ<EFBFBD><DDB5><EFBFBD> override <20>ؾ<EFBFBD> <20><>.
|
||
/// </summary>
|
||
/// <returns><3E>ؽ<EFBFBD><D8BD>ڵ<EFBFBD></returns>
|
||
public override int GetHashCode() {
|
||
return PatternIndex.GetHashCode();
|
||
}
|
||
}
|
||
}
|