public class GraphObstacleProvider extends Object implements IObstacleProvider
IObstacleProvider
interface that uses the edges
and nodes
of an IGraph
as obstacles.
The BridgeManager
then calculates bridges for edge paths that cross these obstacles.
This class can be used to add bridge support via the BridgeManager
to a rendered IGraph
.
Constructor and Description |
---|
GraphObstacleProvider() |
Modifier and Type | Method and Description |
---|---|
protected IGraph |
getGraph(IRenderContext context)
Helper method that retrieves the
IGraph to use from the . |
GeneralPath |
getObstacles(IRenderContext context)
Iterates over all
Edges and Nodes to query an IObstacleProvider
from the IModelItem 's ILookup.lookup(java.lang.Class) . |
boolean |
isEdgeQueryingEnabled()
Gets a value indicating whether to query the
Edges for an IObstacleProvider
implementation. |
boolean |
isNodeQueryingEnabled()
Gets a value indicating whether to query the
Nodes for an IObstacleProvider
implementation. |
void |
setEdgeQueryingEnabled(boolean value)
Sets a value indicating whether to query the
Edges for an IObstacleProvider
implementation. |
void |
setNodeQueryingEnabled(boolean value)
Sets a value indicating whether to query the
Nodes for an IObstacleProvider
implementation. |
protected IGraph getGraph(IRenderContext context)
IGraph
to use from the .context
This implementation uses the ILookup.lookup(java.lang.Class)
of the CanvasControl
to query the IGraph
implementation.
context
- The context to retrieve the implementation from.IGraph
instance to query or null
.public GeneralPath getObstacles(IRenderContext context)
Edges
and Nodes
to query an IObstacleProvider
from the IModelItem
's ILookup.lookup(java.lang.Class)
.
This method will depending on the EdgeQueryingEnabled
and NodeQueryingEnabled
property query the items for an implementation of IObstacleProvider
and concatenate all resulting GeneralPath
obstacles into one path that will then be returned.
getObstacles
in interface IObstacleProvider
context
- The context where the obstacles are queried for.public final boolean isEdgeQueryingEnabled()
Edges
for an IObstacleProvider
implementation.
The default is true
.
setEdgeQueryingEnabled(boolean)
public final boolean isNodeQueryingEnabled()
Nodes
for an IObstacleProvider
implementation.true
if nodes should be queried at all; false
otherwise. The default is false
.setNodeQueryingEnabled(boolean)
public final void setEdgeQueryingEnabled(boolean value)
Edges
for an IObstacleProvider
implementation.
The default is true
.
value
- The EdgeQueryingEnabled to set.isEdgeQueryingEnabled()
public final void setNodeQueryingEnabled(boolean value)
Nodes
for an IObstacleProvider
implementation.value
- true
if nodes should be queried at all; false
otherwise. The default is false
.isNodeQueryingEnabled()