uk.ac.ic.doc.automed.editor.autolayout
Class AutoLayoutTreeObject

java.lang.Object
  extended by uk.ac.ic.doc.automed.editor.autolayout.AutoLayoutPositionable
      extended by uk.ac.ic.doc.automed.editor.autolayout.AutoLayoutSchemaObject
          extended by uk.ac.ic.doc.automed.editor.autolayout.AutoLayoutTreeObject

public class AutoLayoutTreeObject
extends AutoLayoutSchemaObject

Class to implement tree autolayout algorithm.

Author:
Marcin Olawski

Field Summary
 
Fields inherited from class uk.ac.ic.doc.automed.editor.autolayout.AutoLayoutSchemaObject
boundsCorrection, myGraph
 
Fields inherited from class uk.ac.ic.doc.automed.editor.autolayout.AutoLayoutPositionable
autoLayoutPositionablesTable, currentSchema, myPositionableObj, newObjectsClass, pos
 
Constructor Summary
AutoLayoutTreeObject(Positionable positionable)
           
AutoLayoutTreeObject(Positionable positionable, AutoLayoutTreeObject parent, AutoLayoutTreeObject child, AutoLayoutTreeObject sibling)
          Creates a new instance of AutoLayoutTreeObjectect
 
Method Summary
protected static void attachParent(AutoLayoutTreeObject t, int h)
          Attaches the specified node to its children, setting offsets.
protected static uk.ac.ic.doc.automed.editor.autolayout.PolyLine bridge(uk.ac.ic.doc.automed.editor.autolayout.PolyLine line1, int x1, int y1, uk.ac.ic.doc.automed.editor.autolayout.PolyLine line2, int x2, int y2)
          bridge
protected static void computeAbsolutePosition(AutoLayoutTreeObject t, int off_x, int off_y)
           
static AutoLayoutSchemaObject findObjByLabel(java.lang.String label)
           
 AutoLayoutTreeObject findRoot()
          Find object which label = "root$1"
static void initAutoLayoutPositionablesTable(Schema schema)
           
 boolean isRoot()
          Return true if object label = "root$1"
protected static int join(AutoLayoutTreeObject t)
          Joins children/siblings together, merging contours.
protected static void layout(AutoLayoutTreeObject t)
           
protected static int merge(uk.ac.ic.doc.automed.editor.autolayout.Polygon c1, uk.ac.ic.doc.automed.editor.autolayout.Polygon c2)
          Merges two polygons together.
protected static int offset(int p1, int p2, int a1, int a2, int b1, int b2)
          Calculates the offset for specified points.
 void plantTree()
          Call this function on the root node to build a tree.
 void showTree()
          Same as setFinalPosition() but set position on all object in tree.
 
Methods inherited from class uk.ac.ic.doc.automed.editor.autolayout.AutoLayoutSchemaObject
getAbsolutePosition, getAllObjInSchema, getConstructClass, getDependentAutoLayoutPositionables, getDependentAutoLayoutPositionables, getFutureBounds, getFutureSchemaBounds, getObjectBetweenMeAnd, getReferencedAutoLayoutPositionables, getSchemaObjectsToLayout, getSchemaObjectsToLayout, hasChild, initializeMyGraph, isDependent, isOnCurrentSchema, setAbsolutePosition, setFinalPosition
 
Methods inherited from class uk.ac.ic.doc.automed.editor.autolayout.AutoLayoutPositionable
doLayout, findAutoLayoutPositionableFor, getDrawable, getLabel, getPosition, isHide, round, setPosition
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AutoLayoutTreeObject

public AutoLayoutTreeObject(Positionable positionable)

AutoLayoutTreeObject

public AutoLayoutTreeObject(Positionable positionable,
                            AutoLayoutTreeObject parent,
                            AutoLayoutTreeObject child,
                            AutoLayoutTreeObject sibling)
Creates a new instance of AutoLayoutTreeObjectect

Method Detail

findObjByLabel

public static final AutoLayoutSchemaObject findObjByLabel(java.lang.String label)

initAutoLayoutPositionablesTable

public static void initAutoLayoutPositionablesTable(Schema schema)

plantTree

public void plantTree()
Call this function on the root node to build a tree.


isRoot

public boolean isRoot()
Return true if object label = "root$1"


findRoot

public AutoLayoutTreeObject findRoot()
Find object which label = "root$1"


showTree

public void showTree()
Same as setFinalPosition() but set position on all object in tree.

See Also:
AutoLayoutPositionable#setFinalPosition()

layout

protected static void layout(AutoLayoutTreeObject t)

attachParent

protected static void attachParent(AutoLayoutTreeObject t,
                                   int h)
Attaches the specified node to its children, setting offsets.


merge

protected static int merge(uk.ac.ic.doc.automed.editor.autolayout.Polygon c1,
                           uk.ac.ic.doc.automed.editor.autolayout.Polygon c2)
Merges two polygons together. Returns total height of final polygon.


join

protected static int join(AutoLayoutTreeObject t)
Joins children/siblings together, merging contours.


bridge

protected static uk.ac.ic.doc.automed.editor.autolayout.PolyLine bridge(uk.ac.ic.doc.automed.editor.autolayout.PolyLine line1,
                                                                        int x1,
                                                                        int y1,
                                                                        uk.ac.ic.doc.automed.editor.autolayout.PolyLine line2,
                                                                        int x2,
                                                                        int y2)
bridge


offset

protected static int offset(int p1,
                            int p2,
                            int a1,
                            int a2,
                            int b1,
                            int b2)
Calculates the offset for specified points.


computeAbsolutePosition

protected static void computeAbsolutePosition(AutoLayoutTreeObject t,
                                              int off_x,
                                              int off_y)