Packagecom.yworks.yfiles.layout.transformer
Classpublic class GraphTransformer
InheritanceGraphTransformer Inheritance CanonicMultiStageLayouter Inheritance YObject Inheritance Object
Implements LayoutStage

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.



Public Properties
 PropertyDefined By
  bestFitRotationEnabled : Boolean
Getter: Returns whether or not the best fit rotation angle will be applied.
GraphTransformer
 InheritedcomponentLayouter : LayoutStage
Specifies the LayoutStage responsible for laying out the connected components of the graph.
CanonicMultiStageLayouter
  componentLayouterEnabled : Boolean
[override] Getter: Returns whether or not ComponentLayouter is enabled.
GraphTransformer
  coreLayouter : Layouter
GraphTransformer
 InheritedgroupNodeHider : LayoutStage
Specifies the LayoutStage that is responsible for hiding away grouping information for the layout algorithm.
CanonicMultiStageLayouter
 InheritedhideGroupNodes : Boolean
Specifies whether or not to hide away group nodes before the layout begins.
CanonicMultiStageLayouter
 InheritedlabelLayouter : LayoutStage
Getter: Returns the algorithm used for placing labels.
CanonicMultiStageLayouter
 InheritedlabelLayouterEnabled : Boolean
Getter: Returns whether or not LabelLayouter is enabled.
CanonicMultiStageLayouter
 InheritedlayoutOrientation : int
Specifies the main layout orientation.
CanonicMultiStageLayouter
  operation : int
Specifies the transformation operation this layouter performs.
GraphTransformer
 InheritedorientationLayouter : LayoutStage
Specifies the LayoutStage that is responsible for changing the orientation of the computed layout.
CanonicMultiStageLayouter
 InheritedorientationLayouterEnabled : Boolean
Getter: Returns whether or not the OrientationLayouter is enabled.
CanonicMultiStageLayouter
 InheritedparallelEdgeLayouter : LayoutStage
Getter: Returns the LayoutStage responsible for routing parallel edges.
CanonicMultiStageLayouter
 InheritedparallelEdgeLayouterEnabled : Boolean
Getter: Returns whether or not the ParallelEdgeLayouter is enabled.
CanonicMultiStageLayouter
  rotationAngle : Number
Specifies the angle of rotation.
GraphTransformer
  scaleFactor : Number
[write-only] Sets the uniform scaling factor used for the SCALE operation.
GraphTransformer
  scaleFactorX : Number
[read-only] Returns the scaling factor used for the x-coordinate.
GraphTransformer
  scaleFactorY : Number
[read-only] Returns the scaling factor used for the y-coordinate.
GraphTransformer
  scaleNodeSize : Boolean
Getter: Returns whether or not to scale node sizes.
GraphTransformer
 InheritedselfLoopLayouter : LayoutStage
Getter: Returns the LayoutStage used for routing Self-loops.
CanonicMultiStageLayouter
 InheritedselfLoopLayouterEnabled : Boolean
Getter: Returns whether or not the SelfLoopLayouter is enabled.
CanonicMultiStageLayouter
 InheritedsubgraphLayouter : LayoutStage
Specifies the LayoutStage that is responsible for constraining the layout process to a subgraph of the target graph.
CanonicMultiStageLayouter
 InheritedsubgraphLayouterEnabled : Boolean
Getter: Returns whether or not the SubgraphLayouter is enabled.
CanonicMultiStageLayouter
  translateX : Number
Specifies the horizontal translation distance.
GraphTransformer
  translateY : Number
Specifies the vertical translation distance.
GraphTransformer
Public Methods
 MethodDefined By
  
GraphTransformer(init:Boolean = true)
Creates a new instance of graph transformer.
GraphTransformer
 Inherited
Appends a stage to the layout pipeline.
CanonicMultiStageLayouter
  
applyBestFitRotationAngle(graph:LayoutGraph, width:Number, height:Number):Number
[static] Performs a rotation of the given graph such that its resulting bounding box (approximately) fits best to the given area bounds.
GraphTransformer
 Inherited
Returns a layout for the given layout graph.
CanonicMultiStageLayouter
 Inherited
Returns a layout for the given graph interface and layout.
CanonicMultiStageLayouter
 Inherited
canLayout(graph:LayoutGraph):Boolean
Tests whether or not the given graph can be laid out by this layouter.
CanonicMultiStageLayouter
  
canLayoutCore(graph:LayoutGraph):Boolean
[override] Returns always true.
GraphTransformer
 Inherited
doLayout(layoutGraph:LayoutGraph):void
Calculates a layout for the given graph.
CanonicMultiStageLayouter
 Inherited
Calculates a layout for the given graph interface and layout.
CanonicMultiStageLayouter
  
[override] Performs the selected transformation.
GraphTransformer
 Inherited
