Class links.Network.Node
Node
A node. A node can be connected to other nodes via one or multiple links.
Defined in: network.js.
Constructor Attributes | Constructor Name and Description |
---|---|
links.Network.Node(properties, imagelist, grouplist, constants)
|
Method Attributes | Method Name and Description |
---|---|
attachLink(link)
Attach a link to the node
|
|
detachLink(link)
Detach a link from the node
|
|
discreteStep(interval)
Perform one discrete step for the node
|
|
distanceToBorder(ctx, angle)
Calculate the distance to the border of the Node
|
|
draw(ctx)
Draw this node in the given canvas
The 2d context of a HTML canvas can be retrieved by canvas.getContext("2d");
|
|
getDistance(x, y)
Calculate the distance from the nodes location to the given location (x,y)
|
|
getTextSize(ctx)
|
|
getTitle()
get the title of this node.
|
|
getValue()
Retrieve the value of the node.
|
|
isFixed()
Check if this node has a fixed x and y position
|
|
isMoving(vmin)
Check if this node is moving
|
|
isOverlappingWith(obj)
Check if this object is overlapping with the provided object
|
|
check if this node is selecte
|
|
resize(ctx)
Recalculate the size of this node in the given canvas
The 2d context of a HTML canvas can be retrieved by canvas.getContext("2d");
|
|
select()
select this node
|
|
setProperties(properties, constants)
Set or overwrite properties for the node
|
|
setValueRange(min, max)
Adjust the value range of the node.
|
|
unselect()
unselect this node
|
Class Detail
links.Network.Node(properties, imagelist, grouplist, constants)
- Parameters:
- {object} properties
- An object containing properties for the node. All properties are optional, except for the id. {number} id Id of the node. Required {string} text Title for the node {number} x Horizontal position of the node {number} y Vertical position of the node {string} style Drawing style, available: "database", "circle", "rect", "image", "text", "dot", "star", "triangle", "triangleDown", "square" {string} image An image url {string} title An title text, can be HTML {anytype} group A group name or number
- {links.Network.Images} imagelist
- A list with images. Only needed when the node has an image
- {links.Network.Groups} grouplist
- A list with groups. Needed for retrieving group properties
- {Object} constants
- An object with default values for example for the color
Method Detail
attachLink(link)
Attach a link to the node
- Parameters:
- {links.Network.Link} link
detachLink(link)
Detach a link from the node
- Parameters:
- {links.Network.Link} link
discreteStep(interval)
Perform one discrete step for the node
- Parameters:
- {number} interval
- Time interval in seconds
{number}
distanceToBorder(ctx, angle)
Calculate the distance to the border of the Node
- Parameters:
- {CanvasRenderingContext2D} ctx
- {Number} angle
- Angle in radians
- Returns:
- {number} distance Distance to the border in pixels
draw(ctx)
Draw this node in the given canvas
The 2d context of a HTML canvas can be retrieved by canvas.getContext("2d");
- Parameters:
- {CanvasRenderingContext2D} ctx
{Number}
getDistance(x, y)
Calculate the distance from the nodes location to the given location (x,y)
- Parameters:
- {Number} x
- {Number} y
- Returns:
- {Number} value
getTextSize(ctx)
- Parameters:
- ctx
{string}
getTitle()
get the title of this node.
- Returns:
- {string} title The title of the node, or undefined when no title has been set.
{Number}
getValue()
Retrieve the value of the node. Can be undefined
- Returns:
- {Number} value
{boolean}
isFixed()
Check if this node has a fixed x and y position
- Returns:
- {boolean} true if fixed, false if not
{boolean}
isMoving(vmin)
Check if this node is moving
- Parameters:
- {number} vmin
- the minimum velocity considered as "moving"
- Returns:
- {boolean} true if moving, false if it has no velocity
{boolean}
isOverlappingWith(obj)
Check if this object is overlapping with the provided object
- Parameters:
- {Object} obj
- an object with parameters left, top, right, bottom
- Returns:
- {boolean} True if location is located on node
{boolean}
isSelected()
check if this node is selecte
- Returns:
- {boolean} selected True if node is selected, else false
resize(ctx)
Recalculate the size of this node in the given canvas
The 2d context of a HTML canvas can be retrieved by canvas.getContext("2d");
- Parameters:
- {CanvasRenderingContext2D} ctx
select()
select this node
setProperties(properties, constants)
Set or overwrite properties for the node
- Parameters:
- {Object} properties
- an object with properties
- {Object} constants
- and object with default, global properties
setValueRange(min, max)
Adjust the value range of the node. The node will adjust it's radius
based on its value.
- Parameters:
- {Number} min
- {Number} max
unselect()
unselect this node