⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 manet_tora_imep.ex.c

📁 opnet11.5 manet dsr和aodv协议
💻 C
📖 第 1 页 / 共 3 页
字号:
						/* Refresh rate and TORA destination. */			op_ima_sim_attr_get (OPC_IMA_INTEGER, "TORA IMEP Animation Refresh Interval",				&tora_animation_refresh_interval);			op_ima_sim_attr_get (OPC_IMA_INTEGER, "TORA Animated Destination RID",				&tora_animated_dest_rid);						tora_animation_requested = OPC_TRUE;			}				}		FOUT;	}voidtora_imep_sup_draw_arrow_by_position (int src_vx, int src_vy, int dest_vx, int dest_vy, 	int props, int arrow_width, int	offset, Boolean double_thickness, Andid did_array[], Andid did_array_2[])	{	double										slope;	int											x_min, y_min, x_max, y_max;	int											start_line_x, start_line_y, end_line_x, end_line_y;	int											upper_arrow_x, upper_arrow_y, lower_arrow_x;	int											lower_arrow_y, src_remainder, dest_remainder;	int											quarter_x, quarter_y, quarter_line_x;	int											quarter_line_y, quarter_remainder;	int											eighth_x, eighth_y, eighth_line_x;	int											eighth_line_y, eighth_remainder;	int											mid_x, mid_y, mid_line_x, mid_line_y, mid_remainder;	int											start_line_y_d, start_line_x_d;	int											eighth_line_y_d, eighth_line_x_d;	int											upper_arrow_y_d, upper_arrow_x_d;	int											lower_arrow_y_d, lower_arrow_x_d, eighth_line_y_d_l, eighth_line_x_d_l;	Boolean										x_axis = OPC_FALSE;	Boolean										vertical_slope = OPC_FALSE;		/* Function to draw pipe based on the parameters passed to it. */	FIN (tora_imep_sup_draw_arrow_by_position  (params..));		/* Draw intelligently. */	if (src_vx < dest_vx)		{		x_min = src_vx; x_max = dest_vx;		/* src is on the left of dest. */		if (src_vy < dest_vy)			{			/* src is nw of dest. */			y_min = src_vy; y_max = dest_vy;			slope = (double)(y_max - y_min) / (double)(x_max - x_min);			x_axis = (slope > 1.0) ? OPC_FALSE : OPC_TRUE;						quarter_y = dest_vy - (dest_vy - src_vy) / 4;			eighth_y = dest_vy - (dest_vy - src_vy) / 8;			}					if (src_vy == dest_vy)			{			/* src and dest on the same horizontal line. */			y_min = dest_vy; y_max = src_vy;			slope = 0.0;			x_axis = OPC_TRUE;						eighth_y = quarter_y = src_vy;			}			if (src_vy > dest_vy)			{			/* src is sw of dest. */			y_min = dest_vy; y_max = src_vy;			slope = -(double)(y_max - y_min) / (double)(x_max - x_min);			x_axis = (slope < - 1.0) ? OPC_FALSE : OPC_TRUE;								quarter_y = (src_vy - dest_vy) / 4 + dest_vy;			eighth_y = (src_vy - dest_vy) / 8 + dest_vy;			}				quarter_x = dest_vx - (dest_vx - src_vx) / 4;		eighth_x = dest_vx - (dest_vx - src_vx) / 8;		}			if (src_vx == dest_vx)		{		vertical_slope = OPC_TRUE;		x_axis = OPC_FALSE;		x_min = src_vx; x_max = dest_vx;		/* Src and dest on the same vertical line. */		if (src_vy == dest_vy)			{			/* src and dest on the same position */			FOUT;			}					if (src_vy > dest_vy)			{			y_min = dest_vy; y_max = src_vy;							quarter_y = (src_vy - dest_vy) / 4 + dest_vy;			eighth_y = (src_vy - dest_vy) / 8 + dest_vy;			}		else			{			y_max = dest_vy; y_min = src_vy;							quarter_y = dest_vy - (dest_vy - src_vy) / 4;			eighth_y = dest_vy - (dest_vy - src_vy) / 8;			}		eighth_x = quarter_x = src_vx;		}	if (src_vx > dest_vx)		{		x_min = dest_vx; x_max = src_vx;		/* Src is on the right of dest. */		if (src_vy < dest_vy)			{			/* src is ne of dest. */			y_min = src_vy; y_max = dest_vy;			slope = - (double)(y_max - y_min) / (double)(x_max - x_min);			x_axis = (slope < -1.0) ? OPC_FALSE : OPC_TRUE;									quarter_y = dest_vy - (dest_vy - src_vy) / 4;			eighth_y = dest_vy - (dest_vy - src_vy) / 8;			}					if (src_vy == dest_vy)			{			/* src and dest on the same horizontal line. */			y_min = src_vy; y_max = dest_vy;			slope = 0.0;			x_axis = OPC_TRUE;						eighth_y = quarter_y = src_vy;			}			if (src_vy > dest_vy)			{			/* src is se of dest. */			y_min = dest_vy; y_max = src_vy;			slope = (double)(y_max - y_min) / (double)(x_max - x_min);			x_axis = (slope > 1.0) ? OPC_FALSE : OPC_TRUE;						quarter_y = (src_vy - dest_vy) / 4 + dest_vy;			eighth_y = (src_vy - dest_vy) / 8 + dest_vy;			}						quarter_x = (src_vx - dest_vx) / 4 + dest_vx;		eighth_x = (src_vx - dest_vx) / 8 + dest_vx;		}				/* Caluclate the midpoints. */	mid_x = (x_max - x_min) / 2 + x_min;	mid_y = (y_max - y_min) / 2 + y_min;		/* Calculate the endpoints offset amount from the original between the center points. */	if (x_axis)		{		if (slope != 0.0)			{			/* Calculate the diagonal line equation at the source point. */			src_remainder = src_vy + src_vx / slope;			/* Calculate the line start point. */			start_line_y = src_vy + offset;			start_line_x = slope * (src_remainder - start_line_y);						/* Calculate the diagonal line equation at the dest point. */			dest_remainder = dest_vy + dest_vx / slope;			/* Now the end point x, y. */			end_line_y = dest_vy + offset;			end_line_x = slope * (dest_remainder - end_line_y);						/* Find the mid point on the line. */			mid_remainder = mid_y +mid_x / slope;						/* Now the quarter point x, y. */			mid_line_y = mid_y + offset;			mid_line_x = slope * (mid_remainder - mid_line_y);					/* Find the quarter point on the line. */			quarter_remainder = quarter_y + quarter_x / slope;						/* Now the quarter point x, y. */			quarter_line_y = quarter_y + offset;			quarter_line_x = slope * (quarter_remainder - quarter_line_y);							/* Find the eighth point on the line. */			eighth_remainder = eighth_y + eighth_x / slope;						/* Now the quarter point x, y. */			eighth_line_y = eighth_y + offset;			eighth_line_x = slope * (eighth_remainder - eighth_line_y);			/* To find the tip of the arrows... */			upper_arrow_y = quarter_line_y + arrow_width;			upper_arrow_x = slope * (quarter_remainder - upper_arrow_y);			lower_arrow_y = quarter_line_y - arrow_width;			lower_arrow_x = slope * (quarter_remainder - lower_arrow_y);						}		else			{			/* Slope is zero. */			start_line_y = src_vy + offset;			start_line_x = src_vx;			end_line_y = dest_vy + offset;			end_line_x = dest_vx;			quarter_line_y = quarter_y + offset;			quarter_line_x = quarter_x;			mid_line_y = mid_y + offset;			mid_line_x = mid_x;			eighth_line_y = eighth_y + offset;			eighth_line_x = eighth_x;			upper_arrow_y = quarter_line_y + arrow_width;			upper_arrow_x = quarter_x;			lower_arrow_y = quarter_line_y - arrow_width;			lower_arrow_x = quarter_x;			}							/* Optional double thickness calculation. */		start_line_y_d = start_line_y + 1;		start_line_x_d = start_line_x;		eighth_line_y_d = eighth_line_y + 1;		eighth_line_x_d = eighth_line_x;		eighth_line_y_d_l = eighth_line_y - 1;		eighth_line_x_d_l = eighth_line_x;		upper_arrow_y_d = upper_arrow_y + 1;		upper_arrow_x_d = upper_arrow_x;		lower_arrow_y_d = lower_arrow_y - 1;		lower_arrow_x_d = lower_arrow_x;		}	else 		{		if (!vertical_slope)			{			/* Calculate the diagonal line equation at the source point. */			src_remainder = src_vy + src_vx / slope;					/* Calculate the line start point. */			start_line_x = src_vx + offset;			start_line_y = - start_line_x / slope + src_remainder;					/* Calculate the diagonal line equation at the dest point. */			dest_remainder = dest_vy + dest_vx / slope;			/* Now the end point x, y. */			end_line_x = dest_vx + offset;			end_line_y = - end_line_x / slope + dest_remainder;					/* Find the mid point on the line. */			mid_remainder = mid_y + mid_x / slope;			/* Now the mid point x, y. */			mid_line_x = mid_x + offset;			mid_line_y = - mid_line_x / slope + mid_remainder;					/* Find the quarter point on the line. */			quarter_remainder = quarter_y + quarter_x / slope;			/* Now the end point x, y. */			quarter_line_x = quarter_x + offset;			quarter_line_y = - quarter_line_x / slope + quarter_remainder;					/* Find the eighth point on the line. */			eighth_remainder = eighth_y + eighth_x / slope;			/* Now the eighth end point x, y. */			eighth_line_x = eighth_x + offset;			eighth_line_y = - eighth_line_x / slope + eighth_remainder;			/* To find the tip of the arrows... */			upper_arrow_x = quarter_line_x + arrow_width;			upper_arrow_y = - upper_arrow_x / slope + quarter_remainder;			lower_arrow_x = quarter_line_x - arrow_width;			lower_arrow_y = - lower_arrow_x / slope + quarter_remainder;			}		else			{			/* Vertical slope. */			start_line_x = src_vx + offset;			start_line_y = src_vy;						end_line_x = dest_vx + offset;			end_line_y = dest_vy;					/* Now the mid point x, y. */			mid_line_x = mid_x + offset;			mid_line_y = mid_y;					/* Now the quarter point x, y. */			quarter_line_x = quarter_x + offset;			quarter_line_y = quarter_y;						/* Now the eighth point x, y. */			eighth_line_x = eighth_x + offset;			eighth_line_y = eighth_y;					/* To find the tip of the arrows... */			upper_arrow_x = quarter_line_x + arrow_width;			upper_arrow_y = quarter_line_y;			lower_arrow_x = quarter_line_x - arrow_width;			lower_arrow_y = quarter_line_y;			}						/* Optional double thickness calculation. */		start_line_y_d = start_line_y;		start_line_x_d = start_line_x + 1;		eighth_line_y_d = eighth_line_y;		eighth_line_x_d = eighth_line_x + 1;		eighth_line_y_d_l = eighth_line_y;		eighth_line_x_d_l = eighth_line_x - 1;		upper_arrow_y_d = upper_arrow_y;		upper_arrow_x_d = upper_arrow_x + 1;		lower_arrow_y_d = lower_arrow_y;		lower_arrow_x_d = lower_arrow_x - 1;		}			/* Draw and store the id. */	did_array [0] = op_anim_igp_line_draw (Tora_ImepI_Anvid, props, start_line_x, 		start_line_y, eighth_line_x, eighth_line_y);	did_array [1] = op_anim_igp_line_draw (Tora_ImepI_Anvid, props, upper_arrow_x, 		upper_arrow_y, eighth_line_x, eighth_line_y);	did_array [2] = op_anim_igp_line_draw (Tora_ImepI_Anvid, props, lower_arrow_x, 		lower_arrow_y, eighth_line_x, eighth_line_y);		/* Optional double thickness. */	if (double_thickness)		{		did_array_2 [0] = op_anim_igp_line_draw (Tora_ImepI_Anvid, props, start_line_x_d, 			start_line_y_d, eighth_line_x_d, eighth_line_y_d);		did_array_2 [1] = op_anim_igp_line_draw (Tora_ImepI_Anvid, props, upper_arrow_x_d, 			upper_arrow_y_d, eighth_line_x_d, eighth_line_y_d);		did_array_2 [2] = op_anim_igp_line_draw (Tora_ImepI_Anvid, props, lower_arrow_x_d, 			lower_arrow_y_d, eighth_line_x_d_l, eighth_line_y_d_l);		}		FOUT;	}   

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -