]> granicus.if.org Git - graphviz/commitdiff
selection enabled
authorarif <devnull@localhost>
Wed, 23 Apr 2008 18:14:00 +0000 (18:14 +0000)
committerarif <devnull@localhost>
Wed, 23 Apr 2008 18:14:00 +0000 (18:14 +0000)
subgraph saving function
fixed only node graphs

cmd/smyrna/gui/menucallbacks.c
cmd/smyrna/main.c
cmd/smyrna/smyrnadefs.h
cmd/smyrna/topfisheyeview.c
cmd/smyrna/topfisheyeview.h

index 07081906563f79ed86f2ea9fd0c33937a59cfd29..c4dfaa6271b71f9e88206ae2a5e0d52724f47268 100755 (executable)
@@ -376,14 +376,20 @@ void mUnselectAllClustersSlot(GtkWidget * widget, gpointer user_data)
 
 void mSingleSelectSlot(GtkWidget * widget, gpointer user_data)
 {
+       view->mouse.mouse_mode=MM_SINGLE_SELECT;
+
 }
 
 void mSelectAreaSlot(GtkWidget * widget, gpointer user_data)
 {
+       view->mouse.mouse_mode=MM_RECTANGULAR_SELECT;
+
 }
 
 void mSelectAreaXSlot(GtkWidget * widget, gpointer user_data)
 {
+       view->mouse.mouse_mode=MM_RECTANGULAR_X_SELECT;
+
 
 }
 
index a9eae8346d7668a51092632639e75ccf34ec2dc8..d80116a0e41e1d62d42e2ef77a3294c4a436a3db 100755 (executable)
@@ -105,10 +105,10 @@ int main(int argc, char *argv[])
     glconfig = configure_gl();
     gladewidget = glade_xml_get_widget(xml, "vbox2");
     create_window(glconfig, gladewidget);
-    /*first arg is used as file name */
+       /*first arg is used as file name */
     if (argc > 1)
        add_graph_to_viewport_from_file(argv[1]);
-    gtk_main();
+       gtk_main();
 
 
 #ifdef G_OS_WIN32
index 0c1e6c6e2692a166c378bdd00b2d8e0d472c7e68..e514816629c57b6e522c6734a48c56f41dbf54da 100644 (file)
@@ -177,6 +177,7 @@ typedef struct {
        levelparms_t level;
        hierparms_t hier;
     } parms;
+       int animate;
 } topview;
 
 enum {
@@ -434,6 +435,12 @@ typedef struct _ViewInfo
        /*Topview data structure, refer topview.h for more info*/
        topview* Topview;
        Agraph_t* default_attributes;
+       /*timer for animations*/
+       GTimer* timer;
+       int active_frame;
+       int total_frames;
+       int frame_length;
+
 }ViewInfo;
 
 extern ViewInfo *view;
index b32237f274ff55037eda53143079753b5256e905..aa0e1cc805ee93965e8df65375e252886b032daf 100644 (file)
@@ -220,7 +220,8 @@ void prepare_topological_fisheye(topview* t)
 
     vtx_data *graph = makeGraph(t, &ne);
 
