net.ogdf.lib
Class Ogdf

java.lang.Object
  extended by net.ogdf.lib.Ogdf

public class Ogdf
extends Object

The java-side wrapper for the OGDF library.

Rating red

Field Summary
static int BEAUTIFUL_AND_FAST
          the BeautifulAndFast option.
static int COSTS_PLANAR
          the planar cost option.
static int COSTS_REPULSE
          the repulse cost option.
static int COSTS_STANDARD
          the standard cost option.
static int DIRECTION_EAST
          the east direction.
static int DIRECTION_NORTH
          the north direction.
static int DIRECTION_SOUTH
          the south direction.
static int DIRECTION_WEST
          the west direction.
static int EDGE_TYPE_ASSOCIATION
          the association edge type.
static int EDGE_TYPE_DEPENDENCY
          the dependency edge type.
static int EDGE_TYPE_GENERALIZATION
          the generalization edge type.
static int GORGEOUS_AND_EFFICIENT
          the GorgeousAndEfficient option.
static int LABEL_TYPE_END1
          the end1 label type.
static int LABEL_TYPE_END2
          the end2 label type.
static int LABEL_TYPE_MULT1
          the mult1 label type.
static int LABEL_TYPE_MULT2
          the mult2 label type.
static int LABEL_TYPE_NAME
          the name label type.
static int NICE_AND_INCREDIBLE_SPEED
          the NiceAndIncredibleSpeed option.
static int ORIENTATION_BOTTOM_TO_TOP
          the bottom-to-top orientation option.
static int ORIENTATION_LEFT_TO_RIGHT
          the left-to-right orientation option.
static int ORIENTATION_RIGHT_TO_LEFT
          the right-to-left orientation option.
static int ORIENTATION_TOP_TO_BOTTOM
          the top-to-bottom orientation option.
static int SPEED_FAST
          the fast speed option.
static int SPEED_HQ
          the hq speed option.
static int SPEED_MEDIUM
          the medium speed option.
 
Constructor Summary
Ogdf()
           
 
Method Summary
static float BendsIterator_getX()
          Returns the x-coordinate of the bend the current bends iterator is pointing at.
static float BendsIterator_getY()
          Returns the y-coordinate of the bend the current bends iterator is pointing at.
static boolean BendsIterator_hasNext()
          Returns whether the current bends iterator can iterate more bend points.
static void BendsIterator_next()
          Moves the current bends iterator forward.
static void cleanup()
          Deallocates memory that was allocated during the last graph-build and layout process.
This method should be called everytime after such a process finished.
static void createBendsInterator(long edge)
          Creates an iterator for the edge and sets it as the current bends iterator.
static void createCircularLayouter(float minDistCircle, float minDistLevel, float minDistSibling, float minDistCC)
          Creates the circular layouter.
static void createDavidsonHarelLayouter(int costs, int speed, float edgeLength)
          Creates the Davidson-Harel layouter.
static void createFMMMLayouter(float unitEdgeLength, boolean newInitialPlacement, int qualityVsSpeed)
          Creates a new FMMM layouter.
static void createFMMMLayouterDetail(boolean coolTemperature, float coolValue, float fineTuneScalar, int fineTuningIterations, int fixedIterations, float forceScalingFactor, int gridQuotient, int maxIterFactor, float minDistCC, int minGraphSize, int particlesInLeaves, int precision, float postSpringStrength, float strengthOfRepForces, int randomTries, float repForcesStrength, float springStrength, int stepsForRotatingComponents, float threshold)
          Creates a new FMMM layouter with low level options.
static void createGraph(boolean umlGraph)
          Creates new Graph and GraphAttributes and sets them as the current graph.
static void createLabelInterface()
          Creates a new ELabelInterface and sets it as the current label interface.
This requires a preceding call to createGraph.
Furthermore his has to be called before any other Label and LabelLayouter method and after any call to cleanup.
static void createLabelLayouter()
          Creates a new ELabelPosSimple and sets it as the current label layouter.
This has to be called before any other label layouter method and after any call to cleanup.
static void createMixedUpwardPlanarizationLayouter(float pageRatio, float separation, int direction)
          Creates a new Mixed-Upward Planarization layouter.
static void createRadialTreeLayouter(float minDistLevel, float minDistCC)
          Creates the radial tree layouter.
