Beispiel #1
0
        /// <summary>
        /// Implements string representation of DMM for longitudes
        /// </summary>
        /// <param name="wholeDegrees"></param>
        /// <param name="decimalMinutes"></param>
        /// <param name="sign"></param>
        /// <param name="options"></param>
        /// <returns></returns>
        protected override string ToStringDMM(DMMComponents dmm, GeoAngleFormatOptions options)
        {
            string rc     = null;
            char   letter = dmm.get_sign() < 0 ? 'W' : 'E';

            if (options == GeoAngleFormatOptions.Compact)
            {
                rc = string.Format("{0:000}{1:00.0000},{2}", dmm.get_wholeDegrees(), dmm.get_decimalMinutes(), letter);
            }
            else
            {
                rc = string.Format("{0}{1} {2:0.######}'", dmm.get_sign() * dmm.get_wholeDegrees(), Strings.degrees, dmm.get_decimalMinutes());
            }
            return(rc);
        }
Beispiel #2
0
        public DMSComponents(double degrees)
        {
            // ... Compute DMM
            DMMComponents dmm = new DMMComponents(degrees);

            _sign         = dmm.get_sign();
            _wholeDegrees = dmm.get_wholeDegrees();
            _wholeMinutes = (int)Math.Floor(dmm.get_decimalMinutes());
            double fraction = dmm.get_decimalMinutes() - _wholeMinutes;

            _decimalSeconds = fraction * 60;
        }