-    for (i = 0, np = t->Nodes; i < t->Nodecount; i++, np++) {
+       t->animate=0;   //turn the animation off
+       for (i = 0, np = t->Nodes; i < t->Nodecount; i++, np++) {
        x_coords[i] = np->x;
        y_coords[i] = np->y;
     }
@@ -257,9 +258,9 @@ void drawtopologicalfisheye(topview * t)
        for (v = 0; v < hp->nvtxs[level]; v++) {
            ex_vtx_data *gg = hp->geom_graphs[level];
            if (gg[v].active_level == level) {
-               double x0 = gg[v].physical_x_coord;
-               double y0 = gg[v].physical_y_coord;
-               glColor3f((GLfloat) (hp->nlevels - level) /
+                       double x0,y0;
+                       get_temp_coords(t,level,v,&x0,&y0);
+                       glColor3f((GLfloat) (hp->nlevels - level) /
                          (GLfloat) hp->nlevels,
                          (GLfloat) level / (GLfloat) hp->nlevels, 0);
                glVertex3f((GLfloat) x0, (GLfloat) y0, (GLfloat) 0);
@@ -274,8 +275,8 @@ void drawtopologicalfisheye(topview * t)
            ex_vtx_data *gg = hp->geom_graphs[level];
            vtx_data *g = hp->graphs[level];
            if (gg[v].active_level == level) {
-               double x0 = gg[v].physical_x_coord;
-               double y0 = gg[v].physical_y_coord;
+                       double x0,y0;
+                       get_temp_coords(t,level,v,&x0,&y0);
 
                for (i = 1; i < g[v].nedges; i++) {
                    double x, y;
@@ -285,9 +286,11 @@ void drawtopologicalfisheye(topview * t)
                              (GLfloat) level / (GLfloat) hp->nlevels, 0);
                    if (gg[n].active_level == level) {
                        if (v < n) {
-                           x = gg[n].physical_x_coord;
-                           y = gg[n].physical_y_coord;
-                           glVertex3f((GLfloat) x0, (GLfloat) y0,
+                           /*x = gg[n].physical_x_coord;
+                           y = gg[n].physical_y_coord;*/
+                               get_temp_coords(t,level,n,&x,&y);
+
+                               glVertex3f((GLfloat) x0, (GLfloat) y0,
                                       (GLfloat) 0);
                            glVertex3f((GLfloat) x, (GLfloat) y,
                                       (GLfloat) 0);
@@ -326,7 +329,8 @@ void changetopfishfocus(topview * t, float *x, float *y,
     int cur_level = 0;
     Hierarchy *hp = t->h;
 
-    fs->num_foci = num_foci;
+       refresh_old_values(t);
+       fs->num_foci = num_foci;
     for (i = 0; i < num_foci; i++) {
        find_closest_active_node(hp, x[i], y[i], &closest_fine_node);
        fs->foci_nodes[i] = closest_fine_node;
@@ -338,5 +342,119 @@ void changetopfishfocus(topview * t, float *x, float *y,
 
     set_active_levels(hp, fs->foci_nodes, fs->num_foci, &(t->parms.level));
     positionAllItems(hp, fs, &(t->parms.repos));
+       if(t->animate)
+       {
+               view->active_frame=0;
+               g_timer_start(view->timer); 
+       }
+
 }
+void refresh_old_values(topview* t)
+{
+    int level, v,i,n;
+    Hierarchy *hp = t->h;
+       t->animate=0;
+    for (level = 0; level < hp->nlevels; level++) {
+       for (v = 0; v < hp->nvtxs[level]; v++) {
+           ex_vtx_data *gg = hp->geom_graphs[level];
+           vtx_data *g = hp->graphs[level];
+           if (gg[v].active_level == level) {
+                       double x0,y0;
+                       get_temp_coords(t,level,v,&x0,&y0);
+                       gg[v].old_physical_x_coord=gg[v].physical_x_coord;
+                       gg[v].old_physical_y_coord=gg[v].physical_y_coord;
+                       gg[v].old_active_level=gg[v].active_level;
+               if (gg[v].active_level > level)
+               {
+                       find_physical_coords(hp, level, v, &x0, &y0);
+                       gg[v].old_physical_x_coord=x0;
+                       gg[v].old_physical_y_coord=y0;
+                       gg[v].old_active_level=gg[v].active_level;
+
+               }
+
+/*             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);
+                               gg[n].old_physical_x_coord=x;
+                               gg[n].old_physical_y_coord=y;
+                               gg[n].old_active_level=gg[n].active_level;
+       
+                       }
+                   } else if (gg[n].active_level > level) {
+                               find_physical_coords(hp, level, n, &x, &y);
+                               gg[n].old_physical_x_coord=x;
+                               gg[n].old_physical_y_coord=y;
+                               gg[n].old_active_level=gg[n].active_level;
+                       }
+               }*/
+           }
+       }
+    }
+       t->animate=1;
+
+}
+void get_temp_coords(topview* t,int level,int v,double* coord_x,double* coord_y)
+{
+    Hierarchy *hp = t->h;
+       ex_vtx_data *gg = hp->geom_graphs[level];
+       vtx_data *g = hp->graphs[level];
+       /*TEMP*/t->animate=0;/*TEMP*/
+       if (!t->animate)        
+       {
+               *coord_x=(double)gg[v].physical_x_coord;
+               *coord_y=(double)gg[v].physical_y_coord;
+       }
+       else
+       {
+
+                       double x0,y0;   
+                       get_active_frame(t);
+                       find_old_physical_coords(t->h,level,v,&x0,&y0);
+                       get_interpolated_coords(x0,y0,(double)gg[v].physical_x_coord,(double)gg[v].physical_y_coord,view->active_frame,view->total_frames,coord_x,coord_y);
+                       return 1;
+       }
+}
+void get_interpolated_coords(double x0,double y0,double x1,double y1,int fr,int total_fr, double* x,double* y)
+{
+       *x=(x1-x0)/(double)total_fr*(double)(fr+1);
+       *y=(y1-y0)/(double)total_fr*(double)(fr+1);
+}
+int get_active_frame(topview* t)
+{
+       gulong microseconds;
+       gdouble seconds;
+       int fr;
+       seconds=g_timer_elapsed(view->timer,&microseconds);
+       fr=(int)(seconds/((double)view->frame_length/(double)1000));
+       if (fr<view->total_frames)
+       {
+
+               if (fr==view->active_frame)
+                       return 0;
+               else
+               {
+                       view->active_frame=fr;
+                       return 1;
+               }
+       }
+       else
+       {
+               g_timer_stop(view->timer); 
+               return 0;
+       }
+
+/*     return view->
+       view->active_frame=0;
+       view->total_frames=0;
+       view->frame_length=5000;*/
+}
+
+
 
index a33808633599140aa32dd34babf296f4c713a3d2..dd22c39d7b6fadefce39f42540e2a2fce1ed2749 100644 (file)
@@ -25,4 +25,8 @@ void prepare_topological_fisheye(topview*);
 void drawtopologicalfisheye(topview * t);
 void changetopfishfocus(topview * t, float *x, float *y,
                                   float *z, int num_foci);
+void refresh_old_values(topview* t);
+void get_temp_coords(topview* t,int level,int v,double* coord_x,double* coord_y);
+void get_interpolated_coords(double x0,double y0,double x1,double y1,int fr,int total_fr, double* x,double* y);
+int get_active_frame(topview* t);
 #endif