-
Notifications
You must be signed in to change notification settings - Fork 1
/
GMapMarkerHexaX.cs
46 lines (42 loc) · 1.79 KB
/
GMapMarkerHexaX.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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using GMap.NET;
using GMap.NET.WindowsForms;
using System.Drawing;
using System.Drawing.Drawing2D;
namespace JCFLIGHTGCS
{
class GMapMarkerHexaX : GMapMarker
{
const float rad2deg = (float)(180 / Math.PI);
const float deg2rad = (float)(1.0 / rad2deg);
static readonly System.Drawing.Size SizeSt = new System.Drawing.Size(global::JCFLIGHTGCS.Properties.Resources.HexaX.Width, global::JCFLIGHTGCS.Properties.Resources.HexaX.Height);
float heading = 0;
float cog = -1;
float target = -1;
public GMapMarkerHexaX(PointLatLng p, float heading, float cog, float target)
: base(p)
{
this.heading = heading;
this.cog = cog;
this.target = target;
Size = SizeSt;
}
public override void OnRender(Graphics g)
{
Matrix temp = g.Transform;
g.TranslateTransform(LocalPosition.X, LocalPosition.Y);
Image pic = global::JCFLIGHTGCS.Properties.Resources.HexaX;
int length = 250;
g.DrawLine(new Pen(Color.Red, 2), 0.0f, 0.0f, (float)Math.Cos((heading - 90) * deg2rad) * length, (float)Math.Sin((heading - 90) * deg2rad) * length);
g.DrawLine(new Pen(Color.Black, 2), 0.0f, 0.0f, (float)Math.Cos((cog - 90) * deg2rad) * length, (float)Math.Sin((cog - 90) * deg2rad) * length);
g.DrawLine(new Pen(Color.Orange, 2), 0.0f, 0.0f, (float)Math.Cos((target - 90) * deg2rad) * length, (float)Math.Sin((target - 90) * deg2rad) * length);
g.RotateTransform(heading);
g.DrawImageUnscaled(pic, pic.Width / -2 - 4, pic.Height / -2);
g.Transform = temp;
}
}
}