Package dynamic

Class MacaoNode

Constructor   Methods

This class is used to build a node in a MacaoNet.

You can build a MacaoNet to have paths for your objects to walk on. A MacaoNet is identified by its name (= net type). See getNet(). A MacaoNet is build of MacaoNode objects, which are connected by MacaoConnection objects.

You create a net just by creating a node for this net. You provide the net

For nets that are representing a room for example, you will build the net "manual", by adding nodes and connecting them. For road maps, there is the package core/road.js. You can use this package to build large road maps. There you can use the Road Editor to build a large net, just by using the mouse. This functionality is using MacaoNet, MacaoNode and MacaoConnection to build a net with the name (= net type) "Road". You can use this net like a net you built manually.

Constructor Summary
MacaoNode(String netType, integer xPos, integer yPos, optional MacaoObject ownerObject, optional String name)
     Use this constructor to create a new node in a net.

Method Summary
number calculateDistanceTo(integer xPos, integer yPos)
     Call this method to calculate the distance from this node to another position.
MacaoConnection connectTo(MacaoNode node, optional boolean alsoBack)
     Call this method to connect this node to another node by a MacaoConnection.
void disconnectFrom(MacaoNode node, optional boolean alsoBack)
     Call this method to remove the connection from this node to another node.
Array getAssignedObjectNames()
     Call this method to get an array with the names of all the objects, which are assigned to the node.
Array getConnections()
     Call this method to get an array containing all the connections from this node.
integer getIndex()
     Call this method to get the index of the node in the MacaoNet the node belongs to.
String getName()
     Call this method to get the name of the node.
String getNetType()
     Call this method to get the name of the net the node belongs to.
boolean getStepOn()
     Call this method to check, if the property stepOn is activated.
integer getXPos()
     Call this method to get the x-coordinate of the node.
integer getYPos()
     Call this method to get the x-coordinate of the node.
number getZoom()
     Call this method to get the zoom factor, which is used to scale objects, which are passing this node.
boolean mayILeave(MacaoObject object, MacaoNode toNode)
     This method is called, when an object wants to leave the node. The method can prohibit the leaving if it is for example controlled by a traffic light.
void setName(optional String nodeName)
     Call this method to name the node.
void setStepOn(boolean activate)
     Call this method to define if walking objects have to step on this node.
void setZoom(number zoomFactor)
     Call this method to set a zoom factor, which will be used to zoom objects, which walk over this node.

Constructor Details
MacaoNode(String netType, integer xPos, integer yPos, optional MacaoObject ownerObject, optional String name)

Method Details
number calculateDistanceTo(integer xPos, integer yPos)

MacaoConnection connectTo(MacaoNode node, optional boolean alsoBack)

void disconnectFrom(MacaoNode node, optional boolean alsoBack)

Array getAssignedObjectNames()

Array getConnections()

integer getIndex()

String getName()

String getNetType()

boolean getStepOn()

integer getXPos()

integer getYPos()

number getZoom()

boolean mayILeave(MacaoObject object, MacaoNode toNode)

void setName(optional String nodeName)

void setStepOn(boolean activate)

void setZoom(number zoomFactor)