C

GeneralPathNodeStyle

A node style that can display node shapes with a boundary that is defined by a GeneralPath instance.
ImplementsInheritance Hierarchy

Members

No filters for this type

Constructors

Creates a new instance using the specified path.

Parameters

path?: GeneralPath
The path that defines the boundary of this style. The path must be defined in such a way that the point (0,0) represents the top left of a node's layout and the point (1,1) the lower right. The path will be scaled accordingly to the node's size. If not specified, a simple rectangular path is used.

Properties

Gets or sets the aspect ratio for scaling the path to a node's size.

If this value is positive and finite, the path will be scaled to the largest rectangle that a) has a width-to-height ratio that matches this value and b) fits into the node's size. Otherwise, the path is scaled to the node's size (and aspect ratio) without further restrictions.

The default value is 0. That is, path is scaled to the node's size (and aspect ratio).

final

See Also

Developer's Guide
Gets or sets a CSS class that will be applied to the visualization.

The default value is an empty string, in which case no class is set for the visualization.

Multiple classes can be set by separating them with spaces, just like with the SVG class attribute.

final
Gets or sets the Fill that is used to draw the shape.
The default value is WHITE.
conversionfinal

See Also

Developer's Guide
Get or sets the path that defines the boundary of the shape.

The path must be defined in such a way that the point (0,0) represents the top left of a node's layout and the point (1,1) the lower right. The path will be scaled accordingly to the node's size.

The default is a rectangular path.

final

See Also

Developer's Guide
Gets the renderer implementation that can be queried for implementations that provide details about the visual appearance and visual behavior for a given node and this style instance.
The idiom for retrieving, e.g. an IVisualCreator implementation for a given style is:
const creator = style.renderer.getVisualCreator(node, style)
const visual = creator.createVisual(context)
readonlyfinal
Gets or sets the Stroke that is used to draw the shape.
The default value is BLACK.
conversionfinal

See Also

Developer's Guide

Methods

Create a clone of this object.
final

Return Value

Object
A clone of this object.

Static Methods

Creates a new GeneralPathNodeStyle instance for a copy of the given path.
The returned style instance will use a copy of the given GeneralPath instance as its path. Said copy is transformed to meet the coordinate requirements of path. Additionally, the returned style instance will use the width-to-height ratio of the given GeneralPath instance as its aspect ratio.
static

Parameters

path: GeneralPath
The path that defines the outline of a node's visualization. The width and height of its bounds have to be positive and finite.

Return Value

GeneralPathNodeStyle
A GeneralPathNodeStyle instance using the path and its aspect ratio.

Throws

Exception ({ name: 'ArgumentError' })
If the width or height of the given path's bounds is not positive and finite.
Creates a GeneralPath in the form of a polygon.
static

Parameters

pointCount: number
The number of corners of the polygon. For odd numbers, the first corner points to the top.
rotationAngle?: number
The rotation angle of the polygon. The angle is specified in radians, measured clockwise.
stretchToHeight?: boolean
Whether to stretch the path to the full bounding box height.
stretchToWidth?: boolean
Whether to stretch the path to the full bounding box width.

Return Value

GeneralPath
The polygonal GeneralPath.
Creates a GeneralPath in the form of a star.
static

Parameters

pointCount: number
The number of points of the star. For odd numbers, the first corner points to the top.
ratio: number
The ratio between the inner and outer points radius. The ratio should be a positive number smaller or equal to 1. For values > 1, the reciprocal is used.
rotationAngle?: number
The rotation angle of the star. The angle is specified in radians, measured clockwise.
stretchToHeight?: boolean
Whether to stretch the path to the full bounding box height.
stretchToWidth?: boolean
Whether to stretch the path to the full bounding box width.

Return Value

GeneralPath
A star-shaped GeneralPath.