Class Location

Namespace
SIMDispatcher.Core.Models
Assembly
SIMDispatcher.Core.dll

Represents a geographical location, including details such as address, point of interest, coordinates, and location accuracy. This record is used throughout the dispatch system to manage and validate the positions of units and incidents.

public record Location : IComparable<Location>, IComparable, IEquatable<Location>
Inheritance
Location
Implements
Inherited Members

Properties

Accuracy

Specifies the accuracy of the coordinates from the geocoding process.

public LocationAccuracy Accuracy { get; set; }

Property Value

LocationAccuracy

Address

Primary address details of the location.

public required Address Address { get; set; }

Property Value

Address

Coordinates

Geographical coordinates of the location.

public Coordinates? Coordinates { get; set; }

Property Value

Coordinates?

HouseNumber

House number at the location, if applicable.

public string? HouseNumber { get; set; }

Property Value

string

Poi

Point of interest associated with the location, if applicable.

public Poi? Poi { get; set; }

Property Value

Poi

Methods

CompareTo(Location?)

Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.

public int CompareTo(Location? other)

Parameters

other Location

An object to compare with this instance.

Returns

int

A value that indicates the relative order of the objects being compared. The return value has these meanings:

Value Meaning
Less than zero This instance precedes other in the sort order.
Zero This instance occurs in the same position in the sort order as other.
Greater than zero This instance follows other in the sort order.

CompareTo(object?)

Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.

public int CompareTo(object? obj)

Parameters

obj object

An object to compare with this instance.

Returns

int

A value that indicates the relative order of the objects being compared. The return value has these meanings:

Value Meaning
Less than zero This instance precedes obj in the sort order.
Zero This instance occurs in the same position in the sort order as obj.
Greater than zero This instance follows obj in the sort order.

Exceptions

ArgumentException

obj is not the same type as this instance.

CreateInstance(Address)

Creates a new Location instance directly from an address without associated point of interest or additional details.

public static Location CreateInstance(Address address)

Parameters

address Address

The address to convert into a location.

Returns

Location

A new Location instance based solely on the provided address.

CreateInstance(Poi)

Creates a new Location instance based on a point of interest, setting coordinates and address data accordingly.

public static Location CreateInstance(Poi poi)

Parameters

poi Poi

The point of interest from which to create the location.

Returns

Location

A new Location instance with details filled from the POI.

GetUniqueKey()

Generates a unique key for the location to verify that units arrive at the communicated spot. The key format varies depending on the presence of a point of interest.

public string GetUniqueKey()

Returns

string

A string representing a unique identifier for the location based on its properties.

ToString()

Returns a string that represents the current object.

public override string ToString()

Returns

string

A string that represents the current object.