Show / Hide Table of Contents

Class RouteExtensions

Contains extensions for the route object.

Inheritance
System.Object
RouteExtensions
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 RouteExtensions

Methods

Concatenate(IEnumerable<Result<Route>>)

Concatenates all the given routes or returns an error when one of the routes cannot be concatenated.

Declaration
public static Result<Route> Concatenate(this IEnumerable<Result<Route>> routes)
Parameters
IEnumerable<Result<Route>> routes

Returns
Result<Route>

Concatenate(Route, Route)

Concatenates two routes.

Declaration
public static Route Concatenate(this Route route1, Route route2)
Parameters
Route route1

Route route2

Returns
Route

Concatenate(Route, Route, Boolean)

Concatenates two routes.

Declaration
public static Route Concatenate(this Route route1, Route route2, bool clone)
Parameters
Route route1

Route route2

System.Boolean clone

Returns
Route

DirectionToNext(Route, Int32)

Returns the direction to the next shape segment.

Declaration
public static DirectionEnum DirectionToNext(this Route route, int i)
Parameters
Route route

System.Int32 i

Returns
DirectionEnum

DistanceAndTimeAt(Route, Int32, out Single, out Single)

Distance and time a the given shape index.

Declaration
public static void DistanceAndTimeAt(this Route route, int shape, out float distance, out float time)
Parameters
Route route

System.Int32 shape

System.Single distance

System.Single time

GenerateInstructions(Route)

Generates instructions for the given route.

Declaration
public static IList<Instruction> GenerateInstructions(this Route route)
Parameters
Route route

The route.

Returns
IList<Instruction>

A list of instructions.

GenerateInstructions(Route, ILanguageReference)

Generates instructions for the given route.

Declaration
public static IList<Instruction> GenerateInstructions(this Route route, ILanguageReference languageReference)
Parameters
Route route

The route.

ILanguageReference languageReference

The language reference.

Returns
IList<Instruction>

A list of instructions.

GenerateInstructions(Route, RouterDb)

Generates instructions for the given route.

Declaration
public static IList<Instruction> GenerateInstructions(this Route route, RouterDb routerDb)
Parameters
Route route

The route.

RouterDb routerDb

The route db used to generate the route.

Returns
IList<Instruction>

A list of instructions.

GenerateInstructions(Route, RouterDb, ILanguageReference)

Generates instructions for the given route.

Declaration
public static IList<Instruction> GenerateInstructions(this Route route, RouterDb routerDb, ILanguageReference languageReference)
Parameters
Route route

The route.

RouterDb routerDb

The route db used to generate the route.

ILanguageReference languageReference

The language reference.

Returns
IList<Instruction>

A list of instructions.

GenerateInstructions(Route, Profile)

Generates instructions for the given route.

Declaration
public static IList<Instruction> GenerateInstructions(this Route route, Profile profile)
Parameters
Route route

The route.

Profile profile

The profile.

Returns
IList<Instruction>

A list of instructions.

GenerateInstructions(Route, Profile, ILanguageReference)

Generates instructions for the given route.

Declaration
public static IList<Instruction> GenerateInstructions(this Route route, Profile profile, ILanguageReference languageReference)
Parameters
Route route

The route.

Profile profile

The profile.

ILanguageReference languageReference

The language reference.

Returns
IList<Instruction>

A list of instructions.

IsMultimodal(Route)

Returns true if this route has multiple profiles.

Declaration
public static bool IsMultimodal(this Route route)
Parameters
Route route

Returns
System.Boolean

PositionAfter(Route, Single)

Calculates the position on the route after the given distance from the starting point.

Declaration
public static Coordinate? PositionAfter(this Route route, float distanceInMeter)
Parameters
Route route

System.Single distanceInMeter

Returns
System.Nullable<Coordinate>

ProjectOn(Route, Coordinate, out Coordinate)

Calculates the closest point on the route relative to the given coordinate.

Declaration
public static bool ProjectOn(this Route route, Coordinate coordinate, out Coordinate projected)
Parameters
Route route

The route.

Coordinate coordinate

The coordinate to project.

Coordinate projected

The projected coordinate on the route.

Returns
System.Boolean

ProjectOn(Route, Coordinate, out Coordinate, out Int32, out Single, out Single)

Calculates the closest point on the route relative to the given coordinate.

Declaration
public static bool ProjectOn(this Route route, Coordinate coordinate, out Coordinate projected, out int shape, out float distanceFromStartInMeter, out float timeFromStartInSeconds)
Parameters
Route route

The route.

Coordinate coordinate

The coordinate to project.

Coordinate projected

The projected coordinate on the route.

System.Int32 shape

The shape segment of the route the point was projected on to.

System.Single distanceFromStartInMeter

System.Single timeFromStartInSeconds

Returns
System.Boolean

ProjectOn(Route, Coordinate, out Coordinate, out Single, out Single)

Calculates the closest point on the route relative to the given coordinate.

Declaration
public static bool ProjectOn(this Route route, Coordinate coordinate, out Coordinate projected, out float distanceToProjectedInMeter, out float timeToProjectedInSeconds)
Parameters
Route route

The route.

Coordinate coordinate

The coordinate to project.

Coordinate projected

The projected coordinate on the route.

System.Single distanceToProjectedInMeter

The distance in meter to the projected point from the start of the route.

System.Single timeToProjectedInSeconds

The time in seconds to the projected point from the start of the route.

Returns
System.Boolean

ProjectOn(Route, Coordinate, out Single)

Calculates the closest point on the route relative to the given coordinate.

Declaration
public static bool ProjectOn(this Route route, Coordinate coordinate, out float distanceFromStartInMeter)
Parameters
Route route

