redrawGraphWindow {dynamicGraph} | R Documentation |
To redraw the graph window and to draw slave graph windows.
graphLattice |
NULL, or graphLattice of
list(...)$Arguments |
graphWindow |
If graphWindow is set to
the value of list(...)$Arguments$graphWindow then
the calling graph window will be redrawn.
If graphWindow is set to NULL , the default value,
then a new slave graph window will be drawn. |
edgeList |
As for dynamicGraphMain .
If edgeList is given then this value is used,
else the value extracted from list(...)$Arguments is used. |
blockEdgeList |
As for dynamicGraphMain .
If blockEdgeList ... (as for edgeList ). |
factorVertexList |
As for dynamicGraphMain .
If factorVertexList ... (as for edgeList ). |
factorEdgeList |
As for dynamicGraphMain .
If factorEdgeList ... (as for edgeList ). |
visibleVertices |
As for dynamicGraphMain .
If visibleVertices ... (as for edgeList ). |
extraList |
As for dynamicGraphMain .
If extraList ... (as for edgeList ). |
object |
As for dynamicGraphMain .
If object ... (as for edgeList ). |
title |
As for dynamicGraphMain .
If title ... (as for edgeList ). |
transformation |
As for dynamicGraphMain .
If transformation ... (as for edgeList ). |
width |
As for dynamicGraphMain .
If width ... (as for edgeList ). |
height |
As for dynamicGraphMain .
If height ... (as for edgeList ). |
w |
As for dynamicGraphMain .
If w ... (as for edgeList ). |
vertexColor |
As for dynamicGraphMain .
If vertexColor ... (as for edgeList ). |
extraVertexColor |
As for dynamicGraphMain .
If extraVertexColor ... (as for edgeList ). |
edgeColor |
As for dynamicGraphMain .
If edgeColor ... (as for edgeList ). |
factorVertexColor |
As for dynamicGraphMain .
If factorVertexColor ... (as for edgeList ). |
factorEdgeColor |
As for dynamicGraphMain .
If factorEdgeColor ... (as for edgeList ). |
blockEdgeColor |
As for dynamicGraphMain .
If blockEdgeColor ... (as for edgeList ). |
blockColors |
As for dynamicGraphMain .
If blockColors ... (as for edgeList ). |
background |
As for dynamicGraphMain .
If background ... (as for edgeList ). |
... |
Used to porting list(...)$Arguments . |
This function can be called from the functions of menus
(main menu and pop up menus) of dynamicGraphMain
(and from the methods of the model object in the scope of
the function dynamicGraphMain
).
As a result the graph window will be redrawn,
possible with, e.g., other edges,
or a new slave graph window will appear.
If the value of a argument to redrawGraphWindow
is set,
then this value is used, else the value from the calling window is used.
The value of the calling window is given in the argument
Arguments
in the call of the function of the menu item.
Below is an example, where items for labeling all the edges of the graph are added to the menu. The edges are visited, a test is computed for each edge, the label and width of the edge is updated, and the graph is drawn with the updated edge list.
The returned value from dynamicGraphMain
.
The function can not be called from top level.
Jens Henrik Badsberg
See also dynamicGraphMain
.
myLabelAllEdges <- function(object, slave = FALSE, ...) { args <- list(...) Args <- args$Arguments getNodeName <- function(index, type) if (type == "Vertex") name(Args$vertexList[[index]]) else if (type == "Factor") name(Args$factorVertexList[[abs(index)]]) else if (type == "Block") label(Args$blockList[[abs(index)]]) else NULL visitEdges <- function(edges) { for (i in seq(along = edges)) { vertices <- nodeIndicesOfEdge(edges[[i]]) types <- nodeTypesOfEdge(edges[[i]]) name.f <- getNodeName(vertices[1], types[1]) name.t <- getNodeName(vertices[2], types[2]) R <- testEdge(object, action = "remove", name.1 = name.f, name.2 = name.t, from = vertices[1], to = vertices[2], from.type = types[1], to.type = types[2], edge.index = i, force = force, Arguments = Args) if (!is.null(R)) { if (TRUE || (hasMethod("label", class(R)))) label(edges[[i]]) <- label(R) if (TRUE || (hasMethod("width", class(R)))) width(edges[[i]]) <- width(R) } } return(edges) } edgeList <- visitEdges(Args$edgeList) factorEdgeList <- visitEdges(Args$factorEdgeList) blockEdgeList <- visitEdges(Args$blockEdgeList) if (slave) Args$redrawGraphWindow(graphWindow = NULL, edgeList = edgeList, factorEdgeList = factorEdgeList, blockEdgeList = blockEdgeList, title = "A slave window", ...) else Args$redrawGraphWindow(graphWindow = Args$graphWindow, edgeList = edgeList, factorEdgeList = factorEdgeList, blockEdgeList = blockEdgeList, title = "Not used!", width = NULL, height = NULL, Arguments = Args) } Menus <- list(MainUser = list(label = "Test of user drag down menu - Position of \"vertices\"", command = function(object, ...) print(Positions(list(...)$Arguments$vertexList))), MainUser = list(label = "Label all edges, in this window", command = function(object, ...) myLabelAllEdges(object, slave = FALSE, ...)), MainUser = list(label = "Label all edges, in slave window", command = function(object, ...) myLabelAllEdges(object, slave = TRUE, ...)), MainUser = list(label = "Test of user drag down menu - modalDialog", command = function(object, ...) { Args <- list(...)$Arguments ReturnVal <- modalDialog("Test modalDialog Entry", "Enter name", Args$title, # top = Args$graphWindow@top, graphWindow = Args$graphWindow) print(ReturnVal) if (ReturnVal == "ID_CANCEL") return() } ), Vertex = list(label = "Test of user popup menu for vertices", command = function(object, name, ...) { print(name) print(c(list(...)$index)) } ), Edge = list(label = "Test of user popup menu for edges", command = function(object, name1, name2, ...) { args <- list(...) print(c(name1, name2)) print(c(args$edge.index, args$from, args$to)) } ), ClosedBlock = list(label = "Test of user popup menu for blocks", command = function(object, name, ...) { print(name) print(c(list(...)$index)) } ) )