C

ShapeConstraint
abstract

A ShapeConstraint restricts the output area and shape of a layout in conjunction with organic layout algorithms such as OrganicLayout or InteractiveOrganicLayout.
Inheritance Hierarchy

Remarks

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

This class cannot be instantiated

See Also

Developer's Guide

API

shapeConstraint, shapeConstraint

Members

No filters for this type

Constants

This ShapeConstraint 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.
static

See Also

API
shapeConstraint, shapeConstraint

Static Methods

Creates a ShapeConstraint 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.

  • aspect ratio 1: width and height of the layout should be equal
  • aspect ratio between 0 and 1: the height of a layout should be greater than its width
  • aspect ratio larger than 1: the width of a layout should be greater than its height

The aspect ratio needs to be strictly positive.

static

Parameters

ratio: number
the preferred aspect ratio of the output

Return Value

ShapeConstraint
a ShapeConstraint imposing the given aspect ratio on the layout

Throws

Exception ({ name: 'ArgumentError' })
if the given aspect ratio is 0 or negative

Sample Graphs

ShownSetting: Organic layout restricted to an area with aspect ratio 5

See Also

API
shapeConstraint, shapeConstraint
Creates a ShapeConstraint 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.

static

Parameters

x: number
the x-coordinate of the restriction circle's center
y: number
the y-coordinate of the restriction circle's center
radius: number
the radius of the restriction circle

Return Value

ShapeConstraint
the ShapeConstraint confining the layout to a circular area

Throws

Exception ({ name: 'ArgumentError' })
if the given radius is less than or equal to zero

Sample Graphs

ShownSetting: Organic layout restricted to a circular area

See Also

API
shapeConstraint, shapeConstraint
Creates a ShapeConstraint that confines the layout result to an elliptical area.

The restriction ellipse is defined by its bounds 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 bounds need to be greater than zero.

static

Parameters

x: number
the x-coordinate of the bounds' upper left corner
y: number
the y-coordinate of the bounds' upper left corner
w: number
the width of the bounds
h: number
the height of the bounds

Return Value

ShapeConstraint
the ShapeConstraint confining the layout to an elliptical area

Throws

Exception ({ name: 'ArgumentError' })
if the given width or height is 0 or negative

Sample Graphs

ShownSetting: Organic layout restricted to an elliptical area

See Also

API
shapeConstraint, shapeConstraint
Creates a ShapeConstraint 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.

static

Parameters

x: number
the x-coordinate of the restriction rectangle's upper-left corner
y: number
the y-coordinate of the restriction rectangle's upper-left corner
w: number
width of the restriction rectangle
h: number
height of the restriction rectangle

Return Value

ShapeConstraint
the ShapeConstraint confining the layout to a rectangular area

Throws

Exception ({ name: 'ArgumentError' })
if the given width or height is less than or equal to zero

Sample Graphs

ShownSetting: Organic layout restricted to a rectangular area

See Also

API
shapeConstraint, shapeConstraint