Show / Hide Table of Contents

Class RouterDbExtensions

Contains extension methods for the router db.

Inheritance
System.Object
RouterDbExtensions
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: System.Dynamic.ExpandoObject
Assembly: cs.temp.dll.dll
Syntax
public static class RouterDbExtensions

Methods

AddAsVertex(RouterDb, RouterPoint)

Adds the router point as a vertex.

Declaration
public static uint AddAsVertex(this RouterDb routerDb, RouterPoint point)
Parameters
RouterDb routerDb

RouterPoint point

Returns
System.UInt32

AddAsVertices(RouterDb, RouterPoint[])

Adds the router point as a vertex.

Declaration
public static uint[] AddAsVertices(this RouterDb routerDb, RouterPoint[] points)
Parameters
RouterDb routerDb

RouterPoint[] points

Returns
System.UInt32[]

AddContracted(RouterDb, Profile, Boolean)

Creates a new contracted graph and adds it to the router db for the given profile.

Declaration
public static void AddContracted(this RouterDb db, Profile profile, bool forceEdgeBased = false)
Parameters
RouterDb db

Profile profile

System.Boolean forceEdgeBased

AddContracted(RouterDb, Profile, Boolean, CancellationToken)

Creates a new contracted graph and adds it to the router db for the given profile.

Declaration
public static void AddContracted(this RouterDb db, Profile profile, bool forceEdgeBased, CancellationToken cancellationToken)
Parameters
RouterDb db

Profile profile

System.Boolean forceEdgeBased

CancellationToken cancellationToken

AddContracted<T>(RouterDb, Profile, WeightHandler<T>, Boolean)

Creates a new contracted graph and adds it to the router db for the given profile.

Declaration
public static void AddContracted<T>(this RouterDb db, Profile profile, WeightHandler<T> weightHandler, bool forceEdgeBased = false)where T : struct
Parameters
RouterDb db

Profile profile

WeightHandler<T> weightHandler

System.Boolean forceEdgeBased

Type Parameters
T

AddContracted<T>(RouterDb, Profile, WeightHandler<T>, Boolean, CancellationToken)

Creates a new contracted graph and adds it to the router db for the given profile.

Declaration
public static void AddContracted<T>(this RouterDb db, Profile profile, WeightHandler<T> weightHandler, bool forceEdgeBased, CancellationToken cancellationToken)where T : struct
Parameters
RouterDb db

Profile profile

WeightHandler<T> weightHandler

System.Boolean forceEdgeBased

CancellationToken cancellationToken

Type Parameters
T

AddIslandData(RouterDb, Profile)

Adds and detects island data to improve resolving.

Declaration
public static void AddIslandData(this RouterDb db, Profile profile)
Parameters
RouterDb db

Profile profile

AddIslandData(RouterDb, Profile, Boolean)

Adds and detects island data to improve resolving.

Declaration
public static void AddIslandData(this RouterDb db, Profile profile, bool buildEdgeMeta)
Parameters
RouterDb db

Profile profile

System.Boolean buildEdgeMeta

AddIslandData(RouterDb, Profile, Boolean, CancellationToken)

Adds and detects island data to improve resolving.

Declaration
public static void AddIslandData(this RouterDb db, Profile profile, bool buildEdgeMeta, CancellationToken cancellationToken)
Parameters
RouterDb db

Profile profile

System.Boolean buildEdgeMeta

CancellationToken cancellationToken

BuildDualEdgePath<T>(RouterDb, WeightHandler<T>, EdgePath<T>)

Builds a non-dual edge path from a dual edge path taking into account the original router points.

Declaration
public static EdgePath<T> BuildDualEdgePath<T>(this RouterDb routerDb, WeightHandler<T> weightHandler, EdgePath<T> dualPath)where T : struct
Parameters
RouterDb routerDb

WeightHandler<T> weightHandler

EdgePath<T> dualPath

Returns
EdgePath<T>

Type Parameters
T

BuildDualEdgePath<T>(RouterDb, WeightHandler<T>, RouterPoint, RouterPoint, EdgePath<T>)

Builds a non-dual edge path from a dual edge path taking into account the original router points.

Declaration
public static EdgePath<T> BuildDualEdgePath<T>(this RouterDb routerDb, WeightHandler<T> weightHandler, RouterPoint source, RouterPoint target, EdgePath<T> dualPath)where T : struct
Parameters
RouterDb routerDb

WeightHandler<T> weightHandler

RouterPoint source

RouterPoint target

EdgePath<T> dualPath

Returns
EdgePath<T>

Type Parameters
T

BuildEdgePath<T>(RouterDb, WeightHandler<T>, RouterPoint, RouterPoint, List<UInt32>)

