public class QueryGraph extends Object implements Graph
Calling any create method creates virtual edges between the tower nodes of the existing
graph and new virtual tower nodes. Every virtual node has two adjacent nodes and is connected
to each adjacent nodes via 2 virtual edges with opposite base node / adjacent node encoding.
However, the edge explorer returned by createEdgeExplorer()
only returns two
virtual edges per virtual node (the ones with correct base node).
Modifier and Type | Method and Description |
---|---|
void |
clearUnfavoredStatus()
Removes the 'unfavored' status of all virtual edges.
|
Graph |
copyTo(Graph g)
Copy this Graph into the specified Graph g.
|
static QueryGraph |
create(Graph graph,
List<QueryResult> queryResults) |
static QueryGraph |
create(Graph graph,
QueryResult qr) |
static QueryGraph |
create(Graph graph,
QueryResult fromQR,
QueryResult toQR) |
EdgeExplorer |
createEdgeExplorer() |
EdgeExplorer |
createEdgeExplorer(EdgeFilter edgeFilter)
Returns an EdgeExplorer which makes it possible to traverse all filtered edges of a specific
node.
|
EdgeIteratorState |
edge(int a,
int b)
Creates an edge between the nodes a and b.
|
EdgeIteratorState |
edge(int a,
int b,
double distance,
boolean bothDirections)
Use edge(a,b).setDistance().setFlags instead
|
boolean |
enforceHeading(int nodeId,
double favoredHeading,
boolean incoming)
Set those edges at the virtual node (nodeId) to 'unfavored' that require at least a turn of
100° from favoredHeading.
|
AllEdgesIterator |
getAllEdges() |
Graph |
getBaseGraph() |
BBox |
getBounds()
Returns the implicit bounds of this graph calculated from the lat,lon input of setNode
|
EdgeIteratorState |
getEdgeIteratorState(int origEdgeId,
int adjNode)
Returns a wrapper over the specified edgeId.
|
int |
getEdges() |
Graph |
getMainGraph() |
NodeAccess |
getNodeAccess()
Creates an object to access node properties.
|
int |
getNodes() |
int |
getOtherNode(int edge,
int node) |
TurnCostStorage |
getTurnCostStorage() |
Set<EdgeIteratorState> |
getUnfavoredVirtualEdges()
Returns all virtual edges that have been unfavored via
enforceHeading(int, double, boolean) or unfavorVirtualEdgePair(int, int) . |
boolean |
isAdjacentToNode(int edge,
int node) |
boolean |
isVirtualEdge(int edgeId) |
boolean |
isVirtualNode(int nodeId) |
void |
unfavorVirtualEdgePair(int virtualNodeId,
int virtualEdgeId)
Sets the virtual edge with virtualEdgeId and its reverse edge to 'unfavored', which
effectively penalizes both virtual edges towards an adjacent node of virtualNodeId.
|
Weighting |
wrapWeighting(Weighting weighting)
Wraps the given weighting into a weighting that can be used by this graph
|
public static QueryGraph create(Graph graph, QueryResult qr)
public static QueryGraph create(Graph graph, QueryResult fromQR, QueryResult toQR)
public static QueryGraph create(Graph graph, List<QueryResult> queryResults)
public Graph getBaseGraph()
getBaseGraph
in interface Graph
public boolean isVirtualEdge(int edgeId)
public boolean isVirtualNode(int nodeId)
public boolean enforceHeading(int nodeId, double favoredHeading, boolean incoming)
nodeId
- VirtualNode at which edges get unfavoredfavoredHeading
- north based azimuth of favored heading between 0 and 360incoming
- if true, incoming edges are unfavored, else outgoing edgespublic void unfavorVirtualEdgePair(int virtualNodeId, int virtualEdgeId)
virtualNodeId
- virtual node at which edges get unfavoredvirtualEdgeId
- this edge and the reverse virtual edge become unfavoredpublic Set<EdgeIteratorState> getUnfavoredVirtualEdges()
enforceHeading(int, double, boolean)
or unfavorVirtualEdgePair(int, int)
.public void clearUnfavoredStatus()
public int getNodes()
public int getEdges()
public NodeAccess getNodeAccess()
Graph
getNodeAccess
in interface Graph
public BBox getBounds()
Graph
public EdgeIteratorState getEdgeIteratorState(int origEdgeId, int adjNode)
Graph
getEdgeIteratorState
in interface Graph
adjNode
- is the node that will be returned via getAdjNode(). If adjNode is
Integer.MIN_VALUE then the edge will be returned in the direction of how it is storedpublic EdgeExplorer createEdgeExplorer(EdgeFilter edgeFilter)
Graph
createEdgeExplorer
in interface Graph
EdgeExplorer
,
Graph.createEdgeExplorer()
public EdgeExplorer createEdgeExplorer()
createEdgeExplorer
in interface Graph
Graph.createEdgeExplorer(com.graphhopper.routing.util.EdgeFilter)
public AllEdgesIterator getAllEdges()
getAllEdges
in interface Graph
public EdgeIteratorState edge(int a, int b)
Graph
public EdgeIteratorState edge(int a, int b, double distance, boolean bothDirections)
Graph
public Graph copyTo(Graph g)
Graph
public TurnCostStorage getTurnCostStorage()
getTurnCostStorage
in interface Graph
TurnCostStorage
or null if not supportedpublic Weighting wrapWeighting(Weighting weighting)
Graph
wrapWeighting
in interface Graph
public int getOtherNode(int edge, int node)
getOtherNode
in interface Graph
public boolean isAdjacentToNode(int edge, int node)
isAdjacentToNode
in interface Graph
public Graph getMainGraph()
Copyright © 2012–2020. All rights reserved.