static void createSpringEmbedderFRLayouter(int iterations)
          Creates the Spring Embedder layouter by Fruchterman and Reingold.
static void createSugiyamaLayouter(float nodeDistance, float layerDistance)
          Creates a new Sugiyama layouter.
static void createTreeLayouter(float siblingDistance, float subtreeDistance, float levelDistance, float treeDistance, boolean orthogonal, int orientation)
          Creates the tree layouter.
static void createUpwardPlanarizationLayouter(float nodeDistance, float layerDistance)
          Creates the upward planarization layouter.
static long Graph_addEdge(long node1, long node2)
          Adds a new edge to the current graph.
static long Graph_addNode(float x, float y, float w, float h)
          Adds a new node to the current graph.
static void Graph_addNodeCenter2Bends()
          Adds intersections of the bends and the node center with the nodes bounding boxes to the list of bends.
static void Graph_getBoundingBox()
          Calculates the current bounding box and stores it as the current bounding box.
static float Graph_getBoundingBoxHeight()
          Returns the height of the graphs bounding box.
static float Graph_getBoundingBoxWidth()
          Returns the width of the graphs bounding box.
static float Graph_getBoundingBoxX()
          Returns the x-coordinate of the current bounding box.
static float Graph_getBoundingBoxY()
          Returns the y-coordinate of the current bounding box.
static float Graph_getNodeX(long node)
          Returns the nodes x-coordinate.
static float Graph_getNodeY(long node)
          Returns the nodes y-coordinate.
static int Graph_getNumberOfBends(long edge)
          Returns the number of bendpoints for the given edge.
static void Graph_setEdgeType(long edge, int type)
          Sets the edge type of the given edge.
static void Label_addLabel(long edge, int type, float width, float height)
          Adds an edge label to the label interface.
static float Label_getX(long edge, int type)
          Returns the x-coordinate of an edge label.
static float Label_getY(long edge, int type)
          Returns the y-coordinate of an edge label.
static void LabelLayouter_layout()
          Layouts the current label interface with the current label layouter.
static void LabelLayouter_setEdgeDistance(float distance)
          Sets the edge distance option for the label layouter.
static void LabelLayouter_setMarginDistance(float distance)
          Sets the margin distance option for the label layouter.
static void layout()
          Layouts the current graph with the current layouter.
static void loadLibrary()
          Load the native OGDF library.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EDGE_TYPE_ASSOCIATION

public static final int EDGE_TYPE_ASSOCIATION
the association edge type.

See Also:
Constant Field Values

EDGE_TYPE_GENERALIZATION

public static final int EDGE_TYPE_GENERALIZATION
the generalization edge type.

See Also:
Constant Field Values

EDGE_TYPE_DEPENDENCY

public static final int EDGE_TYPE_DEPENDENCY
the dependency edge type.

See Also:
Constant Field Values

LABEL_TYPE_END1

public static final int LABEL_TYPE_END1
the end1 label type.

See Also:
Constant Field Values

LABEL_TYPE_MULT1

public static final int LABEL_TYPE_MULT1
the mult1 label type.

See Also:
Constant Field Values

LABEL_TYPE_NAME

public static final int LABEL_TYPE_NAME
the name label type.

See Also:
Constant Field Values

LABEL_TYPE_END2

public static final int LABEL_TYPE_END2
the end2 label type.

See Also:
Constant Field Values

LABEL_TYPE_MULT2

public static final int LABEL_TYPE_MULT2
the mult2 label type.

See Also:
Constant Field Values

DIRECTION_NORTH

public static final int DIRECTION_NORTH
the north direction.

See Also:
Constant Field Values

DIRECTION_SOUTH

public static final int DIRECTION_SOUTH
the south direction.

See Also:
Constant Field Values

DIRECTION_WEST

public static final int DIRECTION_WEST
the west direction.

See Also:
Constant Field Values

DIRECTION_EAST

public static final int DIRECTION_EAST
the east direction.

See Also:
Constant Field Values

GORGEOUS_AND_EFFICIENT

public static final int GORGEOUS_AND_EFFICIENT
the GorgeousAndEfficient option.

See Also:
Constant Field Values

BEAUTIFUL_AND_FAST

public static final int BEAUTIFUL_AND_FAST
the BeautifulAndFast option.

