-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSquareRadarItem.cs
108 lines (102 loc) · 2.39 KB
/
SquareRadarItem.cs
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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Drawing;
namespace Interface_RADAR
{
public class SquareRadarItem : RadarItem
{
int _id;
int _azimuth;
int _range;
int _width;
int _height;
DateTime _created = DateTime.Now;
public int ID
{
get
{
return _id;
}
}
public int Azimuth
{
get
{
return _azimuth;
}
set
{
_azimuth = value;
while (_azimuth < 0)
{
_azimuth += 360;
}
if (_azimuth >= 360)
_azimuth = _azimuth % 360;
}
}
public int Range
{
get
{
return _range;
}
set
{
_range = value;
if (_range > 90)
_range = 90;
else if (_range < 0)
_range = 0;
}
}
public int Height
{
get
{
return _height;
}
set
{
}
}
public int Width
{
get
{
return _width;
}
set
{
}
}
public DateTime Created
{
get
{
return _created;
}
}
public SquareRadarItem(int id, int size, int az, int rg)
{
_id = id;
_width = size;
_height = size;
_azimuth = az;
_range = rg;
}
public void DrawItem(Radar radar, Graphics g)
{
PointF cp = radar.AzRg2XY(_azimuth, _range);
PointF topLeft = new PointF(cp.X - ((float)_width / 2), cp.Y - ((float)_height / 2));
g.FillRectangle(new SolidBrush(radar.CustomLineColor), new RectangleF(topLeft, new SizeF((float)_width, (float)_height)));
}
public int CompareTo(RadarItem item)
{
return 0;
}
}
}