/// <param name="latitude"> /// the latitude coordinate in degrees. </param> /// <param name="longitude"> /// the longitude coordinate in degrees. </param> /// <param name="validate"> </param> /// <exception cref="IllegalArgumentException"> /// if a coordinate is invalid. </exception> public LatLong(double latitude, double longitude, bool validate) { if (validate) { LatLongUtils.ValidateLatitude(latitude); LatLongUtils.ValidateLongitude(longitude); } this.Latitude = latitude; this.Longitude = longitude; }
/// <param name="minLatitude"> /// the minimum latitude coordinate in degrees. </param> /// <param name="minLongitude"> /// the minimum longitude coordinate in degrees. </param> /// <param name="maxLatitude"> /// the maximum latitude coordinate in degrees. </param> /// <param name="maxLongitude"> /// the maximum longitude coordinate in degrees. </param> /// <exception cref="IllegalArgumentException"> /// if a coordinate is invalid. </exception> public BoundingBox(double minLatitude, double minLongitude, double maxLatitude, double maxLongitude) { LatLongUtils.ValidateLatitude(minLatitude); LatLongUtils.ValidateLongitude(minLongitude); LatLongUtils.ValidateLatitude(maxLatitude); LatLongUtils.ValidateLongitude(maxLongitude); if (minLatitude > maxLatitude) { throw new System.ArgumentException("invalid latitude range: " + minLatitude + ' ' + maxLatitude); } else if (minLongitude > maxLongitude) { throw new System.ArgumentException("invalid longitude range: " + minLongitude + ' ' + maxLongitude); } this.MinLatitude = minLatitude; this.MinLongitude = minLongitude; this.MaxLatitude = maxLatitude; this.MaxLongitude = maxLongitude; }