See Also:
Constant Field Values

NICE_AND_INCREDIBLE_SPEED

public static final int NICE_AND_INCREDIBLE_SPEED
the NiceAndIncredibleSpeed option.

See Also:
Constant Field Values

COSTS_STANDARD

public static final int COSTS_STANDARD
the standard cost option.

See Also:
Constant Field Values

COSTS_REPULSE

public static final int COSTS_REPULSE
the repulse cost option.

See Also:
Constant Field Values

COSTS_PLANAR

public static final int COSTS_PLANAR
the planar cost option.

See Also:
Constant Field Values

SPEED_FAST

public static final int SPEED_FAST
the fast speed option.

See Also:
Constant Field Values

SPEED_MEDIUM

public static final int SPEED_MEDIUM
the medium speed option.

See Also:
Constant Field Values

SPEED_HQ

public static final int SPEED_HQ
the hq speed option.

See Also:
Constant Field Values

ORIENTATION_TOP_TO_BOTTOM

public static final int ORIENTATION_TOP_TO_BOTTOM
the top-to-bottom orientation option.

See Also:
Constant Field Values

ORIENTATION_BOTTOM_TO_TOP

public static final int ORIENTATION_BOTTOM_TO_TOP
the bottom-to-top orientation option.

See Also:
Constant Field Values

ORIENTATION_LEFT_TO_RIGHT

public static final int ORIENTATION_LEFT_TO_RIGHT
the left-to-right orientation option.

See Also:
Constant Field Values

ORIENTATION_RIGHT_TO_LEFT

public static final int ORIENTATION_RIGHT_TO_LEFT
the right-to-left orientation option.

See Also:
Constant Field Values
Constructor Detail

Ogdf

public Ogdf()
Method Detail

loadLibrary

public static void loadLibrary()
                        throws UnsatisfiedLinkError
Load the native OGDF library.

Throws:
UnsatisfiedLinkError - if the library is not found or cannot be loaded

createGraph

public static final void createGraph(boolean umlGraph)
Creates new Graph and GraphAttributes and sets them as the current graph. If umlGraph is true an UMLGraph is created instead of the GraphAttributes.
This method has to be called everytime before a layout graph-build and layout process. Also see cleanup.

Parameters:
umlGraph - true if the graph is an uml graph

Graph_addNode

public static final long Graph_addNode(float x,
                                       float y,
                                       float w,
                                       float h)
Adds a new node to the current graph.

Parameters:
x - the nodes x-coordinate
y - the nodes y-coordinate
w - the nodes width
h - the nodes height
Returns:
a unique identifier for the node

Graph_addEdge

public static final long Graph_addEdge(long node1,
                                       long node2)
Adds a new edge to the current graph.

Parameters:
node1 - the edges source node identifier
node2 - the edges target node identifier
Returns:
the edge identifier

Graph_setEdgeType

public static final void Graph_setEdgeType(long edge,
                                           int type)
Sets the edge type of the given edge.

Parameters:
edge - the edge
type - the edge type (one of EDGE_TYPE_ASSOCIATION, EDGE_TYPE_GENERALIZATION or EDGE_TYPE_DEPENDENCY)

Graph_getNodeX

public static final float Graph_getNodeX(long node)
Returns the nodes x-coordinate.

Parameters:
node - the node identifier
Returns:
the x-coordinate

Graph_getNodeY

public static final float Graph_getNodeY(long node)
Returns the nodes y-coordinate.

Parameters:
node - the node identifier
Returns:
the y-coordinate

Graph_getBoundingBox

public static final void Graph_getBoundingBox()
Calculates the current bounding box and stores it as the current bounding box.


Graph_getBoundingBoxX

public static final float Graph_getBoundingBoxX()
Returns the x-coordinate of the current bounding box.

Returns:
the bounding boxes x-coordinate

Graph_getBoundingBoxY

public static final float Graph_getBoundingBoxY()
Returns the y-coordinate of the current bounding box.

Returns:
the bounding boxes y-coordinate

Graph_getBoundingBoxWidth

public static final float Graph_getBoundingBoxWidth()
Returns the width of the graphs bounding box.

Returns:
the bounding boxes width

Graph_getBoundingBoxHeight

public static final float Graph_getBoundingBoxHeight()
Returns the height of the graphs bounding box.

Returns:
the bounding boxes height