Builds an edge path from a path consisiting of only vertices.

Declaration
public static EdgePath<T> BuildEdgePath<T>(this RouterDb routerDb, WeightHandler<T> weightHandler, RouterPoint source, RouterPoint target, List<uint> vertexPath)where T : struct
Parameters
RouterDb routerDb

WeightHandler<T> weightHandler

RouterPoint source

RouterPoint target

List<System.UInt32> vertexPath

Returns
EdgePath<T>

Type Parameters
T

ExtractArea(RouterDb, Func<Coordinate, Boolean>, Boolean)

Extracts part of the routerdb defined by the isInside function.

Declaration
public static RouterDb ExtractArea(this RouterDb db, Func<Coordinate, bool> isInside, bool insideOnly = false)
Parameters
RouterDb db

The routerdb to extract from.

Func<Coordinate, System.Boolean> isInside

The is inside function.

System.Boolean insideOnly

Don't keep vertices outside, even if they have a neighbour that is inside.

Returns
RouterDb

ExtractArea(RouterDb, Func<UInt32, Boolean>, Func<UInt32, UInt32, Boolean>)

Extracts part of the routerdb defined by the isInside function.

Declaration
public static RouterDb ExtractArea(this RouterDb db, Func<uint, bool> isInside, Func<uint, uint, bool> isEdgeInside)
Parameters
RouterDb db

The routerdb to extract from.

Func<System.UInt32, System.Boolean> isInside

The is inside function, is the vertex to be included. Vertex won't be included if none of it's edge are.

Func<System.UInt32, System.UInt32, System.Boolean> isEdgeInside

The is inside function, is the edge to be included.

Returns
RouterDb

ExtractArea(RouterDb, Func<UInt32, Boolean>, Boolean)

Extracts part of the routerdb defined by the isInside function.

Declaration
public static RouterDb ExtractArea(this RouterDb db, Func<uint, bool> isInside, bool insideOnly = false)
Parameters
RouterDb db

The routerdb to extract from.

Func<System.UInt32, System.Boolean> isInside

The is inside function.

System.Boolean insideOnly

Don't keep vertices outside, even if they have a neighbour that is inside.

Returns
RouterDb

ExtractArea(RouterDb, Single, Single, Single, Single)

Extracts part of the routerdb defined by the isInside function.

Declaration
public static RouterDb ExtractArea(this RouterDb db, float minLatitude, float minLongitude, float maxLatitude, float maxLongitude)
Parameters
RouterDb db

The routerdb to extract from.

System.Single minLatitude

System.Single minLongitude

System.Single maxLatitude

System.Single maxLongitude

Returns
RouterDb

GetGeoJson(RouterDb, Boolean, Boolean, Boolean)

Gets all features inside the given bounding box and builds a geojson string.

Declaration
public static string GetGeoJson(this RouterDb db, bool includeEdges = true, bool includeVertices = true, bool includeProfileDetails = true)
Parameters
RouterDb db

System.Boolean includeEdges

System.Boolean includeVertices

System.Boolean includeProfileDetails

Returns
System.String

GetGeoJsonAround(RouterDb, Single, Single, Single, Boolean, Boolean, Boolean)

Gets all features around the given location as geojson.

Declaration
public static string GetGeoJsonAround(this RouterDb db, float latitude, float longitude, float distanceInMeter = 250F, bool includeEdges = true, bool includeVertices = true, bool includeProfileDetails = true)
Parameters
RouterDb db

System.Single latitude

System.Single longitude

System.Single distanceInMeter

System.Boolean includeEdges

System.Boolean includeVertices

System.Boolean includeProfileDetails

Returns
System.String

GetGeoJsonAround(RouterDb, UInt32, Single, Boolean, Boolean, Boolean)

Gets all features around the given vertex as geojson.

Declaration
public static string GetGeoJsonAround(this RouterDb db, uint vertex, float distanceInMeter = 250F, bool includeEdges = true, bool includeVertices = true, bool includeProfileDetails = true)
Parameters
RouterDb db

System.UInt32 vertex

System.Single distanceInMeter

System.Boolean includeEdges

System.Boolean includeVertices

System.Boolean includeProfileDetails

Returns
System.String

GetGeoJsonEdges(RouterDb, Boolean, Boolean, Boolean, UInt32[])

Gets a geojson containing the given edge and optionally it's neighbours.

Declaration
public static string GetGeoJsonEdges(this RouterDb db, bool neighbours = false, bool includeVertices = true, bool includeProfileDetails = true, params uint[] edgeIds)
Parameters
RouterDb db

The router db.

System.Boolean neighbours

Flag to get neighbours or not.

