AsterixDisplayAnalyser.GeoCordSystemDegMinSecUtilities.ConvertDecimalToDegMinSec C# (CSharp) Метод

ConvertDecimalToDegMinSec() публичный статический Метод

public static ConvertDecimalToDegMinSec ( LatLongDecimal InData ) : LatLongDegMinSec
InData LatLongDecimal
Результат LatLongDegMinSec
        public static LatLongDegMinSec ConvertDecimalToDegMinSec(LatLongDecimal InData)
        {
            LatLongDegMinSec OutData = new LatLongDegMinSec();

            /////////////////////////////
            // Define localac temp data
            int Num1;
            int Num2;
            double Num3;
            double Temp;

            ///////////////////////////////////////////////////////////////////////////////////////
            // First convert latitude
            double TempLatitude;
            if (InData.LatitudeDecimal < 0.0)
            {
                OutData.Latitude.Prefix = LatLongPrefix.S;
                TempLatitude = InData.LatitudeDecimal * -1.0;
            }
            else
            {
                OutData.Latitude.Prefix = LatLongPrefix.N;
                TempLatitude = InData.LatitudeDecimal;
            }

            // DEG
            Num1 = (int)Math.Floor(TempLatitude);
            // MIN
            Temp = TempLatitude - Math.Floor(TempLatitude);
            Temp = Temp * 60.0;
            Num2 = (int)Math.Floor(Temp);
            // SEC
            Temp = Temp - (int)Math.Floor(Temp);
            Temp = Temp * 60.0;
            Num3 = Temp;

            OutData.Latitude.Deg = Num1;
            OutData.Latitude.Min = Num2;
            OutData.Latitude.Sec = Num3;

            ///////////////////////////////////////////////////////////////////////////////////////
            // Then convert longitude
            double TempLongitudeDec;
            if (InData.LongitudeDecimal < 0.0)
            {
                OutData.Longitude.Prefix = LatLongPrefix.W;
                TempLongitudeDec = InData.LongitudeDecimal * -1.0;
            }
            else
            {
                OutData.Longitude.Prefix = LatLongPrefix.E;
                TempLongitudeDec = InData.LongitudeDecimal;
            }
            // DEG
            Num1 = (int)Math.Floor(TempLongitudeDec);
            // MIN
            Temp = TempLongitudeDec - Math.Floor(TempLongitudeDec);
            Temp = Temp * 60.0;
            Num2 = (int)Math.Floor(Temp);
            // SEC
            Temp = Temp - (int)Math.Floor(Temp);
            Temp = Temp * 60.0;
            Num3 = (int)Math.Floor(Temp);

            OutData.Longitude.Deg = Num1;
            OutData.Longitude.Min = Num2;
            OutData.Longitude.Sec = Num3;

            return OutData;
        }