|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.cau.cs.kieler.kiml.util.KimlUtil
public final class KimlUtil
Utility methods for KGraphs and layout data.
Nested Class Summary | |
---|---|
static class |
KimlUtil.PortComparator
Comparator class used to sort ports according to their ranks. |
Method Summary | |
---|---|
static int |
calcFlow(KPort port)
Determines the flow of the given port, that is the difference between the number of outgoing edges and the number of incoming edges. |
static float |
calcPortOffset(KPort port,
PortSide side)
Calculate the offset for a port, that is the amount by which it is moved outside of the node. |
static void |
calcPortRanks(KNode node)
Sets port ranks for all ports of the given node according to their relative positions. |
static PortSide |
calcPortSide(KPort port,
Direction direction)
Determines the port side for the given port from its relative position at its corresponding node. |
static void |
createIdentifier(KGraphElement element)
Create a unique identifier for the given graph element. |
static KEdge |
createInitializedEdge()
Creates a KEdge, initializes some attributes, and returns it. |
static KLabel |
createInitializedLabel(KLabeledGraphElement element)
Creates a KLabel, initializes some attributes, and returns it. |
static KNode |
createInitializedNode()
Creates a KNode, initializes some attributes, and returns it. |
static KPort |
createInitializedPort()
Creates a KPort, initializes some attributes, and returns it. |
static void |
excludeContent(KNode node)
Excludes the content of the given node from layout. |
static void |
excludeLabels(KLabeledGraphElement element)
Exclude all labels of the given graph element from layout. |
static void |
excludePorts(KNode node)
Exclude all ports of the given graph element from layout. |
static void |
fillPortInfo(KNode node,
Direction direction)
Fills all missing data for the ports of the given node, such as port sides and port ranks. |
static KPort[] |
getSortedPorts(KNode node)
Returns a sorted list of the ports of the given node. |
static boolean |
isDescendant(KNode child,
KNode parent)
Determines whether the given child node is a descendant of the parent node. |
static void |
persistDataElements(KNode graph)
Persists all KGraphData elements of a KNode graph. |
static void |
placePoints(List<KPoint> points,
float minPos,
float maxPos,
float offset,
boolean vertical,
boolean forward)
Determines positions of a sorted set of points by placing them with equal distances. |
static KVector |
resizeNode(KNode node)
Sets the size of a given node, depending on the minimal size, the number of ports on each side, the insets, and the label. |
static KVector |
resizeNode(KNode node,
float newWidth,
float newHeight,
boolean movePorts)
Resize a node to the given width and height, adjusting port and label positions if needed. |
static void |
setOption(KGraphData graphData,
String id,
String value)
Set a layout option using a serialized key / value pair. |
static void |
toAbsolute(KVector point,
KNode parent)
Converts the given relative point to an absolute location. |
static void |
toRelative(KVector point,
KNode parent)
Converts the given absolute point to a relative location. |
static void |
translate(KNode parent,
float xoffset,
float yoffset)
Translates the contents of the given node by an offset. |
static void |
translate(KPoint point,
float xoffset,
float yoffset)
Translates the given point by an offset. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static KNode createInitializedNode()
public static KEdge createInitializedEdge()
public static KPort createInitializedPort()
public static KLabel createInitializedLabel(KLabeledGraphElement element)
element
- a labeled graph element
public static void createIdentifier(KGraphElement element)
element
- a graph elementpublic static PortSide calcPortSide(KPort port, Direction direction)
port
- port to analyzedirection
- the overall layout direction
public static float calcPortOffset(KPort port, PortSide side)
port
- a portside
- the side on the node for the given port
public static KPort[] getSortedPorts(KNode node)
node
- a node
public static void calcPortRanks(KNode node)
node
- node for which port ranks shall be setpublic static void fillPortInfo(KNode node, Direction direction)
node
- node for which port data shall be createddirection
- layout directionpublic static void placePoints(List<KPoint> points, float minPos, float maxPos, float offset, boolean vertical, boolean forward)
points
- list of pointsminPos
- minimal position for placingmaxPos
- maximal position for placingoffset
- offset to be added to positionsvertical
- if true, the vertical position is processed, else the
horizontal position is processedforward
- if true, ports are placed from the minimum to the maximum
positionpublic static KVector resizeNode(KNode node)
node
- the node that shall be resized
public static KVector resizeNode(KNode node, float newWidth, float newHeight, boolean movePorts)
node
- a nodenewWidth
- the new width to setnewHeight
- the new height to setmovePorts
- whether port positions shall be adjusted
public static int calcFlow(KPort port)
port
- port for which the flow shall be calculated
public static boolean isDescendant(KNode child, KNode parent)
child
- a child nodeparent
- a parent node
child
is a direct or indirect child of parent
public static void toAbsolute(KVector point, KNode parent)
point
- a relative pointparent
- the parent node to which the point is relative topublic static void toRelative(KVector point, KNode parent)
point
- an absolute pointparent
- the parent node to which the point shall be made relative topublic static void translate(KNode parent, float xoffset, float yoffset)
parent
- parent node whose children shall be translatedxoffset
- x coordinate offsetyoffset
- y coordinate offsetpublic static void translate(KPoint point, float xoffset, float yoffset)
point
- point that shall be translatedxoffset
- x coordinate offsetyoffset
- y coordinate offsetpublic static void excludeContent(KNode node)
LayoutOptions.NO_LAYOUT
option to true
for all children.
node
- a parent nodepublic static void excludeLabels(KLabeledGraphElement element)
LayoutOptions.NO_LAYOUT
option to true
for all labels.
element
- a graph element with labelspublic static void excludePorts(KNode node)
LayoutOptions.NO_LAYOUT
option to true
for all ports and their labels.
node
- a node with portspublic static void setOption(KGraphData graphData, String id, String value)
graphData
- the graph data instance to modifyid
- the layout option identifiervalue
- the value for the layout optionpublic static void persistDataElements(KNode graph)
graph
- the root element of the graph to persist elements of.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |