Class GeoBoundingBox
- Namespace
- Trellis.Primitives
- Assembly
- Trellis.Primitives.dll
One non-wrapping latitude/longitude rectangle used as a conservative geographic query prefilter.
public sealed class GeoBoundingBox : ValueObject, IComparable<ValueObject>, IComparable, IEquatable<ValueObject>
- Inheritance
-
GeoBoundingBox
- Implements
- Inherited Members
- Extension Methods
Remarks
Longitude always increases from MinimumLongitude to MaximumLongitude. A search area that crosses the antimeridian is represented by two boxes in GeoBounds, never by a box whose minimum longitude is greater than its maximum.
Properties
MaximumLatitude
Gets the inclusive northern latitude in decimal degrees.
public double MaximumLatitude { get; }
Property Value
MaximumLongitude
Gets the inclusive eastern longitude in decimal degrees.
public double MaximumLongitude { get; }
Property Value
MinimumLatitude
Gets the inclusive southern latitude in decimal degrees.
public double MinimumLatitude { get; }
Property Value
MinimumLongitude
Gets the inclusive western longitude in decimal degrees.
public double MinimumLongitude { get; }
Property Value
World
Gets a box covering every valid coordinate.
public static GeoBoundingBox World { get; }
Property Value
Methods
Contains(GeoCoordinate)
Checks whether the coordinate's stored components fall inside this rectangle.
public bool Contains(GeoCoordinate coordinate)
Parameters
coordinateGeoCoordinateThe coordinate to test.
Returns
Exceptions
- ArgumentNullException
coordinateis null.
GetEqualityComponents(ref EqualityComponents)
When overridden in a derived class, adds the components that define equality for this value object.
protected override void GetEqualityComponents(ref EqualityComponents components)
Parameters
componentsEqualityComponentsThe sink that collects this value object's equality components.
Examples
protected override void GetEqualityComponents(ref EqualityComponents components)
{
components.Add(Street);
components.Add(City);
components.Add(PostalCode);
}
Remarks
This method is used by Equals(ValueObject?), GetHashCode(), and CompareTo(ValueObject?) to determine equality and ordering. Components must be added in a consistent order.
Guidelines:
- Add all properties that define the value object's identity
- For derived classes, call
base.GetEqualityComponents(ref components)first - Add components in a consistent, deterministic order
- Do not allocate: the sink exists so comparisons stay allocation-free