|
GLG Toolkit, C / C++ API Library
Version 4.5
|
Functions | |
| GlgGraphEdge | GlgGraphAddEdge (GlgGraphLayout graph, GlgGraphNode start_node, GlgGraphNode end_node, GlgObject graphics, GlgLong edge_type, void *data) |
| Creates a new edge and adds it to the graph. More... | |
| GlgGraphNode | GlgGraphAddNode (GlgGraphLayout graph, GlgObject graphics, GlgLong node_type, void *data) |
| Creates a new node and adds it to the graph. More... | |
| void | GlgGraphCircularLayout (GlgGraphLayout graph) |
| Performs a circular layout. More... | |
| GlgGraphLayout | GlgGraphCreate (void) |
| Creates a graph layout object. More... | |
| GlgBoolean | GlgGraphCreateGraphics (GlgGraphLayout graph, GlgObject viewport, GlgObject group) |
| Loads icons from the palette and creates a GLG drawing to render the graph. More... | |
| GlgGraphLayout | GlgGraphCreateRandom (GlgLong num_nodes, GlgLong num_node_types, GraphType type) |
| Creates a demo graph layout and populates it with nodes and edges. More... | |
| void | GlgGraphDeleteEdge (GlgGraphLayout graph, GlgGraphEdge edge) |
| Deletes an edge from the graph. More... | |
| void | GlgGraphDeleteNode (GlgGraphLayout graph, GlgGraphNode node) |
| Deletes a node from the graph. More... | |
| void | GlgGraphDestroy (GlgGraphLayout graph) |
| Destroys all graph layout's objects. More... | |
| void | GlgGraphDestroyGraphics (GlgGraphLayout graph) |
| Destroys the graph's drawing and all graphical objects used to render nodes and edges. More... | |
| void | GlgGraphError (char *message) |
| Error handler. More... | |
| GlgGraphEdge | GlgGraphFindEdge (GlgGraphLayout graph, GlgObject edge_graphics) |
| Finds an edge object by its graphics. More... | |
| GlgGraphNode | GlgGraphFindNode (GlgGraphLayout graph, GlgObject node_graphics) |
| Finds a node object by its graphics. More... | |
| GlgGraphEdge | GlgGraphGetEdge (GlgGraphLayout graph, GlgLong index) |
| Finds an edge object by its index. More... | |
| GlgLong | GlgGraphGetEdgeIndex (GlgGraphLayout graph, GlgGraphEdge edge) |
| Returns an edge's index inside the graph's edge_array. More... | |
| GlgObject | GlgGraphGetGroup (GlgGraphLayout graph) |
| Queries the container used to hold graph's nodes and edges. More... | |
| GlgGraphNode | GlgGraphGetNode (GlgGraphLayout graph, GlgLong index) |
| Finds a node object by its index. More... | |
| GlgLong | GlgGraphGetNodeIndex (GlgGraphLayout graph, GlgGraphNode node) |
| Returns a node's index inside the graph's node array. More... | |
| void | GlgGraphGetNodePosition (GlgGraphLayout graph, GlgGraphNode node, double *x, double *y, double *z) |
| Queries node position. More... | |
| GlgBoolean | GlgGraphGetUntangle (GlgGraphLayout graph) |
| Queries if the untangling algorithm was enabled via GlgGraphSetUntangle. More... | |
| GlgObject | GlgGraphGetViewport (GlgGraphLayout graph) |
| Queries the viewport of the graph's drawing. More... | |
| void | GlgGraphIncreaseTemperature (GlgGraphLayout graph, GlgBoolean initial) |
| Forces the graph to continue layout after it's finished. More... | |
| GlgBoolean | GlgGraphNodesConnected (GlgGraphNode node1, GlgGraphNode node2) |
| Connectivity test. More... | |
| void | GlgGraphScramble (GlgGraphLayout graph) |
| Demo function: Randomly scrambles the graph's nodes. More... | |
| void | GlgGraphSetDefPalette (GlgObject palette_drawing) |
| Sets the default icon palette. More... | |
| void | GlgGraphSetNodePosition (GlgGraphLayout graph, GlgGraphNode node, double x, double y, double z) |
| Sets node position in the GLG world coordinates within the graph's dimensions. More... | |
| void | GlgGraphSetPalette (GlgGraphLayout graph, GlgObject palette_drawing) |
| Sets a graph's icon palette. More... | |
| void | GlgGraphSetUntangle (GlgGraphLayout graph, GlgBoolean untangle) |
| Enables or disables untangling algorithm. More... | |
| GlgBoolean | GlgGraphSpringIterate (GlgGraphLayout graph) |
| Performs one iteration of the spring embedder layout. More... | |
| void | GlgGraphUnloadDefPalette (void) |
| Unsets the default palette. More... | |
| void | GlgGraphUpdate (GlgGraphLayout graph) |
| Updates the graphics display to show results of the spring layout. More... | |
| GlgGraphEdge GlgGraphAddEdge | ( | GlgGraphLayout | graph, |
| GlgGraphNode | start_node, | ||
| GlgGraphNode | end_node, | ||
| GlgObject | graphics, | ||
| GlgLong | edge_type, | ||
| void * | data | ||
| ) |
Creates a new edge and adds it to the graph.
| graph | Graph layout object. |
| start_node | The edge's start node. |
| end_node | The edge's end node. |
| graphics | An 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 that will be attached to the edge. |
| GlgGraphNode GlgGraphAddNode | ( | GlgGraphLayout | graph, |
| GlgObject | graphics, | ||
| GlgLong | node_type, | ||
| void * | data | ||
| ) |
Creates a new node and adds it to the graph.
| graph | Graph layout object. |
| graphics | An 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 that will be attached to the node. |
When a node is created, it is assigned a random initial position. An application can assign a node's initial position in normalized coordinates using GlgNodePosition after the node is created.
| void GlgGraphCircularLayout | ( | GlgGraphLayout | graph | ) |
Performs a circular layout.
| graph | Graph layout object. |
| GlgGraphLayout GlgGraphCreate | ( | void | ) |
Creates a graph layout object.
| GlgBoolean GlgGraphCreateGraphics | ( | GlgGraphLayout | graph, |
| GlgObject | viewport, | ||
| GlgObject | group | ||
| ) |
Loads icons from the palette and creates a GLG drawing to render the graph.
| graph | Graph layout object. |
| viewport | An optional viewport parameter. If it's not NULL, it will be 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. |
| GlgGraphLayout GlgGraphCreateRandom | ( | GlgLong | num_nodes, |
| GlgLong | num_node_types, | ||
| GraphType | type | ||
| ) |
Creates a demo graph layout and populates it with nodes and edges.
| num_nodes | Number of nodes to create. |
| num_node_types | Number of node types to use for rendering. |
| type | Graph type constant: RANDOM_GRAPH, CIRCULAR_GRAPH or STAR_GRAPH. |
| void GlgGraphDeleteEdge | ( | GlgGraphLayout | graph, |
| GlgGraphEdge | edge | ||
| ) |
Deletes an edge from the graph.
| graph | Graph layout object. |
| edge | The edge object to be deleted. |
| void GlgGraphDeleteNode | ( | GlgGraphLayout | graph, |
| GlgGraphNode | node | ||
| ) |
Deletes a node from the graph.
It also delets all edges connected to the node.
| graph | Graph layout object. |
| node | The node object to be deleted. |
| void GlgGraphDestroy | ( | GlgGraphLayout | graph | ) |
Destroys all graph layout's objects.
| graph | Graph layout object. |
| void GlgGraphDestroyGraphics | ( | GlgGraphLayout | graph | ) |
Destroys the graph's drawing and all graphical objects used to render nodes and edges.
| graph | Graph layout object. |
| void GlgGraphError | ( | char * | message | ) |
Error handler.
It uses the default GLG error handler to display the supplied error message and may be overridden by subclasses to implement custom error handling.
| message | An error message. |
| GlgGraphEdge GlgGraphFindEdge | ( | GlgGraphLayout | graph, |
| GlgObject | edge_graphics | ||
| ) |
Finds an edge object by its graphics.
It is used to handle mouse selection.
| graph | Graph layout object. |
| edge_graphics | The graphical object used to render the edge in the drawing. |
| GlgGraphNode GlgGraphFindNode | ( | GlgGraphLayout | graph, |
| GlgObject | node_graphics | ||
| ) |
Finds a node object by its graphics.
It is used to handle mouse selections.
| graph | Graph layout object. |
| node_graphics | The graphical object used to render the node in the drawing. |
| GlgGraphEdge GlgGraphGetEdge | ( | GlgGraphLayout | graph, |
| GlgLong | index | ||
| ) |
Finds an edge object by its index.
| graph | Graph layout object. |
| index | Edge's index inside the graph's edge array. |
| GlgLong GlgGraphGetEdgeIndex | ( | GlgGraphLayout | graph, |
| GlgGraphEdge | edge | ||
| ) |
Returns an edge's index inside the graph's edge_array.
| graph | Graph layout object. |
| edge | The edge object. |
| GlgObject GlgGraphGetGroup | ( | GlgGraphLayout | graph | ) |
Queries the container used to hold graph's nodes and edges.
| graph | Graph layout object. |
| GlgGraphNode GlgGraphGetNode | ( | GlgGraphLayout | graph, |
| GlgLong | index | ||
| ) |
Finds a node object by its index.
| graph | Graph layout object. |
| index | Node's index inside the graph's node array. |
| GlgLong GlgGraphGetNodeIndex | ( | GlgGraphLayout | graph, |
| GlgGraphNode | node | ||
| ) |
Returns a node's index inside the graph's node array.
| graph | Graph layout object. |
| node | The node object. |
| void GlgGraphGetNodePosition | ( | GlgGraphLayout | graph, |
| GlgGraphNode | node, | ||
| double * | x, | ||
| double * | y, | ||
| double * | z | ||
| ) |
Queries node position.
| graph | Graph layout object. |
| node | The node to query. |
| x,y,z | Pointers that will receive X, Y and Z node position in the GLG world coordinates. |
| GlgBoolean GlgGraphGetUntangle | ( | GlgGraphLayout | graph | ) |
Queries if the untangling algorithm was enabled via GlgGraphSetUntangle.
The untangling algorithm helps the graph layout to avoid local minimums in the form of intersecting edges. Using it doubles the time it takes to finish the layout.
| graph | Graph layout object. |
| GlgObject GlgGraphGetViewport | ( | GlgGraphLayout | graph | ) |
Queries the viewport of the graph's drawing.
| graph | Graph layout object. |
| void GlgGraphIncreaseTemperature | ( | GlgGraphLayout | graph, |
| GlgBoolean | initial | ||
| ) |
Forces the graph to continue layout after it's finished.
| graph | Graph layout object. |
| initial |
|
| GlgBoolean GlgGraphNodesConnected | ( | GlgGraphNode | node1, |
| GlgGraphNode | node2 | ||
| ) |
Connectivity test.
| node1 | The first node object. |
| node2 | The second node object. |
| void GlgGraphScramble | ( | GlgGraphLayout | graph | ) |
Demo function: Randomly scrambles the graph's nodes.
| graph | Graph layout object. |
| void GlgGraphSetDefPalette | ( | GlgObject | palette_drawing | ) |
Sets the default icon palette.
The default palette is used by all graph layouts if no graph-specific palette is defined to override the default one.
| palette_drawing | Palette drawing object. See description of the GlgGraphSetPalette method for more details. |
| void GlgGraphSetNodePosition | ( | GlgGraphLayout | graph, |
| GlgGraphNode | node, | ||
| double | x, | ||
| double | y, | ||
| double | z | ||
| ) |
Sets node position in the GLG world coordinates within the graph's dimensions.
The default dimensions are [-800; +800].
| graph | Graph layout object. |
| node | The node to position. |
| x | X coordinate. |
| y | Y coordinate. |
| z | Z coordinate. |
| void GlgGraphSetPalette | ( | GlgGraphLayout | graph, |
| GlgObject | palette_drawing | ||
| ) |
Sets a graph's icon palette.
| graph | Graph layout object. |
| palette_drawing | An GLG object containing node and edge icons to be used for rendering the graph's nodes and edges. |
The palette drawing must contain node icons named Node0, Node1, Node2 and so on. Each node icon must contain a data resource of the G (point) type named Position", which will be used by the graph layout to position the node. The palette must also contain an edge icon (a polygon object named Edge), which will be used to define the edges' attributes.
| void GlgGraphSetUntangle | ( | GlgGraphLayout | graph, |
| GlgBoolean | untangle | ||
| ) |
Enables or disables untangling algorithm.
| graph | Graph layout object. |
| untangle | True to enable untangling, False to disable. |
| GlgBoolean GlgGraphSpringIterate | ( | GlgGraphLayout | graph | ) |
Performs one iteration of the spring embedder layout.
| graph | Graph layout object. |
| void GlgGraphUnloadDefPalette | ( | void | ) |
Unsets the default palette.
| void GlgGraphUpdate | ( | GlgGraphLayout | graph | ) |
Updates the graphics display to show results of the spring layout.
There is no need to update the display after every iteration: it may be updated after every N iterations or just once, when the layout is finished.
If GlgGraphUpdateRate is set to a non-zero value, the GlgGraphSpringIterate function will periodically update the graph's graphics display, see GlgGraphUpdateRate.
| graph | Graph layout object. |