|
<< Click to Display Table of Contents >> Navigation: Using SMILE Wrappers > Networks, nodes and arcs > Nodes > Other node attributes |
Node attributes control how a node appears in the graphical interface of GeNIe, BayesBox or other SMILE-based tools. These attributes do not affect probabilistic calculations or inference results; they are purely visual. Each node has textual attributes (name and optional description), positional attributes (coordinates and size), and color attributes (background, text, and border colors).
Nodes can also be assigned to submodels to help organize complex networks. For more details, see the Submodels chapter.
Textual attributes:
Python
set_node_name(node: int | str, name: str) -> None
get_node_name(node: int | str) -> str
set_node_description(node: int | str, description: str) -> None
get_node_description(node: int | str) -> str
Java
void setNodeName(int nodeHandle, String name);
void setNodeName(String nodeId, String name);
String getNodeName(int nodeHandle);
String getNodeName(String nodeId);
void setNodeDescription(int nodeHandle, String description);
void setNodeDescription(String nodeId, String description);
String getNodeDescription(int nodeHandle);
C#
void SetNodeName(int nodeHandle, string name);
void SetNodeName(string nodeId, string name);
string GetNodeName(int nodeHandle);
string GetNodeName(string nodeId);
void SetNodeDescription(int nodeHandle, string description);
void SetNodeDescription(string nodeId, string description);
string GetNodeDescription(int nodeHandle);
R
setNodeName(nodeIdOrHandle, name)
nodeName <- getNodeName(nodeIdOrHandle)
setNodeDescription(nodeIdOrHandle, description)
nodeDescription <- getNodeDescription(nodeIdOrHandle)
Positional attributes:
Python
set_node_position(node: int | str, rect: List[int]) -> None
get_node_position(node: int | str) -> List[int]
Java
void setNodePosition(int nodeHandle, int x, int y, int width, int height);
void setNodePosition(String nodeId, int x, int y, int width, int height);
void setNodePosition(int nodeHandle, java.awt.Rectangle rect)
void setNodePosition(String nodeId, java.awt.Rectangle rect)
java.awt.Rectangle getNodePosition(int nodeHandle);
java.awt.Rectangle getNodePosition(String nodeId);
C#
void SetNodePosition(int nodeHandle, System.Drawing.Rectangle rect);
void SetNodePosition(string nodeId, System.Drawing.Rectangle rect);
System.Drawing.Rectangle GetNodePosition(int nodeHandle);
System.Drawing.Rectangle GetNodePosition(string nodeId);
R
set_node_position(nodeIdOrHandle, rect)
position <- get_node_position(nodeIdOrHandle)
Node colors in SMILE are stored in the Windows API COLORREF format, a legacy of SMILE’s early development around 2000 when Windows was the dominant platform. In this representation, the red, green, and blue components each occupy one byte (8 bits) and are ordered as BB GG RR in memory (least significant byte is red, most significant byte is blue). This format is preserved for compatibility, and color values passed to or returned from SMILE methods must follow this convention.
For example, the RGB color (Red = 0x78, Green = 0xC8, Blue = 0x40) is represented as 0x40C878 in COLORREF notation.
The following methods of the Network class are used to get and set node colors:
Python
set_node_bg_color(node: int | str, color: int) -> None
get_node_bg_color(node: int | str) -> int
set_node_text_color(node: int | str, color: int) -> None
get_node_text_color(node: int | str) -> int
set_node_border_color(node: int | str, color: int) -> None
get_node_border_color(node: int | str) -> int
Java
void setNodeBgColor(int nodeHandle, java.awt.Color color);
void setNodeBgColor(String nodeId, java.awt.Color color);
java.awt.Color getNodeBgColor(int nodeHandle);
java.awt.Color getNodeBgColor(String nodeId);
void setNodeTextColor(int nodeHandle, java.awt.Color color);
void setNodeTextColor(String nodeId, java.awt.Color color);
java.awt.Color getNodeTextColor(int nodeHandle);
java.awt.Color getNodeTextColor(String nodeId);
void setNodeBorderColor(int nodeHandle, java.awt.Color color);
void setNodeBorderColor(String nodeId, java.awt.Color color);
java.awt.Color getNodeBorderColor(int nodeHandle);
java.awt.Color getNodeBorderColor(String nodeId);
C#
void SetNodeBgColor(int nodeHandle, System.Drawing.Color color);
void SetNodeBgColor(string nodeId, System.Drawing.Color color);
System.Drawing.Color GetNodeBgColor(int nodeHandle);
System.Drawing.Color GetNodeBgColor(string nodeId);
void SetNodeTextColor(int nodeHandle, System.Drawing.Color color);
void SetNodeTextColor(string nodeId, System.Drawing.Color color);
System.Drawing.Color GetNodeTextColor(int nodeHandle);
System.Drawing.Color GetNodeTextColor(string nodeId);
void SetNodeBorderColor(int nodeHandle, System.Drawing.Color color);
void SetNodeBorderColor(string nodeId, System.Drawing.Color color);
System.Drawing.Color GetNodeBorderColor(int nodeHandle);
System.Drawing.Color GetNodeBorderColor(string nodeId);
R
setNodeBgColor(nodeIdOrHandle, color)
bgColor <- getNodeBgColor(nodeIdOrHandle)
setNodeTextColor(nodeIdOrHandle, color)
textColor <- getNodeTextColor(nodeIdOrHandle)
setNodeBorderColor(nodeIdOrHandle, color)
borderColor <- getNodeBorderColor(nodeIdOrHandle)