
Search this API  
PREV CLASS NEXT CLASS  FRAMES NO FRAMES  
SUMMARY: NESTED  FIELD  CONSTR  METHOD  DETAIL: FIELD  CONSTR  METHOD 
java.lang.Object y.layout.AbstractLayoutStage y.layout.RemoveColinearBendsStage
public class RemoveColinearBendsStage
The RemoveColinearBendsStage
removes all collinear bends found in a graph. The algorithm traverses each
edge path from source to target and removes for each triple of consecutive collinear bends the middle one.
A collinear bend forms a straight line with its preceding bend and its subsequent bend. The angle between the
connecting edge segments is either 0
or 180
degrees.
Field Summary 

Fields inherited from interface y.layout.Layouter 

EDGE_ID_DPKEY, NODE_ID_DPKEY, NODE_TYPE_DPKEY, SELECTED_EDGES, SELECTED_NODES 
Constructor Summary  

RemoveColinearBendsStage()
Creates a new RemoveColinearBendsStage instance with default settings. 
Method Summary  

boolean 
canLayout(LayoutGraph graph)
Accepts all general graphs. 
void 
doLayout(LayoutGraph graph)
Removes collinear bends of the edges in the given graph. 
double 
getScale()
Returns the scale that defines how accurate the algorithm is when it comes to comparing the coordinates of two bends. 
boolean 
isRemoveStraightOnly()
Returns whether the algorithm removes only collinear bends which lie in the middle of their neighbors or all collinear bends. 
void 
setRemoveStraightOnly(boolean removeStraightOnly)
Specifies whether the algorithm removes only collinear bends which lie in the middle of their neighbors or all collinear bends. 
void 
setScale(double scale)
Specifies the scale that defines how accurate the algorithm is when it comes to comparing the coordinates of two bends. 
Methods inherited from class y.layout.AbstractLayoutStage 

canLayoutCore, doLayoutCore, getCoreLayouter, setCoreLayouter 
Methods inherited from class java.lang.Object 

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait 
Constructor Detail 

public RemoveColinearBendsStage()
RemoveColinearBendsStage
instance with default settings.
Method Detail 

public boolean canLayout(LayoutGraph graph)
graph
 the input graph
true
for all graphsLayouter.doLayout(LayoutGraph)
public double getScale()
This value determines how the values of the coordinates are rounded. If rounded coordinates lead to a collinear bend, this bend will be removed. The larger the value, the higher the precision is.
10.2345
becomes 10.23
for a scale factor of 2
).
10.2345
becomes 10
).
10
, 100
and so on (e.g. 10.2345
becomes 0
for a scale factor of 2
).
setScale(double)
public void setScale(double scale)
This value determines how the values of the coordinates are rounded. If rounded coordinates lead to a collinear bend, this bend will be removed. The larger the value, the higher the precision is.
10.2345
becomes 10.23
for a scale factor of 2
).
10.2345
becomes 10
).
10
, 100
and so on (e.g. 10.2345
becomes 0
for a scale factor of 2
).
scale
 the scalepublic boolean isRemoveStraightOnly()
In the first case, the angle at the middle bend must be 180
degrees, while in the second case, the
angle can be either 180
degrees or 0
degrees.
true
if only bends with 180
degrees are removed, false
otherwisepublic void setRemoveStraightOnly(boolean removeStraightOnly)
In the first case, the angle at the middle bend must be 180
degrees, while in the second case, the
angle can be either 180
degrees or 0
degrees.
removeStraightOnly
 true
if only bends with 180
degrees are removed,
false
otherwisepublic void doLayout(LayoutGraph graph)
graph
 the input graphLayouter.canLayout(LayoutGraph)

© Copyright 20002022, yWorks GmbH. All rights reserved. 

PREV CLASS NEXT CLASS  FRAMES NO FRAMES  
SUMMARY: NESTED  FIELD  CONSTR  METHOD  DETAIL: FIELD  CONSTR  METHOD 