Struct Bounds
- Namespace
- Tudormobile.Strava.Model
- Assembly
- Tudormobile.Strava.dll
Represents a rectangular geographic area defined by its southwest and northeast corner coordinates.
public struct Bounds
- Inherited Members
Remarks
The Bounds structure is typically used to specify a bounding box for map operations, such as searching for locations within a specific area or defining the visible region of a map. The southwest and northeast corners must be specified using valid latitude and longitude values. The structure does not enforce that the southwest corner is actually southwest of the northeast corner; it is the caller's responsibility to ensure the coordinates define a valid area.
Properties
NorthEastCorner
Gets or sets the coordinates of the north-east corner of the bounding area.
public LatLng NorthEastCorner { readonly get; set; }
Property Value
SouthWestCorner
Gets or sets the geographic coordinates of the southwest corner of the bounding area.
public LatLng SouthWestCorner { readonly get; set; }
Property Value
Methods
AsArray()
Returns the coordinates of the bounding box as an array of doubles.
public readonly double[] AsArray()
Returns
- double[]
A double array containing the latitude and longitude of the south-west and north-east corners, in the order: SouthWestCorner.Latitude, SouthWestCorner.Longitude, NorthEastCorner.Latitude, NorthEastCorner.Longitude.
FromCoordinates(double, double, double, double)
Creates a Bounds instance from four double values representing latitude and longitude coordinates.
public static Bounds FromCoordinates(double southWestLat, double southWestLng, double northEastLat, double northEastLng)
Parameters
southWestLatdoubleThe latitude of the southwest corner of the bounds.
southWestLngdoubleThe longitude of the southwest corner of the bounds.
northEastLatdoubleThe latitude of the northeast corner of the bounds.
northEastLngdoubleThe longitude of the northeast corner of the bounds.
Returns
- Bounds
A new Bounds instance.
ToString()
Returns a string that represents the bounding box using the coordinates of its southwest and northeast corners.
public override readonly string ToString()
Returns
- string
A string in the format "({SouthWestLatitude},{SouthWestLongitude}),({NorthEastLatitude},{NorthEastLongitude})" representing the bounding box coordinates.
Operators
implicit operator Bounds((double, double, double, double))
Converts a tuple containing four double values to a Bounds instance.
public static implicit operator Bounds((double, double, double, double) v)
Parameters
v(double, double, double, double)A tuple containing the minimum X, minimum Y, maximum X, and maximum Y coordinates, in that order.
Returns
Remarks
This operator enables implicit conversion from a tuple of four doubles to a Bounds object, allowing for concise initialization. The tuple elements must represent valid coordinates for the bounds.