pl.edu.agh.cast.schema.editor.layout.algorithm
Class EnhancedCircleLayoutAlgorithm

java.lang.Object
  extended by pl.edu.agh.cast.schema.editor.layout.algorithm.AbstractLayoutAlgorithm
      extended by pl.edu.agh.cast.schema.editor.layout.algorithm.EnhancedCircleLayoutAlgorithm
All Implemented Interfaces:
ILayoutAlgorithm

public class EnhancedCircleLayoutAlgorithm
extends AbstractLayoutAlgorithm

This is implementation of AbstractLayoutAlgorithm. Nodes are positioned to create circle. Order of nodes is optimized so nodes with many connections are close to each other. Algorithm is divided into two phases. Phase 1 : Finding groups in graph Phase 2 : Setting order of nodes in every group. Phase 1: First, check if graph contains separate subgraphs. If it does, we init list of groups with subgraphs, otherwise init list of groups with whole graph. As second step, every group is divided into subgroups by removing some edges. Edge is removed when it's connections count is lower then some cutoff value. Every group is replace in list by it's subgroups, so we end with list of separate groups of nodes. Phase 2: For every group we start with empty new list of nodes. While group is not empty, we select node with highest rank value. Rank value is number of node's edges plus sum of their connections counts. Selected node is added to new list, interchangeably on the beginning and on the end. On the end, nodes from all groups are sequentially lay outed on circle. pl.edu.agh.cast.schema.layout.CircleLayoutAlgorithm does not optimize nodes positions to show structure of graph. This algorithm optimizes layout so nodes from local groups are close to each other. Edges that bounds local groups are distributed around circle, and edges that connect different groups are distributted across circle.

Author:
AGH CAST Team

Constructor Summary
EnhancedCircleLayoutAlgorithm()
           
 
Method Summary
protected  int getWorkUnits(int nodesCount)
          Queries for number of planned work units in the algorithm
protected  void setNodesPositions(Collection<ISchemaNode> positionNodes, org.eclipse.core.runtime.IProgressMonitor monitor)
          Method from AbstractLayoutAlgorithm.
 
Methods inherited from class pl.edu.agh.cast.schema.editor.layout.algorithm.AbstractLayoutAlgorithm
getCenterOfGravity, getUpperLeftCorner, layoutNodes
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EnhancedCircleLayoutAlgorithm

public EnhancedCircleLayoutAlgorithm()
Method Detail

setNodesPositions

protected void setNodesPositions(Collection<ISchemaNode> positionNodes,
                                 org.eclipse.core.runtime.IProgressMonitor monitor)
Method from AbstractLayoutAlgorithm. Lay outs nodes on circle.

Specified by:
setNodesPositions in class AbstractLayoutAlgorithm
Parameters:
positionNodes - nodes to be lay out.
monitor - non-null progress monitor

getWorkUnits

protected int getWorkUnits(int nodesCount)
Description copied from class: AbstractLayoutAlgorithm
Queries for number of planned work units in the algorithm

Specified by:
getWorkUnits in class AbstractLayoutAlgorithm
Parameters:
nodesCount - number of nodes to layout
Returns:
number of units that will be added to progress monitor's maximum range


Copyright © 2007-2009 IISG AGH-UST Krakow, Poland. All Rights Reserved.