The route.

Coordinate coordinate

The coordinate to project.

System.Single distanceFromStartInMeter

Returns
System.Boolean

ProjectOn(Route, Int32, Coordinate, out Coordinate, out Int32, out Single, out Single)

Calculates the closest point on the route relative to the given coordinate.

Declaration
public static bool ProjectOn(this Route route, int startShape, Coordinate coordinate, out Coordinate projected, out int shape, out float distanceFromStartInMeter, out float timeFromStartInSeconds)
Parameters
Route route

The route.

System.Int32 startShape

The shape to start at, relevant for routes with u-turns and navigation.

Coordinate coordinate

The coordinate to project.

Coordinate projected

The projected coordinate on the route.

System.Int32 shape

The shape segment of the route the point was projected on to.

System.Single distanceFromStartInMeter

System.Single timeFromStartInSeconds

Returns
System.Boolean

ReadXml(Stream)

Reads a route in xml.

Declaration
public static Route ReadXml(Stream stream)
Parameters
Stream stream

Returns
Route

RelativeDirectionAt(Route, Int32, Single)

Returns the turn direction for the shape point at the given index.

Declaration
public static RelativeDirection RelativeDirectionAt(this Route route, int i, float toleranceInMeters = 1F)
Parameters
Route route

System.Int32 i

System.Single toleranceInMeters

Returns
RelativeDirection

SegmentFor(Route, Int32, out Int32, out Int32)

Searches the segment the given shape index exists in.

Declaration
public static void SegmentFor(this Route route, int shape, out int segmentStart, out int segmentEnd)
Parameters
Route route

System.Int32 shape

System.Int32 segmentStart

System.Int32 segmentEnd

ShapeMetaFor(Route, Int32)

Gets the shape meta for the given shape index.

Declaration
public static Route.Meta ShapeMetaFor(this Route route, int shape)
Parameters
Route route

System.Int32 shape

Returns
Route.Meta

ToGeoJson(Route, Boolean, Boolean, Boolean, Action<IAttributeCollection>, Func<String, String, Boolean>)

Returns this route as geojson.

Declaration
public static string ToGeoJson(this Route route, bool includeShapeMeta = true, bool includeStops = true, bool groupByShapeMeta = true, Action<IAttributeCollection> attributesCallback = null, Func<string, string, bool> isRaw = null)
Parameters
Route route

System.Boolean includeShapeMeta

System.Boolean includeStops

System.Boolean groupByShapeMeta

Action<IAttributeCollection> attributesCallback

Func<System.String, System.String, System.Boolean> isRaw

Returns
System.String

ToJson(Route)

Returns this route as json.

Declaration
public static string ToJson(this Route route)
Parameters
Route route

Returns
System.String

ToXml(Route)

Returns this route as xml.

Declaration
public static string ToXml(this Route route)
Parameters
Route route

Returns
System.String

WriteGeoJson(Route, Stream, Boolean, Boolean, Boolean, Action<IAttributeCollection>, Func<String, String, Boolean>)

Writes the route as geojson.

Declaration
public static void WriteGeoJson(this Route route, Stream stream, bool includeShapeMeta = true, bool includeStops = true, bool groupByShapeMeta = true, Action<IAttributeCollection> attributesCallback = null, Func<string, string, bool> isRaw = null)
Parameters
Route route

Stream stream

System.Boolean includeShapeMeta

System.Boolean includeStops

System.Boolean groupByShapeMeta

Action<IAttributeCollection> attributesCallback

Func<System.String, System.String, System.Boolean> isRaw

WriteGeoJson(Route, TextWriter, Boolean, Boolean, Boolean, Action<IAttributeCollection>, Func<String, String, Boolean>)

Writes the route as geojson.

Declaration
public static void WriteGeoJson(this Route route, TextWriter writer, bool includeShapeMeta = true, bool includeStops = true, bool groupByShapeMeta = true, Action<IAttributeCollection> attributesCallback = null, Func<string, string, bool> isRaw = null)
Parameters
Route route

TextWriter writer

System.Boolean includeShapeMeta

System.Boolean includeStops

System.Boolean groupByShapeMeta

Action<IAttributeCollection> attributesCallback

Func<System.String, System.String, System.Boolean> isRaw

WriteGeoJsonFeatures(Route, JsonWriter, Boolean, Boolean, Boolean, Action<IAttributeCollection>, Func<String, String, Boolean>)

Writes the route as geojson.

Declaration
public static void WriteGeoJsonFeatures(this Route route, JsonWriter jsonWriter, bool includeShapeMeta = true, bool includeStops = true, bool groupByShapeMeta = true, Action<IAttributeCollection> attributesCallback = null, Func<string, string, bool> isRaw = null)
Parameters
Route route

JsonWriter jsonWriter

System.Boolean includeShapeMeta

System.Boolean includeStops

System.Boolean groupByShapeMeta

Action<IAttributeCollection> attributesCallback

Func<System.String, System.String, System.Boolean> isRaw

WriteJson(Route, Stream)

Writes the route as json.

Declaration
public static void WriteJson(this Route route, Stream stream)
Parameters
Route route

Stream stream

WriteJson(Route, TextWriter)

Writes the route as json.

Declaration
public static void WriteJson(this Route route, TextWriter writer)
Parameters
Route route

TextWriter writer

WriteXml(Route, Stream)

Writes the route as xml.

Declaration
public static void WriteXml(this Route route, Stream stream)
Parameters
Route route

Stream stream

WriteXml(Route, TextWriter)

Writes the route as xml.

Declaration
public static void WriteXml(this Route route, TextWriter writer)
Parameters
Route route

TextWriter writer

Back to top Built by Itinero, MIT licensed.