DrawPointManager.cs
5.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TSA_V.DeviceLibrary;
namespace TSA_V
{
public class DrawPointManager
{
public static void DrawPoint(Graphics g, ProjectorPInfo p,Color color)
{
if (p.SizeX < 2)
{
p.SizeX = 2;
}
if (p.SizeY < 2)
{
p.SizeY = 2;
}
int lineLength = 2;
int x =(int) p.PX;
int y =(int)p.PY;
Pen pen = new Pen(color, p.PenWidth);
System.Drawing.SolidBrush myBrush = new System.Drawing.SolidBrush(color);
//点类型,1 = 点,2 = +,3 =|,4 = -,5 = 方形,6 = 圆圈
if (p.PType.Equals(2))
{
g.DrawLine(pen, new Point(x - p.SizeX, y), new Point(x + p.SizeX, y));
g.DrawLine(pen, new Point(x, y - p.SizeY), new Point(x, y + p.SizeY));
}
else if (p.PType.Equals(3))
{
g.DrawLine(pen, new Point(x, y - p.SizeY), new Point(x, y + p.SizeY));
}
else if (p.PType.Equals(4))
{
g.DrawLine(pen, new Point(x - p.SizeX, y), new Point(x + p.SizeX, y));
}
else if (p.PType.Equals(5))
{
g.DrawRectangle(pen, x - p.SizeX / 2, y - p.SizeY / 2, p.SizeX, p.SizeY);
}
else if (p.PType.Equals(6))
{
g.DrawEllipse(pen, x - p.SizeX / 2, y - p.SizeY / 2, p.SizeX, p.SizeY);
}
else if (p.PType > 6)
{
g.DrawEllipse(pen, x - p.SizeX / 2, y - p.SizeY / 2, p.SizeX, p.SizeY);
}
else
{
g.FillEllipse(myBrush, new Rectangle(x - p.SizeX / 2, y - p.SizeY / 2, p.SizeX, p.SizeY));//画实心椭圆
}
Pen nPen = new Pen(color,(p.PenWidth>6?6:p.PenWidth));
if (p.PolaritiesType.Equals(0))
{
}
else if (p.PolaritiesType.Equals(1))
{
//p.SizeX = 12;
//p.SizeY = 36;
int plusSize = p.SizeX / 2;
int pX = x;
int pY = y - p.SizeY / 2 - lineLength - plusSize;
g.DrawLine(nPen, new Point(pX - plusSize, pY), new Point(pX + plusSize, pY));
g.DrawLine(nPen, new Point(pX, pY - plusSize), new Point(pX, pY + plusSize));
}
else if (p.PolaritiesType.Equals(2))
{
//p.SizeX = 12;
//p.SizeY = 36;
int plusSize = p.SizeX / 2;
int pX = x;
int pY = y + p.SizeY / 2 + lineLength + plusSize;
g.DrawLine(nPen, new Point(pX - plusSize, pY), new Point(pX + plusSize, pY));
g.DrawLine(nPen, new Point(pX, pY - plusSize), new Point(pX, pY + plusSize));
}
else if (p.PolaritiesType.Equals(3))
{
//p.SizeX = 12;
//p.SizeY = 36;
int plusSize = p.SizeY / 2;
int pX = x - p.SizeX / 2 - lineLength - plusSize;
int pY = y;
g.DrawLine(nPen, new Point(pX - plusSize, pY), new Point(pX + plusSize, pY));
g.DrawLine(nPen, new Point(pX, pY - plusSize), new Point(pX, pY + plusSize));
}
else if (p.PolaritiesType.Equals(4))
{
//p.SizeX = 12;
//p.SizeY = 36;
int plusSize = p.SizeY / 2;
int pX = x + p.SizeX / 2 + lineLength + plusSize;
int pY = y;
g.DrawLine(nPen, new Point(pX - plusSize, pY), new Point(pX + plusSize, pY));
g.DrawLine(nPen, new Point(pX, pY - plusSize), new Point(pX, pY + plusSize));
}
else if (p.PolaritiesType.Equals(5))
{
int plusSize = p.SizeX / 2;
int pX = x - plusSize;
int pY = y - p.SizeY / 2 - lineLength - plusSize;
g.DrawLine(nPen, new Point(pX - plusSize, pY), new Point(pX + plusSize, pY));
g.DrawLine(nPen, new Point(pX, pY - plusSize), new Point(pX, pY + plusSize));
}
else if (p.PolaritiesType.Equals(6))
{
//p.SizeX = 12;
//p.SizeY = 36;
int plusSize = p.SizeX / 2;
int pX = x + plusSize;
int pY = y - p.SizeY / 2 - lineLength - plusSize;
g.DrawLine(nPen, new Point(pX - plusSize, pY), new Point(pX + plusSize, pY));
g.DrawLine(nPen, new Point(pX, pY - plusSize), new Point(pX, pY + plusSize));
}
else if (p.PolaritiesType.Equals(7))
{
//p.SizeX = 12;
//p.SizeY = 36;
int plusSize = p.SizeX / 2;
int pX = x - plusSize;
int pY = y + p.SizeY / 2 + lineLength + plusSize;
g.DrawLine(nPen, new Point(pX - plusSize, pY), new Point(pX + plusSize, pY));
g.DrawLine(nPen ,new Point(pX, pY - plusSize), new Point(pX, pY + plusSize));
}
else if (p.PolaritiesType.Equals(8))
{
//p.SizeX = 12;
//p.SizeY = 36;
int plusSize = p.SizeX / 2;
int pX = x + plusSize;
int pY = y + p.SizeY / 2 + lineLength + plusSize;
g.DrawLine(nPen, new Point(pX - plusSize, pY), new Point(pX + plusSize, pY));
g.DrawLine(nPen, new Point(pX, pY - plusSize), new Point(pX, pY + plusSize));
}
}
}
}