norsys.netica
Class VisualNode

java.lang.Object
  |
  +--norsys.netica.VisualNode

public class VisualNode
extends java.lang.Object

An object representing the visual aspects of a Netica Node as it would be displayed in the Netica Application.

This class does not have a public constructor; use Node.visual to retrieve an instance for a node.

Since:
2.12
Version:
5.04 - January 21, 2012

Method Summary
 Node getNode()

Returns the Node that this VisualNode represents.

 double[] getPosition()

Retrieves as elements 0 and 1 respectively, the x,y coordinates of the center of this node, as it would appear in a visual display (e.g., in Netica Application).

 java.lang.String getStyle()

Returns the current "style descriptor" of this node for any visual display (e.g., in Netica Application, or within a NetPanel).

 void setPosition(double x, double y)

Moves this node so that its center is at coordinates (x, y), for any visual display (e.g., in Netica Application).

 void setStyle(java.lang.String style)

Sets the style of this node for any visual display (e.g., in Netica Application, or within a NetPanel).

 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

public Node getNode ( )
Returns the Node that this VisualNode represents.

Version:
Versions 3.0 and later have this method.

public double[] getPosition ( ) throws NeticaException
Retrieves as elements 0 and 1 respectively, the x,y coordinates of the center of this node, as it would appear in a visual display (e.g., in Netica Application).

Version:
Versions 2.07 and later have this method.
In the C Version of the API, this function is named GetNodeVisPosition_bn.
See Also:
setPosition    Sets it
Node.getNodesetColor    Gets color
Node.visual    Gets a VisualNode to work with


public String getStyle ( ) throws NeticaException
Returns the current "style descriptor" of this node for any visual display (e.g., in Netica Application, or within a NetPanel).

The returned string may be used as a parameter to setStyle.

Version:

Versions 3.05 and later have this method.
In the C Version of the API, this function is named GetNodeVisStyle_bn.
See Also:
setStyle    Sets the style
getPosition    Retrieves display coordinates
Node.visual    Gets a VisualNode to work with

Example:
 // if style of node is labelled_box, make it belief_bars, for display in Netica Application.
 String style= node.visual().getStyle();
 if ( style.startsWith( "labelled_box" ) ) {
   node.visual().setStyle ( "belief_bars" );
 }
 
 // copy style of node1 to node2, for display in Netica Application.
 node2.visual().setStyle ( node1.visual().getStyle() );
 

public void setPosition (
 double  x
 double  y 
) throws NeticaException
Moves this node so that its center is at coordinates (x, y), for any visual display (e.g., in Netica Application).

This is useful when directly programming Netica Application, or before writing a net to a file that will later be read by Netica Application.

Parameters:
double    x    desired horizontal pixel value
double    y    desired vertical pixel value

Version:

Versions 2.07 and later have this method.
In the C Version of the API, this function is named SetNodeVisPosition_bn.
See Also:
getPosition    Retrieves coordinates
Node.setNodesetColor    Sets color
Node.visual    Gets a VisualNode to work with

Example:
  // lower node by 20 pixels for display in Netica Application.
  double[] pos = node.visual().getPosition();
  node.visual().setPosition (pos[0], pos[1]+20);

public void setStyle (
 String  style 
) throws NeticaException
Sets the style of this node for any visual display (e.g., in Netica Application, or within a NetPanel).

This is useful when directly programming Netica Application, or before writing a net to a file that will later be read by Netica Application.

style must be one of: "Default", "Absent", "Shape", "LabeledBox", "BeliefBars", "BeliefLine", or "Meter". In future, other qualifiers may be added to this style parameter (e.g., "LabeledBox,CornerRoundingRadius=3,LineThickness=2").

Note that setting the style does not guarantee that a particular display application will be able to display the node in that style. Some applications may be limited in their ability and may interpret a particular display style differently or even ignore it.

Parameters:
String    style    a style descriptor for the desired style

Version:

Versions 3.05 and later have this method.
In the C Version of the API, this function is named SetNodeVisStyle_bn.
See Also:
getStyle    Gets style
setPosition    Sets coordinates
Node.visual    Gets a VisualNode to work with

Example:
 // if style of node is labelled_box, make it belief_bars, for display in Netica Application.
 String style= node.visual().getStyle();
 if ( style.startsWith( "labelled_box" ) ) {
   node.visual().setStyle ( "belief_bars" );
 }
 
 // copy style of node1 to node2, for display in Netica Application.
 node2.visual().setStyle ( node1.visual().getStyle() );