TransportApi (Class)
Namespace: Wrld.Transport
Api for accessing streamed transportation networks. Separate transport networks exist for each of the TransportNetworkType enumerator list - for example, roads exist on a separate network to rail. Transport networks are streamed in and out in a similar manner to visual map resources, using a tiled approach.
Methods
TransportPositioner CreatePositioner (TransportPositionerOptions options)
Creates an instance of a TransportPositioner.
Argument | Type | Description |
---|---|---|
options | TransportPositionerOptions | A TransportPositionerOptions object that provides creation parameters for this TransportPositioner. TransportPositionerOptionsBuilder may be used to help construct an appropriate options object. |
TransportPathfindResult FindShortestPath (TransportPathfindOptions options)
Find the shortest path, if any, between two points on a transport network as specified in options. Note that the shortest path from point A to point B is not necessarily the reverse of the shortest path from point B to point A, as some TransportWays may only be traversed in one direction. The method considers the currently streamed-in set of the transport network only. As such, it is provided primarily as a convenience for connecting relatively nearby points for visualization purposes - it is not intended to be useful for large-scale route planning.
Returns: A result object, indicating whether a path was found, and providing the path if successful.
Argument | Type | Description |
---|---|---|
options | TransportPathfindOptions | A TransportPathfindOptions object that provides input parameters. TransportPathfindOptionsBuilder may be used to help construct an appropriate options object. |
bool TryGetNode (TransportNodeId nodeId, out TransportNode node)
Get the TransportNode value associated with the given TransportNodeId key.
Returns: True if a TransportNode object with Id equal to nodeId was found, else false.
Argument | Type | Description |
---|---|---|
nodeId | TransportNodeId | The id of the TransportNode to get. |
node | TransportNode | On return, contains the value associated with nodeId if found; else an empty value as returned by TransportNode.MakeEmpty(). |
bool TryGetDirectedEdge (TransportDirectedEdgeId directedEdgeId, out TransportDirectedEdge directedEdge)
The TransportDirectedEdge value associated with the given TransportDirectedEdgeId key.
Returns: True if a TransportDirectedEdge object with Id equal to directedEdgeId was found, else false.
Argument | Type | Description |
---|---|---|
directedEdgeId | TransportDirectedEdgeId | The id of the TransportDirectedEdge to get. |
directedEdge | TransportDirectedEdge | On return, contains the value associated with directedEdgeId if found; else an empty value as returned by DirectedEdge.MakeEmpty(). |
bool TryGetWay (TransportWayId wayId, out TransportWay way)
The TransportWay value associated with the given TransportWayId key.
Returns: True if a TransportWay object with Id equal to wayId was found, else false.
Argument | Type | Description |
---|---|---|
wayId | TransportWayId | The id of the TransportWay to get. |
way | TransportWay | On return, contains the value associated with transportWayId if found; else an empty value as returned by TransportWay.MakeEmpty(). |
IList<TransportNodeId> GetNodeIdsForNetwork (TransportNetworkType transportNetwork)
Get a collection of TransportNodeId keys for all TransportNode objects currently streamed in for the given transport network.
Returns: An unordered list of TransportNodeId objects.
Argument | Type | Description |
---|---|---|
transportNetwork | TransportNetworkType | The returned results are filtered to contain only ids for nodes belonging to this transport network. |
IList<TransportDirectedEdgeId> GetDirectedEdgeIdsForNetwork (TransportNetworkType transportNetwork)
Get a collection of TransportDirectedEdgeId keys for all TransportDirectedEdge objects currently streamed in for the given transport network.
Returns: An unordered list of TransportDirectedEdgeId objects.
Argument | Type | Description |
---|---|---|
transportNetwork | TransportNetworkType | The returned results are filtered to contain only ids for directed edges belonging to this transport network. |
IList<TransportWayId> GetWayIdsForNetwork (TransportNetworkType transportNetwork)
Get a collection of TransportWayId keys for all TransportWay objects currently streamed in for the given transport network.
Returns: An unordered list of TransportNodeId objects.
Argument | Type | Description |
---|---|---|
transportNetwork | TransportNetworkType | The returned results are filtered to contain only ids for ways belonging to this transport network. |
IList<TransportNodeId> GetNodeIdsForNetworkInCell (TransportNetworkType transportNetwork, TransportCellKey cellKey)
Get a collection of TransportNodeId keys for all TransportNode objects currently streamed in for the given transport network and cell.
Returns: An unordered list of the id of all TransportNode objects currently resident, filtered by transportNetwork and cellKey.
Argument | Type | Description |
---|---|---|
transportNetwork | TransportNetworkType | The returned results are filtered to contain only ids for nodes belonging to this transport network. |
cellKey | TransportCellKey | The returned results are filtered to contain only ids for nodes belonging to this cell. |
IList<TransportDirectedEdgeId> GetDirectedEdgeIdsForNetworkInCell (TransportNetworkType transportNetwork, TransportCellKey cellKey)
Get a collection of TransportDirectedEdgeId keys for all TransportDirectedEdge objects currently streamed in for the given transport network.
Returns: An unordered list of the id of all TransportDirectedEdge objects currently resident, filtered by transportNetwork and cellKey.
Argument | Type | Description |
---|---|---|
transportNetwork | TransportNetworkType | The returned results are filtered to contain only ids for directed edges belonging to this transport network. |
cellKey | TransportCellKey | The returned results are filtered to contain only ids for directed edges belonging to this cell. |
IList<TransportWayId> GetWayIdsForNetworkInCell (TransportNetworkType transportNetwork, TransportCellKey cellKey)
Get a collection of TransportWayId keys for all TransportWay objects currently streamed in for the given transport network and cell.
Returns: An unordered list of the id of all TransportWay objects currently resident, filtered by transportNetwork and cellKey.
Argument | Type | Description |
---|---|---|
transportNetwork | TransportNetworkType | The returned results are filtered to contain only ids for ways belonging to this transport network. |
cellKey | TransportCellKey | The returned results are filtered to contain only ids for ways belonging to this cell. |
DoubleVector3 GetPointEcefOnPolyline (DoubleVector3[] polylinePoints, Double[] polylineParams, double t)
Get an interpolated point along a polyline reprented as an array of points, with associated parameterized distances of each point along the polyline.
Returns: A point in ECEF coordinates at parameterized distance t along the supplied polyline.
Argument | Type | Description |
---|---|---|
polylinePoints | DoubleVector3[] | Polyline vertex points, in ECEF coordinates. |
polylineParams | Double[] | Polyline parameterized distance of each vertex, each element in the range 0.0 to 1.0. |
t | double | A parameterized distance along the polyline, in the range 0.0 to 1.0. |
DoubleVector3 GetDirectionEcefOnPolyline (DoubleVector3[] polylinePoints, Double[] polylineParams, double t)
Get the direction of a polyline at a parameterized distance along it. The polyline is reprented as an array of points, with associated parameterized.
Returns: A unit direction vector in ECEF coordinates at parameterized distance t along the supplied polyline.
Argument | Type | Description |
---|---|---|
polylinePoints | DoubleVector3[] | Polyline vertex points, in ECEF coordinates. |
polylineParams | Double[] | Polyline parameterized distance of each vertex, each element in the range 0.0 to 1.0. |
t | double | A parameterized distance along the polyline, in the range 0.0 to 1.0. |
String TransportCellKeyToString (TransportCellKey cellKey)
Get a string representation for a given TransportCellKey.
Returns: A string representation, formatted as a Morton code.
Argument | Type | Description |
---|---|---|
cellKey | TransportCellKey | A key uniquely identifying a tile on a transport network. |
Events
TransportNetworkChangedHandler OnTransportNetworkCellAdded
Raised when a transport network has changed due to a new cell being streamed in. New TransportNode, TransportDirectedEdge and TransportWay objects that belong to that cell and network may now be present, and can be queried via TransportApi methods, for example via TransportApi.GetNodeIdsForNetworkInCell().
TransportNetworkChangedHandler OnTransportNetworkCellRemoved
Raised when a transport network has changed due to a cell being removed after no longer intersecting the streaming camera’s frustum.
TransportNetworkChangedHandler OnTransportNetworkCellUpdated
Raised when a transport network cell has changed as connections are formed or disconnected due to adjacent portions of the graph streaming in or out.
Delegates
void TransportNetworkChangedHandler (TransportNetworkType networkType, TransportCellKey cellKey)
A delegate type for event handlers receiving notification that a transport network has changed.
Argument | Type | Description |
---|---|---|
networkType | TransportNetworkType | The transport network of the changed cell. |
cellKey | TransportCellKey | The key of the changed cell. |