예제 #1
0
        /// <summary>
        /// The constructor receives the ellipsoid parameters and sets
        /// the corresponding state variables. If any errors occur, an
        /// exception is thrown with a description of the error.
        /// </summary>
        /// <param name="ellipsoidSemiMajorAxis">Semi-major axis of ellipsoid in meters</param>
        /// <param name="ellipsoidFlattening">Flattening of ellipsoid</param>
        /// <param name="ellipsoidCode">2-letter code for ellipsoid</param>
        public MGRS(double ellipsoidSemiMajorAxis, double ellipsoidFlattening, string ellipsoidCode)
        {
            double inv_f = 1 / ellipsoidFlattening;
            string errorStatus = "";

            if (ellipsoidSemiMajorAxis <= 0.0)
            { /* Semi-major axis must be greater than zero */
                errorStatus += ErrorMessages.semiMajorAxis;
            }
            if ((inv_f < 250) || (inv_f > 350))
            { /* Inverse flattening must be between 250 and 350 */
                errorStatus += ErrorMessages.ellipsoidFlattening;
            }

            if (errorStatus.Length > 0)
            {
                throw new ArgumentException(errorStatus);
            }

            this.semiMajorAxis = ellipsoidSemiMajorAxis;
            this.flattening = ellipsoidFlattening;
            this.ellipsoidCode = ellipsoidCode;

            ups = new UPS(this.semiMajorAxis, this.flattening);
            utm = new UTM(this.semiMajorAxis, this.flattening, 0);
        }
예제 #2
0
 public MGRS()
 {
     //this.CoordSys.getEllipsoidParameters(ref this.semiMajorAxis, ref this.flattening);
     this.ups = new UPS(this.semiMajorAxis, this.flattening);
     this.utm = new UTM(this.semiMajorAxis, this.flattening, 0);
 }