Graph_getNumberOfBends

public static final int Graph_getNumberOfBends(long edge)
Returns the number of bendpoints for the given edge.

Parameters:
edge - the edge identifier
Returns:
the number of bends

Graph_addNodeCenter2Bends

public static final void Graph_addNodeCenter2Bends()
Adds intersections of the bends and the node center with the nodes bounding boxes to the list of bends.


createBendsInterator

public static final void createBendsInterator(long edge)
Creates an iterator for the edge and sets it as the current bends iterator.

Parameters:
edge - the edge identifier

BendsIterator_hasNext

public static final boolean BendsIterator_hasNext()
Returns whether the current bends iterator can iterate more bend points.

Returns:
true if the bends iterator can iterate more bend points

BendsIterator_next

public static final void BendsIterator_next()
Moves the current bends iterator forward.


BendsIterator_getX

public static final float BendsIterator_getX()
Returns the x-coordinate of the bend the current bends iterator is pointing at.

Returns:
the x-coordinate of the bend

BendsIterator_getY

public static final float BendsIterator_getY()
Returns the y-coordinate of the bend the current bends iterator is pointing at.

Returns:
the y-coordinate of the bend

createLabelInterface

public static final void createLabelInterface()
Creates a new ELabelInterface and sets it as the current label interface.
This requires a preceding call to createGraph.
Furthermore his has to be called before any other Label and LabelLayouter method and after any call to cleanup.


Label_addLabel

public static final void Label_addLabel(long edge,
                                        int type,
                                        float width,
                                        float height)
Adds an edge label to the label interface.

Parameters:
edge - the edge identifier
type - the label type (one of LABEL_TYPE_END1, LABEL_TYPE_MULT1, LABEL_TYPE_NAME, LABEL_TYPE_END2 or LABEL_TYPE_MULT2)
width - the label width
height - the label height

Label_getX

public static final float Label_getX(long edge,
                                     int type)
Returns the x-coordinate of an edge label.

Parameters:
edge - the edge
type - the label type (one of LABEL_TYPE_END1, LABEL_TYPE_MULT1, LABEL_TYPE_NAME, LABEL_TYPE_END2 or LABEL_TYPE_MULT2)
Returns:
the labels x-coordinate

Label_getY

public static final float Label_getY(long edge,
                                     int type)
Returns the y-coordinate of an edge label.

Parameters:
edge - the edge
type - the label type (one of LABEL_TYPE_END1, LABEL_TYPE_MULT1, LABEL_TYPE_NAME, LABEL_TYPE_END2 or LABEL_TYPE_MULT2)
Returns:
the labels y-coordinate

createLabelLayouter

public static final void createLabelLayouter()
Creates a new ELabelPosSimple and sets it as the current label layouter.
This has to be called before any other label layouter method and after any call to cleanup.


LabelLayouter_setEdgeDistance

public static final void LabelLayouter_setEdgeDistance(float distance)
Sets the edge distance option for the label layouter.

Parameters:
distance - the edge distance

LabelLayouter_setMarginDistance

public static final void LabelLayouter_setMarginDistance(float distance)
Sets the margin distance option for the label layouter.

Parameters:
distance - the margin distance

LabelLayouter_layout

public static final void LabelLayouter_layout()
Layouts the current label interface with the current label layouter.


createSugiyamaLayouter

public static final void createSugiyamaLayouter(float nodeDistance,
                                                float layerDistance)
Creates a new Sugiyama layouter.

Parameters:
nodeDistance - the node distance
layerDistance - the layer distance

createMixedUpwardPlanarizationLayouter

public static final void createMixedUpwardPlanarizationLayouter(float pageRatio,
                                                                float separation,
                                                                int direction)
Creates a new Mixed-Upward Planarization layouter.

Parameters:
pageRatio - the desired page ratio
separation - the separation distance
direction - the layout direction (one of DIRECTION_NORTH, DIRECTION_SOUTH, DIRECTION_WEST or DIRECTION_EAST)

createFMMMLayouter

public static final void createFMMMLayouter(float unitEdgeLength,
                                            boolean newInitialPlacement,
                                            int qualityVsSpeed)
Creates a new FMMM layouter.

