de.cau.cs.kieler.klay.layered
Class AbstractGraphImporter<T>
java.lang.Object
de.cau.cs.kieler.klay.layered.AbstractGraphImporter<T>
- Type Parameters:
T
- the type of graph that this importer can transform into a layered graph.
- All Implemented Interfaces:
- IGraphImporter<T>
- Direct Known Subclasses:
- KGraphImporter
public abstract class AbstractGraphImporter<T>
- extends Object
- implements IGraphImporter<T>
Abstract implementation of IGraphImporter
, containing commonly used functionality.
Graph importers may subclass this class instead of implementing the interface directly.
When a graph importer supports external ports, it must create dummies for those ports by calling
#createExternalPortDummy(Object, PortConstraints, PortSide, int, int, KInsets, KVector)
.
The correct position of those ports can later be retrieved by calling
#getExternalPortPosition(LNode, double, double)
.
- Rating

Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
AbstractGraphImporter
public AbstractGraphImporter()
createExternalPortDummy
protected LNode createExternalPortDummy(Object port,
PortConstraints portConstraints,
PortSide portSide,
int netFlow,
KVector portNodeSize,
KVector portPosition,
KVector portSize)
- Creates a dummy for an external port. The dummy will have just one port. The port is on
the eastern side for western external ports, and on the western side for all other ports.
The returned dummy node is decorated with some properties. Its Properties.NODE_TYPE
is set to NodeType.EXTERNAL_PORT
. Its Properties.ORIGIN
is set
to the external port object. The LayoutOptions.PORT_CONSTRAINTS
are set to
PortConstraints.FIXED_POS
. For western and eastern port dummies, the
Properties.LAYER_CONSTRAINT
is set toLayerConstraint.FIRST_SEPARATE
and LayerConstraint.LAST_SEPARATE
, respectively. For northern and southern
port dummies, the Properties.IN_LAYER_CONSTRAINT
is set to
InLayerConstraint.TOP
and InLayerConstraint.BOTTOM
,
respectively. For eastern dummies, the Properties.EDGE_CONSTRAINT
is set to
EdgeConstraint.OUTGOING_ONLY
; for all other dummies, it is set to
EdgeConstraint.INCOMING_ONLY
. Properties.EXT_PORT_SIDE
is
set to the side of the external port represented. If the port constraints of the original
port's node are set to PortConstraints.FIXED_RATIO
or PortConstraints.FIXED_POS
,
the dummy node's Properties.EXT_PORT_RATIO_OR_POSITION
property is set to the port's
original position, defined relative to the original node's origin. (as opposed to relative to
the node's content area)
- Parameters:
port
- the port object the dummy will represent.portConstraints
- constraints for external ports.portSide
- the side of the external port.netFlow
- the number of incoming minus the number of outgoing edges.portNodeSize
- the size of the node the port belongs to. Only relevant if the port
constraints are FIXED_RATIO
.portPosition
- the current port position. Only relevant if the port constraints are
FIXED_ORDER
, FIXED_RATIO
or FIXED_POSITION
.portSize
- size of the port. Depending on the port's side, the created dummy will
have the same width or height as the port, with the other dimension set
to zero.
- Returns:
- a dummy node representing the external port.
getExternalPortPosition
protected KVector getExternalPortPosition(LayeredGraph graph,
LNode portDummy,
double portWidth,
double portHeight)
- Calculates the position of the external port's top left corner from the position of the
given dummy node that represents the port. The position is relative to the graph node's
top left corner.
- Parameters:
graph
- the graph for which ports shall be placedportDummy
- the dummy node representing the external port.portWidth
- the external port's width.portHeight
- the external port's height.
- Returns:
- the external port's position.