예제 #1
0
int get_temp_coords(topview * t, int level, int v, double *coord_x,
		    double *coord_y)
{
    Hierarchy *hp = t->fisheyeParams.h;
    ex_vtx_data *gg = hp->geom_graphs[level];
    /* v_data *g = hp->graphs[level]; */

    if (!t->fisheyeParams.animate) {
	if (gg[v].active_level != level)
	    return 0;

	*coord_x = (double) gg[v].physical_x_coord;
	*coord_y = (double) gg[v].physical_y_coord;
    } else {


	double x0, y0, x1, y1;
	int OAL, AL;

	x0 = 0;
	y0 = 0;
	x1 = 0;
	y1 = 0;
	AL = gg[v].active_level;
	OAL = gg[v].old_active_level;

	if ((OAL < level) || (AL < level))	//no draw 
	    return 0;
	if ((OAL >= level) || (AL >= level))	//draw the node
	{
	    if ((OAL == level) && (AL == level))	//draw as is from old coords to new)
	    {
		x0 = (double) gg[v].old_physical_x_coord;
		y0 = (double) gg[v].old_physical_y_coord;
		x1 = (double) gg[v].physical_x_coord;
		y1 = (double) gg[v].physical_y_coord;
	    }
	    if ((OAL > level) && (AL == level))	//draw as  from ancs  to new)
	    {
		find_old_physical_coords(t->fisheyeParams.h, level, v, &x0, &y0);
		x1 = (double) gg[v].physical_x_coord;
		y1 = (double) gg[v].physical_y_coord;
	    }
	    if ((OAL == level) && (AL > level))	//draw as  from ancs  to new)
	    {
		find_physical_coords(t->fisheyeParams.h, level, v, &x1, &y1);
		x0 = (double) gg[v].old_physical_x_coord;
		y0 = (double) gg[v].old_physical_y_coord;
	    }
	    get_interpolated_coords(x0, y0, x1, y1, view->active_frame,
				    view->total_frames, coord_x, coord_y);
	    if ((x0 == 0) || (x1 == 0))
		return 0;

	}
    }
    return 1;
}
예제 #2
0
void drawtopologicalfisheye(topview * t)
{
    int level, v, i, n;
	float R,G,B;    
	Hierarchy *hp = t->h;

	//draw only nodes and super nodes
	glPointSize(5);
    glBegin(GL_POINTS);
    for (level = 0; level < hp->nlevels; level++)
	{
		for (v = 0; v < hp->nvtxs[level]; v++)
		{
		    ex_vtx_data *gg = hp->geom_graphs[level];
		    if (gg[v].active_level == level)	
			{
				double x0,y0;
				t->animate=0;
				get_temp_coords(t,level,v,&x0,&y0,&R,&G,&B);
				glColor3f((GLfloat) (hp->nlevels - level) /
					(GLfloat) hp->nlevels,
					(GLfloat) level / (GLfloat) hp->nlevels, 0);
				glVertex3f((GLfloat) x0, (GLfloat) y0, (GLfloat) 0);
				t->animate=1;
			}
		}
	}
    glEnd();

	//draw edges
	glBegin(GL_LINES);
    for (level = 0; level < hp->nlevels; level++)
	{
		for (v = 0; v < hp->nvtxs[level]; v++) 
		{
			ex_vtx_data *gg = hp->geom_graphs[level];
			v_data *g = hp->graphs[level];
			if (gg[v].active_level == level) 
			{
				double x0,y0;
				get_temp_coords(t,level,v,&x0,&y0,&R,&G,&B);
				for (i = 1; i < g[v].nedges; i++) 
				{
					double x, y;
					n = g[v].edges[i];
					glColor3f((GLfloat) (hp->nlevels - level) /
						(GLfloat) hp->nlevels,
						(GLfloat) level / (GLfloat) hp->nlevels, 0);
				    if (gg[n].active_level == level)
					{
						if (v < n)
						{
							get_temp_coords(t,level,n,&x,&y,&R,&G,&B);
							glVertex3f((GLfloat) x0, (GLfloat) y0,(GLfloat) 0);
							glVertex3f((GLfloat) x, (GLfloat) y,(GLfloat) 0);
						}
					}
					else if (gg[n].active_level > level) 
					{
						find_physical_coords(hp, level, n, &x, &y);
						glVertex3f((GLfloat) x0, (GLfloat) y0,(GLfloat) 0);
						glVertex3f((GLfloat) x, (GLfloat) y, (GLfloat) 0);
					}
				}
			}
		}
    }
    glEnd();
}
예제 #3
0
int get_temp_coords(topview* t,int level,int v,double* coord_x,double* coord_y,float *R,float *G,float *B)
{
    Hierarchy *hp = t->h;
	ex_vtx_data *gg = hp->geom_graphs[level];
	/* v_data *g = hp->graphs[level]; */
	int OAL,AL;
	OAL=gg[v].old_active_level;
	AL=gg[v].active_level;
	/*if ((OAL > level) && (AL>level))
		return 0;*/
	if ((OAL < level) && (AL<level))
		return 0;

	if (!t->animate)
	{
		if (AL == level)
		{
			*coord_x=(double)gg[v].physical_x_coord;
			*coord_y=(double)gg[v].physical_y_coord;
			return 1;
		}
		else
			return 0;
	}
	else
	{

		double x0,y0,x1,y1;	
		x0=0;
		y0=0;
		x1=0;
		y1=0;

		get_active_frame(t);
		if ((OAL == level) && (AL==level))
		{
			x0=(double)gg[v].old_physical_x_coord;
			y0=(double)gg[v].old_physical_y_coord;
			x1=(double)gg[v].physical_x_coord;
			y1=(double)gg[v].physical_y_coord;
			*G=0;
			*R=1;

		}
		if ((OAL == level) && (AL>level))
		{
			x0=(double)gg[v].old_physical_x_coord;
			y0=(double)gg[v].old_physical_y_coord;
			find_physical_coords(t->h,level,v,&x1,&y1);
			*G=view->active_frame/view->total_frames;
				*R=0;

		}
		if ((OAL > level) && (AL==level))
		{
			find_old_physical_coords(t->h,level,v,&x0,&y0);
			x1=(double)gg[v].physical_x_coord;
			y1=(double)gg[v].physical_y_coord;
			*R=view->active_frame/view->total_frames;
			*G=1/(view->active_frame/view->total_frames+0.0000001);

		}
		if ((OAL > level) && (AL>level))
		{
			find_old_physical_coords(t->h,level,v,&x0,&y0);
			find_physical_coords(t->h,level,v,&x1,&y1);
			*G=1;
			*R=0;

		}

		get_interpolated_coords(x0,y0,x1,y1,view->active_frame,view->total_frames,coord_x,coord_y);
		
		return 1;
	}
	return 0;
}