Class GeoHashEnvironment<T>
This class provides a geo-based environment with CRS projected to EPSG:4326 (WGS:84).
The environment provides a spatial index in which insert, remove, move (update) and query (read)
operations are provided, used on conjunction with concrete entity type
implementing
IPositionable.
Inheritance
System.Object
GeoHashEnvironment<T>
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Assembly: Mars.Components.dll
Syntax
public class GeoHashEnvironment<T> : GeoEnvironment, IGeoGridEnvironment<T>, IEnvironment<T>, IEnvironment, IModelObject where T : IPositionable, IEntity
Type Parameters
Properties
|
Improve this Doc
View Source
Entities
Gets all containing entities within this environment
and their actual GeoHash where they are located.
Declaration
public IDictionary<T, string> Entities { get; }
Property Value
Type |
Description |
System.Collections.Generic.IDictionary<T, System.String> |
|
|
Improve this Doc
View Source
GeoHashPrecision
Gets the hash precision of this environment.
Declaration
public GeoHashPrecision GeoHashPrecision { get; }
Property Value
Methods
|
Improve this Doc
View Source
BuildByBBox(BoundingBox, Double)
Constructs a new
GeoHashEnvironment<T> for the specified bounding box
where the BBOX will be slitted into multiple cells by the
.
E.g. the call
BuildByBBox(-0.489, 51.28, 0.236, 51.686, 10)
would create
a bounding box over the city of london with a grid size of 10 metres and resulting
x-dimension of
and y-dimension of
.
Declaration
public static GeoHashEnvironment<T> BuildByBBox(BoundingBox boundingBox, double cellSizeInM)
Parameters
Type |
Name |
Description |
BoundingBox |
boundingBox |
The bounding box containing the envelopment.. |
System.Double |
cellSizeInM |
The size of each geohash-cell |
Returns
|
Improve this Doc
View Source
BuildByBBox(Double, Double, Double, Double, Boolean)
Constructs a new
GeoHashEnvironment<T> for the specified bounding box
E.g. the call
BuildByBBox(-0.489, 51.28, 0.236, 51.686, 10)
would create
a bounding box over the city of london
Declaration
public static GeoHashEnvironment<T> BuildByBBox(double minLongitude, double minLatitude, double maxLongitude, double maxLatitude, bool withBoundaries = false)
Parameters
Type |
Name |
Description |
System.Double |
minLongitude |
The longitude or x coordinate of the lower-left corner in degree eg. -0.489. |
System.Double |
minLatitude |
The latitude or y coordinate of the lower left corner in degree e.g. 51.28. |
System.Double |
maxLongitude |
The longitude or x coordinate of the upper-right corner in degree e.g. 0.236. |
System.Double |
maxLatitude |
The latitude or y coordinate of the upper-right corner in degree e.g. 51.686. |
System.Boolean |
withBoundaries |
The flag indicating whether the environment shall check the movements outside the
boundaries.
|
Returns
|
Improve this Doc
View Source
BuildByBBox(Double, Double, Double, Double, Double)
Constructs a new
GeoHashEnvironment<T> for the specified bounding box
where the BBOX will be slitted into multiple cells by the
.
E.g. the call
BuildByBBox(-0.489, 51.28, 0.236, 51.686, 10)
would create
a bounding box over the city of london with a grid size of 10 metres and resulting
x-dimension of
and y-dimension of
.
Declaration
public static GeoHashEnvironment<T> BuildByBBox(double minLongitude, double minLatitude, double maxLongitude, double maxLatitude, double cellSizeInM)
Parameters
Type |
Name |
Description |
System.Double |
minLongitude |
The longitude or x coordinate of the lower-left corner in degree eg. -0.489. |
System.Double |
minLatitude |
The latitude or y coordinate of the lower left corner in degree e.g. 51.28. |
System.Double |
maxLongitude |
The longitude or x coordinate of the upper-right corner in degree e.g. 0.236. |
System.Double |
maxLatitude |
The latitude or y coordinate of the upper-right corner in degree e.g. 51.686. |
System.Double |
cellSizeInM |
The size of each geohash-cell |
Returns
|
Improve this Doc
View Source
BuildEnvironment(Double, Double, Double, Double, Boolean)
This class provides a geo-based environment with CRS projected to EPSG:4326 (WGS:84).
The environment provides a spatial index in which insert, remove, move (update) and query (read)
operations are provided, used on conjunction with concrete entity type
implementing
IPositionable.
Declaration
public static GeoHashEnvironment<T> BuildEnvironment(double topLat, double bottomLat, double leftLong, double rightLong, bool withBoundaries = false)
Parameters
Type |
Name |
Description |
System.Double |
topLat |
|
System.Double |
bottomLat |
|
System.Double |
leftLong |
|
System.Double |
rightLong |
|
System.Boolean |
withBoundaries |
|
Returns
|
Improve this Doc
View Source
BuildEnvironment(Double, Double, Double, Double, Int32)
The factory method provides a utility function to construct a geo-based
GeoHashEnvironment<T>
by giving a bounding box of the considered environment.
Declaration
public static GeoHashEnvironment<T> BuildEnvironment(double topLat, double bottomLat, double leftLong, double rightLong, int cellSizeInM)
Parameters
Type |
Name |
Description |
System.Double |
topLat |
The uppermost away latitude (y-value) of the bounding box, anywhere on the upper line. |
System.Double |
bottomLat |
The lowest away latitude (y-value) of the bounding box, anywhere on the upper line. |
System.Double |
leftLong |
The most left-side away longitude (x-value) of the bounding box, anywhere on the upper line. |
System.Double |
rightLong |
The right-side away longitude (x-value) of the bounding box, anywhere on the upper line. |
System.Int32 |
cellSizeInM |
The granularity of the environment in meters. |
Returns
|
Improve this Doc
View Source
Explore(Position, Double, Int32, Func<T, Boolean>)
Queries the a set of nearest entities around the
position
with with optional specified radius
and count for the positioning system of the
IEnvironment.
Declaration
public IEnumerable<T> Explore(Position position = null, double radius = -1, int count = -1, Func<T, bool> predicate = null)
Parameters
Type |
Name |
Description |
Position |
position |
The Position from which the exploration shall be started. |
System.Double |
radius |
The range of the exploration circle. |
System.Int32 |
count |
The amount of entities to find. |
System.Func<T, System.Boolean> |
predicate |
A predicate to select only specific entities based on a condition. |
Returns
Type |
Description |
System.Collections.Generic.IEnumerable<T> |
An distance based order from the nearest entity to tha farthest |
|
Improve this Doc
View Source
Explore(Double, Double, Double, Int32, Func<T, Boolean>)
This class provides a geo-based environment with CRS projected to EPSG:4326 (WGS:84).
The environment provides a spatial index in which insert, remove, move (update) and query (read)
operations are provided, used on conjunction with concrete entity type
implementing
IPositionable.
Declaration
public IEnumerable<T> Explore(double latitude, double longitude, double radius = -1, int count = -1, Func<T, bool> predicate = null)
Parameters
Type |
Name |
Description |
System.Double |
latitude |
Latitude of search point |
System.Double |
longitude |
Longitude of search point |
System.Double |
radius |
The maximum distance to search to in meters. |
System.Int32 |
count |
Define the maximum results wanted.
When
count
lower or equal -1 everything will be returned.
|
System.Func<T, System.Boolean> |
predicate |
An optional predicate. Will be evaluated
for every found item. Only those items returning true, are returned
|
Returns
Type |
Description |
System.Collections.Generic.IEnumerable<T> |
List with found items, empty list if none were found. |
|
Improve this Doc
View Source
Explore(Double[], Double, Int32, Func<T, Boolean>)
Queries the a set of nearest entities around the with
with optional specified radius and count
Declaration
public IEnumerable<T> Explore(double[] position, double radius = -1, int count = -1, Func<T, bool> predicate = null)
Parameters
Type |
Name |
Description |
System.Double[] |
position |
The discrete position from which the exploration shall be calculated |
System.Double |
radius |
The radius of exploration range |
System.Int32 |
count |
The amount of entities to find |
System.Func<T, System.Boolean> |
predicate |
A predicate to filter specific entities |
Returns
Type |
Description |
System.Collections.Generic.IEnumerable<T> |
An distance based order from the nearest entity to tha farthest |
|
Improve this Doc
View Source
GetNearest(Position, Double, Func<T, Boolean>)
Declaration
public T GetNearest(Position gpsCoordinate, double maxDistanceInM = -1, Func<T, bool> predicate = null)
Parameters
Type |
Name |
Description |
Position |
gpsCoordinate |
|
System.Double |
maxDistanceInM |
|
System.Func<T, System.Boolean> |
predicate |
|
Returns
|
Improve this Doc
View Source
GetNearest(Double, Double, Double, Func<T, Boolean>)
This class provides a geo-based environment with CRS projected to EPSG:4326 (WGS:84).
The environment provides a spatial index in which insert, remove, move (update) and query (read)
operations are provided, used on conjunction with concrete entity type
implementing
IPositionable.
Declaration
public T GetNearest(double latitude, double longitude, double maxDistanceInM = -1, Func<T, bool> predicate = null)
Parameters
Type |
Name |
Description |
System.Double |
latitude |
Latitude of search point |
System.Double |
longitude |
Longitude of search point |
System.Double |
maxDistanceInM |
Maximum distance to search to in meters. |
System.Func<T, System.Boolean> |
predicate |
An optional predicate. Will be evaluated for the found items.
The nearest item returning true will be returned.
|
Returns
Type |
Description |
T |
The nearest item or default(T) if not found |
|
Improve this Doc
View Source
Insert(T)
Inserts an positionable entity into the environment defined by their
Declaration
public bool Insert(T entity)
Parameters
Type |
Name |
Description |
T |
entity |
The entity to passionate. |
Returns
Type |
Description |
System.Boolean |
Returns True if the entity was successfully inserted |
|
Improve this Doc
View Source
MoveTo(T, Position, Double, Func<Double[], Boolean>)
Moves an
entity
to the destination of type
Position along an optimal ray path with
minimal costs. Note that his method does not guarantee to reach the destination.
Declaration
public Position MoveTo(T entity, Position geoCoordinate, double distanceInMeter = 1.7976931348623157E+308, Func<double[], bool> predicate = null)
Parameters
Type |
Name |
Description |
T |
entity |
The entity to move. |
Position |
geoCoordinate |
The target destination coordinate. |
System.Double |
distanceInMeter |
The distance in meters to move |
System.Func<System.Double[], System.Boolean> |
predicate |
The predicate along the movement which need to be valid or null |
Returns
Type |
Description |
Position |
Returns the new position of the entity > or null if no positioning happened. |
|
Improve this Doc
View Source
MoveTo(T, Double, Double, Double, Func<Double[], Boolean>)
This class provides a geo-based environment with CRS projected to EPSG:4326 (WGS:84).
The environment provides a spatial index in which insert, remove, move (update) and query (read)
operations are provided, used on conjunction with concrete entity type
implementing
IPositionable.
Declaration
public Position MoveTo(T entity, double x, double y, double distanceInMeter = 1.7976931348623157E+308, Func<double[], bool> predicate = null)
Parameters
Type |
Name |
Description |
T |
entity |
|
System.Double |
x |
|
System.Double |
y |
|
System.Double |
distanceInMeter |
|
System.Func<System.Double[], System.Boolean> |
predicate |
|
Returns
|
Improve this Doc
View Source
MoveTo(T, Double[], Double, Func<Double[], Boolean>)
Moves an entity
to destination along an optimal path with
minimal costs. Note that his method does not guarantee to reach the destination.
Declaration
public Position MoveTo(T entity, double[] position = null, double distanceInMeter = 1.7976931348623157E+308, Func<double[], bool> predicate = null)
Parameters
Type |
Name |
Description |
T |
entity |
|
System.Double[] |
position |
The discrete position target |
System.Double |
distanceInMeter |
The distance to move |
System.Func<System.Double[], System.Boolean> |
predicate |
The predicate along the movement which need to be valid or null |
Returns
Type |
Description |
Position |
Returns the new position of the entity > or null if no positioning happened. |
|
Improve this Doc
View Source
MoveToPosition(T, Double, Double)
This class provides a geo-based environment with CRS projected to EPSG:4326 (WGS:84).
The environment provides a spatial index in which insert, remove, move (update) and query (read)
operations are provided, used on conjunction with concrete entity type
implementing
IPositionable.
Declaration
public Position MoveToPosition(T objectToMove, double latitudeDestination, double longitudeDestination)
Parameters
Type |
Name |
Description |
T |
objectToMove |
|
System.Double |
latitudeDestination |
|
System.Double |
longitudeDestination |
|
Returns
|
Improve this Doc
View Source
MoveTowards(T, DirectionType, Double)
Moves an entity
the travelling distance distanceToPass
towards the direction
with a fixed bearing.
Declaration
public Position MoveTowards(T entity, DirectionType direction, double distanceToPass = 0)
Parameters
Type |
Name |
Description |
T |
entity |
The entity to move |
DirectionType |
direction |
One of the eight direction on a 2D plane, including diagonal |
System.Double |
distanceToPass |
The distance units to pass. |
Returns
Type |
Description |
Position |
Returns the new position of the entity or null if no positioning happened.
|
|
Improve this Doc
View Source
MoveTowards(T, Double, Double)
Moves an entity
the travelling distance distanceToPass
towards the bearing
direction.
Declaration
public Position MoveTowards(T entity, double bearing, double distanceToPass = 0)
Parameters
Type |
Name |
Description |
T |
entity |
The entity to move |
System.Double |
bearing |
The bearing in degree in value range 0-360 |
System.Double |
distanceToPass |
The distance in meters to pass. |
Returns
Type |
Description |
Position |
Returns the new position of the entity > or null if no positioning happened. |
|
Improve this Doc
View Source
PosAt(T, Double, Double)
This class provides a geo-based environment with CRS projected to EPSG:4326 (WGS:84).
The environment provides a spatial index in which insert, remove, move (update) and query (read)
operations are provided, used on conjunction with concrete entity type
implementing
IPositionable.
Declaration
public Position PosAt(T entity, double longitude, double latitude)
Parameters
Type |
Name |
Description |
T |
entity |
|
System.Double |
longitude |
|
System.Double |
latitude |
|
Returns
|
Improve this Doc
View Source
PosAt(T, Double[])
This class provides a geo-based environment with CRS projected to EPSG:4326 (WGS:84).
The environment provides a spatial index in which insert, remove, move (update) and query (read)
operations are provided, used on conjunction with concrete entity type
implementing
IPositionable.
Declaration
public Position PosAt(T entity, double[] position)
Parameters
Type |
Name |
Description |
T |
entity |
|
System.Double[] |
position |
|
Returns
|
Improve this Doc
View Source
Remove(T)
Removes the entity item from the environment at the defined
Position
over the
IPositionable implementation of
entity
.
Declaration
public bool Remove(T entity)
Parameters
Type |
Name |
Description |
T |
entity |
The entity and position to remove |
Returns
Type |
Description |
System.Boolean |
Returns True if the entity was successfully removed |
Implements
Extension Methods