예제 #1
0
 /// <summary>
 /// Create a new geographical coordinate or position on a map.
 /// </summary>
 /// <param name="Latitude">The Latitude (south to nord).</param>
 /// <param name="Longitude">The Longitude (parallel to equator).</param>
 /// <param name="Altitude">The (optional) Altitude.</param>
 /// <param name="Projection">The gravitational model or projection of the geo coordinates.</param>
 /// <param name="Planet">The planet.</param>
 public GeoCoordinate(Latitude Latitude,
                      Longitude Longitude,
                      Altitude?Altitude             = null,
                      GravitationalModel Projection = GravitationalModel.WGS84,
                      Planets Planet = Planets.Earth)
 {
     this.Latitude   = Latitude;
     this.Longitude  = Longitude;
     this.Altitude   = Altitude ?? new Altitude?();
     this.Projection = Projection;
     this.Planet     = Planet;
 }
예제 #2
0
        /// <summary>
        /// Create a new geographical coordinate or position on a map.
        /// </summary>
        /// <param name="Latitude">The Latitude (south to nord).</param>
        /// <param name="Longitude">The Longitude (parallel to equator).</param>
        /// <param name="Altitude">The (optional) Altitude.</param>
        /// <param name="Projection">The gravitational model or projection of the geo coordinates.</param>
        /// <param name="Planet">The planet.</param>
        public GeoCoordinate(Latitude Latitude,
                             Longitude Longitude,
                             Altitude?Altitude             = null,
                             GravitationalModel Projection = GravitationalModel.WGS84,
                             Planets Planet = Planets.Earth)
        {
            #region Initial checks

            if (Latitude < MinLatitude)
            {
                throw new ArgumentException("The latitude value must be at least " + MinLatitude + "°!", nameof(Latitude));
            }

            if (Latitude > MaxLatitude)
            {
                throw new ArgumentException("The latitude value must be at most " + MaxLatitude + "°!", nameof(Latitude));
            }

            if (Longitude < MinLongitude)
            {
                throw new ArgumentException("The longitude value must be at least " + MinLongitude + "°!", nameof(Longitude));
            }

            if (Longitude > MaxLongitude)
            {
                throw new ArgumentException("The longitude value must be at most " + MaxLongitude + "°!", nameof(Longitude));
            }

            #endregion

            this.Latitude   = Latitude;
            this.Longitude  = Longitude;
            this.Altitude   = Altitude ?? new Altitude?();
            this.Projection = Projection;
            this.Planet     = Planet;
        }