diva.graph.basic
Class BasicLayoutTarget

java.lang.Object
  extended by diva.graph.basic.BasicLayoutTarget
All Implemented Interfaces:
LayoutTarget

public class BasicLayoutTarget
extends Object
implements LayoutTarget

The basic set of information necessary to layout a graph: a mapping the graph data structure to aspects of its visual representation, a viewport to layout in, and some manipulation routines including pick, place, and route. This is an implementation for the Diva canvas, other layout target implementations can "port" the layout algorithms to other display implementations.

Version:
$Revision: 1.7 $
Author:
Michael Shilman (michaels@eecs.berkeley.edu)

Constructor Summary
BasicLayoutTarget(GraphController controller)
          Construce a new layout target that operates in the given pane.
 
Method Summary
 Rectangle2D getBounds(Object node)
          Return the bounds of the figure associated with the given node in the target's view.
 GraphController getController()
          Return the graph controller.
protected  GraphicsPane getGraphicsPane()
          Return the pane of this display.
 GraphModel getGraphModel()
          Return the graph model that we are operating on.
 double getLayoutPercentage()
          Return the percentage of the pane that is used for layout.
protected  Object getRootGraph()
          Return the root graph of this display.
 Rectangle2D getViewport(Object composite)
          Return the viewport of the given graph as a rectangle in logical coordinates.
 Object getVisualObject(Object object)
          Return the visual object of the given graph object.
 Iterator intersectingEdges(Rectangle2D r)
          Return an iterator over the node or edge figures which intersect the given rectangle.
 Iterator intersectingNodes(Rectangle2D r)
          Return an iterator over the nodes which intersect the given rectangle in the top-level graph.
 boolean isEdgeVisible(Object edge)
          Return whether or not the given edge is actually visible in the view.
 boolean isNodeVisible(Object node)
          Return whether or not the given node is actually visible in the view.
 void route(Object edge)
          Route absolutely the figure associated with the given edge in the target's view.
 void setLayoutPercentage(double d)
          Set the percentage of the pane that should be used for layout.
 void translate(Object node, double dx, double dy)
          Translate the figure associated with the given node in the target's view by the given delta.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BasicLayoutTarget

public BasicLayoutTarget(GraphController controller)
Construce a new layout target that operates in the given pane.

Method Detail

getBounds

public Rectangle2D getBounds(Object node)
Return the bounds of the figure associated with the given node in the target's view.

Specified by:
getBounds in interface LayoutTarget

getController

public GraphController getController()
Return the graph controller.


getGraphModel

public GraphModel getGraphModel()
Return the graph model that we are operating on.

Specified by:
getGraphModel in interface LayoutTarget

getLayoutPercentage

public double getLayoutPercentage()
Return the percentage of the pane that is used for layout.

See Also:
setLayoutPercentage(double)

getGraphicsPane

protected GraphicsPane getGraphicsPane()
Return the pane of this display. This is a template method for lazy subclassers.


getRootGraph

protected Object getRootGraph()
Return the root graph of this display. This is a template method for lazy subclassers.


getViewport

public Rectangle2D getViewport(Object composite)
Return the viewport of the given graph as a rectangle in logical coordinates.

Specified by:
getViewport in interface LayoutTarget

getVisualObject

public Object getVisualObject(Object object)
Return the visual object of the given graph object. Note that the purpose of a layout target is to abstract away the visual object and using this method breaks that abstraction.

Specified by:
getVisualObject in interface LayoutTarget

isNodeVisible

public boolean isNodeVisible(Object node)
Return whether or not the given node is actually visible in the view.

Specified by:
isNodeVisible in interface LayoutTarget

isEdgeVisible

public boolean isEdgeVisible(Object edge)
Return whether or not the given edge is actually visible in the view.

Specified by:
isEdgeVisible in interface LayoutTarget

intersectingNodes

public Iterator intersectingNodes(Rectangle2D r)
Return an iterator over the nodes which intersect the given rectangle in the top-level graph.

Specified by:
intersectingNodes in interface LayoutTarget

intersectingEdges

public Iterator intersectingEdges(Rectangle2D r)
Return an iterator over the node or edge figures which intersect the given rectangle.

Specified by:
intersectingEdges in interface LayoutTarget

route

public void route(Object edge)
Route absolutely the figure associated with the given edge in the target's view.

Specified by:
route in interface LayoutTarget

setLayoutPercentage

public void setLayoutPercentage(double d)
Set the percentage of the pane that should be used for layout. This method defines a frame in which layout is executed that is sized layoutPercentage*bounds, where "bounds" is the rectangular bounding box of the visual representation of a particular graph.

See Also:
#getVieport(Graph)

translate

public void translate(Object node,
                      double dx,
                      double dy)
Translate the figure associated with the given node in the target's view by the given delta.

Specified by:
translate in interface LayoutTarget


Copyright © 2015 Central Laboratory of the Research Councils. All Rights Reserved.