Class SpatialGraph
This graph holds edges and nodes by their keys for fast import, export and access.
Inheritance
System.Object
SpatialGraph
Implements
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()
Namespace: Mars.Common.Collections.Graph
Assembly: Mars.Common.dll
Syntax
[MessagePackObject(true)]
public class SpatialGraph : ISpatialGraph
Constructors
| Improve this Doc View SourceSpatialGraph()
Standard constructor for deserialize purposes.
Declaration
public SpatialGraph()
SpatialGraph(Input)
Creates a new SpatialGraph from a concrete
import source.
Declaration
public SpatialGraph(Input import)
Parameters
| Type | Name | Description |
|---|---|---|
| Input | import | The graph data source to import. |
SpatialGraph(SpatialGraphOptions)
This graph holds edges and nodes by their keys for fast import, export and access.
Declaration
public SpatialGraph(SpatialGraphOptions imports)
Parameters
| Type | Name | Description |
|---|---|---|
| SpatialGraphOptions | imports |
SpatialGraph(IReadOnlyCollection<Input>)
This graph holds edges and nodes by their keys for fast import, export and access.
Declaration
public SpatialGraph(IReadOnlyCollection<Input> imports)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Collections.Generic.IReadOnlyCollection<Input> | imports |
SpatialGraph(Nullable<Double>, String, Boolean)
Import a network file into the SpatialGraph structure.
Declaration
public SpatialGraph(double? nodeTolerance, string value, bool bidirectional = false)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Nullable<System.Double> | nodeTolerance | Slower init methodology that allows to find nodes in a tolerance distance. |
| System.String | value | The value to load into the network. |
| System.Boolean | bidirectional | Flag to import each edge in both direction. |
SpatialGraph(String, Nullable<Double>, Boolean)
Import a network file into the SpatialGraph structure.
Declaration
public SpatialGraph(string file, double? nodeTolerance = null, bool bidirectional = false)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | file | The file path to the network file. |
| System.Nullable<System.Double> | nodeTolerance | Slower init methodology that allows to find nodes in a tolerance distance. |
| System.Boolean | bidirectional | Flag to import each edge in both direction. |
Properties
| Improve this Doc View SourceBoundingBox
This graph holds edges and nodes by their keys for fast import, export and access.
Declaration
public BoundingBox BoundingBox { get; set; }
Property Value
| Type | Description |
|---|---|
| BoundingBox |
Edges
This graph holds edges and nodes by their keys for fast import, export and access.
Declaration
public IDictionary<int, EdgeData> Edges { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Collections.Generic.IDictionary<System.Int32, EdgeData> |
EdgesMap
This graph holds edges and nodes by their keys for fast import, export and access.
Declaration
public IDictionary<(int, int), HashSet<int>> EdgesMap { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Collections.Generic.IDictionary<System.ValueTuple<System.Int32, System.Int32>, System.Collections.Generic.HashSet<System.Int32>> |
Features
This graph holds edges and nodes by their keys for fast import, export and access.
Declaration
[IgnoreMember]
public FeatureCollection Features { get; }
Property Value
| Type | Description |
|---|---|
| NetTopologySuite.Features.FeatureCollection |
KeyHelper
This graph holds edges and nodes by their keys for fast import, export and access.
Declaration
public KeyContainer KeyHelper { get; set; }
Property Value
| Type | Description |
|---|---|
| KeyContainer |
Metric
This graph holds edges and nodes by their keys for fast import, export and access.
Declaration
[IgnoreMember]
public IMetric<double[]> Metric { get; set; }
Property Value
| Type | Description |
|---|---|
| IMetric<System.Double[]> |
NodeOrdering
This graph holds edges and nodes by their keys for fast import, export and access.
Declaration
public IDictionary<int, int> NodeOrdering { get; }
Property Value
| Type | Description |
|---|---|
| System.Collections.Generic.IDictionary<System.Int32, System.Int32> |
NodesMap
This graph holds edges and nodes by their keys for fast import, export and access.
Declaration
public IDictionary<int, NodeData> NodesMap { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Collections.Generic.IDictionary<System.Int32, NodeData> |
Methods
| Improve this Doc View SourceAddContractionLayer(IEnumerable<NodeData>)
This graph holds edges and nodes by their keys for fast import, export and access.
Declaration
public void AddContractionLayer(IEnumerable<NodeData> nodeOrder = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Collections.Generic.IEnumerable<NodeData> | nodeOrder |
AddEdge(NodeData, NodeData, IDictionary<String, Object>, Geometry, Double, Int32[], Boolean, IList<Int32>)
Create a new edge and add references in the affected nodes
Declaration
public EdgeData AddEdge(NodeData origin, NodeData destination, IDictionary<string, object> attributes = null, Geometry line = null, double distance = -1, int[] restrictions = null, bool isHelperEdge = false, IList<int> shortcutPath = null)
Parameters
| Type | Name | Description |
|---|---|---|
| NodeData | origin | the node where the edge starts |
| NodeData | destination | the node where the edge ends |
| System.Collections.Generic.IDictionary<System.String, System.Object> | attributes | All associated data to this edge e.g., the amount of lanes the length or maximum speed constraints. |
| NetTopologySuite.Geometries.Geometry | line | The LineString geometry to represent curves and lines. |
| System.Double | distance | The whole distance of this edge. |
| System.Int32[] | restrictions | The collection restricting keys only able to route along this edge. |
| System.Boolean | isHelperEdge | This flag describes whether the SpatialGraph has created this edge or not. |
| System.Collections.Generic.IList<System.Int32> | shortcutPath |
A shortcut path connecting the |
Returns
| Type | Description |
|---|---|
| EdgeData | the newly created edge |
AddEdge(Int32, Int32, IDictionary<String, Object>)
This graph holds edges and nodes by their keys for fast import, export and access.
Declaration
public EdgeData AddEdge(int originKey, int destinationKey, IDictionary<string, object> attributes = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | originKey | |
| System.Int32 | destinationKey | |
| System.Collections.Generic.IDictionary<System.String, System.Object> | attributes |
Returns
| Type | Description |
|---|---|
| EdgeData |
AddNode(IDictionary<String, Object>)
Creates a new NodeData object with default
spatial reference and adds it to the graph model.
Declaration
public NodeData AddNode(IDictionary<string, object> attributes = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Collections.Generic.IDictionary<System.String, System.Object> | attributes | The optional data collection. |
Returns
| Type | Description |
|---|---|
| NodeData | the newly created node |
AddNode(Double, Double, IDictionary<String, Object>, Boolean)
Creates a new NodeData object with
spatial reference and adds it to the graph model.
Declaration
public NodeData AddNode(double x, double y, IDictionary<string, object> attributes = null, bool isHelperNode = false)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Double | x | The x coordinate of the spatial reference. |
| System.Double | y | The y coordinate of the spatial reference. |
| System.Collections.Generic.IDictionary<System.String, System.Object> | attributes | The optional data collection. |
| System.Boolean | isHelperNode | The node was created by the spatial graph itself. |
Returns
| Type | Description |
|---|---|
| NodeData | Returns a new NodeData object with spatial reference. |
RemoveEdge(Int32)
This graph holds edges and nodes by their keys for fast import, export and access.
Declaration
public void RemoveEdge(int edgeIndex)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | edgeIndex |
RemoveNode(NodeData)
Removes a node and deletes all edges which are affected by this change
Declaration
public void RemoveNode(NodeData node)
Parameters
| Type | Name | Description |
|---|---|---|
| NodeData | node | the node to be deleted |