From: arif Date: Wed, 9 Apr 2008 16:17:52 +0000 (+0000) Subject: drawc: spherical fisheye has been added X-Git-Tag: LAST_LIBGRAPH~32^2~4346 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8a4db4cee503613c82e4d3872fb2b77b5946a507;p=graphviz drawc: spherical fisheye has been added topviewc:edge and node colors are fixed.now smyrna first looks at color attribute for both then randomize if no color exists --- diff --git a/cmd/smyrna/draw.c b/cmd/smyrna/draw.c index 8a01b18dc..494ccebec 100755 --- a/cmd/smyrna/draw.c +++ b/cmd/smyrna/draw.c @@ -575,6 +575,7 @@ static void draw_circle(float originX, float originY, float radius) } +static GLUquadric* fisheyesphere; void draw_fisheye_magnifier(ViewInfo * view) { if ((view->mouse.mouse_mode == 21) && (view->mouse.mouse_down)) { @@ -592,7 +593,15 @@ void draw_fisheye_magnifier(ViewInfo * view) } if (((view->fmg.x != mg_x) || (view->fmg.y != mg_y))&&(view->active_camera>-1)) { fisheye_spherical(mg_x, mg_y,0.00,view->Topview); - draw_circle(mg_x, mg_y, a); + + + if(!fisheyesphere) + fisheyesphere=gluNewQuadric(); + gluQuadricDrawStyle ( fisheyesphere, GLU_LINE ); + glColor4f((GLfloat) 0.3, (GLfloat) 0.1, (GLfloat) 0.8,0.05); + glTranslatef(mg_x,mg_y,0); + gluSphere(fisheyesphere,a,30,30); + glTranslatef(-mg_x,-mg_y,0); } diff --git a/cmd/smyrna/topview.c b/cmd/smyrna/topview.c index fca688a6f..c0a0d5c7c 100755 --- a/cmd/smyrna/topview.c +++ b/cmd/smyrna/topview.c @@ -54,6 +54,7 @@ void preparetopview(Agraph_t * g, topview * t) Agsym_t *sym; int ind, ind2, data_type_count; //number of columns for custom view->Topview data ,IP ,HOST, etc char buf[256]; + RGBColor color; ind = 0; ind2 = 0; gtk_widget_hide(glade_xml_get_widget(xml, "layout6")); //hide top panel @@ -104,8 +105,17 @@ void preparetopview(Agraph_t * g, topview * t) } /*initialize group index, -1 means no group */ t->Nodes[ind].GroupIndex = -1; - randomize_color(&(t->Nodes[ind].Color), 2); t->Nodes[ind].Node = v; + if (agget(t->Nodes[ind].Node,"color")) + { + color=GetRGBColor(agget(t->Nodes[ind].Node,"color")); + t->Nodes[ind].Color.R=color.R; + t->Nodes[ind].Color.G=color.G; + t->Nodes[ind].Color.B=color.B; + t->Nodes[ind].Color.A=color.A; + } + else + randomize_color(&(t->Nodes[ind].Color), 2); t->Nodes[ind].x = a; t->Nodes[ind].y = b; t->Nodes[ind].z = c; @@ -572,34 +582,35 @@ int get_color_from_edge(topview_edge * e) return_value = 1; - if ((((custom_object_data *) AGDATA(e->Node1->Node))->Selected == 1) + /*if both head and tail nodes are selected use selection color for edges*/ + if ((((custom_object_data *) AGDATA(e->Node1->Node))->Selected == 1) && (((custom_object_data *) AGDATA(e->Node2->Node))->Selected == 1) ) { -// glColor4f(0,0,1,1); - glColor4f(view->selectedNodeColor.R, view->selectedNodeColor.G, - view->selectedNodeColor.B, view->selectedNodeColor.A); - return return_value; + glColor4f(view->selectedEdgeColor.R, view->selectedEdgeColor.G, + view->selectedEdgeColor.B, view->selectedEdgeColor.A); + return return_value; } - if ((((custom_object_data *) AGDATA(e->Node1->Node))->Highlighted == 1) + /*if both head and tail nodes are highlighted use edge highlight color */ + + if ((((custom_object_data *) AGDATA(e->Node1->Node))->Highlighted == 1) && (((custom_object_data *) AGDATA(e->Node2->Node))->Highlighted == 1) ) { - glColor4f(0, 0, 1, 1); - return return_value; + glColor4f(view->highlightedEdgeColor.R,view->highlightedEdgeColor.G,view->highlightedEdgeColor.B,view->highlightedEdgeColor.A); + return return_value; } - color_string = agget(e->Node1->Node, "fillcolor"); - //group colors + /*edge maybe in a group and group may be selected, then use groups's color example:ATT hosts*/ if ((e->Node1->GroupIndex >= 0) || (e->Node2->GroupIndex >= 0)) { - if (view->Topview->TopviewData->hostactive[e->Node1->GroupIndex] == + if (view->Topview->TopviewData->hostactive[e->Node1->GroupIndex] == 1) { - gtk_color_button_get_color(view->Topview->TopviewData-> + gtk_color_button_get_color(view->Topview->TopviewData-> gtkhostcolor[e->Node1->GroupIndex], &color); - glColor4f((GLfloat) color.red / (GLfloat) 65535.0, - (GLfloat) color.green / (GLfloat) 65535.0, - (GLfloat) color.blue / (GLfloat) 65535.0, - (GLfloat) 1); - return return_value; + glColor4f((GLfloat) color.red / (GLfloat) 65535.0, + (GLfloat) color.green / (GLfloat) 65535.0, + (GLfloat) color.blue / (GLfloat) 65535.0, + (GLfloat) 1); + return return_value; } else { if (view->Topview->TopviewData-> hostactive[e->Node2->GroupIndex] == 1) { @@ -617,7 +628,8 @@ int get_color_from_edge(topview_edge * e) } - + /*get edge's color attribute*/ + color_string = agget(e->Edge, "color"); if (color_string) { c = GetRGBColor(color_string); glColor4f(c.R, c.G, c.B, Alpha);