|
GLG Toolkit v. 4.2 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.genlogic.GraphLayout.GlgGraphLayout
public class GlgGraphLayout
Graph layout. Implements spring-embedder and circular graph layouts.
Field Summary | |
---|---|
static int |
CIRCULAR_GRAPH
Graph type constant for creating circular demo graphs. |
static GlgObject |
DefEdgeIcon
Default edge icon to use if no palette is defined. |
static GlgObject |
DefNodeIcons
A group of default node icons to use if no palette is defined. |
static GlgObject |
DefViewportIcon
Default viewport to use to render the graph. |
GlgCube |
dimensions
Dimensions of the graph rendering, [-800;800] by default. |
GlgObject |
edge_array
Array of all graph's edges. |
double |
end_temperature
The end temperature defining the end of the layout process, 0.2 by default. |
boolean |
finished
Is set to true when graph layout finishes positioning the nodes. |
int |
iteration
Current iteration number. |
GlgObject |
node_array
Array of all graph's nodes. |
GlgObject |
palette
Graph's palette object. |
static int |
RANDOM_GRAPH
Graph type constant for creating random demo graphs. |
static int |
STAR_GRAPH
Graph type constant for creating demo graphs with a star shape. |
int |
update_rate
Update rate: the graph is redrawn after each update_rate iterations. |
double |
z
Z coordinate of the graph. |
Constructor Summary | |
---|---|
GlgGraphLayout()
Constructor. |
Method Summary | |
---|---|
GlgGraphEdge |
AddEdge(GlgGraphNode start_node,
GlgGraphNode end_node,
GlgObject graphics,
int edge_type,
java.lang.Object data)
Creates a new edge and adds it to the graph. |
GlgGraphNode |
AddNode(GlgObject graphics,
int node_type,
java.lang.Object data)
Creates a new node and adds it to the graph. |
void |
CircularLayout()
Performs circular layout. |
void |
CreateGraphics(GlgObject viewport,
GlgObject group)
Loads icons from the palette and creates a Glg drawing to render the graph. |
static GlgGraphLayout |
CreateRandom(int num_nodes,
int num_node_types,
int graph_type)
Demo constructor. |
void |
DeleteEdge(GlgGraphEdge edge)
Deletes edge from the graph. |
void |
DeleteNode(GlgGraphNode node)
Deletes node from the graph. |
void |
Destroy()
Destroys all graph's objects. |
void |
DestroyGraphics()
Destroys graph's drawing and all graphical objects used to render nodes and edges. |
static void |
Error(java.lang.String string)
Error message handler. |
GlgGraphEdge |
FindEdge(GlgObject edge_graphics)
Finds the edge object by its graphics. |
GlgGraphNode |
FindNode(GlgObject node_graphics)
Finds the node object by its graphics. |
GlgGraphEdge |
GetEdge(int i)
Finds the node object by its index. |
GlgGraphNode |
GetNode(int i)
Finds the edge object by its index. |
GlgPoint |
GetNodePosition(GlgGraphNode node)
Queries node position. |
boolean |
GetUntangle()
Returns true if the untangling algorithm is enabled. |
GlgObject |
GetViewport()
Returns the viewport of the graph's drawing. |
int |
GlgGraphGetEdgeIndex(GlgGraphEdge edge)
Returns edge's index. |
int |
GlgGraphGetNodeIndex(GlgGraphNode node)
Returns node's index. |
void |
IncreaseTemperature(boolean init)
Forces the graph to continue layout after it's finished. |
boolean |
NodesConnected(GlgGraphNode node1,
GlgGraphNode node2)
Connectivity test. |
void |
Scramble()
Demo method: Randomly scrambles the graph's nodes |
static void |
SetDefPalette(GlgObject palette_drawing)
Sets default icon palette. |
void |
SetNodePosition(GlgGraphNode node,
double x,
double y,
double z)
Sets node position in Glg coordinates as defined by the graph's dimension. |
void |
SetPalette(GlgObject palette_drawing)
Sets graph's icon palette. |
void |
SetUntangle(boolean untangle)
Enables or disables untangling algorithm. |
boolean |
SpringIterate()
Performs one iteration of the spring embedder layout. |
static void |
UnloadDefPalette()
Unsets the default palette |
void |
Update()
Updates graphics display to show results of the spring layout. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int RANDOM_GRAPH
public static final int CIRCULAR_GRAPH
public static final int STAR_GRAPH
public static GlgObject DefNodeIcons
public static GlgObject DefEdgeIcon
public static GlgObject DefViewportIcon
public GlgObject node_array
public GlgObject edge_array
public boolean finished
public int iteration
public int update_rate
public double end_temperature
public GlgCube dimensions
public double z
public GlgObject palette
Constructor Detail |
---|
public GlgGraphLayout()
Method Detail |
---|
public static GlgGraphLayout CreateRandom(int num_nodes, int num_node_types, int graph_type)
num_nodes
- Number of nodes to createnum_node_types
- Number of node types to use for renderinggraph_type
- Graph type constant: RANDOM_GRAPH, CIRCULAR_GRAPH or
STAR_GRAPH.
public GlgGraphNode AddNode(GlgObject graphics, int node_type, java.lang.Object data)
graphics
- Optional custom node icon (to override the icon from
the palette)node_type
- Palette index, specifies what icon to use from the node
palette if no custom graphics is specified. The value
of -1 can be used to define an external node with
no graphics. External nodes will not be moved by the
layout.data
- Custom data to attach to the node
public GlgGraphEdge AddEdge(GlgGraphNode start_node, GlgGraphNode end_node, GlgObject graphics, int edge_type, java.lang.Object data)
start_node
- Edge's start nodeend_node
- Edge's end nodegraphics
- Optional custom edge icon (to override the icon
from the palette)edge_type
- Palette index, specifies what icon to use from the edge
palette if no custom graphics is specified.
This parameter is reserved for the future use and the
value of 0 must be used for regular nodes. The value
of -1 can be used to define an external edge with no
graphics that connects to an external node.data
- Custom data to attach to the edge
public void DeleteNode(GlgGraphNode node)
node
- Node object to be deletedpublic void DeleteEdge(GlgGraphEdge edge)
edge
- Edge object to be deletedpublic void Destroy()
public static void SetDefPalette(GlgObject palette_drawing)
palette_drawing
- Palette drawing object. See description of the
SetPalette method for more details.public void SetPalette(GlgObject palette_drawing)
public static void UnloadDefPalette()
public void CreateGraphics(GlgObject viewport, GlgObject group)
viewport
- An optional viewport parameter. If it's not null, it's
used as a viewport for the graph's drawing, rendering the graph in an
existing object hierarchy. If it's null, the graph will create a new
viewport to render the graph.group
- An optional group parameter. If it's not null, it defines
the group container to add nodes and edges to (used when several graph
layouts reside in the same viewport). If it's null, the graph's viewport
is used as a container.public void DestroyGraphics()
public GlgGraphNode FindNode(GlgObject node_graphics)
node_graphics
- Graphical object used to render the node in the
drawing
public GlgGraphEdge FindEdge(GlgObject edge_graphics)
edge_graphics
- Graphical object used to render the edge in the
drawing
public GlgGraphNode GetNode(int i)
public GlgGraphEdge GetEdge(int i)
public int GlgGraphGetNodeIndex(GlgGraphNode node)
public int GlgGraphGetEdgeIndex(GlgGraphEdge edge)
public void CircularLayout()
public boolean NodesConnected(GlgGraphNode node1, GlgGraphNode node2)
node1
- Node objectnode2
- Node object
public void Update()
public boolean SpringIterate()
public void IncreaseTemperature(boolean init)
public void Scramble()
public void SetNodePosition(GlgGraphNode node, double x, double y, double z)
node
- Node to positionx
- X coordinatey
- Y coordinatez
- Z coordinatepublic GlgPoint GetNodePosition(GlgGraphNode node)
node
- Node to query
public GlgObject GetViewport()
public boolean GetUntangle()
public void SetUntangle(boolean untangle)
untangle
- true to enable untanglingpublic static void Error(java.lang.String string)
string
- Error message
|
GLG Toolkit v. 4.2 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |