124 lines
4.1 KiB
C#
124 lines
4.1 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.Windows.Media;
|
|
|
|
namespace VisionUI.ProcTest {
|
|
/// <summary>
|
|
/// 모양 타입
|
|
/// Rectangle | Circle | TextBox | Path
|
|
/// </summary>
|
|
public enum eShapeType {
|
|
Rectangle = 0,
|
|
Circle,
|
|
TextBox,
|
|
Path
|
|
}
|
|
/// <summary>
|
|
/// 자재공차 테스트 모델 추상 클래스
|
|
/// </summary>
|
|
public abstract class MaterialToleranceTestModel {
|
|
private static int _nextId = 1;
|
|
/// <summary>ID</summary>
|
|
public int ID { get; private set; }
|
|
/// <summary>이름</summary>
|
|
public string Name { get; set; }
|
|
/// <summary>툴팁</summary>
|
|
public string Tooltip { get; set; }
|
|
/// <summary>모양 타입</summary>
|
|
public eShapeType shapeType { get; set; }
|
|
/// <summary>설명</summary>
|
|
public string Description { get; set; }
|
|
/// <summary>Shape Visibility</summary>
|
|
public System.Windows.Visibility ShapeVisible { get; set; }
|
|
/// <summary>Item이 선택되었는지 여부</summary>
|
|
public bool ItemSelected { get; set; }
|
|
/// <summary>캔버스 왼쪽위치</summary>
|
|
public double Left { get; set; }
|
|
/// <summary>캔버스 상부쪽 위치</summary>
|
|
public double Top { get; set; }
|
|
/// <summary>불투명도 0~1</summary>
|
|
public double Opacity { get; set; } = 1;
|
|
/// <summary>선 두께</summary>
|
|
public double StrokeThick { get; set; }
|
|
/// <summary>선 색상</summary>
|
|
public Brush StrokeColor { get; set; }
|
|
/// <summary>도형 내부 채우는 색상</summary>
|
|
public Brush FillColor { get; set; }
|
|
/// <summary>도형들의 Z 인덱스 (layer)</summary>
|
|
public int ZIndex { get; set; } = 0;
|
|
/// <summary>
|
|
/// 생성자
|
|
/// </summary>
|
|
public MaterialToleranceTestModel() {
|
|
ID = _nextId++;
|
|
}
|
|
/// <summary>
|
|
/// 생성자
|
|
/// </summary>
|
|
/// <param name="name">이름</param>
|
|
public MaterialToleranceTestModel(string name) : this() {
|
|
Name = name;
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 원 모델
|
|
/// </summary>
|
|
public class CircleModel : MaterialToleranceTestModel {
|
|
/// <summary>
|
|
/// 생성자
|
|
/// </summary>
|
|
/// <param name="name">이름</param>
|
|
/// <param name="cx">센터 X</param>
|
|
/// <param name="cy">센터 Y</param>
|
|
/// <param name="r">반지름</param>
|
|
public CircleModel(string name, double cx, double cy, double r) : base(name) {
|
|
R = r;
|
|
Top = cy - R;
|
|
Left = cx - R;
|
|
EllipseWidth = R * 2;
|
|
EllipseHeight = R * 2;
|
|
FillColor = new SolidColorBrush(Colors.LightGreen);
|
|
shapeType = eShapeType.Circle;
|
|
}
|
|
/// <summary>원 높이</summary>
|
|
public double EllipseHeight { get; set; }
|
|
/// <summary>원 너비</summary>
|
|
public double EllipseWidth { get; set; }
|
|
/// <summary>반지름</summary>
|
|
public double R { get; set; }
|
|
/// <summary>위치변경</summary>
|
|
public void SetTopLeft(double top, double left) {
|
|
Top = top - R;
|
|
Left = left - R;
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// Path 모델
|
|
/// </summary>
|
|
public class PathModel : MaterialToleranceTestModel {
|
|
/// <summary>
|
|
/// 생성자
|
|
/// </summary>
|
|
/// <param name="name">이름</param>
|
|
/// <param name="path"></param>
|
|
public PathModel(string name, string path) : base(name) {
|
|
StrokeThick = 2;
|
|
StrokeColor = new SolidColorBrush(Colors.LightGreen);
|
|
FillColor = new SolidColorBrush(Colors.Transparent);
|
|
PathData = path;
|
|
shapeType = eShapeType.Path;
|
|
}
|
|
/// <summary>
|
|
/// Path 데이터
|
|
/// </summary>
|
|
public string PathData { get; set; }
|
|
}
|
|
}
|