/// <returns><c>true</c> if this geo area contains the provided point, <c>false</c> otherwise.</returns> /// <param name="point">The point coordinates to check.</param> public bool Contains(GeoPoint point) { return(Contains(point.Latitude, point.Longitude)); }
/// <summary> /// Shorten this full Open Location Code by removing four or six digits (depending on the provided reference point). /// It removes as many digits as possible. /// </summary> /// <returns>A new <see cref="ShortCode"/> instance shortened from this Open Location Code.</returns> /// <param name="referencePoint">The reference point coordinates</param> /// <exception cref="InvalidOperationException">If this code is padded (<see cref="IsPadded()"/>).</exception> /// <exception cref="ArgumentException">If the reference point is too far from this code's center point.</exception> /// <remarks>Convenient alternative to <see cref="Shorten(double, double)"/></remarks> public ShortCode Shorten(GeoPoint referencePoint) { return(Shorten(referencePoint.Latitude, referencePoint.Longitude)); }
/// <summary> /// Encodes geographic point coordinates into a full Open Location Code of the provided length. /// </summary> /// <returns>The encoded Open Location Code.</returns> /// <param name="point">The geographic point coordinates.</param> /// <param name="codeLength">The number of digits in the code (Default: <see cref="CodePrecisionNormal"/>).</param> /// <exception cref="ArgumentException">If the code length is not valid.</exception> /// <remarks>Alternative too <see cref="Encode(double, double, int)"/></remarks> public static string Encode(GeoPoint point, int codeLength = CodePrecisionNormal) { return(Encode(point.Latitude, point.Longitude, codeLength)); }
/// <summary> /// Creates an <see cref="OpenLocationCode"/> object encoded from the provided geographic point coordinates /// with the provided code length. /// </summary> /// <param name="point">The geographic coordinate point.</param> /// <param name="codeLength">The desired number of digits in the code (Default: <see cref="CodePrecisionNormal"/>).</param> /// /// <exception cref="ArgumentException">If the code length is not valid.</exception> /// <remarks>Alternative to <see cref="OpenLocationCode(double, double, int)"/></remarks> public OpenLocationCode(GeoPoint point, int codeLength = CodePrecisionNormal) : this(point.Latitude, point.Longitude, codeLength) { }