Search this API

y.layout.transformer
Class GraphZoomer

java.lang.Object
  extended by y.layout.transformer.GraphZoomer
All Implemented Interfaces:
Layouter

public class GraphZoomer
extends Object
implements Layouter

This class contains algorithms which allow for zooming parts of a diagram only in a so-called fish-eye (radial) style. This type of zoom however will not introduce new bends for edges but will move the node centers and bends only.


Nested Class Summary
static interface GraphZoomer.Zoom
          This interface can be implemented for custom zoom types.
 
Field Summary
 
Fields inherited from interface y.layout.Layouter
EDGE_ID_DPKEY, NODE_ID_DPKEY, SELECTED_EDGES, SELECTED_NODES
 
Constructor Summary
GraphZoomer()
          Creates a new instance of GraphZoomer.
 
Method Summary
 void addRadialZoom(YPoint center, double innerRadius, double outerRadius, double zoomFactor)
          Adds a zoom operation to the list of operations to be performed on the graph during the doLayout phase.
 void addRectangularZoom(YPoint center, double innerRadius, double outerRadius, double ratio, double zoomFactor)
          Adds a zoom operation to the list of operations performed during the doLayout phase.
 boolean canLayout(LayoutGraph graph)
          Returns true iff the given graph can be laid out by this algorithm.
 void doLayout(LayoutGraph graph)
          Assigns a new graph layout to the given layout graph.
static void zoom(LayoutGraph graph, GraphZoomer.Zoom zoom)
          Convenience method which applies a custom zoom to the graph
static void zoomRadial(LayoutGraph graph, double centerX, double centerY, double innerRadius, double outerRadius, double zoomFactor)
          Convenience method which applies a radial zoom to the graph
static void zoomRectangular(LayoutGraph graph, double centerX, double centerY, double innerRadius, double outerRadius, double ratio, double zoomFactor)
          Convenience method which applies a rectangular zoom to the graph
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GraphZoomer

public GraphZoomer()
Creates a new instance of GraphZoomer.

Method Detail

addRadialZoom

public void addRadialZoom(YPoint center,
                          double innerRadius,
                          double outerRadius,
                          double zoomFactor)
Adds a zoom operation to the list of operations to be performed on the graph during the doLayout phase.

Parameters:
center - the center of the zoom
innerRadius - the radius of the circle around the center inside which the zoom level is constantly set to zoomFactor
outerRadius - the radius of the outer circle around the center outside of which the zoomFactor should be unchanged. This value must be greater than innerRadius
zoomFactor - the zoomFactor inside the inner circle

addRectangularZoom

public void addRectangularZoom(YPoint center,
                               double innerRadius,
                               double outerRadius,
                               double ratio,
                               double zoomFactor)
Adds a zoom operation to the list of operations performed during the doLayout phase. This performs a zoom on a rectangular shape using the given radii and the ratio defining the rectangle.

Parameters:
center - the center of the zoom
innerRadius - the radius of the rectangular shape around the center inside which the zoom level is constantly set to zoomFactor
outerRadius - the radius of the outer rectangular shape around the center outside of which the zoomFactor should be unchanged. This value must be greater than innerRadius
zoomFactor - the zoomFactor inside the inner rectangle

canLayout

public boolean canLayout(LayoutGraph graph)
Returns true iff the given graph can be laid out by this algorithm. Calling doLayout with the given graph as it's argument will only success if this method returns true.

Specified by:
canLayout in interface Layouter

doLayout

public void doLayout(LayoutGraph graph)
Assigns a new graph layout to the given layout graph.

Specified by:
doLayout in interface Layouter

zoomRadial

public static final void zoomRadial(LayoutGraph graph,
                                    double centerX,
                                    double centerY,
                                    double innerRadius,
                                    double outerRadius,
                                    double zoomFactor)
Convenience method which applies a radial zoom to the graph


zoomRectangular

public static final void zoomRectangular(LayoutGraph graph,
                                         double centerX,
                                         double centerY,
                                         double innerRadius,
                                         double outerRadius,
                                         double ratio,
                                         double zoomFactor)
Convenience method which applies a rectangular zoom to the graph


zoom

public static final void zoom(LayoutGraph graph,
                              GraphZoomer.Zoom zoom)
Convenience method which applies a custom zoom to the graph


© Copyright 2000-2013,
yWorks GmbH.
All rights reserved.