hytos / DTI_PID / APIDConverter / Model / PlantItem / Text.cs @ 98fdb329
이력 | 보기 | 이력해설 | 다운로드 (3.6 KB)
1 |
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 |
public enum TextAngle |
10 |
{ |
11 |
None, |
12 |
Degree0, |
13 |
Degree90, |
14 |
Degree180, |
15 |
Degree270 |
16 |
} |
17 |
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 |
{ |
67 |
value = 0; |
68 |
TextAngle = TextAngle.Degree0; |
69 |
} |
70 |
else if (1.57 - gap < value && value < 1.57 + gap) |
71 |
{ |
72 |
value = 90 * Math.PI / 180; |
73 |
TextAngle = TextAngle.Degree90; |
74 |
} |
75 |
else if (3.14 - gap < value && value < 3.14 + gap) |
76 |
{ |
77 |
value = Math.PI; |
78 |
TextAngle = TextAngle.Degree180; |
79 |
} |
80 |
else if (4.71 - gap < value && value < 4.71 + gap) |
81 |
{ |
82 |
value = 270 * Math.PI / 180; |
83 |
TextAngle = TextAngle.Degree270; |
84 |
} |
85 |
|
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 |
public AvevaLabelInfo Aveva { get; set; } |
116 |
public TextAngle TextAngle { get; set; } |
117 |
} |
118 |
} |