• 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 SpatialEdge

    Represents a spatial or geometric edge of this graph which is able to persist and to manage entities on a continuous geometric line in meters.
    Inheritance
    System.Object
    AbstractGraphElement
    SpatialEdge
    Implements
    IEquatable<AbstractGraphElement>
    ISpatialEdge
    IEdge<ISpatialEdge, ISpatialNode>
    IGraphEntity
    IEqualityComparer<IGraphEntity>
    Inherited Members
    AbstractGraphElement.Equals(AbstractGraphElement)
    AbstractGraphElement.Index
    AbstractGraphElement.Equals(IGraphEntity, IGraphEntity)
    AbstractGraphElement.GetHashCode(IGraphEntity)
    AbstractGraphElement.GetHashCode()
    AbstractGraphElement.Equals(Object)
    Namespace: Mars.Components.Environments
    Assembly: Mars.Components.dll
    Syntax
    public class SpatialEdge : AbstractGraphElement, IEquatable<AbstractGraphElement>, ISpatialEdge, IEdge<ISpatialEdge, ISpatialNode>, IGraphEntity, IEqualityComparer<IGraphEntity>

    Constructors

    SpatialEdge()

    Declaration
    public SpatialEdge()

    SpatialEdge(ISpatialNode, ISpatialNode)

    Creates a new instance of the SpatialEdge without source or target.
    Declaration
    public SpatialEdge(ISpatialNode from, ISpatialNode to)
    Parameters
    Type Name Description
    ISpatialNode from
    ISpatialNode to

    SpatialEdge(ISpatialNode, ISpatialNode, Double, Int32, SpatialModalityType[])

    Creates a new instance of the directed ISpatialEdge with no parent graph environment
    Declaration
    public SpatialEdge(ISpatialNode from, ISpatialNode to, double length, int laneCount = 1, SpatialModalityType[] passableTypes = null)
    Parameters
    Type Name Description
    ISpatialNode from The origin of this edge
    ISpatialNode to The target of this edge
    System.Double length The length of this spatial edge
    System.Int32 laneCount The amount of lanes of this spatial edge.
    SpatialModalityType[] passableTypes The set of SpatialModalityTypes which can access this edge.

    Properties

    Attributes

    Gets all all data associated to this edge get out by the importer from the provided source
    Declaration
    public IDictionary<string, object> Attributes { get; set; }
    Property Value
    Type Description
    IDictionary<System.String, System.Object>

    DataLaneCount

    Gets or sets the LaneCount without initialization.
    Declaration
    public int DataLaneCount { get; set; }
    Property Value
    Type Description
    System.Int32

    DataLanes

    Gets or sets the SpatialLanes without initialization.
    Declaration
    public List<SpatialLane> DataLanes { get; set; }
    Property Value
    Type Description
    List<SpatialLane>

    DataModalities

    Gets or sets the Modalities without initialization.
    Declaration
    public ISet<SpatialModalityType> DataModalities { get; set; }
    Property Value
    Type Description
    ISet<SpatialModalityType>

    DataModalityLaneRanges

    Gets or sets the DataModalityLaneRanges without initialization.
    Declaration
    public IDictionary<SpatialModalityType, > DataModalityLaneRanges { get; set; }
    Property Value
    Type Description
    IDictionary<SpatialModalityType, System.>

    EdgeConnections

    Gets or sets the EdgeData assigned to the representing road.
    Declaration
    public List<EdgeData> EdgeConnections { get; }
    Property Value
    Type Description
    List<EdgeData>

    Entities

    Gets all the entities on this edge as a readonly collection.
    Declaration
    public IReadOnlyCollection<ISpatialGraphEntity> Entities { get; }
    Property Value
    Type Description
    IReadOnlyCollection<ISpatialGraphEntity>

    EntityLanes

    Gets the internal index maintaining all entities positioned along an edge and separated into multiple lane by the index of the outer array.
    Declaration
    public List<IEntityLane<ISpatialGraphEntity>> EntityLanes { get; set; }
    Property Value
    Type Description
    List<IEntityLane<ISpatialGraphEntity>>

    From

    The starting point (node) of the edge
    Declaration
    public ISpatialNode From { get; }
    Property Value
    Type Description
    ISpatialNode

    FromNode

    Gets or sets the key used to identify the From node.
    Declaration
    public int FromNode { get; set; }
    Property Value
    Type Description
    System.Int32
    Remarks
    This property is only be used for de-/serialization purposes.

    Geometry

    Gets the line and curve form of this spatial edge as a set of ordered geospatial points.
    Declaration
    public Position[] Geometry { get; set; }
    Property Value
    Type Description
    Position[]

    GeometryLength

    Gets the line with each element representing the length codes as integer (value * 10000) until this point. This is helper collection to improve the lookup for nearest coordinates along the path in log(log(n) complexity, performed by the interpolation search (Geometry).
    Declaration
    public int[] GeometryLength { get; set; }
    Property Value
    Type Description
    System.Int32[]

    HighwayType

    Gets or sets the highway kind of this road segment.
    Declaration
    public HighwayType HighwayType { get; set; }
    Property Value
    Type Description
    HighwayType

    IsOneWay

    Gets or sets a flag indicating that this edge has no opposite edge.
    Declaration
    public bool IsOneWay { get; set; }
    Property Value
    Type Description
    System.Boolean

    LaneCount

    The amount of lanes where agents can be placed on.
    Declaration
    public int LaneCount { get; set; }
    Property Value
    Type Description
    System.Int32

    Lanes

    Gets the lanes of this road edge.
    Declaration
    public IEnumerable<ISpatialLane> Lanes { get; }
    Property Value
    Type Description
    IEnumerable<ISpatialLane>

    Length

    Gets the length in meters of this spatial edge
    Declaration
    public double Length { get; set; }
    Property Value
    Type Description
    System.Double

    MaxSpeed

    Defines the max speed for this edge in m/s. If the attribute value holds multiple max speeds, then the min value is chosen.
    Declaration
    public double MaxSpeed { get; set; }
    Property Value
    Type Description
    System.Double

    Modalities

    Gets or sets the modalities, identified as string to distinguish imported multiple graphs.
    Declaration
    public ISet<SpatialModalityType> Modalities { get; }
    Property Value
    Type Description
    ISet<SpatialModalityType>

    ModalityLaneRanges

    Gets the mapping of each SpatialModalityType to their lane range on this edge e.g. CarDriving --> (0,1) Cycling --> (2,2)
    Declaration
    public IDictionary<SpatialModalityType, > ModalityLaneRanges { get; set; }
    Property Value
    Type Description
    IDictionary<SpatialModalityType, System.>

    RoadArea

    Gets the polygon representing the area of this road segment.
    Declaration
    public Polygon RoadArea { get; set; }
    Property Value
    Type Description
    Polygon

    SpatialEdgeLock

    Gets the lock to handle concurrency on the edge.
    Declaration
    public ReaderWriterLockSlim SpatialEdgeLock { get; }
    Property Value
    Type Description
    ReaderWriterLockSlim

    SpatialLanes

    Gets or sets the individual lane array describing each lane with restrictions, geometry and width.
    Declaration
    public List<SpatialLane> SpatialLanes { get; set; }
    Property Value
    Type Description
    List<SpatialLane>
    Examples
    ______________________________________ [ | | driving [_ _ _ _ _ _ | | [ | | driving,cycling [_ _ _ _ _ _ | Intersection | [#####################| | cycling,walking [/\/\/\/\/\/\/\/\/\/ >| | walking [O O O O O O O O O O >|______________|

    To

    The end point (node) of the edge
    Declaration
    public ISpatialNode To { get; }
    Property Value
    Type Description
    ISpatialNode

    ToNode

    Gets or sets the key used to identify the To node.
    Declaration
    public int ToNode { get; set; }
    Property Value
    Type Description
    System.Int32
    Remarks
    This property is only be used for de-/serialization purposes.

    TravelTime

    Gets the static travel time in seconds required to cross this edge when the max-speed restrictions and the length are considered.
    Declaration
    public double TravelTime { get; }
    Property Value
    Type Description
    System.Double

    Methods

    Clear()

    Removes all entities on this edge.
    Declaration
    public void Clear()

    Explore(ISpatialGraphEntity, Double, ISpatialEdge)

    Explore the agents surroundings
    Declaration
    public EdgeExploreResult Explore(ISpatialGraphEntity entity, double distance = null, ISpatialEdge nextEdge = null)
    Parameters
    Type Name Description
    ISpatialGraphEntity entity the agent around the explore takes place
    System.Double distance determines which objects the agent see's objects that are farther ahead than "distance" will not be returned
    ISpatialEdge nextEdge the next edge the agent will move to after traversing the current edge
    Returns
    Type Description
    EdgeExploreResult an edge explore result which contains the found agents

    Explore(ISpatialGraphEntity, Double, Boolean, ExploreDirection, ISpatialEdge, Int32[])

    Explore the agents surrounded entities for a specified distance in meters and a selected set of lanes or the whole ISpatialEdge if nothing was defined. Every entity what can be see within the distance are collected. Explored entities will be returned grouped by lane in the EdgeExploreResult and ordered by the distance to the outgoing source agent.
    Declaration
    public EdgeExploreResult Explore(ISpatialGraphEntity entity, double distance, bool onlyNext = false, ExploreDirection direction = ExploreDirection.Forward, ISpatialEdge nextEdge = null, params int[] lanes)
    Parameters
    Type Name Description
    ISpatialGraphEntity entity The outgoing agent specifying the source the exploration.
    System.Double distance The exploration distance in meters.
    System.Boolean onlyNext The flag indicating that no the entity behind another one with different position shall be explored. Default is false so that each entity also them behind the next one will be collected.
    ExploreDirection direction The direction of the exploration. Default is forward same direction as the edge.
    ISpatialEdge nextEdge The next edge the agent will move to after traversing the current edge.
    System.Int32[] lanes The selected lanes to explore as indices, starting with 0. If no lane was passed each lane will be queried.
    Returns
    Type Description
    EdgeExploreResult An EdgeExploreResult containing a grouping of explores by each lane. Each lane exploration is ordered by the distance of the object to the source.

    Explore(Double, Double, Boolean, ExploreDirection, ISpatialEdge, Int32[])

    Explore the agents surrounded entities for a specified distance in meters and a selected set of lanes or the whole ISpatialEdge if nothing was defined. Every entity what can be see within the distance are collected. Explored entities will be returned grouped by lane in the EdgeExploreResult and ordered by the distance to the outgoing source agent.
    Declaration
    public EdgeExploreResult Explore(double source, double distance, bool onlyNext = false, ExploreDirection direction = ExploreDirection.Both, ISpatialEdge nextEdge = null, params int[] lanes)
    Parameters
    Type Name Description
    System.Double source The outgoing source position from which to start the exploration.
    System.Double distance The exploration distance in meters.
    System.Boolean onlyNext The flag indicating that no the entity behind another one with different position shall be explored. Default is false so that each entity also them behind the next one will be collected.
    ExploreDirection direction The direction of the exploration. Default is forward same direction as the edge.
    ISpatialEdge nextEdge The next edge the agent will move to after traversing the current edge.
    System.Int32[] lanes The selected lanes to explore as indices, starting with 0. If no lane was passed each lane will be queried.
    Returns
    Type Description
    EdgeExploreResult An EdgeExploreResult containing a grouping of explores by each lane. Each lane exploration is ordered by the distance of the object to the source.

    ExploreInLaneOnEdge(ISpatialGraphEntity, Double)

    Declaration
    public int ExploreInLaneOnEdge(ISpatialGraphEntity entity, double distance = null)
    Parameters
    Type Name Description
    ISpatialGraphEntity entity
    System.Double distance
    Returns
    Type Description
    System.Int32

    Insert(ISpatialGraphEntity, Double, Int32)

    Add an entity to the edge
    Declaration
    public bool Insert(ISpatialGraphEntity entity, double position, int laneIndex)
    Parameters
    Type Name Description
    ISpatialGraphEntity entity The respective entity to insert
    System.Double position The position it should be inserted
    System.Int32 laneIndex The lane it should be inserted
    Returns
    Type Description
    System.Boolean true -> entity was inserted at desired position and lane false -> the entity was already on the edge or the desired position is already occupied or the desired position is ahead of another entity which would result in an unwanted overtaking maneuver

    InsertUnsafe(ISpatialGraphEntity, Double, Int32)

    Add an entity to the edge
    Declaration
    public bool InsertUnsafe(ISpatialGraphEntity entity, double position, int laneIndex)
    Parameters
    Type Name Description
    ISpatialGraphEntity entity The respective entity to insert
    System.Double position The position it should be inserted
    System.Int32 laneIndex The lane it should be inserted
    Returns
    Type Description
    System.Boolean true -> entity was inserted at desired position and lane false -> the entity was already on the edge or the desired position is already occupied or the desired position is ahead of another entity which would result in an unwanted overtaking maneuver

    IsLaneFree(Int32)

    Declaration
    public bool IsLaneFree(int lane)
    Parameters
    Type Name Description
    System.Int32 lane
    Returns
    Type Description
    System.Boolean

    Merge(EdgeData)

    Initialize and merges each lanes from given EdgeData.
    Declaration
    public void Merge(EdgeData laneEdges)
    Parameters
    Type Name Description
    EdgeData laneEdges

    Move(ISpatialGraphEntity, Double, Int32)

    Move an entity on the edge
    Declaration
    public bool Move(ISpatialGraphEntity entity, double distance, int desiredLane)
    Parameters
    Type Name Description
    ISpatialGraphEntity entity the entity to move
    System.Double distance the distance the entity shall be moved forth
    System.Int32 desiredLane the lane the entities wants to move on. This can either be his current lane which or another lane (overtaking maneuver)
    Returns
    Type Description
    System.Boolean an edge move results which contains information about the movement like a success statement and the entities new position (if successfully)

    PosAt(ISpatialGraphEntity, Double, Int32)

    Declaration
    public bool PosAt(ISpatialGraphEntity entity, double position, int desiredLaneIndex)
    Parameters
    Type Name Description
    ISpatialGraphEntity entity
    System.Double position
    System.Int32 desiredLaneIndex
    Returns
    Type Description
    System.Boolean

    Remove(ISpatialGraphEntity)

    Remove an entity from the edge and from the respective lane
    Declaration
    public bool Remove(ISpatialGraphEntity entity)
    Parameters
    Type Name Description
    ISpatialGraphEntity entity The respective entity to remove.
    Returns
    Type Description
    System.Boolean true -> entity was removed false -> entity wasn't on the edge or the remove failed

    RemoveUnsafe(ISpatialGraphEntity, Int32)

    Provides a custom remove operation based on specific passed position value, where look at on the specified lane to remove the desired entity.
    Declaration
    public bool RemoveUnsafe(ISpatialGraphEntity entity, int lane = 0)
    Parameters
    Type Name Description
    ISpatialGraphEntity entity The entity to remove.
    System.Int32 lane The concrete or maybe last lane on which to remove the entity. Default is 0
    Returns
    Type Description
    System.Boolean Returns true, when the old entry was successfully removed with the passed pos, otherwise false.

    Implements

    IEquatable<>
    ISpatialEdge
    IEdge<TEdge, TNode>
    IGraphEntity
    IEqualityComparer<>
    Back to top Copyright © MARS GROUP.
    HAW Hamburg