|
Search this API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object y.layout.transformer.GraphZoomer
public class GraphZoomer
This layout algorithm applies zoom operations to (sub-)graphs.
A radial zoom in a regular grid
The zoom operations are defined by GraphZoomer.Zoom
. Custom implementations provide the modification of the
initial graph coordinates.
There are two predefined zoom operations:
radial (fish-eye) zoom
and
rectangular zoom
. Both operations will just
move the nodes and bends. However, they will not introduce new bends.
Zoom operations can be combined by adding several instances to a list that gets processed in
doLayout(LayoutGraph)
.
addRadialZoom(YPoint, double, double, double)
,
addRectangularZoom(YPoint, double, double, double, double)
,
GraphZoomer.Zoom
Nested Class Summary | |
---|---|
static interface |
GraphZoomer.Zoom
A GraphZoomer.Zoom modifies the position of the nodes in a specific area in the graph. |
Field Summary |
---|
Fields inherited from interface y.layout.Layouter |
---|
EDGE_ID_DPKEY, NODE_ID_DPKEY, NODE_TYPE_DPKEY, SELECTED_EDGES, SELECTED_NODES |
Constructor Summary | |
---|---|
GraphZoomer()
Creates a new instance of GraphZoomer with an empty list of zoom operations. |
Method Summary | |
---|---|
void |
addRadialZoom(YPoint center,
double innerRadius,
double outerRadius,
double zoomFactor)
Adds a radial zoom operation to the list of operations to be performed on the graph. |
void |
addRectangularZoom(YPoint center,
double innerRadius,
double outerRadius,
double ratio,
double zoomFactor)
Adds a rectangular zoom operation to the list of operations performed on the graph. |
boolean |
canLayout(LayoutGraph graph)
Accepts all general graphs. |
void |
doLayout(LayoutGraph graph)
Applies previously defined zoom operations to the given graph. |
static void |
zoom(LayoutGraph graph,
GraphZoomer.Zoom zoom)
Applies the given zoom operation to the given graph. |
static void |
zoomRadial(LayoutGraph graph,
double centerX,
double centerY,
double innerRadius,
double outerRadius,
double zoomFactor)
Applies a radial zoom operation to the given graph. |
static void |
zoomRectangular(LayoutGraph graph,
double centerX,
double centerY,
double innerRadius,
double outerRadius,
double ratio,
double zoomFactor)
Applies a rectangular zoom operation to the given graph. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public GraphZoomer()
GraphZoomer
with an empty list of zoom operations.
addRadialZoom(YPoint, double, double, double)
,
addRectangularZoom(YPoint, double, double, double, double)
,
GraphZoomer.Zoom
Method Detail |
---|
public void addRadialZoom(YPoint center, double innerRadius, double outerRadius, double zoomFactor)
The zoom factor is applied to the subgraph located inside the inner radius. Inside the outer radius and outside the inner radius, the zoom factor will be reduced. The zoom factor outside the outer radius will be reduced again.
center
- the center coordinates of the zooming areainnerRadius
- the radius of the circle around the center inside which the zoom level is constantly set to the
given zoom factorouterRadius
- the radius of the outer circle around the center inside which the zoom factor will be reduced;
must be greater than the inner radiuszoomFactor
- the zoom factor inside the inner circleGraphZoomer.Zoom
public void addRectangularZoom(YPoint center, double innerRadius, double outerRadius, double ratio, double zoomFactor)
The zoom factor is applied to the subgraph located inside the rectangle defined by the inner radius and the given ratio. Inside the rectangle defined by the outer radius and the ratio and outside the inner rectangle, the zoom factor will be reduced. The zoom factor outside the outer rectangle will be reduced again.
center
- the center coordinates of the zooming areainnerRadius
- the radius of the rectangular shape around the center inside which the zoom level is
constantly set to the given zoom factorouterRadius
- the radius of the outer rectangular shape around the center inside which the zoom factor will
be reduced; must be greater than the inner radiusratio
- the aspect ratio of the inner and outer rectanglezoomFactor
- the zoom factor inside the inner rectangleGraphZoomer.Zoom
public boolean canLayout(LayoutGraph graph)
canLayout
in interface Layouter
graph
- the input graph
true
for all graphsLayouter.doLayout(LayoutGraph)
public void doLayout(LayoutGraph graph)
doLayout
in interface Layouter
graph
- the input graphaddRadialZoom(YPoint, double, double, double)
,
addRectangularZoom(YPoint, double, double, double, double)
,
GraphZoomer.Zoom
public static final void zoomRadial(LayoutGraph graph, double centerX, double centerY, double innerRadius, double outerRadius, double zoomFactor)
The zoom factor is applied to the subgraph located inside the inner radius. Inside the outer radius and outside the inner radius, the zoom factor will be reduced. The zoom factor outside the outer radius will be reduced again.
graph
- the input graphcenterX
- the center x-coordinate of the zooming areacenterY
- the center y-coordinate of the zooming areainnerRadius
- the radius of the circle around the center inside which the zoom level is constantly set to the
given zoom factorouterRadius
- the radius of the outer circle around the center inside which the zoom factor will be reduced;
must be greater than the inner radiuszoomFactor
- the zoom factor inside the inner circleGraphZoomer.Zoom
,
addRadialZoom(YPoint, double, double, double)
public static final void zoomRectangular(LayoutGraph graph, double centerX, double centerY, double innerRadius, double outerRadius, double ratio, double zoomFactor)
The zoom factor is applied to the subgraph located inside the rectangle defined by the inner radius and the given ratio. Inside the rectangle defined by the outer radius and the ratio and outside the inner rectangle, the zoom factor will be reduced. The zoom factor outside the outer rectangle will be reduced again.
graph
- the input graphcenterX
- the center x-coordinate of the zooming areacenterY
- the center y-coordinate of the zooming areainnerRadius
- the radius of the rectangular shape around the center inside which the zoom level is
constantly set to the given zoom factorouterRadius
- the radius of the outer rectangular shape around the center inside which the zoom factor will
be reduced; must be greater than the inner radiusratio
- the aspect ratio of the inner and outer rectanglezoomFactor
- the zoom factor inside the inner circleGraphZoomer.Zoom
,
addRectangularZoom(YPoint, double, double, double, double)
public static final void zoom(LayoutGraph graph, GraphZoomer.Zoom zoom)
graph
- the input graphzoom
- the zoom operation
|
© Copyright 2000-2022, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |