public class TopologyLayouts extends Object
TopologyLayouts
offers functions allowing to manipulate the content of a Topology
:
center(Topology)
: centers the Node
s of a Topology
.autoscale(Topology)
: scales (up) elements (Node
's positions, communication ranges, sensing
ranges) from a Topology
to fill its boundaries at best. It also centers the elements inside the
Topology
. To do this, autoscale(Topology, AutoScaleParams)
is called with the default
parameters.autoscale(Topology, AutoScaleParams)
: scales (up) elements from a Topology
as specified
in the provided TopologyLayouts.AutoScaleParams
object.Some methods allow to modify the shape of the Topology
(without respect with connectivity):
circle(Topology)
, circle(Topology, double)
; ellipse(Topology)
, ellipse(Topology, double, double)
;line(Topology)
, line(Topology, double)
.The computeBoundaries(Topology)
provides a easy way to retrieve the provided Topology
's extreme
points, as a TopologyLayouts.TopologyBoundaries
object.
Modifier and Type  Class and Description 

static class 
TopologyLayouts.AutoScaleParams
The
TopologyLayouts.AutoScaleParams object is used to configure scaling operations. 
static class 
TopologyLayouts.TopologyBoundaries
The
TopologyLayouts represents the boundaries of a topology. 
Modifier and Type  Field and Description 

static double 
DEFAULT_MARGIN
The default margin ratio (value: 0.1).

Constructor and Description 

TopologyLayouts() 
Modifier and Type  Method and Description 

static void 
autoscale(Topology topology)

static void 
autoscale(Topology topology,
TopologyLayouts.AutoScaleParams autoScaleParams)

static void 
center(Topology topology)

static void 
circle(Topology topology)

static void 
circle(Topology topology,
double marginRatio)

protected static double 
computeAvailableSpaceRatio(double marginRatio) 
static TopologyLayouts.TopologyBoundaries 
computeBoundaries(Topology topology)
Computes the boundaries of a
Topology . 
protected static double 
computeScaleFactor(Topology topology,
TopologyLayouts.TopologyBoundaries boundaries,
TopologyLayouts.AutoScaleParams scaleParams) 
static void 
ellipse(Topology topology)

static void 
ellipse(Topology topology,
double xMarginRatio,
double yMarginRatio)

static void 
line(Topology topology)

static void 
line(Topology topology,
double marginRatio)

public static final double DEFAULT_MARGIN
public static void autoscale(Topology topology)
Automatically scales the position of the Node
s of the Topology
to match its boundaries.
A margin ratio of is used on all sides to keep boudaries clean.
For more control on the margins, please use autoscale(Topology, AutoScaleParams)
.
Note that this method changes the Node
s' position without respect for their
Link
s.
topology
 the Topology
to scale.public static void autoscale(Topology topology, TopologyLayouts.AutoScaleParams autoScaleParams)
Automatically scales the position of the Node
s of the Topology
to match its boundaries.
Note that this method changes the Node
s' position without respect for their
Link
s.
topology
 the Topology
to scale.autoScaleParams
 the TopologyLayouts.AutoScaleParams
object specifying the scaling process.public static void center(Topology topology)
Automatically centers the Node
s of the Topology
inside its boundaries.
Note that nodes positions are supposed to be inside the boundaries of the Topology
.
topology
 the Topology
to center.public static TopologyLayouts.TopologyBoundaries computeBoundaries(Topology topology)
Topology
.topology
 the Topology
to be examined?TopologyLayouts.TopologyBoundaries
.protected static double computeScaleFactor(Topology topology, TopologyLayouts.TopologyBoundaries boundaries, TopologyLayouts.AutoScaleParams scaleParams)
protected static double computeAvailableSpaceRatio(double marginRatio)
public static void circle(Topology topology, double marginRatio)
Modifies the location of the Nodes
of provided Topology
so that they form a circle with
a margin on all sides.
Note that the modification are applied without respect to the existing Links
.
topology
 the Topology
to be modified.marginRatio
 the margin ratio used to compute the margin which should be kept on all sides (up, down,
right, and left). A double in [0:1].public static void circle(Topology topology)
Modifies the location of the Nodes
of provided Topology
so that they form a circle.
Margins are applied on all sides (up, down, right, and left) with a margin ratio of DEFAULT_MARGIN
.
Note that the modification are applied without respect to the existing Links
.
topology
 the Topology
to be modified.public static void ellipse(Topology topology, double xMarginRatio, double yMarginRatio)
Modifies the location of the Nodes
of provided Topology
so that they form a ellipse with
a margin on all sides.
Note that the modification are applied without respect to the existing Links
.
topology
 the Topology
to be modified.xMarginRatio
 the margin ratio used to compute the margin which should be kept on horizontal sides (right
and left). A double in [0:1].yMarginRatio
 the margin ratio used to compute the margin which should be kept on vertical sides (up
and down). A double in [0:1].public static void ellipse(Topology topology)
Modifies the location of the Nodes
of provided Topology
so that they form a ellipse.
Margins are applied on all sides (up, down, right, and left) with a margin ratio of DEFAULT_MARGIN
.
Note that the modification are applied without respect to the existing Links
.
topology
 the Topology
to be modified.public static void line(Topology topology, double marginRatio)
Modifies the location of the Nodes
of provided Topology
so that they form a line with
a margin on all sides.
A vertical line will be created if the Topology
's height is greater than its width. Otherwise, an
horizontal line will be created.
Note that the modification are applied without respect to the existing Links
.
topology
 the Topology
to be modified.marginRatio
 the margin ratio used to compute the margin which should be kept on all sides (up, down,
right, and left). A double in [0:1].public static void line(Topology topology)
Modifies the location of the Nodes
of provided Topology
so that they form a line.
Margins are applied on all sides (up, down, right, and left) with a margin ratio of DEFAULT_MARGIN
.
A vertical line will be created if the Topology
's height is greater than its width. Otherwise, an
horizontal line will be created.
Note that the modification are applied without respect to the existing Links
.
topology
 the Topology
to be modified.