topfisheyeview.h viewportcamera.h gvprpipe.h md5.h drawxdot.h arcball.h \
gui/beacon.h gui/callbacks.h gui/datalistcallbacks.h gui/filterscallbacks.h \
gui/frmobjectui.h gui/glcompui.h gui/gui.h gui/menucallbacks.h \
- gui/toolboxcallbacks.h gui/topviewsettings.h gui/appmouse.h
+ gui/toolboxcallbacks.h gui/topviewsettings.h gui/appmouse.h polytess.h smyrna_utils.h
smyrna_SOURCES = btree.c draw.c filter.c glexpose.c glmotion.c gltemplate.c \
hier.c main.c selection.c support.c template.c topview.c topviewdata.c \
gvprpipe.c md5.c drawxdot.c arcball.c hotkeymap.c \
gui/beacon.c gui/callbacks.c gui/datalistcallbacks.c gui/filterscallbacks.c \
gui/frmobjectui.c gui/glcompui.c gui/gui.c gui/menucallbacks.c \
- gui/toolboxcallbacks.c gui/topviewsettings.c gui/appmouse.c
+ gui/toolboxcallbacks.c gui/topviewsettings.c gui/appmouse.c polytess.c smyrna_utils.c
smyrna_LDADD = $(top_builddir)/lib/cgraph/libcgraph_C.la \
$(top_builddir)/lib/cdt/libcdt_C.la \
#include "topfisheyeview.h"
#include "appmouse.h"
#include "hotkeymap.h"
+#include "polytess.h"
//delta values
static float dx = 0.0;
}
glLineWidth(view->LineWidth);
+ drawTessPolygon(o);
+/*
if (!filled)
glBegin(GL_LINE_STRIP);
else
(GLfloat) op->u.polygon.pts[i].z + view->Topview->global_z);
}
glVertex3f((GLfloat) op->u.polygon.pts[0].x - dx, (GLfloat) op->u.polygon.pts[0].y - dy, (GLfloat) op->u.polygon.pts[0].z + view->Topview->global_z); //close the polygon
- glEnd();
+ glEnd();*/
+}
+
+
+extern void DrawPolygon2(sdot_op * o, int param)
+
+{
+ drawTessPolygon(o);
}
+
+
+
+
+
void DrawPolyline(sdot_op* o, int param)
{
int i = 0;
#include "gui/toolboxcallbacks.h"
#include "arcball.h"
#include "hotkeymap.h"
+#include "polytess.h"
void drawRotatingAxis(void);
void draw_cube()
drawRotatingAxis();
// draw_stuff();
// test_color_pallete();
-
-
-
// drawtestpoly();
/*DEBUG*/
/* if (view->mouse.mouse_mode == MM_PAN)
if (view->activeGraph > -1) {
// if (GD_TopView(view->g[view->activeGraph]))
// {
- if (!view->Topview->is_top_fisheye)
+ if (!view->Topview->fisheyeParams.active)
drawTopViewGraph(view->g[view->activeGraph]); //view->Topview style dots and straight lines
else {
drawtopologicalfisheye(view->Topview);
if (view->activeGraph >= 0)
{
- if (view->Topview->is_top_fisheye)
+ if (view->Topview->fisheyeParams.active)
changetopfishfocus(view->Topview,&view->mouse.GLpos.x,&view->mouse.GLpos.y, 0, 1);
else //single right click
// pick_node_from_coords(view->mouse.GLpos.x, view->mouse.GLpos.y,view->mouse.GLpos.z);
static void menu_switch_to_fisheye(glCompObj *obj, GLfloat x, GLfloat y,
glMouseButtonType t)
{
- if (!view->Topview->is_top_fisheye == 1) {
- if (!view->Topview->h) {
+ if (!view->Topview->fisheyeParams.active)
+ {
+ if (!view->Topview->fisheyeParams.h) {
prepare_topological_fisheye(view->Topview);
g_timer_start(view->timer);
}
- view->Topview->is_top_fisheye = 1;
+ view->Topview->fisheyeParams.active = 1;
glCompButtonShow(toNormal);
glCompButtonHide(toFisheye);
imgFisheye->common.visible = 1;
} else {
- view->Topview->is_top_fisheye = 0;
+ view->Topview->fisheyeParams.active = 0;
g_timer_stop(view->timer);
glCompButtonHide(toNormal);
glCompButtonShow(toFisheye);
glCompImageLoadPng(i, smyrnaPath("mod_3D.png"));
img3D = i;
i->common.visible = 0;
- l=glCompLabelNew((glCompObj *)s,100,5,view->Topview->Graphdata.GraphFileName);
- glCompLabelSetFontSize(l,24);
+/* l=glCompLabelNew((glCompObj *)s,100,5,view->Topview->Graphdata.GraphFileName);
+ glCompLabelSetFontSize(l,24);*/
return s;
view_mode=smyrna_2D;
if (v->active_camera >= 0 )
view_mode=smyrna_3D;
- if(v->Topview->is_top_fisheye)
+ if(v->Topview->fisheyeParams.active)
view_mode=smyrna_fisheye;
--- /dev/null
+#include "polytess.h"
+#include "xdot.h"
+tessPoly TP;
+
+GLdouble star[5][3] = { 0.6f, -0.1f, 0.0f,
+ 1.35f, 1.4f, 0.0f,
+ 2.1f, -0.1f, 0.0f,
+ 0.6f, 0.9f, 0.0f,
+ 2.1f, 0.9f, 0.0f,};
+
+
+//second polygon: a quad-4 vertices; first contour
+
+GLdouble s1[3][3] = { 0.0f, 0.0f, 0.0f,
+ 1.0f, 0.0f, 0.0f,
+ 1.0f, 0.0f, 0.0f,};
+GLdouble s2[4][3] = { 0.0f, 1.0f, 0.0f,
+ 0.3f, 0.3f, 0.0f,
+ 0.7f, 0.3f, 0.0f,
+ 0.5f, 0.7f, 0.0f,};
+
+
+
+
+
+
+GLdouble quad2[9][3] = { 0.0f, 0.0f, 0.0f,
+ 1.0f, 0.0f, 0.0f,
+ 1.0f, 1.0f, 0.0f,
+ 0.0f, 1.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f,
+ 0.3f, 0.3f, 0.0f,
+ 0.7f, 0.3f, 0.0f,
+ 0.5f, 0.7f, 0.0f,
+ 0.3f, 0.3f, 0.0f};
+
+
+
+GLdouble quad[5][3] = { 0.0f, 0.0f, 0.0f,
+ 1.0f, 0.0f, 0.0f,
+ 1.0f, 1.0f, 0.0f,
+ 0.0f, 1.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f};
+
+//second polygon: a triangle-3 vertices; second contour
+GLdouble tri[3][3] = { 0.3f, 0.3f, 0.0f,
+ 0.7f, 0.3f, 0.0f,
+ 0.5f, 0.7f, 0.0f};
+
+GLdouble complex[25][3] = { 0.0f, 0.0f, 0.0f,
+ 2.0f, 1.0f, 0.0f,
+ 2.0f, 2.0f, 0.0f,
+ 1.0f, 3.0f, 0.0f,
+ 3.0f, 3.0f, 0.0f,
+ 3.0f, 5.0f, 0.0f,
+ 0.0f, 5.0f, 0.0f,
+ 1.0f, 6.0f, 0.0f,
+ 0.0f, 7.0f, 0.0f,
+ 3.0f, 7.0f, 0.0f,
+ 5.0f, 5.0f, 0.0f,
+ 6.0f, 7.0f, 0.0f,
+ 7.0f, 7.0f, 0.0f,
+ 6.0f, 4.0f, 0.0f,
+ 5.0f, 4.0f, 0.0f,
+ 5.0f, 3.0f, 0.0f,
+ 4.0f, 3.0f, 0.0f,
+ 4.0f, 2.0f, 0.0f,
+ 7.0f, 2.0f, 0.0f,
+ 4.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f,
+ 2.5f, 0.5f, 0.0f,
+ 3.5f, 1.0f, 0.0f,
+ 3.5f, 0.5f, 0.0f,
+ 2.5f, 0.5f, 0.0f};
+
+
+
+void CALLBACK combineCallback(GLdouble coords[3], GLdouble *vertex_data[4],GLfloat weight[4], GLdouble **dataOut)
+{
+ GLdouble *vertex;
+ int i;
+ vertex = (GLdouble *) malloc(6 * sizeof(GLdouble));
+ vertex[0] = coords[0];
+ vertex[1] = coords[1];
+ vertex[2] = coords[2];
+ for (i = 3; i < 6; i++)
+ {
+/* vertex[i] = weight[0] * vertex_data[0][i] +
+ weight[1] * vertex_data[1][i] +
+ weight[2] * vertex_data[2][i] +
+ weight[3] * vertex_data[3][i];*/
+ vertex[i] = 0;
+
+ }
+ *dataOut = vertex;
+}
+
+void CALLBACK vertexCallback(GLvoid *vertex)
+{
+ GLdouble *ptr;
+ ptr = (GLdouble *) vertex;
+ glVertex3dv((GLdouble *) ptr);
+
+}
+
+
+
+static GLUtesselator* Init()
+{
+ // Create a new tessellation object
+ GLUtesselator* tobj = gluNewTess();
+ // Set callback functions
+ gluTessCallback(tobj, GLU_TESS_VERTEX, &vertexCallback);
+ gluTessCallback(tobj, GLU_TESS_BEGIN, &glBegin);
+ gluTessCallback(tobj, GLU_TESS_END, &glEnd);
+ gluTessCallback(tobj, GLU_TESS_COMBINE,&combineCallback);
+ return tobj;
+}
+
+
+
+static int Set_Winding_Rule(GLUtesselator *tobj,GLenum winding_rule)
+{
+
+// Set the winding rule
+ gluTessProperty(tobj, GLU_TESS_WINDING_RULE, winding_rule);
+ return 1 ;
+}
+
+static int Render_Contour2(GLUtesselator *tobj,sdot_op* p)
+{
+ GLdouble** d;
+ int x=0;
+ int y=0;
+
+ d=(GLdouble**) malloc(sizeof(GLdouble)* p->op.u.polygon.cnt);
+ for (x=0;x < p->op.u.polygon.cnt; x++)
+ {
+ GLdouble temp;
+ d[x]=(GLdouble*)(malloc(sizeof(GLdouble)*3));
+ d[x][0]=p->op.u.polygon.pts[x].x;
+ d[x][1]=p->op.u.polygon.pts[x].y;
+ d[x][2]=p->op.u.polygon.pts[x].z;
+ }
+ for (x = 0; x < p->op.u.polygon.cnt; x++) //loop through the vertices
+ {
+ gluTessVertex(tobj, d[x],d[x]); //store the vertex
+ }
+
+
+/* for (x = 0; x < p->op.u.polygon.cnt; x++) //loop through the vertices
+ {
+ d[0]=p->op.u.polygon.pts[x].x;
+ d[1]=p->op.u.polygon.pts[x].y;
+ d[2]=p->op.u.polygon.pts[x].z;
+// gluTessVertex(tobj, obj_data[x], obj_data[x]); //store the vertex
+ gluTessVertex(tobj, d,d); //store the vertex
+ }*/
+ return(1);
+
+}
+static int Render_Contour(GLUtesselator *tobj, GLdouble obj_data[][3],int cnt)
+{
+
+
+
+// GLdouble d[1][3];
+ static GLdouble**d;
+ int x=0;
+ int y=0;
+ if (!d)
+ {
+ d=(GLdouble**) malloc(sizeof(GLdouble)* cnt);
+ for (x=0;x < cnt; x++)
+ {
+ GLdouble temp;
+ d[x]=(GLdouble*)(malloc(sizeof(GLdouble)*3));
+ d[x][0]=obj_data[x][0];
+ d[x][1]=obj_data[x][1];
+ d[x][2]=obj_data[x][2];
+ }
+ }
+
+
+
+
+ for (x = 0; x < cnt; x++) //loop through the vertices
+ {
+/* d[0][0]=obj_data[x][0];
+ d[0][1]=obj_data[x][1];
+ d[0][2]=obj_data[x][2];*/
+
+
+
+/*void APIENTRY gluTessVertex(
+ GLUtesselator *tess,
+ GLdouble coords[3],
+ void *data );*/
+
+ gluTessVertex(tobj, d[x], d[x]); //store the vertex
+// gluTessVertex(tobj, obj_data[x], obj_data[x]); //store the vertex
+// gluTessVertex(tobj, d[0],d[0]); //store the vertex
+// gluTessVertex(tobj, g,g); //store the vertex
+
+ }
+
+ return(1);
+
+}
+
+
+
+
+
+
+static int Begin_Polygon(GLUtesselator *tobj)
+{
+ gluTessBeginPolygon(tobj, NULL);
+ return(1);
+}
+static int End_Polygon(GLUtesselator *tobj)
+{
+ gluTessEndPolygon(tobj);
+ return(1);
+
+}
+static int Begin_Contour(GLUtesselator *tobj)
+{
+ gluTessBeginContour(tobj);
+ return(1);
+
+}
+static int End_Contour(GLUtesselator *tobj)
+{
+ gluTessEndContour(tobj);
+ return(1);
+
+}
+
+static int freeTes(GLUtesselator *tobj)
+{
+ gluDeleteTess(tobj);
+ return(1);
+
+}
+int drawTessPolygon(sdot_op* p)
+{
+ if (!TP.tobj)
+ {
+ TP.tobj=Init();
+ TP.windingRule=GLU_TESS_WINDING_ODD;
+ }
+ Set_Winding_Rule(TP.tobj,TP.windingRule);
+ Begin_Polygon(TP.tobj);
+ Begin_Contour(TP.tobj);
+ Render_Contour2(TP.tobj,p);
+// Render_Contour(TP.tobj,complex,25);
+ End_Contour(TP.tobj);
+ End_Polygon(TP.tobj);
+ return 1;
+}
+
--- /dev/null
+/* $Id$ $Revision$ */
+/* vim:set shiftwidth=4 ts=8: */
+
+/**********************************************************
+* This software is part of the graphviz package *
+* http://www.graphviz.org/ *
+* *
+* Copyright (c) 1994-2004 AT&T Corp. *
+* and is licensed under the *
+* Common Public License, Version 1.0 *
+* by AT&T Corp. *
+* *
+* Information and Software Systems Research *
+* AT&T Research, Florham Park NJ *
+**********************************************************/
+
+#ifndef POLYTESS_H
+#define POLYTESS_H
+#include "smyrnadefs.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+ typedef struct {
+ GLUtesselator *tobj;
+ GLenum windingRule;
+ }tessPoly;
+ extern int drawTessPolygon(sdot_op* p);
+ extern int testDraw();
+#ifdef __cplusplus
+} /* end extern "C" */
+#endif
+#endif
RelativePath=".\gui\menucallbacks.c"
>
</File>
+ <File
+ RelativePath=".\polytess.c"
+ >
+ </File>
<File
RelativePath=".\selection.c"
>
</File>
+ <File
+ RelativePath=".\smyrna_utils.c"
+ >
+ </File>
<File
RelativePath=".\template.c"
>
RelativePath=".\topviewdata.c"
>
</File>
+ <File
+ RelativePath=".\topviewfuncs.c"
+ >
+ </File>
<File
RelativePath=".\gui\topviewsettings.c"
>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<VisualStudioUserFile
+ ProjectType="Visual C++"
+ Version="8.00"
+ ShowAllFiles="true"
+ >
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ >
+ <DebugSettings
+ Command="$(TargetPath)"
+ WorkingDirectory="C:\graphviz-ms\bin"
+ CommandArguments="C:\u.dot.xdot"
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="YEHUDA"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor="0"
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ >
+ <DebugSettings
+ Command="$(TargetPath)"
+ WorkingDirectory="C:\graphviz-ms\bin"
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="YEHUDA"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor="0"
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ </Configurations>
+</VisualStudioUserFile>
--- /dev/null
+#include "smyrna_utils.h"
+static boolean mapbool(char *p)
+{
+ if (p == NULL)
+ return FALSE;
+ if (!strcasecmp(p, "false"))
+ return FALSE;
+ if (!strcasecmp(p, "no"))
+ return FALSE;
+ if (!strcasecmp(p, "true"))
+ return TRUE;
+ if (!strcasecmp(p, "yes"))
+ return TRUE;
+ return atoi(p);
+}
+
+static int late_int(void *obj,Agsym_t* attr, int def, int low)
+{
+ char *p;
+ int rv;
+ if (attr == NULL)
+ return def;
+ p = agxget(obj, attr);
+ if (!p || p[0] == '\0')
+ return def;
+ if ((rv = atoi(p)) < low)
+ rv = low;
+ return rv;
+}
+
+static double late_double(void *obj, Agsym_t* attr, double def, double low)
+{
+ char *p;
+ double rv;
+
+ if (!attr || !obj)
+ return def;
+ p = agxget(obj, attr);
+ if (!p || p[0] == '\0')
+ return def;
+ if ((rv = atof(p)) < low)
+ rv = low;
+ return rv;
+}
+
+static char* late_string(void *obj, Agsym_t * attr, char *def)
+{
+ if (!attr || !obj)
+ return def;
+ return agxget(obj, attr);
+}
+
+static char *late_nnstring(void *obj, Agsym_t * attr, char *def)
+{
+ char *rv = late_string(obj, attr, def);
+ if (!rv || (rv[0] == '\0'))
+ rv = def;
+ return rv;
+}
+
+static boolean late_bool(void *obj, Agsym_t * attr, int def)
+{
+ if (attr == NULL)
+ return def;
+ return mapbool(agxget(obj, attr));
+}
+
+int l_int(void *obj, Agsym_t * attr, int def)
+{
+ char *p;
+ if (attr == NULL)
+ return def;
+ p = agxget(obj, attr);
+ if (!p || p[0] == '\0')
+ return def;
+ return atoi(p);
+}
+
+float l_float(void *obj, Agsym_t * attr, float def)
+{
+ char *p;
+ if (!attr || !obj)
+ return def;
+ p = agxget(obj, attr);
+ if (!p || p[0] == '\0')
+ return def;
+ return atof(p);
+}
+int getAttrBool(Agraph_t* g,void* obj,char* attr_name,int def)
+{
+ Agsym_t* attr;
+ attr = agattr(g, AGTYPE(obj), attr_name,0);
+ return late_bool(obj, attr,def);
+}
+int getAttrInt(Agraph_t* g,void* obj,char* attr_name,int def)
+{
+ Agsym_t* attr;
+ attr = agattr(g, AGTYPE(obj), attr_name,0);
+ return l_int(obj,attr,def);
+}
+float getAttrFloat(Agraph_t* g,void* obj,char* attr_name,float def)
+{
+ Agsym_t* attr;
+ attr = agattr(g, AGTYPE(obj), attr_name,0);
+ return l_float(obj,attr,def);
+}
+char* getAttrStr(Agraph_t* g,void* obj,char* attr_name,char* def)
+{
+ Agsym_t* attr;
+ attr = agattr(g, AGTYPE(obj), attr_name,0);
+ return late_string(obj, attr,def);
+}
+
+
+void setColor(glCompColor* c,GLfloat R,GLfloat G,GLfloat B,GLfloat A)
+{
+ c->R=R;
+ c->G=G;
+ c->B=B;
+ c->A=A;
+}
+static float interpol(float minv, float maxv, float minc, float maxc, float x)
+{
+ return ((x - minv) * (maxc - minc) / (maxv - minv) + minc);
+}
+
+
+/*void getcolorfromschema(colorschemaset * sc, float l, float maxl,glCompColor * c)
+{
+ int ind;
+ float percl = l / maxl * 100.00;
+ for (ind = 0; ind < sc->schemacount; ind++) {
+ if (percl < sc->s[ind].perc)
+ break;
+ }
+
+ if (sc->s[ind].smooth) {
+ c->R =
+ interpol(sc->s[ind - 1].perc, sc->s[ind].perc,
+ sc->s[ind - 1].c.R, sc->s[ind].c.R, percl);
+ c->G =
+ interpol(sc->s[ind - 1].perc, sc->s[ind].perc,
+ sc->s[ind - 1].c.G, sc->s[ind].c.G, percl);
+ c->B =
+ interpol(sc->s[ind - 1].perc, sc->s[ind].perc,
+ sc->s[ind - 1].c.B, sc->s[ind].c.B, percl);
+ c->A = 1;
+ } else {
+ c->R = sc->s[ind].c.R;
+ c->G = sc->s[ind].c.G;
+ c->B = sc->s[ind].c.B;
+ c->A = 1;
+ }
+}*/
--- /dev/null
+#ifndef SMYRNA_UTILS_H
+#define SMYRNA_UTILS_H
+
+#include "smyrnadefs.h"
+#include "cgraph.h"
+
+extern int l_int(void *obj, Agsym_t * attr, int def);
+extern float l_float(void *obj, Agsym_t * attr, float def);
+extern int getAttrBool(Agraph_t* g,void* obj,char* attr_name,int def);
+extern int getAttrInt(Agraph_t* g,void* obj,char* attr_name,int def);
+extern float getAttrFloat(Agraph_t* g,void* obj,char* attr_name,float def);
+extern char* getAttrStr(Agraph_t* g,void* obj,char* attr_name,char* def);
+extern void setColor(glCompColor* c,GLfloat R,GLfloat G,GLfloat B,GLfloat A);
+extern void getcolorfromschema(colorschemaset * sc, float l, float maxl,glCompColor * c);
+
+#endif
extern "C" {
#endif
+#define WITH_CGRAPH 1
+
#ifdef WIN32 //this is needed on WIN32 to get libglade see the callback
#define _BB __declspec(dllexport)
glCompFont* font;
int size;
int layer;
+ int listId;/*opengl list id*/
} sdot_op;
topview_edge *Edges;
int Nodecount;
int Edgecount;
- int limits[4];
topviewdata *TopviewData;
void *customptr;
- Hierarchy *h;
- glCompColor srcColor; //fine node colors of topfisheye
- glCompColor tarColor; //supernode colors of fisheye
- int is_top_fisheye; //1 draw hierarchy 0 draw regular topview
- focus_t *fs;
struct {
+ int active; //1 draw hierarchy 0 draw regular topview
reposition_t repos;
levelparms_t level;
hierparms_t hier;
- } parms;
- int animate;
+ Hierarchy *h;
+ int animate;
+ glCompColor srcColor; //fine node colors of topfisheye
+ glCompColor tarColor; //supernode colors of fisheye
+ focus_t *fs;
+ } fisheyeParams;
+
topview_node **picked_nodes;
int picked_node_count;
topview_edge **picked_edges;
float global_z;
attr_list* attributes;/*attribute list*/
attr_list* filtered_attr_list;
+ int xdotId;
} topview;
v_data *graph = makeGraph(t, &ne);
-// t->animate=1; //turn the animation on
+// t->fisheyeParams.animate=1; //turn the animation on
for (i = 0, np = t->Nodes; i < t->Nodecount; i++, np++) {
x_coords[i] = np->x;
y_coords[i] = np->y;
}
- hp = t->h =
+ hp = t->fisheyeParams.h =
makeHier(t->Nodecount, ne, graph, x_coords, y_coords,
- &(t->parms.hier));
+ &(t->fisheyeParams.hier));
freeGraph(graph);
free(x_coords);
free(y_coords);
- fs = t->fs = initFocus(t->Nodecount); // create focus set
+ fs = t->fisheyeParams.fs = initFocus(t->Nodecount); // create focus set
gg = hp->geom_graphs[0];
closest_fine_node = 0; /* first node */
fs->x_foci[0] = hp->geom_graphs[cur_level][closest_fine_node].x_coord;
fs->y_foci[0] = hp->geom_graphs[cur_level][closest_fine_node].y_coord;
- view->Topview->parms.repos.width =
+ view->Topview->fisheyeParams.repos.width =
(int) (view->bdxRight - view->bdxLeft);
- view->Topview->parms.repos.height =
+ view->Topview->fisheyeParams.repos.height =
(int) (view->bdyTop - view->bdyBottom);
- view->Topview->parms.repos.rescale = Polar;
+ view->Topview->fisheyeParams.repos.rescale = Polar;
//topological fisheye
colorxlate(get_attribute_value
("topologicalfisheyefinestcolor", view,
view->g[view->activeGraph]), &cl, RGBA_DOUBLE);
- view->Topview->srcColor.R = (float) cl.u.RGBA[0];
- view->Topview->srcColor.G = (float) cl.u.RGBA[1];
- view->Topview->srcColor.B = (float) cl.u.RGBA[2];
+ view->Topview->fisheyeParams.srcColor.R = (float) cl.u.RGBA[0];
+ view->Topview->fisheyeParams.srcColor.G = (float) cl.u.RGBA[1];
+ view->Topview->fisheyeParams.srcColor.B = (float) cl.u.RGBA[2];
colorxlate(get_attribute_value
("topologicalfisheyecoarsestcolor", view,
view->g[view->activeGraph]), &cl, RGBA_DOUBLE);
- view->Topview->tarColor.R = (float) cl.u.RGBA[0];
- view->Topview->tarColor.G = (float) cl.u.RGBA[1];
- view->Topview->tarColor.B = (float) cl.u.RGBA[2];
+ view->Topview->fisheyeParams.tarColor.R = (float) cl.u.RGBA[0];
+ view->Topview->fisheyeParams.tarColor.G = (float) cl.u.RGBA[1];
+ view->Topview->fisheyeParams.tarColor.B = (float) cl.u.RGBA[2];
sscanf(agget
(view->g[view->activeGraph],
"topologicalfisheyedistortionfactor"), "%lf",
- &view->Topview->parms.repos.distortion);
+ &view->Topview->fisheyeParams.repos.distortion);
sscanf(agget
(view->g[view->activeGraph], "topologicalfisheyefinenodes"),
- "%d", &view->Topview->parms.level.num_fine_nodes);
+ "%d", &view->Topview->fisheyeParams.level.num_fine_nodes);
sscanf(agget
(view->g[view->activeGraph],
"topologicalfisheyecoarseningfactor"), "%lf",
- &view->Topview->parms.level.coarsening_rate);
+ &view->Topview->fisheyeParams.level.coarsening_rate);
sscanf(agget
(view->g[view->activeGraph], "topologicalfisheyedist2limit"),
- "%d", &view->Topview->parms.hier.dist2_limit);
+ "%d", &view->Topview->fisheyeParams.hier.dist2_limit);
sscanf(agget(view->g[view->activeGraph], "topologicalfisheyeanimate"),
- "%d", &view->Topview->animate);
+ "%d", &view->Topview->fisheyeParams.animate);
- set_active_levels(hp, fs->foci_nodes, fs->num_foci, &(t->parms.level));
- positionAllItems(hp, fs, &(t->parms.repos));
+ set_active_levels(hp, fs->foci_nodes, fs->num_foci, &(t->fisheyeParams.level));
+ positionAllItems(hp, fs, &(t->fisheyeParams.repos));
refresh_old_values(t);
/* fprintf (stderr, "No. of active nodes = %d\n", count_active_nodes(hp)); */
void printalllevels(topview * t)
{
int level, v;
- Hierarchy *hp = t->h;
+ Hierarchy *hp = t->fisheyeParams.h;
glPointSize(5);
glBegin(GL_POINTS);
for (level = 0; level < hp->nlevels; level++) {
glCompColor tarColor;
glCompColor color;
int level, v;
- Hierarchy *hp = t->h;
+ Hierarchy *hp = t->fisheyeParams.h;
static int max_visible_level = 0;
- srcColor.R = view->Topview->srcColor.R;
- srcColor.G = view->Topview->srcColor.G;
- srcColor.B = view->Topview->srcColor.B;
- tarColor.R = view->Topview->tarColor.R;
- tarColor.G = view->Topview->tarColor.G;
- tarColor.B = view->Topview->tarColor.B;
+ srcColor.R = view->Topview->fisheyeParams.srcColor.R;
+ srcColor.G = view->Topview->fisheyeParams.srcColor.G;
+ srcColor.B = view->Topview->fisheyeParams.srcColor.B;
+ tarColor.R = view->Topview->fisheyeParams.tarColor.R;
+ tarColor.G = view->Topview->fisheyeParams.tarColor.G;
+ tarColor.B = view->Topview->fisheyeParams.tarColor.B;
glEnable(GL_POINT_SMOOTH); /*turn this off to make points look square */
//draw focused node little bigger than others
/* ex_vtx_data *gg = hp->geom_graphs[0];
- if ((gg[v].active_level == 0) &&(v==t->fs->foci_nodes[0]))*/
+ if ((gg[v].active_level == 0) &&(v==t->fisheyeParams.fs->foci_nodes[0]))*/
//drawing nodes
int v, finenodes, focusnodes;
char buf[512];
char *str;
- Hierarchy *hp = t->h;
+ Hierarchy *hp = t->fisheyeParams.h;
finenodes = focusnodes = 0;
str =
agget(view->g[view->activeGraph],
else
sprintf(buf, "%d", v);
- if ((v == t->fs->foci_nodes[0]) && (focusnodes)) {
+ if ((v == t->fisheyeParams.fs->foci_nodes[0]) && (focusnodes)) {
glColor4f((float) 0, (float) 0, (float) 1, (float) 1);
glprintfglut(GLUT_BITMAP_HELVETICA_18,
gg[v].physical_x_coord,
glCompColor color;
int level, v, i, n;
- Hierarchy *hp = t->h;
+ Hierarchy *hp = t->fisheyeParams.h;
static int max_visible_level = 0;
- srcColor.R = view->Topview->srcColor.R;
- srcColor.G = view->Topview->srcColor.G;
- srcColor.B = view->Topview->srcColor.B;
- tarColor.R = view->Topview->tarColor.R;
- tarColor.G = view->Topview->tarColor.G;
- tarColor.B = view->Topview->tarColor.B;
+ srcColor.R = view->Topview->fisheyeParams.srcColor.R;
+ srcColor.G = view->Topview->fisheyeParams.srcColor.G;
+ srcColor.B = view->Topview->fisheyeParams.srcColor.B;
+ tarColor.R = view->Topview->fisheyeParams.tarColor.R;
+ tarColor.G = view->Topview->fisheyeParams.tarColor.G;
+ tarColor.B = view->Topview->fisheyeParams.tarColor.B;
//and edges
glBegin(GL_LINES);
get_active_frame(t);
drawtopfishnodes(t);
drawtopfishedges(t);
- if (!t->animate)
+ if (!t->fisheyeParams.animate)
drawtopfishnodelabels(t);
}
int get_temp_coords(topview * t, int level, int v, double *coord_x,
double *coord_y)
{
- Hierarchy *hp = t->h;
+ Hierarchy *hp = t->fisheyeParams.h;
ex_vtx_data *gg = hp->geom_graphs[level];
/* v_data *g = hp->graphs[level]; */
- if (!t->animate) {
+ if (!t->fisheyeParams.animate) {
if (gg[v].active_level != level)
return 0;
}
if ((OAL > level) && (AL == level)) //draw as from ancs to new)
{
- find_old_physical_coords(t->h, level, v, &x0, &y0);
+ 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->h, level, v, &x1, &y1);
+ 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;
}
void infotopfisheye(topview * t, float *x, float *y, float *z)
{
- Hierarchy *hp = t->h;
+ Hierarchy *hp = t->fisheyeParams.h;
int closest_fine_node;
find_closest_active_node(hp, *x, *y, &closest_fine_node);
{
gvcolor_t cl;
- focus_t *fs = t->fs;
+ focus_t *fs = t->fisheyeParams.fs;
int i;
int closest_fine_node;
int cur_level = 0;
- Hierarchy *hp = t->h;
+ Hierarchy *hp = t->fisheyeParams.h;
refresh_old_values(t);
fs->num_foci = num_foci;
for (i = 0; i < num_foci; i++) {
}
- view->Topview->parms.repos.width =
+ view->Topview->fisheyeParams.repos.width =
(int) (view->bdxRight - view->bdxLeft);
- view->Topview->parms.repos.height =
+ view->Topview->fisheyeParams.repos.height =
(int) (view->bdyTop - view->bdyBottom);
colorxlate(get_attribute_value
("topologicalfisheyefinestcolor", view,
view->g[view->activeGraph]), &cl, RGBA_DOUBLE);
- view->Topview->srcColor.R = (float) cl.u.RGBA[0];
- view->Topview->srcColor.G = (float) cl.u.RGBA[1];
- view->Topview->srcColor.B = (float) cl.u.RGBA[2];
+ view->Topview->fisheyeParams.srcColor.R = (float) cl.u.RGBA[0];
+ view->Topview->fisheyeParams.srcColor.G = (float) cl.u.RGBA[1];
+ view->Topview->fisheyeParams.srcColor.B = (float) cl.u.RGBA[2];
colorxlate(get_attribute_value
("topologicalfisheyecoarsestcolor", view,
view->g[view->activeGraph]), &cl, RGBA_DOUBLE);
- view->Topview->tarColor.R = (float) cl.u.RGBA[0];
- view->Topview->tarColor.G = (float) cl.u.RGBA[1];
- view->Topview->tarColor.B = (float) cl.u.RGBA[2];
+ view->Topview->fisheyeParams.tarColor.R = (float) cl.u.RGBA[0];
+ view->Topview->fisheyeParams.tarColor.G = (float) cl.u.RGBA[1];
+ view->Topview->fisheyeParams.tarColor.B = (float) cl.u.RGBA[2];
sscanf(agget
(view->g[view->activeGraph],
"topologicalfisheyedistortionfactor"), "%lf",
- &view->Topview->parms.repos.distortion);
+ &view->Topview->fisheyeParams.repos.distortion);
sscanf(agget
(view->g[view->activeGraph], "topologicalfisheyefinenodes"),
- "%d", &view->Topview->parms.level.num_fine_nodes);
+ "%d", &view->Topview->fisheyeParams.level.num_fine_nodes);
sscanf(agget
(view->g[view->activeGraph],
"topologicalfisheyecoarseningfactor"), "%lf",
- &view->Topview->parms.level.coarsening_rate);
+ &view->Topview->fisheyeParams.level.coarsening_rate);
sscanf(agget
(view->g[view->activeGraph], "topologicalfisheyedist2limit"),
- "%d", &view->Topview->parms.hier.dist2_limit);
+ "%d", &view->Topview->fisheyeParams.hier.dist2_limit);
sscanf(agget(view->g[view->activeGraph], "topologicalfisheyeanimate"),
- "%d", &view->Topview->animate);
+ "%d", &view->Topview->fisheyeParams.animate);
- set_active_levels(hp, fs->foci_nodes, fs->num_foci, &(t->parms.level));
+ set_active_levels(hp, fs->foci_nodes, fs->num_foci, &(t->fisheyeParams.level));
- positionAllItems(hp, fs, &(t->parms.repos));
+ positionAllItems(hp, fs, &(t->fisheyeParams.repos));
- view->Topview->animate = 1;
+ view->Topview->fisheyeParams.animate = 1;
- if (t->animate) {
+ if (t->fisheyeParams.animate) {
view->active_frame = 0;
g_timer_start(view->timer);
}
void refresh_old_values(topview * t)
{
int level, v;
- Hierarchy *hp = t->h;
+ Hierarchy *hp = t->fisheyeParams.h;
for (level = 0; level < hp->nlevels; level++) {
for (v = 0; v < hp->nvtxs[level]; v++) {
ex_vtx_data *gg = hp->geom_graphs[level];
}
} else {
g_timer_stop(view->timer);
- view->Topview->animate = 0;
+ view->Topview->fisheyeParams.animate = 0;
return 0;
}
void drawtopologicalfisheyestatic(topview * t)
{
int level, v;
- Hierarchy *hp = t->h;
+ Hierarchy *hp = t->fisheyeParams.h;
glPointSize(15);
glBegin(GL_POINTS);
static int get_color_from_edge(topview_edge * e);
static void draw_tv_xdot(topview* t);
static void draw_xdot(xdot* x,float base_z);
+static int drawtopviewnodes(Agraph_t * g);
+static void drawtopviewedges(Agraph_t * g);
+void tesstest();
void settvxdot(Agraph_t * g, topview * t)
{
- /*look for xdot attributes and parse them if there is any */
-
+ /*
+ look for xdot attributes and parse them if there is any
+ */
topview_node *np;
topview_edge *ep;
int ind;
v->refresh.visibility=0;
}
+
+
+static create_DL()
+{
+ Agraph_t* g=view->g[view->activeGraph];
+ glNewList(1,GL_COMPILE);
+ drawtopviewnodes(g);
+ drawtopviewlabels(g);
+ drawtopviewedges(g);
+ drawtopviewedgelabels(g);
+/* renderNodes(g);
+ renderEdges(g);*/
+ glEndList();
+
+}
+
void update_topview(Agraph_t * g, topview * t, int init)
{
if (init)
+ {
preparetopview(g, t);
+ t->xdotId=-1;
+ }
settvcolorinfo(g, t);
set_boundaries(t);
settvxdot(view->g[view->activeGraph], view->Topview);
if (view->SignalBlock)
btnToolZoomFit_clicked(NULL, NULL);
+// create_DL();
+
}
/*for grouped data , group data viewing buttons extension */
// load_host_buttons(t, g, view->widgets);
/*set topologilca fisheye to NULL */
- t->h = '\0';
+ t->fisheyeParams.h = '\0';
if (view->dfltViewType == VT_TOPFISH)
- t->is_top_fisheye = 1;
+ t->fisheyeParams.active = 1;
else
- t->is_top_fisheye = 0;
+ t->fisheyeParams.active = 0;
/*reset picked nodes */
t->picked_node_count = 0;
view->visiblenodecount = 0;
for (ind = 0; ind < view->Topview->Nodecount; ind++) {
v = view->Topview->Nodes + ind;
- if (((-v->distorted_x / view->zoom >= view->clipX1)
+/* if (((-v->distorted_x / view->zoom >= view->clipX1)
&& (-v->distorted_x / view->zoom <= view->clipX2)
&& (-v->distorted_y / view->zoom >= view->clipY1)
&& (-v->distorted_y / view->zoom <= view->clipY2))
- || (view->active_camera >= 0)) {
+ || (view->active_camera >= 0))*/
+ if(1)
+ {
float zdepth;
view->visiblenodecount = view->visiblenodecount + 1;
if (!view->drawnodes || !node_visible(v))
static glCompPoint b;
static glCompPoint c;
static glCompPoint d;
+ return 1;
x1=e->x1/ view->zoom * -1;
x2=e->y1/ view->zoom * -1;
glDisable(GL_DEPTH_TEST);*/
// glDisable(GL_DEPTH_TEST);
+// glCallList (1);
drawtopviewnodes(g);
drawtopviewlabels(g);
drawtopviewedges(g);
drawtopviewedgelabels(g);
enddrawcycle(g);
draw_tv_xdot(view->Topview);
- draw_node_hint_boxes();
+ // draw_node_hint_boxes();
+// tesstest();
// glEnable(GL_DEPTH_TEST);
static void draw_tv_xdot(topview* t)
{
+
+/* glNewList(1,GL_COMPILE);
+ drawtopviewnodes(g);
+ drawtopviewlabels(g);
+ drawtopviewedges(g);
+ drawtopviewedgelabels(g);
+ renderNodes(g);
+ renderEdges(g);*/
+
int j;
float basez=0;
+
+ if(t->xdotId==-1)
+ {
+ t->xdotId=glGenLists(1);
+ glNewList(1,GL_COMPILE);
+ glNewList(t->xdotId,GL_COMPILE);
+ draw_xdot(t->xDot,basez);
+ basez= basez+0.01;
+ for (j=0; j < t->Nodecount; j++)
+ {
+ draw_xdot(t->Nodes[j].xDot,basez);
+ basez = basez+0.001;
+ }
+ for (j=0; j < t->Edgecount; j++)
+ {
+ draw_xdot(t->Edges[j].xDot,basez);
+
+ }
+ glEndList();
+ }
+ else
+ glCallList(t->xdotId);
+
+/* if((t->xDot)&&(t->xDot->ops->kind ==xd_font))
+ {
draw_xdot(t->xDot,basez);
basez= basez+0.01;
- for (j=0; j < t->Nodecount; j++)
- draw_xdot(t->Nodes[j].xDot,basez);
- basez = basez+0.001;
- for (j=0; j < t->Edgecount; j++)
- draw_xdot(t->Edges[j].xDot,basez);
+ }
+ for (j=0; j < t->Nodecount; j++)
+ {
+ if(t->Nodes[j].xDot->ops->kind==xd_font)
+ {
+ draw_xdot(t->Nodes[j].xDot,basez);
+ basez = basez+0.001;
+ }
+ }
+ for (j=0; j < t->Edgecount; j++)
+ {
+ if(t->Edges[j].xDot->ops->kind==xd_font)
+ draw_xdot(t->Edges[j].xDot,basez);
+ }*/
+
}
void setMultiedges(Agraph_t * g, char *attrname)
}
freePM(map);
}
+void CALLBACK tessBeginCB(GLenum which)
+{
+ glBegin(which);
+}
+
+
+
+void CALLBACK tessEndCB()
+{
+ glEnd();
+}
+void errorCallback(GLenum errorCode)
+{
+ const GLubyte *estring;
+
+ estring = gluErrorString(errorCode);
+ fprintf (stderr, "Tessellation Error: %s\n", estring);
+ exit (0);
+}
+
+void tesstest()
+{
+
+ static GLUtesselator *tobj;
+
+
+ GLdouble rect[4][3] = {0.0, 0.0, 0.0,
+ 200.0, 50.0, 0.0,
+ 200.0, 200.0, 0.0,
+ 0, 0, 0.0};
+ GLdouble tri[3][3] = {0.0, 0.0, 0.0,
+ 125.0, 175.0, 0.0,
+ 175.0, 0.0, 0.0};
+ GLdouble star[5][6] = {250.0, 50.0, 0.0, 1.0, 0.0, 1.0,
+ 325.0, 200.0, 0.0, 1.0, 1.0, 0.0,
+ 400.0, 50.0, 0.0, 0.0, 1.0, 1.0,
+ 250.0, 150.0, 0.0, 1.0, 0.0, 0.0,
+ 400.0, 150.0, 0.0, 0.0, 1.0, 0.0};
+
+ if(!tobj)
+ tobj=gluNewTess(); // create a tessellator
+ if(!tobj) return; // failed to create tessellation object, return 0
+
+// gluTessCallback(tobj, GLU_TESS_VERTEX,(GLvoid (*) ()) &glVertex3dv);
+
+ gluTessCallback(tobj, GLU_TESS_BEGIN, (void (CALLBACK *)())tessBeginCB);
+ gluTessCallback(tobj, GLU_TESS_END, (void (CALLBACK *)())tessEndCB);
+
+
+ glShadeModel(GL_FLAT);
+ gluTessBeginPolygon(tobj, NULL);
+ gluTessBeginContour(tobj);
+ gluTessVertex(tobj, rect[0], rect[0]);
+ gluTessVertex(tobj, rect[1], rect[1]);
+ gluTessVertex(tobj, rect[2], rect[2]);
+ gluTessVertex(tobj, rect[3], rect[3]);
+ gluTessEndContour(tobj);
+ gluTessBeginContour(tobj);
+ gluTessVertex(tobj, tri[0], tri[0]);
+ gluTessVertex(tobj, tri[1], tri[1]);
+ gluTessVertex(tobj, tri[2], tri[2]);
+ gluTessEndContour(tobj);
+ gluTessEndPolygon(tobj);
+
+ glShadeModel(GL_SMOOTH);
+ gluTessProperty(tobj, GLU_TESS_WINDING_RULE,
+ GLU_TESS_WINDING_POSITIVE);
+ gluTessBeginPolygon(tobj, NULL);
+ gluTessBeginContour(tobj);
+ gluTessVertex(tobj, star[0], star[0]);
+ gluTessVertex(tobj, star[1], star[1]);
+ gluTessVertex(tobj, star[2], star[2]);
+ gluTessVertex(tobj, star[3], star[3]);
+ gluTessVertex(tobj, star[4], star[4]);
+ gluTessEndContour(tobj);
+ gluTessEndPolygon(tobj);
+}
\ No newline at end of file
static gboolean gl_main_expose(gpointer data)
{
if (view->activeGraph >= 0) {
- if (view->Topview->animate == 1)
+ if (view->Topview->fisheyeParams.animate == 1)
expose_event(view->drawing_area, NULL, NULL);
return 1;
}
view->Selection.SelectionColor.A = 1;
view->Selection.Anti = 0;
view->Topview = GNEW(topview);
- view->Topview->fs = 0;
+ view->Topview->fisheyeParams.fs = 0;
view->Topview->xDot=NULL;
/* init topfish parameters */
- view->Topview->parms.level.num_fine_nodes = 10;
- view->Topview->parms.level.coarsening_rate = 2.5;
- view->Topview->parms.hier.dist2_limit = 1;
- view->Topview->parms.hier.min_nvtxs = 20;
- view->Topview->parms.repos.rescale = Polar;
- view->Topview->parms.repos.width =
+ view->Topview->fisheyeParams.level.num_fine_nodes = 10;
+ view->Topview->fisheyeParams.level.coarsening_rate = 2.5;
+ view->Topview->fisheyeParams.hier.dist2_limit = 1;
+ view->Topview->fisheyeParams.hier.min_nvtxs = 20;
+ view->Topview->fisheyeParams.repos.rescale = Polar;
+ view->Topview->fisheyeParams.repos.width =
(int) (view->bdxRight - view->bdxLeft);
- view->Topview->parms.repos.height =
+ view->Topview->fisheyeParams.repos.height =
(int) (view->bdyTop - view->bdyBottom);
- view->Topview->parms.repos.margin = 0;
- view->Topview->parms.repos.graphSize = 100;
- view->Topview->parms.repos.distortion = 1.0;
+ view->Topview->fisheyeParams.repos.margin = 0;
+ view->Topview->fisheyeParams.repos.graphSize = 100;
+ view->Topview->fisheyeParams.repos.distortion = 1.0;
/*create timer */
view->timer = g_timer_new();
view->timer2 = g_timer_new();
int save_graph(void)
{
//check if there is an active graph
- if (view->activeGraph > -1) {
+ if (view->activeGraph > -1)
+ {
//check if active graph has a file name
if (view->Topview->Graphdata.GraphFileName) {
return save_graph_with_file_name(view->g[view->activeGraph],
GraphFileName);
} else
return save_as_graph();
+ fill_key(view->orig_key, get_md5_key(view->g[view->activeGraph]));
}
- fill_key(view->orig_key, get_md5_key(view->g[view->activeGraph]));
return 1;
}