op_anim_viewer_open()
Abstract
Opens a viewer with the specified name, position, and size.
Syntax
op_anim_viewer_open (name, x, y, width, height)
| Argument | Type | Description |
|---|---|---|
name |
char* |
viewer name [Viewer names are used as “rendezvous points” for global animations (i.e., repeated viewer open operations reusing a viewer name will return the same viewer ID as the original viewer open operation); thus multiple processes or even remote modules can share the same viewer. Viewer names also appear in the banner of the viewer, serving as a window title.] |
x |
int |
x coordinate of viewer upper-left corner |
y |
int |
y coordinate of viewer upper-left corner [The x and y coordinate values are measured in pixels from the origin of the workspace (upper-left corner).] |
width |
int |
width of viewer (in pixels) |
height |
int |
height of viewer (in pixels) |
Return Type
Anvid
numeric ID of the opened viewer
[This integer ID is used as a “handle” to refer to the new viewer in calls to other op_anim… KPs.]
Example
/* Open a viewer for network. */
net_vid = op_anim_viewer_open ("Network View", 10, 10, 450, 650);
/* Load network model. */
op_anim_ime_nmod_draw (net_vid, OPC_ANIM_MODTYPE_NETWORK, "inet", "top",
OPC_ANIM_MOD_OPTION_NONE, OPC_ANIM_DEFPROPS);
/* Open a viewer for node. */
node_vid = op_anim_viewer_open ("Node View", 475, 10, 450, 650);
/* Load node model. */
op_anim_ime_nmod_draw (node_vid, OPC_ANIM_MODTYPE_NODE, "inet_fddi_gwy", " ",
OPC_ANIM_MOD_OPTION_NONE, OPC_ANIM_DEFPROPS);
Details
Explicitly opening an animation viewer is one of several techniques available to obtain access to a viewer for animation request display (the other techniques rely on custom animation probes to automatically open their associated viewers). An invocation of this KP will open a viewer as specified by the function arguments, and will ignore the viewer attributes specified by any defined custom animation probes.
Execution of this KP is disabled by the standard masking conditions: an inactive animation flow, or a complete lack of custom animation probes. However, execution is not disabled by the lack of active custom animation probes, due to the importance of having a viewer available for animation KPs independent of when the probe becomes active.
Purpose
Provides a mechanism to open a viewer window with specified location and size. Viewers are the “drawing surfaces” of animations, so there must be at least one viewer opened in each viewable animation.
Errors
- Program Abort: segmentation violation (due to a badly formed string for the
nameargument) - Diagnostic Error: Kernel procedure argument (
<arg_name>) has out-of-range value (<value>). (due to a value for the argumentsx,y,width, orheightthat exceeds the range of a short)
Reference
- Use the KP
op_anim_viewer_open_std()to open a viewer with a standard location and size - Use the KP
op_anim_lprobe_anvid()to obtain the ID of a viewer opened by a labeled animation probe - Use the
op_anim_igp…KPs to display graphical primitives in an opened viewer - Use the
op_anim_ime…KPs to display or modify model elements in an opened viewer - Use the KP
op_anim_viewer_close()to erase and deallocate an open viewer - Use the KP
op_anim_viewer_redraw()to cause a redraw of a viewer