hytos / DTI_PID / APIDConverter / Model / PlantItem / Text.cs @ f37c5383
이력 | 보기 | 이력해설 | 다운로드 (3.6 KB)
1 | 475071f2 | gaqhf | using System; |
---|---|---|---|
2 | using System.Collections.Generic; |
||
3 | using System.Linq; |
||
4 | using System.Text; |
||
5 | using System.Threading.Tasks; |
||
6 | |||
7 | namespace AVEVA.PID.CustomizationUtility.Model |
||
8 | { |
||
9 | 6503fec8 | gaqhf | public enum TextAngle |
10 | { |
||
11 | None, |
||
12 | Degree0, |
||
13 | Degree90, |
||
14 | Degree180, |
||
15 | Degree270 |
||
16 | } |
||
17 | 475071f2 | gaqhf | public class Text |
18 | { |
||
19 | private string _UID; |
||
20 | private string _OWNER; |
||
21 | private string _ATTRIBUTEVALUE; |
||
22 | private string _NAME; |
||
23 | private string _LOCATION; |
||
24 | private double _LOCATION_X; |
||
25 | private double _LOCATION_Y; |
||
26 | public double LOCATION_X { get { return _LOCATION_X; } } |
||
27 | public double LOCATION_Y { get { return _LOCATION_Y; } } |
||
28 | private string _VALUE; |
||
29 | private double _ANGLE; |
||
30 | private string _WIDTH; |
||
31 | private string _HEIGHT; |
||
32 | private string _AREA; |
||
33 | private string _SCENE; |
||
34 | private bool _ASSOCIATION; |
||
35 | |||
36 | public string UID { get => _UID; set => _UID = value; } |
||
37 | public string ATTRIBUTEVALUE { get => _ATTRIBUTEVALUE; set => _ATTRIBUTEVALUE = value; } |
||
38 | public string NAME { get => _NAME; set => _NAME = value; } |
||
39 | public string LOCATION |
||
40 | { |
||
41 | get |
||
42 | { |
||
43 | return _LOCATION; |
||
44 | } |
||
45 | set |
||
46 | { |
||
47 | _LOCATION = value; |
||
48 | double x = 0; |
||
49 | double y = 0; |
||
50 | APIDUtils.ConvertPointBystring(_LOCATION, ref x, ref y); |
||
51 | _LOCATION_X = x; |
||
52 | _LOCATION_Y = y; |
||
53 | } |
||
54 | } |
||
55 | public string VALUE { get => _VALUE; set => _VALUE = value; } |
||
56 | public double ANGLE |
||
57 | { |
||
58 | get |
||
59 | { |
||
60 | return _ANGLE; |
||
61 | } |
||
62 | set |
||
63 | { |
||
64 | double gap = 0.05; |
||
65 | if (value < gap) |
||
66 | 6503fec8 | gaqhf | { |
67 | 475071f2 | gaqhf | value = 0; |
68 | 6503fec8 | gaqhf | TextAngle = TextAngle.Degree0; |
69 | } |
||
70 | 475071f2 | gaqhf | else if (1.57 - gap < value && value < 1.57 + gap) |
71 | 6503fec8 | gaqhf | { |
72 | 475071f2 | gaqhf | value = 90 * Math.PI / 180; |
73 | 6503fec8 | gaqhf | TextAngle = TextAngle.Degree90; |
74 | } |
||
75 | 475071f2 | gaqhf | else if (3.14 - gap < value && value < 3.14 + gap) |
76 | 6503fec8 | gaqhf | { |
77 | 475071f2 | gaqhf | value = Math.PI; |
78 | 6503fec8 | gaqhf | TextAngle = TextAngle.Degree180; |
79 | } |
||
80 | 475071f2 | gaqhf | else if (4.71 - gap < value && value < 4.71 + gap) |
81 | 6503fec8 | gaqhf | { |
82 | 475071f2 | gaqhf | value = 270 * Math.PI / 180; |
83 | 6503fec8 | gaqhf | TextAngle = TextAngle.Degree270; |
84 | } |
||
85 | 475071f2 | gaqhf | |
86 | _ANGLE = value; |
||
87 | } |
||
88 | } |
||
89 | public string WIDTH { get => _WIDTH; set => _WIDTH = value; } |
||
90 | public string HEIGHT { get => _HEIGHT; set => _HEIGHT = value; } |
||
91 | public string AREA { get => _AREA; set => _AREA = value; } |
||
92 | public bool ASSOCIATION { get => _ASSOCIATION; set => _ASSOCIATION = value; } |
||
93 | public string OWNER { get => _OWNER; set => _OWNER = value; } |
||
94 | |||
95 | public string SCENE |
||
96 | { |
||
97 | get |
||
98 | { |
||
99 | return _SCENE; |
||
100 | } |
||
101 | set |
||
102 | { |
||
103 | string[] split = value.Split(','); |
||
104 | X1 = Convert.ToDouble(split[0]); |
||
105 | Y1 = Convert.ToDouble(split[1]); |
||
106 | X2 = X1 + Convert.ToDouble(split[2]); |
||
107 | Y2 = Y1 + Convert.ToDouble(split[3]); |
||
108 | _SCENE = value; |
||
109 | } |
||
110 | } |
||
111 | public double X1 { get; set; } |
||
112 | public double X2 { get; set; } |
||
113 | public double Y1 { get; set; } |
||
114 | public double Y2 { get; set; } |
||
115 | 6503fec8 | gaqhf | public AvevaLabelInfo Aveva { get; set; } |
116 | public TextAngle TextAngle { get; set; } |
||
117 | 475071f2 | gaqhf | } |
118 | } |