• Documentation
  • Core API
  • SmartOpenHamburg API
  • Model Components API
  • Common API

    Show / Hide Table of Contents
    • Mars.Components
      • DependencyRegistrationModelling
    • Mars.Components.Agents
      • AbstractAgent
      • AbstractEntity
      • Agent
    • Mars.Components.Environments
      • AbstractEnvironment
      • AbstractGraphElement
      • AlwaysPassingNodeGuard
      • EntityLane<TEntity>
      • GeoEnvironment
      • GeoHashEnvironment<T>
      • IEnvironmentMediator
      • IModalChoiceResolver
      • PathHeuristics
      • SpatialEdge
      • SpatialGraphEntityExtensions
      • SpatialGraphEnvironment
      • SpatialGraphHelper
      • SpatialHashEnvironment<TEntity>
      • SpatialNode
      • WorldIndexExtensions
    • Mars.Components.Environments.Cartesian
      • CartesianEnvironment<TEntity>
      • CollisionEnvironment<TCharacter, TObstacle>
      • CollisionKind
      • ConeExplorationView
      • ExplorationView
      • GeometryFactory
      • ICartesianEnvironment<TEntity>
      • ICharacter
      • ICollidable
      • ICollisionEnvironment<TCharacter, TObstacle>
      • IObstacle
      • IVisible
      • RayExplorationView
      • TrapezoidExploration
      • VisibilityKind
    • Mars.Components.Environments.Cartesian.Routing
      • CartesianRoutingService<TObstacle>
      • GeometryCoordinatesRoutingPointsGenerator
      • HomogenousRoutingPointsGenerator
      • IRoutingPointsGenerator
      • RandomRoutingPointsGenerator
      • SectionalRandomRoutingPointsGenerator
    • Mars.Components.Layers
      • AbstractActiveLayer
      • AbstractEnvelopedLayer
      • AbstractLayer
      • AbstractVectorFeature
      • AgentSchedulerLayer<TAgent, TLayer>
      • QuerySourceLoader
      • RasterLayer
      • SchedulerEntry
      • SchedulerLayer
      • VectorFeature
      • VectorLayer
      • VectorLayer<T>
      • VectorLayerHelper
    • Mars.Components.Layers.Temporal
      • IQueryFieldProvider
      • ITemporalObjectCatalog
      • ITemporalObjectIterator
      • TemporalCatalogFeature<TKey>
      • TemporalFeatureKind
      • TemporalMetadataLoader
    • Mars.Components.Services
      • AgentManager
    • Mars.Components.Services.Explorations
      • BoltzmannExploration
      • EpsilonGreedyExploration
      • IExplorationPolicy
      • RouletteWheelExploration
      • TabuSearchExploration
    • Mars.Components.Services.Learning
      • InfiniteQLearning
      • QLearning
      • Sarsa
    • Mars.Components.Services.Planning
      • ActionPlanResult
      • GoapAction
      • GoapAgentStates
      • GoapGoal
      • GoapPlanner
      • GoapStateKey<T>
      • GoapStateProperty
      • GoapStateProperty<TElement>
      • IGoapAction
      • IGoapAgentStates
      • IGoapGoal
      • IGoapPlanner
      • IGoapStateKey
      • StatesCommons
    • Mars.Components.Services.Planning.ActionCommons
      • AllGoalsSatisfiedAction
      • NoGoalReachableAction
    • Mars.Components.Starter
      • Command
      • CommandArgumentContainer
      • CommandParser
      • CommandSet
      • HelpCommand
      • Option
      • OptionContext
      • OptionException
      • OptionSet
      • OptionValueCollection
      • OptionValueType
      • SimulationStarter
    • Mars.Components.Starter.Exceptions
      • SimulationStartupException
    • Mars.Interfaces
      • IModelObject
      • ISimulationContainer
      • ISimulationContext
      • ISimulationModule
      • ISimulationState
      • IStepExecutionContext
      • SimulationContext
      • SimulationContext.WorkflowStateType
    • Mars.Interfaces.Agents
      • IAgent
      • IAgent<TLayer>
      • IEntity
      • IMarsDslAgent
      • IModalCapabilitiesAgent
      • ISpatialGraphEntity
      • ITickClient
    • Mars.Interfaces.Annotations
      • ActiveConstructor
      • PropertyDescription
    • Mars.Interfaces.Data
      • AbstractDomainData
      • GeometryData
      • IDomainData
      • IGeometryData
      • IIdentifiableData
      • IMarsFeature
      • IRasterBandData
      • ISource
      • IStringData
      • IStringStructuredData
      • IStructuredData
      • IStructuredDataGeometry
      • IValueData
      • LayerInitData
      • RasterBandData
      • StringDataDto
      • StructuredData
      • VectorStructuredData
    • Mars.Interfaces.Environments
      • BoundingBox
      • DirectionType
      • EdgeExploreResult
      • EdgeStop
      • ExploreDirection
      • GeoPositionExtension
      • HighwayType
      • IEdge<TEdge, TNode>
      • IEntityLane<TEntity>
      • IEnvironment
      • IEnvironment<TEntity>
      • IGeoGridEnvironment<T>
      • IGraphEntity
      • IGraphEnvironment<TEdge, TNode>
      • INode<TEdge, TNode>
      • INodeGuard
      • IPositionable
      • IRoutePlanner
      • ISpatialEdge
      • ISpatialGraphEnvironment
      • ISpatialLane
      • ISpatialNode
      • LaneExploreResult
      • ModalChoice
      • MultimodalRoute
      • NodeIntegrationKind
      • Position
      • Route
      • RouteStop
      • Size
      • SpatialGraphExploreResult
      • SpatialModalityType
      • TrafficLightPhase
    • Mars.Interfaces.Layers
      • FinallySimulationStep
      • IChangingLayer
      • IDataContainer
      • IDataLayer
      • IDataSet
      • IEnvelopDataLayer
      • ILayer
      • IMarsDslLayer
      • IModalChoiceConsumer
      • InitSimulationStep
      • INotifyChangedSource<T>
      • IRaster<TValue>
      • IRasterLayer
      • ISteppedActiveLayer
      • IVectorFeature
      • IVectorLayer
      • IVectorLayer<T>
      • IVectorNode<TEntity>
      • RegisterAgent
      • UnregisterAgent
    • Mars.Interfaces.Model
      • ActiveTypeMapping
      • AgentMapping
      • AgentType
      • ConstructorType
      • ContainsOperator
      • DataContainer
      • DataType
      • EntityMapping
      • EntityType
      • Execution
      • FeatureType
      • Globals
      • IdentifiableElement
      • IndividualMapping
      • Input
      • InputConfiguration
      • LayerMapping
      • LayerType
      • ModelDescription
      • ModelElement
      • ObjectType
      • Output
      • OutputConfiguration
      • OutputFilter
      • OutputKind
      • OutputTargetType
      • ParameterMapping
      • Processing
      • ProcessingConfiguration
      • ProcessingTargetType
      • PropertyType
      • SimulationConfig
      • TimeSpanUnit
      • TimeSpanUnitExtensions
      • TypeElement
      • TypeMapping
    • Mars.Interfaces.Model.Converters
      • CultureConverter
      • SerializationTypeConverter
      • TimeSpanUnitConverter
    • Mars.Interfaces.Model.Exceptions
      • InvalidTypeException
      • MissingTypeException
    • Mars.Interfaces.Model.Options
      • AbstractEndpointOptions
      • AbstractFileOptions
      • AbstractOptions
      • AscOptions
      • CsvOptions
      • GeoJsonOptions
      • MongoOptions
      • MqttOptions
      • PostgresSqlOptions
      • RedisOptions
      • RelationalEndpointOptions
      • SerializationType
      • SocketOutputOptions
      • SpatialGraphOptions
      • SqLiteOptions
      • TripsOptions

    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
    ICloneable
    Position
    Implements
    IComparable
    IComparable<Position>
    Namespace: Mars.Interfaces.Environments
    Assembly: Mars.Interfaces.dll
    Syntax
    public sealed class Position : ICloneable, IComparable, IComparable<Position>

    Constructors

    Position()

    Creates a Position at (0,0).
    Declaration
    public Position()

    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
    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.

    Position(Double, Double, Double)

    Declaration
    public Position(double x, double y, double z)
    Parameters
    Type Name Description
    System.Double x
    System.Double y
    System.Double z

    Position(Double[])

    Declaration
    public Position(double[] positionArray)
    Parameters
    Type Name Description
    System.Double[] positionArray

    Properties

    Bearing

    Declaration
    public double Bearing { get; set; }
    Property Value
    Type Description
    System.Double

    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

    Latitude

    The latitude (y-position) interpreted value of this position in degree within value range -90 to +90
    Declaration
    public double Latitude { get; set; }
    Property Value
    Type Description
    System.Double

    Longitude

    The longitude (x-position) interpreted value of this position in degree within value range -180 to +180
    Declaration
    public double Longitude { get; set; }
    Property Value
    Type Description
    System.Double

    PositionArray

    Gets the position with (longitude, latitude) or (x,y) in form of an array
    Declaration
    public double[] PositionArray { get; set; }
    Property Value
    Type Description
    System.Double[]

    X

    The x-position on a 2D-cartesian plane
    Declaration
    public double X { get; set; }
    Property Value
    Type Description
    System.Double

    Y

    The y-position on a 2D-cartesian plane
    Declaration
    public double Y { get; set; }
    Property Value
    Type Description
    System.Double

    Methods

    Clone()

    Create a new object as copy of this instance.
    Declaration
    public object Clone()
    Returns
    Type Description
    System.Object A new instance of this position object with the exact same values.

    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.

    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.

    Copy()

    Create a new object as copy of this instance.
    Declaration
    public Position Copy()
    Returns
    Type Description
    Position A new instance of this position object with the exact same values.

    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
    Type Description
    Position A new Position object

    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
    Type Description
    Position A new Position object.

    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
    Type Description
    Position

    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.

    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.

    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

    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)

    Operators

    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.

    Division(Position, Double)

    Declaration
    public static Position operator /(Position lhs, double scalar)
    Parameters
    Type Name Description
    Position lhs
    System.Double scalar
    Returns
    Type Description
    Position

    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

    IComparable
    IComparable<>

    Extension Methods

    GeoPositionExtension.DistanceInKmTo(Position, Position)
    GeoPositionExtension.DistanceInMTo(Position, Position)
    GeoPositionExtension.DistanceInMTo(Position, Double, Double)
    Back to top Copyright © MARS GROUP.
    HAW Hamburg