java.lang.Object
de.grogra.imp2d.layout.Layout.Algorithm
- Direct Known Subclasses:
ForceBasedLayout.FBAlgorithm
,ForceBasedLayout2.FBAlgorithm2
,HierarchyLayout.HAlgorithm
- Enclosing class:
- Layout
An
Algorithm
is created by a Layout
in order
to perform the actual layout task. It may use the fields
of the layout instance as algorithm parameters.- Author:
- Ole Kniemeyer
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Graph
protected Graph
protected GraphState
protected View2D
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
acceptNode
(Object node) Determines whether a givennode
of the original graph is to be included in the layout graph.protected void
fitLayoutToWindow
(Node nodes, int param) rotates and scales a graph to fit in the drawing window possibility for choosing the param: 0 -> the first node will be arranged in the centre of the drawing window, then zooming else -> calculating the max distance in the graph, then zoomingprotected Vector2d
getGlobalMaxBounds
(Node nodes) Getting the highest value (absolute) of height and width of the nodesprotected Vector2d
getGlobalMaxCoordinates
(Node nodes) Getting the most differing x- and y-coordinates from point (0,0)protected Vector2d
getGlobalMaxCoordinates
(Node nodes, Node rootNode) Getting the most differing x- and y-coordinates (absolute) from rootNodeprotected Vector2d
getGlobalMaxDistances
(Node nodes) Getting the longest distance (absolute) from nodes of the graphfinal void
invokeLayout
(Layout layout, Node nodes) Delegates layouting to anotherlayout
.protected abstract void
This method has to be implemented to perform the layout.protected void
setProgress
(float progress, String text) This method sets the status bar of the UI.
-
Field Details
-
state
-
graph
-
finalGraph
-
view
-
-
Constructor Details
-
Algorithm
public Algorithm()
-
-
Method Details
-
layout
This method has to be implemented to perform the layout.- Parameters:
nodes
- the first node of the linked list of all nodes- See Also:
-
acceptNode
Determines whether a givennode
of the original graph is to be included in the layout graph.- Parameters:
node
- a node of the original graph- Returns:
true
iff the node is to be included in layout
-
invokeLayout
Delegates layouting to anotherlayout
. This method initializes an algorithm created bylayout
with the current context and graph information and invokeslayout(Node)
on the created algorithm. This method may only be invoked by an active algorithm, i.e., only withinlayout(Node)
.- Parameters:
layout
- another layout to be usednodes
- the linked list of layout nodes
-
setProgress
This method sets the status bar of the UI.- Parameters:
progress
- a value indicating the progress of the algorithmtext
- a text to show in the status bar
-
getGlobalMaxBounds
Getting the highest value (absolute) of height and width of the nodes- Parameters:
nodes
-- Returns:
-
getGlobalMaxDistances
Getting the longest distance (absolute) from nodes of the graph- Parameters:
nodes
-- Returns:
-
getGlobalMaxCoordinates
Getting the most differing x- and y-coordinates from point (0,0)- Parameters:
nodes
-- Returns:
-
getGlobalMaxCoordinates
Getting the most differing x- and y-coordinates (absolute) from rootNode- Parameters:
nodes
-- Returns:
-
fitLayoutToWindow
rotates and scales a graph to fit in the drawing window possibility for choosing the param: 0 -> the first node will be arranged in the centre of the drawing window, then zooming else -> calculating the max distance in the graph, then zooming- Parameters:
nodes
-param
-
-
getCommandName
-