Search this API

y.layout.organic
Class OutputRestriction

java.lang.Object
  extended by y.layout.organic.OutputRestriction

public abstract class OutputRestriction
extends java.lang.Object

OutputRestrictions restrict the output area and the shape of a layout in conjunction with organic layout algorithms such as SmartOrganicLayouter or InteractiveOrganicLayouter.

In consequence, all nodes need to be placed inside a specific restricted area.

See Also:
SmartOrganicLayouter.setOutputRestriction(OutputRestriction), InteractiveOrganicLayouter.setOutputRestriction(OutputRestriction)
 

Field Summary
static OutputRestriction NONE
          This OutputRestriction does not restrict the output by any means.
 
Method Summary
static OutputRestriction createAspectRatioRestriction(double ratio)
          Creates an OutputRestriction that confines the layout result to a rectangular area which roughly complies with the given aspect ratio.
static OutputRestriction createCircularCageRestriction(double x, double y, double radius)
          Creates an OutputRestriction that confines the layout result to a circle.
static OutputRestriction createEllipticalCageRestriction(double x, double y, double w, double h)
          Creates an OutputRestriction that confines the layout result to an elliptical area.
static OutputRestriction createRectangularCageRestriction(double x, double y, double w, double h)
          Creates an OutputRestriction that confines the layout to a rectangular area.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NONE

public static final OutputRestriction NONE
This OutputRestriction does not restrict the output by any means. It is a no-op that can be used when the output area and shape of a layout should be unrestricted.

See Also:
SmartOrganicLayouter.setOutputRestriction(OutputRestriction), InteractiveOrganicLayouter.setOutputRestriction(OutputRestriction)
Method Detail

createRectangularCageRestriction

public static OutputRestriction createRectangularCageRestriction(double x,
                                                                 double y,
                                                                 double w,
                                                                 double h)
Creates an OutputRestriction that confines the layout to a rectangular area.

This restriction rectangle is defined by the given coordinates and size values.

The values for height and width of the rectangle need to be greater than zero.

Parameters:
x - the x-coordinate of the restriction rectangle's upper-left corner
y - the y-coordinate of the restriction rectangle's upper-left corner
w - width of the restriction rectangle
h - height of the restriction rectangle
Returns:
the OutputRestriction confining the layout to a rectangular area
Throws:
java.lang.IllegalArgumentException - if the given width or height is less than or equal to zero
See Also:
SmartOrganicLayouter.setOutputRestriction(OutputRestriction), InteractiveOrganicLayouter.setOutputRestriction(OutputRestriction)
Sample Graph:

Organic layout restricted to a rectangular area

createCircularCageRestriction

public static OutputRestriction createCircularCageRestriction(double x,
                                                              double y,
                                                              double radius)
Creates an OutputRestriction that confines the layout result to a circle.

The actual restriction circle is defined by the given coordinates and radius.

The radius of the restriction circle needs to be greater than zero.

Parameters:
x - the x-coordinate of the restriction circle's center
y - the y-coordinate of the restriction circle's center
radius - the radius of the restriction circle
Returns:
the OutputRestriction confining the layout to a circular area
Throws:
java.lang.IllegalArgumentException - if the given radius is less than or equal to zero
See Also:
SmartOrganicLayouter.setOutputRestriction(OutputRestriction), InteractiveOrganicLayouter.setOutputRestriction(OutputRestriction)
Sample Graph:

Organic layout restricted to a circular area

createEllipticalCageRestriction

public static OutputRestriction createEllipticalCageRestriction(double x,
                                                                double y,
                                                                double w,
                                                                double h)
Creates an OutputRestriction that confines the layout result to an elliptical area.

The restriction ellipse is defined by its bounding box specified by the given coordinates and size values.

The main axes of the ellipse are parallel to the coordinate axes.

The values for height and width of the ellipse's bounding box need to be greater than zero.

Parameters:
x - the x-coordinate of the bounding box's upper left corner
y - the y-coordinate of the bounding box's upper left corner
w - the width of the bounding box
h - the height of the bounding box
Returns:
the OutputRestriction confining the layout to an elliptical area
Throws:
java.lang.IllegalArgumentException - if the given width or height is 0 or negative
See Also:
SmartOrganicLayouter.setOutputRestriction(OutputRestriction), InteractiveOrganicLayouter.setOutputRestriction(OutputRestriction)
Sample Graph:

Organic layout restricted to an elliptical area

createAspectRatioRestriction

public static OutputRestriction createAspectRatioRestriction(double ratio)
Creates an OutputRestriction that confines the layout result to a rectangular area which roughly complies with the given aspect ratio.

The aspect ratio is defined as the ratio between the width and the height of a layout.

The aspect ratio needs to be strictly positive.

Parameters:
ratio - the preferred aspect ratio of the output
Returns:
an OutputRestriction imposing the given aspect ratio on the layout
Throws:
java.lang.IllegalArgumentException - if the given aspect ratio is 0 or negative
See Also:
SmartOrganicLayouter.setOutputRestriction(OutputRestriction), InteractiveOrganicLayouter.setOutputRestriction(OutputRestriction)
Sample Graph:

Organic layout restricted to an area with aspect ratio 5

© Copyright 2000-2022,
yWorks GmbH.
All rights reserved.