Parameters:
unitEdgeLength - the unit edge length
newInitialPlacement - true if the algorithm should start with different starting positions every time
qualityVsSpeed - the QualityVsSpeed option (one of GORGEOUS_AND_EFFICIENT, BEAUTIFUL_AND_FAST or NICE_AND_INCREDIBLE_SPEED)

createFMMMLayouterDetail

public static final void createFMMMLayouterDetail(boolean coolTemperature,
                                                  float coolValue,
                                                  float fineTuneScalar,
                                                  int fineTuningIterations,
                                                  int fixedIterations,
                                                  float forceScalingFactor,
                                                  int gridQuotient,
                                                  int maxIterFactor,
                                                  float minDistCC,
                                                  int minGraphSize,
                                                  int particlesInLeaves,
                                                  int precision,
                                                  float postSpringStrength,
                                                  float strengthOfRepForces,
                                                  int randomTries,
                                                  float repForcesStrength,
                                                  float springStrength,
                                                  int stepsForRotatingComponents,
                                                  float threshold)
Creates a new FMMM layouter with low level options.

Parameters:
coolTemperature - the cool temperature
coolValue - the cool value
fineTuneScalar - the fine tune scalar
fineTuningIterations - the fine tuning iterations
fixedIterations - the fixed iterations
forceScalingFactor - the force scaling factor
gridQuotient - the grid quotient
maxIterFactor - the max iter factor
minDistCC - the min dist cc
minGraphSize - the min graph size
particlesInLeaves - the particles in leaves
precision - the precision
postSpringStrength - the post spring strength
strengthOfRepForces - the strength of rep forces
randomTries - the random tries
repForcesStrength - the rep forces strength
springStrength - the spring strength
stepsForRotatingComponents - the steps for rotating components
threshold - the threshold

createDavidsonHarelLayouter

public static final void createDavidsonHarelLayouter(int costs,
                                                     int speed,
                                                     float edgeLength)
Creates the Davidson-Harel layouter.

Parameters:
costs - the costs option (one of COSTS_STANDARD, COSTS_REPULSE or COSTS_PLANAR)
speed - the speed option (one of SPEED_FAST, SPEED_MEDIUM or SPEED_HQ)
edgeLength - the desired edge length

createSpringEmbedderFRLayouter

public static final void createSpringEmbedderFRLayouter(int iterations)
Creates the Spring Embedder layouter by Fruchterman and Reingold.

Parameters:
iterations - the number of iterations that are performed by the algorithm

createCircularLayouter

public static final void createCircularLayouter(float minDistCircle,
                                                float minDistLevel,
                                                float minDistSibling,
                                                float minDistCC)
Creates the circular layouter.

Parameters:
minDistCircle - the minimum distance between nodes on a circle
minDistLevel - the minimum distance between father and child circle
minDistSibling - the minimum distance between circles on the same level
minDistCC - the minimum distance between connected components

createTreeLayouter

public static final void createTreeLayouter(float siblingDistance,
                                            float subtreeDistance,
                                            float levelDistance,
                                            float treeDistance,
                                            boolean orthogonal,
                                            int orientation)
Creates the tree layouter.

Parameters:
siblingDistance - the horizontal spacing between adjacent sibling nodes
subtreeDistance - the horizontal spacing between adjacent subtrees
levelDistance - the vertical spacing between adjacent levels
treeDistance - the horizontal spacing between adjacent trees in a forest
orthogonal - determines whether edges are routed in an orthogonal or straight-line fashion
orientation - determines if the orientation of the tree (one of ORIENTATION_TOP_TO_BOTTOM, ORIENTATION_BOTTOM_TO_TOP, ORIENTATION_LEFT_TO_RIGHT or ORIENTATION_RIGHT_TO_LEFT)

createRadialTreeLayouter

public static final void createRadialTreeLayouter(float minDistLevel,
                                                  float minDistCC)
Creates the radial tree layouter.

Parameters:
minDistLevel - the minimum distance between father and child layer
minDistCC - the minimum distance between connected components

createUpwardPlanarizationLayouter

public static final void createUpwardPlanarizationLayouter(float nodeDistance,
                                                           float layerDistance)
Creates the upward planarization layouter.


layout

public static final void layout()
Layouts the current graph with the current layouter.


cleanup

public static final void cleanup()
Deallocates memory that was allocated during the last graph-build and layout process.
This method should be called everytime after such a process finished.