System.Boolean includeVertices

Flag to get vertices or not.

System.Boolean includeProfileDetails

System.UInt32[] edgeIds

The edge id's to get.

Returns
System.String

GetGeoJsonIn(RouterDb, Single, Single, Single, Single, Boolean, Boolean, Boolean)

Gets all features inside the given bounding box and builds a geojson string.

Declaration
public static string GetGeoJsonIn(this RouterDb db, float minLatitude, float minLongitude, float maxLatitude, float maxLongitude, bool includeEdges = true, bool includeVertices = true, bool includeProfileDetails = true)
Parameters
RouterDb db

System.Single minLatitude

System.Single minLongitude

System.Single maxLatitude

System.Single maxLongitude

System.Boolean includeEdges

System.Boolean includeVertices

System.Boolean includeProfileDetails

Returns
System.String

GetGeoJsonVertices(RouterDb, Boolean, Boolean, UInt32[])

Gets a geojson containing the given edge and optionally it's neighbours.

Declaration
public static string GetGeoJsonVertices(this RouterDb db, bool neighbours = false, bool includeProfileDetails = false, params uint[] vertexIds)
Parameters
RouterDb db

The router db.

System.Boolean neighbours

Flag to get neighbours or not.

System.Boolean includeProfileDetails

Flag to get profile details or not.

System.UInt32[] vertexIds

The vertices to get.

Returns
System.String

GetGetRestrictions(RouterDb, Profile, Nullable<Boolean>)

Gets the get restriction function for the given profile.

Declaration
public static Func<uint, IEnumerable<uint[]>> GetGetRestrictions(this RouterDb db, Profile profile, bool ? first)
Parameters
RouterDb db

The router db.

Profile profile

The vehicle profile.

System.Nullable<System.Boolean> first

When true, only restrictions starting with given vertex, when false only restrictions ending with given vertex already reversed, when null all restrictions are returned.

Returns
Func<System.UInt32, IEnumerable<System.UInt32[]>>

GetGetSimpleRestrictions(RouterDb, Profile)

Gets the simple restriction function for the given profile.

Declaration
public static Func<uint, uint> GetGetSimpleRestrictions(this RouterDb db, Profile profile)
Parameters
RouterDb db

The router db.

Profile profile

The vehicle profile.

Returns
Func<System.UInt32, System.UInt32>

GetHasAnyRestriction(RouterDb)

Gets the has any restriction function.

Declaration
public static Func<uint, bool> GetHasAnyRestriction(this RouterDb db)
Parameters
RouterDb db

The router db.

Returns
Func<System.UInt32, System.Boolean>

GetPathForEdge<T>(RouterDb, WeightHandler<T>, DirectedEdgeId, Boolean)

Generates an edge path for the given edge.

Declaration
public static EdgePath<T> GetPathForEdge<T>(this RouterDb routerDb, WeightHandler<T> weightHandler, DirectedEdgeId directedEdgeId, bool asSource)where T : struct
Parameters
RouterDb routerDb

WeightHandler<T> weightHandler

DirectedEdgeId directedEdgeId

System.Boolean asSource

Returns
EdgePath<T>

Type Parameters
T

GetPathForEdge<T>(RouterDb, WeightHandler<T>, RoutingEdge, Boolean, Boolean)

Generates an edge path for the given edge.

Declaration
public static EdgePath<T> GetPathForEdge<T>(this RouterDb routerDb, WeightHandler<T> weightHandler, RoutingEdge edge, bool edgeForward, bool asSource)where T : struct
Parameters
RouterDb routerDb

WeightHandler<T> weightHandler

RoutingEdge edge

System.Boolean edgeForward

System.Boolean asSource

Returns
EdgePath<T>

Type Parameters
T

GetPathForEdge<T>(RouterDb, WeightHandler<T>, Int64, Boolean)

Generates an edge path for the given edge.

Declaration
public static EdgePath<T> GetPathForEdge<T>(this RouterDb routerDb, WeightHandler<T> weightHandler, long directedEdgeId, bool asSource)where T : struct
Parameters
RouterDb routerDb

WeightHandler<T> weightHandler

System.Int64 directedEdgeId

System.Boolean asSource

Returns
EdgePath<T>

Type Parameters
T

GetProfileAndMeta(RouterDb, UInt32, UInt32)

Returns one attribute collection containing both the profile and meta tags.

Declaration
public static IAttributeCollection GetProfileAndMeta(this RouterDb db, uint profileId, uint meta)
Parameters
RouterDb db

System.UInt32 profileId

System.UInt32 meta

Returns
IAttributeCollection

GetRestrictions(RouterDb, Profile)

