Class Position
This class is used to store position objects for a 2-dimensional Cartesian plane.
It is the the value type for holding the position information with x and y value.
In addition it also used to represent geospatial referenced positions which are enhanced with invariants.
The Mars.Interfaces.Environment.IPosittionable ist strongly coupled to this.
Unlike objects of type GeoAPI.Geometries.Point (which contain additional
information that an entity has position, a Position only contains
the ordinate values and properties.
Positions are two-dimensional points.
Inheritance
System.Object
Position
Implements
System.ICloneable
System.IComparable
Inherited Members
System.Object.Equals(System.Object, System.Object)
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
Assembly: Mars.Interfaces.dll
Syntax
[Serializable]
[MessagePackObject(false)]
public sealed class Position : ICloneable, IComparable, IComparable<Position>
Constructors
|
Improve this Doc
View Source
Position()
Creates a Position at (0,0).
Declaration
|
Improve this Doc
View Source
Position(Double, Double, Double)
This class is used to store position objects for a 2-dimensional Cartesian plane.
It is the the value type for holding the position information with x and y value.
In addition it also used to represent geospatial referenced positions which are enhanced with invariants.
The Mars.Interfaces.Environment.IPosittionable ist strongly coupled to this.
Unlike objects of type GeoAPI.Geometries.Point (which contain additional
information that an entity has position, a Position only contains
the ordinate values and properties.
Positions are two-dimensional points.
Declaration
public Position(double x, double y, double z)
Parameters
Type |
Name |
Description |
System.Double |
x |
|
System.Double |
y |
|
System.Double |
z |
|
|
Improve this Doc
View Source
Position(Double, Double)
A protected constructor to create instances of the
Position
When you want to access this from outside use the factory methods
CreatePosition
or
CreateGeoPosition(Double, Double) for geospatial referenced positions.
Declaration
[JsonConstructor]
public Position(double x, double y)
Parameters
Type |
Name |
Description |
System.Double |
x |
The component of the x-axis. |
System.Double |
y |
The component of the y-axis. |
|
Improve this Doc
View Source
Position(Double[])
This class is used to store position objects for a 2-dimensional Cartesian plane.
It is the the value type for holding the position information with x and y value.
In addition it also used to represent geospatial referenced positions which are enhanced with invariants.
The Mars.Interfaces.Environment.IPosittionable ist strongly coupled to this.
Unlike objects of type GeoAPI.Geometries.Point (which contain additional
information that an entity has position, a Position only contains
the ordinate values and properties.
Positions are two-dimensional points.
Declaration
public Position(double[] positionArray)
Parameters
Type |
Name |
Description |
System.Double[] |
positionArray |
|
Properties
|
Improve this Doc
View Source
Bearing
This class is used to store position objects for a 2-dimensional Cartesian plane.
It is the the value type for holding the position information with x and y value.
In addition it also used to represent geospatial referenced positions which are enhanced with invariants.
The Mars.Interfaces.Environment.IPosittionable ist strongly coupled to this.
Unlike objects of type GeoAPI.Geometries.Point (which contain additional
information that an entity has position, a Position only contains
the ordinate values and properties.
Positions are two-dimensional points.
Declaration
[IgnoreMember]
[JsonIgnore]
public double Bearing { get; set; }
Property Value
Type |
Description |
System.Double |
|
|
Improve this Doc
View Source
Item[Int32]
Access the 2-dimensional components x and y over an index access e.g.
position[0]
to get the x-component of the position and
position[1]
to get the y-component of the position
Declaration
public double this[int index] { get; set; }
Parameters
Type |
Name |
Description |
System.Int32 |
index |
The index within the 2-dimensional space |
Property Value
Type |
Description |
System.Double |
|
Exceptions
Type |
Condition |
System.IndexOutOfRangeException |
If the index access lies outside 2D |
|
Improve this Doc
View Source
Latitude
The latitude (y-position) interpreted value of this position
in degree within value range -90 to +90
Declaration
[IgnoreMember]
[JsonIgnore]
public double Latitude { get; set; }
Property Value
Type |
Description |
System.Double |
|
|
Improve this Doc
View Source
Longitude
The longitude (x-position) interpreted value of this position
in degree within value range -180 to +180
Declaration
[IgnoreMember]
[JsonIgnore]
public double Longitude { get; set; }
Property Value
Type |
Description |
System.Double |
|
|
Improve this Doc
View Source
PositionArray
Gets the position with (longitude, latitude) or (x,y) in form of an array
Declaration
[Key(0)]
[JsonProperty("position", NullValueHandling = NullValueHandling.Ignore)]
public double[] PositionArray { get; set; }
Property Value
Type |
Description |
System.Double[] |
|
|
Improve this Doc
View Source
X
The x-position on a 2D-cartesian plane
Declaration
[IgnoreMember]
[JsonIgnore]
public double X { get; set; }
Property Value
Type |
Description |
System.Double |
|
|
Improve this Doc
View Source
Y
The y-position on a 2D-cartesian plane
Declaration
[IgnoreMember]
[JsonIgnore]
public double Y { get; set; }
Property Value
Type |
Description |
System.Double |
|
Methods
|
Improve this Doc
View Source
Clone()
Create a new object as copy of this instance.
Declaration
Returns
Type |
Description |
System.Object |
A new instance of this position object with the exact same values. |
|
Improve this Doc
View Source
CompareTo(Position)
Compares this object with the specified object for order.
Since Coordinates are 2D, this routine focus only on the x and y value for comparison.
Returns
-1 : this.x lower than other.x || ((this.x == other.x) AND (this.y lower than other.y))
0 : this.x == other.x AND this.y = other.y
1 : this.x greater than other.x || ((this.x == other.x) AND (this.y greater than other.y))
Declaration
public int CompareTo(Position other)
Parameters
Type |
Name |
Description |
Position |
other |
Position with which this Position is being compared. |
Returns
Type |
Description |
System.Int32 |
A negative integer, zero, or a positive integer as this Coordinate
is less than, equal to, or greater than the specified Coordinate.
|
|
Improve this Doc
View Source
CompareTo(Object)
Compares this object with the specified object for order.
Since Coordinates are 2D, this routine focus only on the x and y value for comparison.
Returns
-1 : this.x lowerthan other.x || ((this.x == other.x) AND (this.y lowerthan other.y))
0 : this.x == other.x AND this.y = other.y
1 : this.x greaterthan other.x || ((this.x == other.x) AND (this.y greaterthan other.y))
Declaration
public int CompareTo(object obj)
Parameters
Type |
Name |
Description |
System.Object |
obj |
Position with which this Position is being compared. |
Returns
Type |
Description |
System.Int32 |
A negative integer, zero, or a positive integer as this Coordinate
is less than, equal to, or greater than the specified Coordinate.
|
|
Improve this Doc
View Source
Copy()
Create a new object as copy of this instance.
Declaration
Returns
Type |
Description |
Position |
A new instance of this position object with the exact same values. |
|
Improve this Doc
View Source
CreateGeoPosition(Double, Double)
Creates an instance of the
Position with passed geo-referenced
position longitude and latitude.
Declaration
public static Position CreateGeoPosition(double longitude, double latitude)
Parameters
Type |
Name |
Description |
System.Double |
longitude |
The longitude value in degree. |
System.Double |
latitude |
The latitude value in degree. |
Returns
Exceptions
Type |
Condition |
System.ArgumentException |
The latitude or longitude value is outside their value range. |
|
Improve this Doc
View Source
CreatePosition(Double, Double)
Creates a new instance of the
Position with 2D-cartesian position x and y.
Declaration
public static Position CreatePosition(double x, double y)
Parameters
Type |
Name |
Description |
System.Double |
x |
The x position of the position. |
System.Double |
y |
The y position of the position. |
Returns
|
Improve this Doc
View Source
CreatePosition(Double[])
Creates a new instance of the
Position with 2D-cartesian position array
as input.
Declaration
public static Position CreatePosition(double[] coordinates)
Parameters
Type |
Name |
Description |
System.Double[] |
coordinates |
The 2d-cartesian input |
Returns
|
Improve this Doc
View Source
Equals(Object)
Checks whether the specified object is equal to the current object.
Declaration
public override bool Equals(object obj)
Parameters
Type |
Name |
Description |
System.Object |
obj |
The object to compare with the current object. |
Returns
Type |
Description |
System.Boolean |
true if the specified object is equal to the current object; otherwise, false. |
Overrides
System.Object.Equals(System.Object)
|
Improve this Doc
View Source
GetHashCode()
Serves as the default hash function for value types
with no additional garbage.
Declaration
public override int GetHashCode()
Returns
Type |
Description |
System.Int32 |
An integer hash code for the current object. |
Overrides
System.Object.GetHashCode()
|
Improve this Doc
View Source
ToLatLonString()
Provides a lat-lon-representation for fast usage in other tools.
Declaration
public string ToLatLonString()
Returns
Type |
Description |
System.String |
string with lat and lon, in this order |
|
Improve this Doc
View Source
ToString()
Returns a string of the form (x,y) .
Declaration
public override string ToString()
Returns
Type |
Description |
System.String |
string of the form (x,y) |
Overrides
System.Object.ToString()
Operators
|
Improve this Doc
View Source
Addition(Position, Position)
The vector addition operator for 2D position object.s
This operation creates a new Position object.
Declaration
public static Position operator +(Position lhs, Position rhs)
Parameters
Type |
Name |
Description |
Position |
lhs |
left hand side of the position vector |
Position |
rhs |
right hand side of the position vector |
Returns
Type |
Description |
Position |
Returns a new position where the left hand side is added by the right one. |
|
Improve this Doc
View Source
Division(Position, Double)
This class is used to store position objects for a 2-dimensional Cartesian plane.
It is the the value type for holding the position information with x and y value.
In addition it also used to represent geospatial referenced positions which are enhanced with invariants.
The Mars.Interfaces.Environment.IPosittionable ist strongly coupled to this.
Unlike objects of type GeoAPI.Geometries.Point (which contain additional
information that an entity has position, a Position only contains
the ordinate values and properties.
Positions are two-dimensional points.
Declaration
public static Position operator /(Position lhs, double scalar)
Parameters
Type |
Name |
Description |
Position |
lhs |
|
System.Double |
scalar |
|
Returns
|
Improve this Doc
View Source
Subtraction(Position, Position)
The vector subtraction operator for 2D position object.s
This operation creates a new Position object.
Declaration
public static Position operator -(Position lhs, Position rhs)
Parameters
Type |
Name |
Description |
Position |
lhs |
left hand side of the position vector |
Position |
rhs |
right hand side of the position vector |
Returns
Type |
Description |
Position |
Returns a new position where the left hand side is subtracted by the right one. |
Implements
System.ICloneable
System.IComparable
System.IComparable<T>
Extension Methods