op_anim_mme_nobj_pos()
Abstract
Defines an operation within the specified macro that loads the position of the specified model object into a pair of registers.
Syntax
op_anim_mme_nobj_pos (anmid, obj_type, obj_name, x_regid, y_regid, vertex)
| Argument | Type | Description |
|---|---|---|
anmid |
Anmid |
macro ID [This value is a numeric identifier which references an open animation macro, created via the KP op_anim_macro_create().] |
obj_type |
int |
object type code [This is a numeric code that specifies the type of model object which will be queried for its position. Supported object type constants are listed in the Details section.] |
obj_name |
char* |
object name |
x_regid |
int |
drawing register ID for x coordinate of position |
y_regid |
int |
drawing register ID for y coordinate of position |
vertex |
int |
object vertex code [This is a numeric code that identifies the “hot-point” on the object being used to determine its position. Supported vertex type constants are listed in the Details section.] |
Return Type
void
no return value
Example
/* Create a macro which draws a line between two nodes. */
mid = op_anim_macro_create ("node dynconn");
/* Determine the positions of the nodes A & B; the position of A is */
/* stored in (M,N) and the position of B is stored in (O,P). */
op_anim_mme_nobj_pos (mid, OPC_ANIM_OBJTYPE_NODE, OPC_ANIM_REG_A_STR,
OPC_ANIM_REG_M_INT, OPC_ANIM_REG_N_INT, OPC_ANIM_VERTEX_ICON_CTR);
op_anim_mme_nobj_pos (mid, OPC_ANIM_OBJTYPE_NODE, OPC_ANIM_REG_B_STR,
OPC_ANIM_REG_O_INT, OPC_ANIM_REG_P_INT, OPC_ANIM_VERTEX_ICON_CTR);
/* Indicate end of register setup section. */
op_anim_mgp_setup_end (mid);
/* Draw the line between the nodes. */
op_anim_mgp_line_draw (mid, OPC_ANIM_COLOR_GREEN,
OPC_ANIM_REG_M_INT, OPC_ANIM_REG_N_INT, OPC_ANIM_REG_O_INT, OPC_ANIM_REG_P_INT);
/* Execute the macro for source & destination nodes. */
op_anim_igp_macro_draw (vid, OPC_ANIM_RETAIN, mid,
OPC_ANIM_REG_A_STR, src_nd_name,
OPC_ANIM_REG_B_STR, dst_nd_name, OPC_EOL);
Details
The obj_type argument should be passed a symbolic constant with the format OPC_ANIM_OBJTYPE_<type>, where possible values of <type> are:
- Network Model Objects
- SUBNET—subnet object
- NODE—node object (fixed, mobile, satellite)
- SIMPLINK—simplex point-to-point link object
- DUPLINK—duplex point-to-point link object
- BUSLINK—bus link object
- TAPLINK—bus tap object
- MODULE—module object
- STREAM—stream object
- STATWIRE—statistic wire object
- Process Model Objects
- STATE—state object
- TRANSITION—transition object
The vertex argument specifies the vertex of the object to be loaded into the registers. The value passed to this argument should have the format OPC_ANIM_VERTEX_<v>, where <v> specifies one of the following:
- an icon corners (ICON_NE, ICON_NW, ICON_SE, ICON_SW)
- the middle of an icon edges (ICON_N, ICON_S, ICON_E, ICON_W)
- the center of the icon (ICON_CTR)
- one of three points along a path (PATH_SRC, PATH_DST, PATH_MID)
Purpose
Provides a mechanism for obtaining positions of model objects, for use in subsequent macro operations. Many macros display graphical elements in neighborhood of existing model objects, as a way of depicting the status of the objects. For instance, a line of text can be placed near a queue module’s icon, indicating the number of packets stored in the queue.
Errors
- Program Abort: segmentation violation (due to a badly formed string for the
obj_nameargument) - Recoverable Error: Animation macro ID (
<anmid>) is [out-of-range] [unrecognized]. (former case due toanmidargument value that is invalid, latter case to destroyed macro) - Standard diagnostic errors for the
obj_type,vertex,x_regid, andy_regidarguments being out-of-range.
Reference
- Use the KP
op_anim_ime_gen_pos()to convert a general position in model coordinates into coordinate values which can be used in Anim package graphics KPs - Use the KP
op_anim_macro_create()to create an empty macro - Use the KP
op_anim_macro_close()to indicate the completion of a macro definition - Use the KP
op_anim_igp_macro_draw()to invoke a macro within a viewer