Gets the restriction collection for the given profile.

Declaration
public static RestrictionCollection GetRestrictions(this RouterDb db, Profile profile)
Parameters
RouterDb db

The router db.

Profile profile

The vehicle profile.

Returns
RestrictionCollection

HasComplexRestrictions(RouterDb, IEnumerable<String>)

Returns true if this db contains complex restrictions for the given vehicle types.

Declaration
public static bool HasComplexRestrictions(this RouterDb db, IEnumerable<string> vehicleTypes)
Parameters
RouterDb db

IEnumerable<System.String> vehicleTypes

Returns
System.Boolean

HasComplexRestrictions(RouterDb, Profile)

Returns true if this db contains complex restrictions for the given profile.

Declaration
public static bool HasComplexRestrictions(this RouterDb db, Profile profile)
Parameters
RouterDb db

Profile profile

Returns
System.Boolean

HasComplexRestrictions(RouterDb, String)

Returns true if this db contains complex restrictions for the given vehicle type.

Declaration
public static bool HasComplexRestrictions(this RouterDb db, string vehicleType)
Parameters
RouterDb db

System.String vehicleType

Returns
System.Boolean

HasIslandData(RouterDb, Profile)

Returns true if the routerdb already has island data for the given profile.

Declaration
public static bool HasIslandData(this RouterDb db, Profile profile)
Parameters
RouterDb db

The router db.

Profile profile

The profile.

Returns
System.Boolean

True if there is island data.

HasRestrictions(RouterDb, String)

Returns true if this db contains restrictions for the given vehicle type.

Declaration
public static bool HasRestrictions(this RouterDb db, string vehicleType)
Parameters
RouterDb db

System.String vehicleType

Returns
System.Boolean

LocationOnNetwork(RouterDb, UInt32, UInt16)

Returns the location on the network.

Declaration
public static Coordinate LocationOnNetwork(this RouterDb db, uint edgeId, ushort offset)
Parameters
RouterDb db

System.UInt32 edgeId

System.UInt16 offset

Returns
Coordinate

Supports(RouterDb, Profile)

Returns true if the given profile is supported.

Declaration
public static bool Supports(this RouterDb db, Profile profile)
Parameters
RouterDb db

Profile profile

Returns
System.Boolean

SupportsAll(RouterDb, IProfileInstance[])

Returns true if all of the given profiles are supported.

Declaration
public static bool SupportsAll(this RouterDb db, params IProfileInstance[] profiles)
Parameters
RouterDb db

IProfileInstance[] profiles

Returns
System.Boolean

SupportsAll(RouterDb, Profile[])

Returns true if all of the given profiles are supported.

Declaration
public static bool SupportsAll(this RouterDb db, params Profile[] profiles)
Parameters
RouterDb db

Profile[] profiles

Returns
System.Boolean

WriteGeoJson(RouterDb, Stream, Single, Single, Single, Single, Boolean, Boolean, Boolean)

Gets all features inside the given bounding box and writes them as a geojson string.

Declaration
public static void WriteGeoJson(this RouterDb db, Stream stream, float minLatitude, float minLongitude, float maxLatitude, float maxLongitude, bool includeEdges = true, bool includeVertices = true, bool includeProfileDetails = true)
Parameters
RouterDb db

Stream stream

System.Single minLatitude

System.Single minLongitude

System.Single maxLatitude

System.Single maxLongitude

System.Boolean includeEdges

System.Boolean includeVertices

System.Boolean includeProfileDetails

WriteGeoJson(RouterDb, TextWriter, Boolean, Boolean, Boolean)

Gets all features inside the given bounding box and writes them as a geojson string.

Declaration
public static void WriteGeoJson(this RouterDb db, TextWriter writer, bool includeEdges = true, bool includeVertices = true, bool includeProfileDetails = true)
Parameters
RouterDb db

TextWriter writer

System.Boolean includeEdges

System.Boolean includeVertices

System.Boolean includeProfileDetails

WriteGeoJson(RouterDb, TextWriter, Single, Single, Single, Single, Boolean, Boolean, Boolean)

Gets all features inside the given bounding box and writes them as a geojson string.

Declaration
public static void WriteGeoJson(this RouterDb db, TextWriter writer, float minLatitude, float minLongitude, float maxLatitude, float maxLongitude, bool includeEdges = true, bool includeVertices = true, bool includeProfileDetails = true)
Parameters
RouterDb db

TextWriter writer

System.Single minLatitude

System.Single minLongitude

System.Single maxLatitude

System.Single maxLongitude

System.Boolean includeEdges

System.Boolean includeVertices

System.Boolean includeProfileDetails

Back to top Built by Itinero, MIT licensed.