Disables all layout stages and performs only the core layouter.
CanonicMultiStageLayouter
 Inherited
equals(o:Object):Boolean
YObject
  
findBestFitRotationAngle(graph:LayoutGraph, width:Number, height:Number):Number
[static] 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.
GraphTransformer
  
getClass():Class
[override]
GraphTransformer
 Inherited
hashCode():int
YObject
  
[static] Creates a new instance of graph transformer.
GraphTransformer
 Inherited
Prepends a stage to the layout pipeline.
CanonicMultiStageLayouter
 Inherited
Removes a LayoutStage that has been previously added by the methods appendStage() or prependStage().
CanonicMultiStageLayouter
  
scaleToRect(g:LayoutGraph, rect:Rectangle):Vector.<Number>
[static] 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.
GraphTransformer
  
setMaximalBounds(graph:LayoutGraph, x:Number, y:Number, w:Number, h:Number):void
[static] Assures that the given graph fits into the given rectangular bounds.
GraphTransformer
  
setPreferedLayoutSize(width:Number, height:Number):void
Sets the preferred layout size for this layouter.
GraphTransformer
  
setScaleFactors(xFactor:Number, yFactor:Number):void
Sets the scaling factors for the x-coordinates and y-coordinates used for the SCALE operation.
GraphTransformer
  
translate(g:LayoutGraph, dx:Number, dy:Number):void
[static] Translates the layout coordinates by the vector (dx,dy).
GraphTransformer
Protected Methods
 MethodDefined By
 Inherited
checkGroupNodeSize(layout:GraphLayout, node:Object):void
This method throws an com.yworks.bridge.util.IllegalArgumentException if the width/height of the given group node object is zero.
CanonicMultiStageLayouter
 Inherited
checkNodeSize(layout:GraphLayout, node:Object):void
This method throws an com.yworks.bridge.util.IllegalArgumentException if the width/height of the given node object is zero.
CanonicMultiStageLayouter
 Inherited
CanonicMultiStageLayouter
  
Initializes this object.
GraphTransformer
Public Constants
 ConstantDefined By
  MIRROR_XAXIS : int = 0
[static] Operation type constant.
GraphTransformer
  MIRROR_YAXIS : int = 1
[static] Operation type constant.
GraphTransformer
  ROTATE : int = 2
[static] Operation type constant.
GraphTransformer
  SCALE : int = 3
[static] Operation type constant.
GraphTransformer
  TRANSLATE : int = 4
[static] Operation type constant.
GraphTransformer
Property Detail
bestFitRotationEnabledproperty
bestFitRotationEnabled:Boolean

Getter: Returns whether or not the best fit rotation angle will be applied.

Setter: Set whether or not to choose a best fit rotation angle instead of the one set by rotationAngle. Also, to apply the best fit rotation angle, the operation type of this layouter must be set to ROTATE.

Use setPreferedLayoutSize() to specify the preferred aspect ratio of the resulting layout.


Implementation
    public function get bestFitRotationEnabled():Boolean
    public function set bestFitRotationEnabled(value:Boolean):void

See also

componentLayouterEnabledproperty 
componentLayouterEnabled:Boolean[override]

Getter: Returns whether or not ComponentLayouter is enabled. By default it is disabled.

Setter: Specifies whether or not to enable the ComponentLayouter. By default it is disabled.


Implementation
    public function get componentLayouterEnabled():Boolean
    public function set componentLayouterEnabled(value:Boolean):void
coreLayouterproperty 
coreLayouter:Layouter


Implementation
    public function get coreLayouter():Layouter
    public function set coreLayouter(value:Layouter):void
operationproperty 
operation:int

Specifies the transformation operation this layouter performs.

By default the SCALE operation is set.


Implementation
    public function get operation():int
    public function set operation(value:int):void

See also

rotationAngleproperty 
rotationAngle:Number

Specifies the angle of rotation. The angle must be given in degrees. This feature is only meaningful for the ROTATE operation.

By default the rotation angle is 0.0.


Implementation
    public function get rotationAngle():Number
    public function set rotationAngle(value:Number):void
scaleFactorproperty 
scaleFactor:Number  [write-only]

Sets the uniform scaling factor used for the SCALE operation.

By default the scaling factor is set to 1.0


Implementation
    public function set scaleFactor(value:Number):void
scaleFactorXproperty 
scaleFactorX:Number  [read-only]

Returns the scaling factor used for the x-coordinate.


Implementation
    public function get scaleFactorX():Number
scaleFactorYproperty 
scaleFactorY:Number  [read-only]

Returns the scaling factor used for the y-coordinate.


Implementation
    public function get scaleFactorY():Number
scaleNodeSizeproperty 
scaleNodeSize:Boolean

Getter: Returns whether or not to scale node sizes.

