public RadarHandler(PictureBox _radarPictureBox) { radarPictureBox = _radarPictureBox; radar = new Radar(radarPictureBox.Width); StaticRadarItems = new SquareRadarItem[3]; for (int i = 0; i < 3; i++) { StaticRadarItems[i] = new SquareRadarItem(i, 8, 0, 0); } StaticRadarItems[2].Azimuth = 45; StaticRadarItems[0].Azimuth = 315; DynamicRadarItems = new CircleRadarItem[9]; for (int i = 0; i < 9; i++) { DynamicRadarItems[i] = new CircleRadarItem(i + 5, 8, 0, 0); } DynamicRadarItems[0].Azimuth = 360 - 90; DynamicRadarItems[1].Azimuth = 360 - 67; DynamicRadarItems[2].Azimuth = 360 - 45; DynamicRadarItems[3].Azimuth = 360 - 22; DynamicRadarItems[4].Azimuth = 0; DynamicRadarItems[5].Azimuth = 22; DynamicRadarItems[6].Azimuth = 45; DynamicRadarItems[7].Azimuth = 67; DynamicRadarItems[8].Azimuth = 90; RearRadarItem = new TriangleRadarItem(4, 8, 180, 0); radar.ImageUpdate += new ImageUpdateHandler(_radar_ImageUpdate); radar.DrawScanInterval = 60; radar.DrawScanLine = true; }
public void DrawItem(Radar radar, Graphics g) { PointF cp = radar.AzEl2XY(_azimuth, _elevation); PointF topLeft = new PointF(cp.X - ((float)_width / 2), cp.Y - ((float)_height / 2)); g.FillEllipse(new SolidBrush(radar.CustomLineColor), new RectangleF(topLeft, new SizeF((float)_width, (float)_height))); }
public void DrawItem(Radar radar, Graphics g) { PointF cp = radar.AzEl2XY(_azimuth, _elevation); PointF _topLeft = new PointF(cp.X - ((float)_width / 2), cp.Y - ((float)_height / 2)); PointF p1 = new PointF(((float)_topLeft.X + ((float)_width / 2F)), (float)_topLeft.Y); PointF p2 = new PointF((float)_topLeft.X, (float)_topLeft.Y + (float)_height); PointF p3 = new PointF((float)_topLeft.X + (float)_width, (float)_topLeft.Y + (float)_height); _gp = new GraphicsPath(FillMode.Winding); _gp.AddPolygon(new PointF[] { p1, p2, p3 }); g.FillPath(new SolidBrush(radar.CustomLineColor), _gp); }
public void DrawItem(Radar radar, Graphics g) { PointF cp = radar.AzEl2XY(_azimuth, _elevation); PointF topLeft = new PointF(cp.X - ((float)_width / 2), cp.Y - ((float)_height / 2)); string itemTag = IsRecent ? this.Mmsi.ToString() : String.Format("{0} ({1})", this.Mmsi, AisData.LocalTime.ToString("HH:mm")); g.FillEllipse(new SolidBrush(IsRecent ? radar.CustomLineColor : Color.Gray), new RectangleF(topLeft, new SizeF((float)_width, (float)_height))); g.DrawString(itemTag, new Font("Digital-7", 13F), new SolidBrush(IsRecent ? Color.Yellow : Color.Gray), new PointF(topLeft.X + _width + 4, topLeft.Y)); }
//Radar //---------------------------------------------------------------------- private void radarTabPage_Show() { if (!this.topTabControl.Controls.Contains(this.radarTabPage)) this.topTabControl.TabPages.Add(this.radarTabPage); radar = new Radar(radarPictureBox.Width); StaticRadarItems = new SquareRadarItem[3]; for (int i = 0; i < 3; i++) { StaticRadarItems[i] = new SquareRadarItem(i, 8, 0, 0); } StaticRadarItems[2].Azimuth = 45; StaticRadarItems[0].Azimuth = 315; DynamicRadarItems = new CircleRadarItem[9]; for (int i = 0; i < 9; i++) { DynamicRadarItems[i] = new CircleRadarItem(i + 5, 8, 0, 0); } DynamicRadarItems[0].Azimuth = 360 - 90; DynamicRadarItems[1].Azimuth = 360 - 67; DynamicRadarItems[2].Azimuth = 360 - 45; DynamicRadarItems[3].Azimuth = 360 - 22; DynamicRadarItems[4].Azimuth = 0; DynamicRadarItems[5].Azimuth = 22; DynamicRadarItems[6].Azimuth = 45; DynamicRadarItems[7].Azimuth = 67; DynamicRadarItems[8].Azimuth = 90; RearRadarItem = new TriangleRadarItem(4, 8, 180, 0); radar.ImageUpdate += new ImageUpdateHandler(_radar_ImageUpdate); radar.DrawScanInterval = 60; radar.DrawScanLine = true; }
private void RadarWindow_Load(object sender, EventArgs e) { aisReg.OnAISNodeDiscovery += new EventHandler<AISNodeDiscoveryEventArgs>(Registry_OnAISNodeDiscovery); aisReg.OnAISNodeUpdate += new EventHandler<AISNodeUpdateEventArgs>(Registry_OnAISNodeUpdate); _radar = new Radar(pictureBox1.Width); pictureBox1.Image = _radar.Image; _radar.ImageUpdate += new ImageUpdateHandler(_radar_ImageUpdate); _radar.DrawScanInterval = 60; _radar.DrawScanLine = true; lock (aisReg) { foreach (KeyValuePair<string, ReceiveAISEventArgs> pair in aisReg) { AddNode(pair.Value); } } }