edu.uci.ics.jung.visualization.contrib
Class KKLayoutInt

java.lang.Object
  extended byedu.uci.ics.jung.visualization.AbstractLayout
      extended byedu.uci.ics.jung.visualization.contrib.KKLayoutInt
All Implemented Interfaces:
Layout

public class KKLayoutInt
extends AbstractLayout

Implements the Kamada-Kawai algorithm for node layout, tweaked to store vertex distances as integers. Uses less memory than the classic KKLayout, but doesn't respect non-integer edge distances or lengths. Does not respect filter calls, and sometimes crashes when the view changes to it.

Author:
Masanori Harada
See Also:
"Tomihisa Kamada and Satoru Kawai: An algorithm for drawing general indirect graphs. Information Processing Letters 31(1):7-15, 1989", "Tomihisa Kamada: On visualization of abstract objects and relations. Ph.D. dissertation, Dept. of Information Science, Univ. of Tokyo, Dec. 1988."

Constructor Summary
KKLayoutInt(Graph g)
           
 
Method Summary
 void adjustForGravity()
          Shift all vertices so that the center of gravity is located at the center of the screen.
 void advancePositions()
          Implementors must override this method in order to create a Layout.
 boolean getAdjustForGravity()
          Returns true if gravity point adjusting is enabled.
 boolean getExchangeVertices()
          Returns true if the local minimum escape technique by exchanging vertices is enabled.
 java.lang.String getStatus()
          Returns the current status of the sytem, or null if there is no particular status to report. Useful for reporting things like number of iterations passed, temperature, and so on.By default, an AbstractLayout returns null for its status.By default, an AbstractLayout returns null for its status.
 boolean incrementsAreDone()
          Returns true once the current iteration has passed the maximum count.
 boolean isIncremental()
          This one is an incremental visualization.
 void setAdjustForGravity(boolean on)
          Enable or disable gravity point adjusting.
 void setExchangeVertices(boolean on)
          Enable or disable the local minimum escape technique by exchanging vertices.
 void setMaxIterations(int maxIterations)
           
 
Methods inherited from class edu.uci.ics.jung.visualization.AbstractLayout
applyFilter, dontMove, forceMove, getBaseKey, getCoordinates, getCurrentSize, getEdge, getEdge, getGraph, getVertex, getVertex, getVisibleEdges, getVisibleVertices, getX, getY, initialize, lockVertex, resize, restart, unlockVertex
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

KKLayoutInt

public KKLayoutInt(Graph g)
Method Detail

getStatus

public java.lang.String getStatus()
Description copied from class: AbstractLayout
Returns the current status of the sytem, or null if there is no particular status to report. Useful for reporting things like number of iterations passed, temperature, and so on.By default, an AbstractLayout returns null for its status.

Specified by:
getStatus in interface Layout
Overrides:
getStatus in class AbstractLayout

setMaxIterations

public void setMaxIterations(int maxIterations)

isIncremental

public boolean isIncremental()
This one is an incremental visualization.


incrementsAreDone

public boolean incrementsAreDone()
Returns true once the current iteration has passed the maximum count.


advancePositions

public void advancePositions()
Description copied from class: AbstractLayout
Implementors must override this method in order to create a Layout. If the Layout is the sort that only calculates locations once, this method may be overridden with an empty method.

Note that "locked" vertices are not to be moved; however, it is the policy of the visualization to decide how to handle them, and what to do with the vertices around them. Prototypical code might include a clipping like

  for (Iterator i = getVertices().iterator(); i.hasNext() ) { Vertex v = (Vertex) i.next(); if (! dontmove.contains( v ) ) { ... // handle the node } else { // ignore the node } }
 

Specified by:
advancePositions in interface Layout
Specified by:
advancePositions in class AbstractLayout
See Also:
Layout.advancePositions()

adjustForGravity

public void adjustForGravity()
Shift all vertices so that the center of gravity is located at the center of the screen.


setAdjustForGravity

public void setAdjustForGravity(boolean on)
Enable or disable gravity point adjusting.


getAdjustForGravity

public boolean getAdjustForGravity()
Returns true if gravity point adjusting is enabled.


setExchangeVertices

public void setExchangeVertices(boolean on)
Enable or disable the local minimum escape technique by exchanging vertices.


getExchangeVertices

public boolean getExchangeVertices()
Returns true if the local minimum escape technique by exchanging vertices is enabled.