Setter: Specifies whether or not to scale node sizes when performing the SCALE operation.

By default this feature is disabled.


Implementation
    public function get scaleNodeSize():Boolean
    public function set scaleNodeSize(value:Boolean):void
translateXproperty 
translateX:Number

Specifies the horizontal translation distance. A positive value means the graph is moved to the right; a negative value means the graph is moved to the left. Defaults to 0.


Implementation
    public function get translateX():Number
    public function set translateX(value:Number):void

See also

translateYproperty 
translateY:Number

Specifies the vertical translation distance. A positive value means the graph is moved downwards; a negative value means the graph is moved upwards. Defaults to 0.


Implementation
    public function get translateY():Number
    public function set translateY(value:Number):void

See also

Constructor Detail
GraphTransformer()Constructor
public function GraphTransformer(init:Boolean = true)

Creates a new instance of graph transformer.

Parameters
init:Boolean (default = true) — An internally used switch to help handle proper instance initialization in inheritance chains where classes can have multiple constructor-like factory methods. This parameter can safely be ignored/omitted when calling the constructor.
Method Detail
applyBestFitRotationAngle()method
public static function applyBestFitRotationAngle(graph:LayoutGraph, width:Number, height:Number):Number

Performs a rotation of the given graph such that its resulting bounding box (approximately) fits best to the given area bounds.

Parameters

graph:LayoutGraph
 
width:Number
 
height:Number

Returns
Number
canLayoutCore()method 
override public function canLayoutCore(graph:LayoutGraph):Boolean

Returns always true.

Parameters

graph:LayoutGraph

Returns
Boolean
doLayoutCore()method 
override public function doLayoutCore(graph:LayoutGraph):void

Performs the selected transformation.

Parameters

graph:LayoutGraph

findBestFitRotationAngle()method 
public static function findBestFitRotationAngle(graph:LayoutGraph, width:Number, height:Number):Number

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.

Parameters

graph:LayoutGraph
 
width:Number
 
height:Number

Returns
Number
getClass()method 
override public function getClass():Class

Returns
Class
initGraphTransformer()method 
protected final function initGraphTransformer():void

Initializes this object. See the documentation of the corresponding factory method newGraphTransformer() for details.

See also

newGraphTransformer()method 
public static function newGraphTransformer():GraphTransformer

Creates a new instance of graph transformer.

Returns
GraphTransformer
scaleToRect()method 
public static function scaleToRect(g:LayoutGraph, rect:Rectangle):Vector.<Number>

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.

Note that this operation won't have any effects, if there is only one node in the graph or if there are nodes that are bigger than the requested bounding box size.

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.

Parameters

g:LayoutGraph
 
rect:Rectangle

Returns
Vector.<Number>
setMaximalBounds()method 
public static function setMaximalBounds(graph:LayoutGraph, x:Number, y:Number, w:Number, h:Number):void

Assures that the given graph fits into the given rectangular bounds. If the bounding box fits in the rectangle, nothing is done. Otherwise the graph is scaled and optionally moved to fit. This algorithm does not modify the node's sizes. Note that this operation won't have any effects, if there are nodes that are bigger than the requested bounding box size.

Parameters

graph:LayoutGraph — the graph to modify
 
x:Number — the upper left x coordinate of the bounds
 
y:Number — the upper left y coordinate of the bounds
 
w:Number — the width of the bounds
 
h:Number — the height of the bounds

setPreferedLayoutSize()method 
public function setPreferedLayoutSize(width:Number, height:Number):void

Sets the preferred layout size for this layouter.

Parameters

width:Number
 
height:Number

setScaleFactors()method 
public function setScaleFactors(xFactor:Number, yFactor:Number):void

Sets the scaling factors for the x-coordinates and y-coordinates used for the SCALE operation.

By default the scaling factors are set to 1.0

Parameters

xFactor:Number
 
yFactor:Number

translate()method 
public static function translate(g:LayoutGraph, dx:Number, dy:Number):void

Translates the layout coordinates by the vector (dx,dy).

Parameters

g:LayoutGraph
 
dx:Number
 
dy:Number

Constant Detail
MIRROR_XAXISConstant
public static const MIRROR_XAXIS:int = 0

Operation type constant. Specifies that the graph should be mirrored along the x-axis.

See also

MIRROR_YAXISConstant 
public static const MIRROR_YAXIS:int = 1

Operation type constant. Specifies that the graph should be mirrored along the y-axis.

See also

ROTATEConstant 
public static const ROTATE:int = 2

Operation type constant. Specifies that the graph should be rotated.

See also

SCALEConstant 
public static const SCALE:int = 3

Operation type constant. Specifies that the graph should be scaled.

See also

TRANSLATEConstant 
public static const TRANSLATE:int = 4

Operation type constant. Specifies that the graph should be translated.

See also