op_anim_ime_nmod_draw()
Abstract
Loads and draws the specified model diagram in a viewer.
Syntax
op_anim_ime_nmod_draw (anvid, mod_type, mod_name, view_name, mod_options, props)
| Argument | Type | Description |
|---|---|---|
anvid |
Anvid |
viewer ID [This value is a numeric identifier which references a viewer. The specified model will be displayed in the viewer’s window.] |
mod_type |
int |
model type code [This value is a numeric code which identifies the type of model.] |
mod_name |
char* |
model name |
view_name |
char* |
model view name [This value is a string identifying the name of a specific view of the model being drawn.] |
mod_options |
int |
model drawing option flags |
props |
int |
graphical property flags [This value is ignored by the op_vuanim viewer program, and can be assigned the value 0. It is defined as an argument to support future modifications of model graphical properties.] |
Return Type
void
no return value
Example
/* Open a full-size animation viewer. */
vid = op_anim_viewer_open_std ("Network Display", OPC_ANIM_LOCATION_FULL);
/* Load and draw a network model into viewer. */
op_anim_ime_nmod_draw (vid, OPC_ANIM_MODTYPE_NETWORK, "anet", "top",
OPC_ANIM_MOD_OPTION_NONE, OPC_ANIM_DEFPROPS);
/* Determine the name of the "animation" node. */
mod_objid = op_id_self ();
node_objid = op_topo_parent (mod_objid);
op_ima_obj_attr_get (node_objid, "name", node_name);
/* Change the icon of the "animation" node so that it is not seen. */
op_anim_ime_nobj_update (vid, OPC_ANIM_OBJTYPE_NODE, node_name,
OPC_ANIM_OBJ_ATTR_ICON, "blank", OPC_EOL);
Details
Unlike other animation KPs with names including the word “draw”, this KP does not produce a drawing that can later be erased. The specified viewer is permanently associated with the drawn model.
There are three types of models which can be drawn within a viewer, as specified by the mod_type argument:
the accepted symbolic constants have the format OPC_ANIM_MODTYPE_<m>, where <m> is either NETWORK, NODE, or PROCESS. The model view identified in the view_name argument only applies to network models; for other model types it is ignored. The diagram within each subnet of a network model is considered a separate view which can be specified via the subnet name.
Model display can be modified by several options, as specified by the mod_options argument. The option symbolic constant flags (listed under “Animation Model Drawing Option Symbolic Constants“ on page 7.) are independent and can be combined via bitwise OR. Default model display can be obtained using the flag OPC_ANIM_MOD_OPTION_NONE. The most common options are the depiction of trajectories and orbits in network models (OPC_ANIM_MOD_OPTION_DYNPATHS) and the half-size display of process models (OPC_ANIM_MOD_OPTION_HFSIZE).
In addition to the sources of viewer IDs listed in the Reference section, the symbolic constant OPC_ANIM_ANVID_PBSPEC can be used as a substitute viewer ID, indicating that the real viewer ID should be obtained from an active unlabeled custom animation probe.
Purpose
Provides a mechanism to load and display a model within a viewer, for use as a backdrop for custom animated displays. The positions of model objects can be determined within a macro and used to place graphical primitives in the proximity of these objects. Selected graphical attributes of model objects can be updated to depict a changed status of the object (examples include changing the icon of a queue to depict its level, the color of a link to depict its utilization, or the position of a mobile node’s icon to depict its movement). The traversal of packets across connections or links can also be conveniently animated. Selected model-based animation requests are discussed in the Reference section. Such requests depend on the model being previously loaded and displayed by this KP.
Errors
- Program Abort: segmentation violation (due to a badly formed string for the
mod_nameorview_namearguments) - Recoverable Error: Unable to read network model (
<mod_name>) for animation. (due to an unrecognized network model name—only networks are loaded in the simulation by this KP) - Recoverable Error: Unable to set specified view (
<view_name>). (due to an unrecognized name of subnet in network model) - Standard diagnostic errors for the
anvidandmod_typearguments being out-of-range, and for thepropsargument being invalid.
Reference
- Use the KP op_anim_mme_nobj_pos() to determine the position of a model object within a macro
- Use the KP op_anim_ime_nobj_update() to update a graphical attribute of a displayed model object
- Use the KP op_anim_ime_npath_traverse() to dynamically depict the traversal of a model path object (e.g., packets traversing links or connections)
- Use the KPs op_anim_viewer_open() or op_anim_viewer_open_std() to obtain the ID of a newly created animation viewer (or rendezvous with a previously opened viewer), or the KP op_anim_lprobe_anvid() to obtain the ID of a viewer opened by a labeled custom animation probe