|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--y.layout.CanonicMultiStageLayouter | +--y.layout.transformer.GraphTransformer
Provides geometric transforms for (sub-)graphs. This module provides the following kinds of geometric transforms on graphs or subgraphs.
Here is an sample output of the layouter that rotated the inner nine nodes of the grid by 45 degrees.
Field Summary | |
static int |
MIRROR_XAXIS
Operation type constant. |
static int |
MIRROR_YAXIS
Operation type constant. |
static int |
ROTATE
Operation type constant. |
static int |
SCALE
Operation type constant. |
Fields inherited from interface y.layout.Layouter |
EDGE_ID_DPKEY, NODE_ID_DPKEY, SELECTED_EDGES, SELECTED_NODES |
Constructor Summary | |
GraphTransformer()
Creates a new instance of graph transformer. |
Method Summary | |
static double |
applyBestFitRotationAngle(LayoutGraph graph,
double width,
double height)
Performs a rotation of the given graph such that its resulting bounding box (approximately) fits best to the given area bounds. |
boolean |
canLayoutCore(LayoutGraph graph)
Returns always true . |
void |
doLayoutCore(LayoutGraph graph)
Performs the selected transformation. |
static double |
findBestFitRotationAngle(LayoutGraph graph,
double width,
double height)
Returns a rotation angle that, if applied to the given graph, would minimize the zoom-level needed to display the graph in an area of the given dimension. |
Layouter |
getCoreLayouter()
Returns the core layouter. |
int |
getOperation()
Returns the transformation operation this layouter performs. |
double |
getRotationAngle()
Returns the angle of rotation. |
double |
getScaleFactorX()
Returns the scaling factor used for the x-coordinate. |
double |
getScaleFactorY()
Returns the scaling factor used for the y-coordinate. |
boolean |
getScaleNodeSize()
Returns whether or not to scale node sizes. |
boolean |
isBestFitRotationEnabled()
Returns whether or not the best fit roatiopn angle will be applied. |
static double[] |
scaleToRect(LayoutGraph g,
Rectangle rect)
Scales the coordinates of the given graph in such a way that the resulting bounding box of the graph approximately equals the bounds of the given rectangle. |
void |
setBestFitRotationEnabled(boolean enabled)
Set whether or not to choose a best fit rotation angle instead of the one set by GraphTransformer.setRotationAngle(double) . |
void |
setCoreLayouter(Layouter coreLayouter)
Sets the core layouter. |
void |
setOperation(int operation)
Sets the transformation operation this layouter performs. |
void |
setPreferedLayoutSize(double width,
double height)
Sets the preferred layout size for this layouter. |
void |
setRotationAngle(double angle)
Sets the angle of rotation. |
void |
setScaleFactor(double f)
Sets the uniform scaling factor used for the SCALE
operation.
|
void |
setScaleFactors(double xFactor,
double yFactor)
Sets the scaling factors for the x-coordinates and y-coordinates used for the SCALE operation.
|
void |
setScaleNodeSize(boolean s)
Whether or not to scale node sizes when performing the
SCALE operation.
|
static void |
translate(LayoutGraph g,
double dx,
double dy)
Translates the layout coordinates by the vector (dx,dy) . |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface y.layout.Layouter |
canLayout, doLayout |
Field Detail |
public static final int MIRROR_XAXIS
public static final int MIRROR_YAXIS
public static final int ROTATE
public static final int SCALE
Constructor Detail |
public GraphTransformer()
Method Detail |
public void setCoreLayouter(Layouter coreLayouter)
LayoutStage
setCoreLayouter
in interface LayoutStage
public Layouter getCoreLayouter()
LayoutStage
getCoreLayouter
in interface LayoutStage
public void setOperation(int operation)
By default the SCALE
operation is set.
GraphTransformer.MIRROR_XAXIS
,
GraphTransformer.MIRROR_YAXIS
,
GraphTransformer.ROTATE
,
GraphTransformer.SCALE
public int getOperation()
public void setRotationAngle(double angle)
ROTATE
operation.
By default the rotation angle is 0.0
.
public double getRotationAngle()
public void setBestFitRotationEnabled(boolean enabled)
GraphTransformer.setRotationAngle(double)
. Also, to apply the best fit rotation
angle, the operation type of this layouter must be set to GraphTransformer.ROTATE
.
Use GraphTransformer.setPreferedLayoutSize(double, double)
to specify the preferred
aspect ratio of the resulting layout.
public boolean isBestFitRotationEnabled()
GraphTransformer.setBestFitRotationEnabled(boolean)
public void setPreferedLayoutSize(double width, double height)
public void setScaleNodeSize(boolean s)
SCALE
operation.
By default this feature is disabled.
public boolean getScaleNodeSize()
public void setScaleFactor(double f)
SCALE
operation.
By default the scaling factor is set to 1.0
public void setScaleFactors(double xFactor, double yFactor)
SCALE
operation.
By default the scaling factors are set to 1.0
public double getScaleFactorY()
public double getScaleFactorX()
public boolean canLayoutCore(LayoutGraph graph)
true
.
canLayoutCore
in class CanonicMultiStageLayouter
public void doLayoutCore(LayoutGraph graph)
doLayoutCore
in class CanonicMultiStageLayouter
public static double applyBestFitRotationAngle(LayoutGraph graph, double width, double height)
public static double findBestFitRotationAngle(LayoutGraph graph, double width, double height)
public static double[] scaleToRect(LayoutGraph g, Rectangle rect)
The x- and y-scaling factors are returned in a double array of size 2. The first value of the array is the x-scaling factor that has was used and the second value is the y-scaling factor.
public static void translate(LayoutGraph g, double dx, double dy)
(dx,dy)
.
|
© Copyright 2000-2003, yWorks GmbH. All rights reserved. 2003 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |