]> granicus.if.org Git - graphviz/commitdiff
colors fixed
authorarif <devnull@localhost>
Wed, 3 Dec 2008 19:00:34 +0000 (19:00 +0000)
committerarif <devnull@localhost>
Wed, 3 Dec 2008 19:00:34 +0000 (19:00 +0000)
focus point added
topfish works with no animation

cmd/smyrna/topfisheyeview.c
cmd/smyrna/viewport.c
lib/topfish/hierarchy.c

index d29a8f8512838cf3245322286e69d4216a86e6c9..c909dfa8624d5f80cc7dfea569a7ab607dbb0564 100644 (file)
@@ -249,8 +249,6 @@ void prepare_topological_fisheye(topview* t)
     view->Topview->parms.repos.width =(int) (view->bdxRight-view->bdxLeft);
     view->Topview->parms.repos.height =(int) (view->bdyTop-view->bdyBottom);
        set_active_levels(hp, fs->foci_nodes, fs->num_foci, &(t->parms.level));
-       printf ("dist:%s\n",agget(view->g[view->active_camera],"topologicalfisheyedistortionfactor"));
-       t->parms.repos.distortion=atof(agget(view->g[view->active_camera],"topologicalfisheyedistortionfactor"));
        positionAllItems(hp, fs, &(t->parms.repos));
        refresh_old_values(t);
 
@@ -261,7 +259,6 @@ void prepare_topological_fisheye(topview* t)
 /*
        draws all level 0 nodes and edges, during animation
 */
-
 void printalllevels(topview* t)
 {
     int level, v;
@@ -290,15 +287,30 @@ void drawtopologicalfisheye(topview * t)
 {
     int level, v, i, n;
     Hierarchy *hp = t->h;
-       static int a=0;
-       if(a==0)
+
+       
+       glEnable(GL_POINT_SMOOTH);      /*turn this off to make points look square*/
+       //draw focused node little bigger than others
+       glPointSize(8);
+    glBegin(GL_POINTS);
+
+       for (v = 0; v < hp->nvtxs[0]; v++) 
        {
-               printalllevels(t);
-               a=1;
+               ex_vtx_data *gg = hp->geom_graphs[0];
+               if ((gg[v].active_level == 0) &&(v==t->fs->foci_nodes[0]))
+               {
+                       double x0,y0;
+                       get_temp_coords(t,0,v,&x0,&y0);
+                       glColor3f(0,0,1);
+                       glVertex3f((GLfloat) x0, (GLfloat) y0, (GLfloat) -0.1);
+               }
        }
+       glEnd();
 
 
-    glPointSize(5);
+
+       //drawing nodes
+       glPointSize(5);
     glBegin(GL_POINTS);
     for (level = 0; level < hp->nlevels; level++) 
        {
@@ -321,9 +333,12 @@ void drawtopologicalfisheye(topview * t)
                        }
                }
     }
-    glEnd();
+       glEnd();
+
+
 
-    glBegin(GL_LINES);
+       //and edges
+       glBegin(GL_LINES);
     for (level = 0; level < hp->nlevels; level++)
        {
                for (v = 0; v < hp->nvtxs[level]; v++) 
@@ -364,6 +379,8 @@ void drawtopologicalfisheye(topview * t)
                }
        }
     glEnd();
+       glDisable(GL_POINT_SMOOTH);
+
 }
 
 
