Google. Maps. Unity. Intersections. RoadLattice
A representation of a graph of nodes and connections representing the road network in an area. For example, a single map tile, or a loaded map region.
Summary
Properties |
|
---|---|
Nodes
|
IEnumerable< RoadLatticeNode >
The nodes in this lattice.
|
Public functions |
|
---|---|
FindNodeAt(ulong locationUID)
|
Find any node in the lattice at the supplied location UID.
|
GetEdgeSegments()
|
List< LineSegment2D >
Returns a list of LineSegment2D objects representing all the edges in this lattice.
|
GetLocationsOfNodes()
|
List< Vector2 >
Returns a list of positions of all of the nodes in this lattice.
|
GetNodes()
|
List< RoadLatticeNode >
Deprecated. Please use Nodes instead. Returns a list of all the nodes in this lattice.
|
RoadLatticeNodePredicate(RoadLatticeNode node)
|
delegate bool
A predicate on a RoadLatticeNode used for filtering. For example, ins RoadLattice.SnapToNode.
|
SnapToNode(Vector3 position, RoadLatticeNodePredicate predicate)
|
Finds the nearest node in the RoadLattice to the supplied position.
|
UncheckedSnapToNode(Vector3 position, RoadLatticeNodePredicate predicate)
|
Finds the nearest node in the RoadLattice to the supplied position.
|
Public static functions |
|
---|---|
FindPath(RoadLatticeNode start, RoadLatticeNode end, int searchLimit, PathOptions options)
|
List< RoadLatticeNode >
Finds a path between the supplied nodes, or throws a NoPathException when a path cannot be found between the supplied nodes.
|
UncheckedFindPath(RoadLatticeNode start, RoadLatticeNode end, int searchLimit, PathOptions options)
|
List< RoadLatticeNode >
Returns a list of RoadLatticeNodes on the (inclusive) path from start node to end node, or null if there is no path.
|
Classes |
|
---|---|
Google. |
Exception thrown by RoadLattice.SnapToNode when no nodes can be found. For example, when the lattice is currently empty. |
Google. |
Exception thrown by RoadLattice.FindPath when a path cannot be found. |
Google. |
Additional options provided to RoadLattice.FindPath and RoadLattice.UncheckedFindPath. |
Structs |
|
---|---|
Google. |
Encapsulates an immutable, directed line segment that represents a connection between nodes in this lattice. |
Properties
Public functions
FindNodeAt
RoadLatticeNode FindNodeAt( ulong locationUID )
Find any node in the lattice at the supplied location UID.
See RoadLatticeNode.LocationUID for more information.
Details | |||
---|---|---|---|
Parameters |
|
||
Returns |
Any node found at the supplied location UID, or null if none exists.
|
GetEdgeSegments
List< LineSegment2D > GetEdgeSegments()
Returns a list of LineSegment2D objects representing all the edges in this lattice.
This method is primarily intended for use in debugging methods, e.g., displaying a representation of the RoadLattice.
Details | |
---|---|
Returns |
All of the edges in this lattice.
|
GetLocationsOfNodes
List< Vector2 > GetLocationsOfNodes()
Returns a list of positions of all of the nodes in this lattice.
This method is primarily intended for use in debugging methods, e.g. display.
Details | |
---|---|
Returns |
List of positions of nodes.
|
GetNodes
List< RoadLatticeNode > GetNodes()
Deprecated. Please use Nodes instead. Returns a list of all the nodes in this lattice.
Details | |
---|---|
Returns |
The list of nodes.
|
RoadLatticeNodePredicate
delegate bool RoadLatticeNodePredicate( RoadLatticeNode node )
A predicate on a RoadLatticeNode used for filtering. For example, ins RoadLattice.SnapToNode.
Details | |||
---|---|---|---|
Parameters |
|
SnapToNode
RoadLatticeNode SnapToNode( Vector3 position, RoadLatticeNodePredicate predicate )
Finds the nearest node in the RoadLattice to the supplied position.
This is a proof of concept brute force implementation. Performance is O(n), where n is lattice.GetNodes().Count.
Details | |||||
---|---|---|---|---|---|
Parameters |
|
||||
Returns |
The nearest node to the supplied position or null if the lattice has no nodes, or no nodes pass the supplied predicate.
|
UncheckedSnapToNode
RoadLatticeNode UncheckedSnapToNode( Vector3 position, RoadLatticeNodePredicate predicate )
Finds the nearest node in the RoadLattice to the supplied position.
Details | |||||
---|---|---|---|---|---|
Parameters |
|
||||
Returns |
The nearest node to the supplied position, or null if the lattice has no nodes, or if no nodes pass the supplied predicate.
|
Public static functions
FindPath
List< RoadLatticeNode > FindPath( RoadLatticeNode start, RoadLatticeNode end, int searchLimit, PathOptions options )
Finds a path between the supplied nodes, or throws a NoPathException when a path cannot be found between the supplied nodes.
Details | |||||||||
---|---|---|---|---|---|---|---|---|---|
Parameters |
|
||||||||
Exceptions |
|
||||||||
Returns |
An ordered list of nodes on the found path
|
UncheckedFindPath
List< RoadLatticeNode > UncheckedFindPath( RoadLatticeNode start, RoadLatticeNode end, int searchLimit, PathOptions options )
Returns a list of RoadLatticeNodes on the (inclusive) path from start node to end node, or null if there is no path.
Details | |||||||||
---|---|---|---|---|---|---|---|---|---|
Parameters |
|
||||||||
Returns |
An ordered list of nodes on the found path, or null.
|