Class Index | File Index

Classes


Class links.Network.Package

Package This class contains one package
Defined in: network.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
links.Network.Package(properties, network, imagelist, constants)
Method Summary
Method Attributes Method Name and Description
 
discreteStep(interval)
Perform one discrete step for the package.
 
draw(ctx)
Draw this package in the given canvas The 2d context of a HTML canvas can be retrieved by canvas.getContext("2d");
 
Calculate the distance from the packages location to the given location (x,y)
 
get the title of this package.
 
Retrieve the value of the package.
 
Check if a package is finished, if it has reached its destination.
 
Check if this package is moving.
 
Check if this object is overlapping with the provided object
 
setProgress(progress)
Set a new value for the progress of the package
 
setProperties(properties, constants)
Set or overwrite properties for the package
 
setValueRange(min, max)
Adjust the value range of the package.
Class Detail
links.Network.Package(properties, network, imagelist, constants)
Parameters:
{number} properties
Properties for the package. Optional. Available properties are: id {number}, title {string}, style {string} with available values "dot" and "image", radius {number}, image {string}, color {string}, progress {number} with a value between 0-1, duration {number}, timestamp {number or Date}.
{links.Network} network
The network object, used to find and link to nodes.
{links.Network.Images} imagelist
An Images object. Only needed when the package has style 'image'
{Object} constants
An object with default values for example for the color
Method Detail
discreteStep(interval)
Perform one discrete step for the package. Only applicable when the package has no manually set, fixed progress.
Parameters:
{number} interval
Time interval in seconds

draw(ctx)
Draw this package 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 packages location to the given location (x,y)
Parameters:
{Number} x
{Number} y
Returns:
{Number} value

{string} getTitle()
get the title of this package.
Returns:
{string} title The title of the package, or undefined when no title has been set.

{Number} getValue()
Retrieve the value of the package. Can be undefined
Returns:
{Number} value

{boolean} isFinished()
Check if a package is finished, if it has reached its destination. If so, the package can be removed. Only packages with automatically animated progress can be finished
Returns:
{boolean} true if finished, else false.

{boolean} isMoving()
Check if this package is moving. A packages moves when it has automatic progress and not yet reached its destination.
Returns:
{boolean} true if moving, else false.

{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

setProgress(progress)
Set a new value for the progress of the package
Parameters:
{number} progress
A value between 0 and 1

setProperties(properties, constants)
Set or overwrite properties for the package
Parameters:
{Object} properties
an object with properties
{Object} constants
and object with default, global properties

setValueRange(min, max)
Adjust the value range of the package. The package will adjust it's radius based on its value.
Parameters:
{Number} min
{Number} max

Documentation generated by JsDoc Toolkit 2.3.2 on Fri Apr 26 2013 14:32:41 GMT+0200 (CEST)