Home Reference Source Test Repository
public class | source

CircleNode

Extends:

Node → CircleNode

Node subclass for circle nodes.

Constructor Summary

Public Constructor
public

Constructs a CircleNode instance.

Member Summary

Public Members
public

label: *

Method Summary

Public Methods
public

Check if the node contains the given point.

public

Find the distance from the node's coordinates to a given point.

public

Draw the node on the given canvas context.

public

Draw additional objects to display the node as an accepting state on the given canvas context.

public

Draw additional objects to display the node as a starting state on the given canvas context.

public

Find the point on the edge of the node in the direction of the given point.

public

Get the point on the edge of the node at the given angle.

Inherited Summary

From class Node
public

x: *

public

y: *

public abstract

Check if the node contains the given point.

public abstract

Find the distance from the node's coordinates to a given point.

public abstract

Draw the node on the given canvas context.

public

Draw the Label object associated with this node.

public abstract

Find the point on the edge of the node in the direction of the given point.

public abstract

Get the point on the edge of the node at the given angle.

public

setPos(x: number, y: number)

Update the node position.

Public Constructors

public constructor(x: number, y: number) source

Constructs a CircleNode instance.

Override:

Node#constructor

Params:

NameTypeAttributeDescription
x number

x-coordinate of the node.

y number

y-coordinate of the node.

Public Members

public label: * source

Public Methods

public containsPoint(x: number, y: number): boolean source

Check if the node contains the given point.

Override:

Node#containsPoint

Params:

NameTypeAttributeDescription
x number

x-coordinate of the point.

y number

y-coordinate of the point.

Return:

boolean

Whether or not the node contains the point.

public distanceToPoint(x: number, y: number): number source

Find the distance from the node's coordinates to a given point.

Override:

Node#distanceToPoint

Params:

NameTypeAttributeDescription
x number

x-coordinate of the point.

y number

y-coordinate of the point.

Return:

number

The distance to the point.

public draw(context: CanvasRenderingContext2D) source

Draw the node on the given canvas context.

Override:

Node#draw

Params:

NameTypeAttributeDescription
context CanvasRenderingContext2D

Canvas 2D context.

public drawAcceptingState(context: CanvasRenderingContext2D) source

Draw additional objects to display the node as an accepting state on the given canvas context.

Params:

NameTypeAttributeDescription
context CanvasRenderingContext2D

Canvas 2D context.

public drawStartingState(context: CanvasRenderingContext2D) source

Draw additional objects to display the node as a starting state on the given canvas context.

Params:

NameTypeAttributeDescription
context CanvasRenderingContext2D

Canvas 2D context.

public edgePointInDirection(x: number, y: number): Object source

Find the point on the edge of the node in the direction of the given point.

Override:

Node#edgePointInDirection

Params:

NameTypeAttributeDescription
x number

x-coordinate of the point.

y number

y-coordinate of the point.

Return:

Object

The edge point in the direction of the given point.

Return Properties:

NameTypeAttributeDescription
x number

x-coordinate of the edge point.

y number

y-coordinate of the edge point.

public getAnglePoint(angle: number): Object source

Get the point on the edge of the node at the given angle.

Override:

Node#getAnglePoint

Params:

NameTypeAttributeDescription
angle number

The angle (clockwise from +x axis).

Return:

Object

The edge point in the direction of the given angle.

Return Properties:

NameTypeAttributeDescription
x number

x-coordinate of the edge point.

y number

y-coordinate of the edge point.