Retrieving a Position

This example shows how to get the current position. This example uses the INavigate61 (GetPosition) method.

 

privatevoid m_cNavigate()

        {

            try

            {

                var sgworld = new SGWorld61();

                // get our current position

                var currentPos = sgworld.Navigate.GetPosition(AltitudeTypeCode.ATC_TERRAIN_ABSOLUTE);

                // show details of current position

                MessageBox.Show(string.Format(

@"Current position in the world:

Altitude = {0}

AltitudeType = {1}

Distance = {2}

Yaw = {3}

Pitch = {4}

Roll = {5}

X = {6}

Y = {7}

", currentPos.Altitude,currentPos.AltitudeType,currentPos.Distance,currentPos.Yaw,currentPos.Pitch,currentPos.Roll, currentPos.X, currentPos.Y));

            }

            catch (Exception ex)

            {

                MessageBox.Show("Unexpected error: " + ex.Message);

            }

        }