@@ -584,6 +601,7 @@ void infotopfisheye(topview * t, float *x, float *y, float *z)
 void changetopfishfocus(topview * t, float *x, float *y,
                                   float *z, int num_foci)
 {
+
        focus_t *fs = t->fs;
     int i;
     int closest_fine_node;
@@ -596,14 +614,16 @@ void changetopfishfocus(topview * t, float *x, float *y,
        find_closest_active_node(hp, x[i], y[i], &closest_fine_node);
        fs->foci_nodes[i] = closest_fine_node;
        fs->x_foci[i] =
-           hp->geom_graphs[cur_level][closest_fine_node].x_coord;
+               hp->geom_graphs[cur_level][closest_fine_node].physical_x_coord;
        fs->y_foci[i] =
-           hp->geom_graphs[cur_level][closest_fine_node].y_coord;
+               hp->geom_graphs[cur_level][closest_fine_node].physical_y_coord;
     }
 
+
     set_active_levels(hp, fs->foci_nodes, fs->num_foci, &(t->parms.level));
     view->Topview->parms.repos.width =(int) (view->bdxRight-view->bdxLeft);
     view->Topview->parms.repos.height =(int) (view->bdyTop-view->bdyBottom);
+       t->parms.repos.distortion=atof(agget(view->g[0],"topologicalfisheyedistortionfactor"));
        positionAllItems(hp, fs, &(t->parms.repos));
        t->animate=1;
 
index f2ce01bb4f94267e11ff0693868b6f45670633c4..bc1821def45630586c45912340b663dd8bfbf638 100755 (executable)
@@ -818,6 +818,7 @@ int add_graph_to_viewport_from_file(char *fileName)
        view->activeGraph = view->graphCount - 1;
        //GUI update , graph combo box on top-right should be updated
        load_settings_from_graph(view->default_attributes);
+       update_graph_from_settings(view->g[view->activeGraph]);
        refreshControls(view);
        return 1;
     } else
index af3d8fbecf6a5c58161838b6eb761ee930f94913..ea9284485f510ad1d7b8c96957f667c07887a4c6 100644 (file)
@@ -1038,17 +1038,21 @@ findClosestActiveNode(Hierarchy * hierarchy, int node,
 
     graph = hierarchy->geom_graphs[level];
 
-    if (graph[node].active_level == level) {   // node is active
-       double delx = x - graph[node].physical_x_coord;
-       double dely = y - graph[node].physical_y_coord;
-       double dist = delx*delx + dely*dely;
-
-       if (dist < closest_dist) {
-           closest_dist = dist;
-           *closest_node = node;
-           *closest_node_level = level;
-       }
-       return closest_dist;
+    if (graph[node].active_level == level)
+       {       // node is active
+               double delx = x - graph[node].physical_x_coord;
+               double dely = y - graph[node].physical_y_coord;
+               double dist = delx*delx + dely*dely;
+
+               if (dist < closest_dist) 
+               {
+                       closest_dist = dist;
+                       *closest_node = node;
+                       *closest_node_level = level;
+
+
+               }
+               return closest_dist;
     }
 
     closest_dist =
@@ -1074,8 +1078,9 @@ static int
 find_leftmost_descendant(Hierarchy * hierarchy, int node, int level,
                         int cur_level)
 {
-    while (level > cur_level) {
-       node = hierarchy->cv2v[level--][2 * node];
+    while (level > cur_level) 
+       {
+               node = hierarchy->cv2v[level--][2 * node];
     }
     return node;
 }
@@ -1093,13 +1098,11 @@ find_closest_active_node(Hierarchy * hierarchy, double x, double y,
     int top_level = hierarchy->nlevels - 1;
     double min_dist = 1e20;
 
-    for (i = 0; i < hierarchy->nvtxs[top_level]; i++) {
-       min_dist = findClosestActiveNode(hierarchy, i, top_level, x, y, 
-           min_dist, &closest_node, &closest_node_level);
+    for (i = 0; i < hierarchy->nvtxs[top_level]; i++) 
+       {
+               min_dist = findClosestActiveNode(hierarchy, i, top_level, x, y,min_dist, &closest_node, &closest_node_level);
     }
-    *closest_fine_node =
-       find_leftmost_descendant(hierarchy, closest_node,
-                                closest_node_level, cur_level);
+    *closest_fine_node =find_leftmost_descendant(hierarchy, closest_node,closest_node_level, cur_level);
 
     return min_dist;
 }