op_anim_ime_gen_pos()

Abstract

Converts the coordinates of an arbitrary position within a model diagram into the equivalent coordinates of the specified animation viewer.

Syntax

op_anim_ime_gen_pos (anvid, modx, mody, vx_ptr, vy_ptr)
Argument Type Description
anvid Anvid viewer ID
[This value is a numeric identifier which references a viewer. The text will be displayed in the viewer’s window.]
modx double x coordinate of general model position
mody double y coordinate of general model position
[The modx and mody coordinate values are measured in the units of the model associated with the specified viewer.]
vx_ptr int* pointer to integer which will be assigned x coordinate of corresponding viewer position
vy_ptr int* pointer to integer which will be assigned y coordinate of corresponding viewer position
[The vx_ptr and vy_ptr coordinate values are measured in pixels from the origin of the viewer window (upper-left corner).]

Return Type

void

no return value

Example

/** Draw triangulation lines from listening posts to mobile target. **/

/* Determine position of mobile target. */
op_ima_obj_pos_get (tgt_objid, &tgt_lat, &tgt_lon, &tgt_alt,
	&tgt_x, &tgt_y, &tgt_z);

/* Convert target position from model to viewer coordinates. */
op_anim_ime_gen_pos (vid, tgt_lon, tgt_lat, &tgt_vx, &tgt_vy);

/* Erase existing triangulation lines. */
op_anim_igp_drawing_erase (vid, tl1_id, OPC_ANIM_ERASE_MODE_XOR);
op_anim_igp_drawing_erase (vid, tl2_id, OPC_ANIM_ERASE_MODE_XOR);
op_anim_igp_drawing_erase (vid, tl3_id, OPC_ANIM_ERASE_MODE_XOR);

/* Draw new triangulation lines. */
line_props = OPC_ANIM_RETAIN | OPC_ANIM_PIXOP_XOR | OPC_ANIM_COLOR_YELLOW;
tl1_id = op_anim_igp_line_draw (vid, line_props, lp1_vx, lp1_vy, tgt_vx, tgt_vy);
tl2_id = op_anim_igp_line_draw (vid, line_props, lp2_vx, lp2_vy, tgt_vx, tgt_vy);
tl3_id = op_anim_igp_line_draw (vid, line_props, lp3_vx, lp3_vy, tgt_vx, tgt_vy);

Details

Before this KP can be used, a request to load and display a model via the KP op_anim_ime_nmod_draw() must have been applied to the specified animation viewer. For proper translation of a model position, the position coordinate arguments (modx and mody) should be within the coordinate system of the viewer-associated model diagram. If a network model is being displayed in a viewer, the specified model position must fall within the view (subnet) being displayed. If an out-of-range model position is specified, the maximum displayable viewer coordinates in the quadrant corresponding to the specified position will be returned (for instance, out-of-range positive model coordinates will be translated to the lower-right corner of the viewer’s potential area).

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 for obtaining the animation viewer coordinates of positions within model diagrams. This is useful when drawing graphical primitives using op_anim_igp… KPs within a viewer displaying a model diagram. Macros can also be invoked with the obtained viewer coordinates passed in as arguments. In node and process diagrams, general positions are not typically useful, since most applications will draw graphical primitives in the proximity of model elements. However, in many network diagrams, general positions have a “real-world” significance, and may be used to place graphical primitives representing dynamic objects or relations not normally depicted in the model diagram.

Errors

  • Program Abort: segmentation violation (due to invalid integer pointers for the vx_ptr and vy_ptr arguments)
  • Recoverable Error: Unable to perform translation of general model position into viewer coordinates. (due to an inability to load a network model needed for translation)

Reference

本站文档由 北京智网畅联科技有限公司 整理、翻译并提供 · Documentation compiled and provided by Beijing ZNetLink Technology Co., Ltd.

交流群 · QQ Group:OPNET/智网妙算网络仿真交流群(群号 486383494)

原文档 © 2017 Riverbed Technology · 本站为公益翻译,由 AI 辅助完成,请仔细甄别

Original documentation © 2017 Riverbed Technology. Community translation, AI-assisted. Contact: jiazequn@znetlink.com