AsterixDisplayAnalyser.RngBrngMarker.OnRender C# (CSharp) Метод

OnRender() публичный Метод

public OnRender ( Graphics g ) : void
g System.Drawing.Graphics
Результат void
        public override void OnRender(Graphics g)
        {
            g.DrawLine(new Pen(Brush_To_Use), StartPosition, EndPosition);

            // select a reference elllipsoid
            Ellipsoid reference = Ellipsoid.WGS84;
            // instantiate the calculator
            GeodeticCalculator geoCalc = new GeodeticCalculator();
            GlobalPosition Start = new GlobalPosition(new GlobalCoordinates(this.Position.Lat, this.Position.Lng));
            PointLatLng End_LatLng = FormMain.FromLocalToLatLng(EndPosition.X, EndPosition.Y);
            GlobalPosition End = new GlobalPosition(new GlobalCoordinates(End_LatLng.Lat, End_LatLng.Lng));
            GeodeticMeasurement GM = geoCalc.CalculateGeodeticMeasurement(reference, Start, End);

            // Now compute position half way between two points.
            double distance = GM.PointToPointDistance / 2.0;
            if (distance > 0.0)
            {
                GlobalCoordinates GC = geoCalc.CalculateEndingGlobalCoordinates(reference, new GlobalCoordinates(this.Position.Lat, this.Position.Lng), GM.Azimuth, distance);
                GPoint GP = FormMain.FromLatLngToLocal(new PointLatLng(GC.Latitude.Degrees, GC.Longitude.Degrees));
                double Distane_NM = 0.00053996 * GM.PointToPointDistance;
                g.DrawString(Math.Round(GM.Azimuth.Degrees).ToString() + "°/" + Math.Round(Distane_NM, 1).ToString() + "nm", new Font(FontFamily.GenericSansSerif, 9), Brush_To_Use, new PointF(GP.X, GP.Y));
            }
        }