0xc0, 0x00, 0xc0, 0x00, 0xc0, 0x00, 0xff, 0xc0, 0xff, 0xc0
};
-static void
-DrawBezier(GLfloat * xp, GLfloat * yp, GLfloat * zp, int filled, int param)
+void DrawBezier(GLfloat * xp, GLfloat * yp, GLfloat * zp, int filled, int param)
{
/*copied from NEHE */
/*Written by: David Nikdel ( ogapo@ithink.net ) */
//Draws a ellpise made out of points.
//void DrawEllipse(xdot_point* xpoint,GLfloat xradius, GLfloat yradius,int filled)
-static void DrawEllipse(xdot_op * op, int param)
+void DrawEllipse(xdot_op * op, int param)
{
//to draw a circle set xradius and yradius same values
GLfloat x, y, xradius, yradius;
glEnd();
}
-static void DrawPolyline(xdot_op * op, int param)
+void DrawPolyline(xdot_op * op, int param)
{
int i = 0;
if (param == 0)
}
#endif
-static void SetFillColor(xdot_op * op, int param)
+void SetFillColor(xdot_op * op, int param)
{
RGBColor c;
c = GetRGBColor(op->u.color);
view->fillColor.B = c.B;
view->fillColor.A = c.A;
}
-static void SetPenColor(xdot_op * op, int param)
+void SetPenColor(xdot_op * op, int param)
{
RGBColor c;
c = GetRGBColor(op->u.color);
view->penColor.A = c.A;
}
-static void SetStyle(xdot_op * op, int param)
+void SetStyle(xdot_op * op, int param)
{
view->FontSize = op->u.font.size;*/
}
-static void InsertImage(xdot_op * op, int param)
+void InsertImage(xdot_op * op, int param)
{
// SelectImage((sdot_op *) op);
}
-static void EmbedText(xdot_op * op, int param)
+void EmbedText(xdot_op * op, int param)
{
GLfloat x;
// SelectText((sdot_op *) op);
}
-static void draw_circle(float originX, float originY, float radius)
+void draw_circle(float originX, float originY, float radius)
{
/* draw a circle from a bunch of short lines */
float vectorX1, vectorY1, vectorX, vectorY, angle;
}
-static GLUquadric* fisheyesphere;
+GLUquadric* fisheyesphere;
void draw_fisheye_magnifier(ViewInfo * view)
{
if ((view->mouse.mouse_mode == 21) && (view->mouse.mouse_down)) {
extern void drawBorders(ViewInfo * view);
void drawEllipse(float xradius, float yradius,int angle1,int angle2);
int draw_node_hintbox(GLfloat x,GLfloat y,GLfloat z,GLfloat fs,char* text);
+void DrawBezier(GLfloat * xp, GLfloat * yp, GLfloat * zp, int filled, int param);
void draw_sphere(float x,float y,float z,float r);
{
int ind = 0;
int found = 0;
- printf("removed\n");
for (; ind < view->Topview->picked_node_count; ind++) {
if ((view->Topview->picked_nodes[ind] == n) && (!found))
found = 1;
view->Topview->picked_node_count++;
view->Topview->picked_nodes =realloc(view->Topview->picked_nodes,sizeof(topview_node *) * view->Topview->picked_node_count);
view->Topview->picked_nodes[view->Topview->picked_node_count - 1] = n;
- printf("picked count:%d\n",view->Topview->picked_node_count);
return 1;
}
{
int ind = 0;
int found = 0;
- printf("removed\n");
for (; ind < view->Topview->picked_edge_count; ind++)
{
if ((view->Topview->picked_edges[ind] == e) && (!found))
view->Topview->picked_edge_count++;
view->Topview->picked_edges =realloc(view->Topview->picked_edges,sizeof(topview_edge *) * view->Topview->picked_edge_count);
view->Topview->picked_edges[view->Topview->picked_edge_count - 1] = e;
- printf("picked edge count:%d\n",view->Topview->picked_edge_count);
return 1;
}
for (ind = 0; ind < view->Topview->picked_edge_count; ind++)
{
- buf[0]=(char*)0;
float x1,x2,x3,y1,y2,y3,z1,z2,z3l;
+ buf[0]=(char*)0;
glColor4f(0, 1, 0, 0.5);
e = view->Topview->picked_edges[ind];
x1=e->Node1->distorted_x;
#define BEACON_H
#include "smyrnadefs.h"
-int pick_node(topview_node * n);
-int is_node_picked(topview_node * n);
-int remove_from_pick_list(topview_node * n);
-int add_to_pick_list(topview_node * n);
+extern int pick_node(topview_node * n);
+extern int is_node_picked(topview_node * n);
+extern int remove_from_pick_list(topview_node * n);
+extern int add_to_pick_list(topview_node * n);
+extern int draw_node_hint_boxes(void);
#endif
}
void mCloseSlot(GtkWidget * widget, gpointer user_data)
{
- printf("mCloseSlot clicked\n");
if (view->activeGraph == 0)
close_graph(view,0);
}
char* smyrnaGlade;
unsigned char SmyrnaVerbose;
-#if 0
-infixtoposfic(char* infix,char* posfix,int bfsize)
-{
- char a=NULL;
- int ind=0;
- int ind2=0; /*points to empty cell*/
- int st[512];
- int ptr=0;
- for (ind=0;ind < strlen(infix); ind ++)
- {
- printf ("stack:%s\n",st);
- printf ("posix:%s\n",posfix);
- a=infix[ind];
- if ((a != '(') && (a != ')') &&(a != '+') && (a != '-') && (a != '/') &&(a != '*'))
- {
- posfix[ind2]=a;
- ind2++;
- continue;
- }
- if(a=='(')
- {
- st[ptr]=a;
- ptr++;
- continue;
- }
- if((a == '+') || (a == '-') || (a == '/') ||(a == '*'))
- {
- ptr --;
- while ((st[ptr]=='+') || (st[ptr]=='-')|| (st[ptr]=='/')|| (st[ptr]=='*'))
- {
- posfix[ind2]=st[ptr];
- ind2++;
- ptr --;
- }
- ptr++;
- st[ptr]=a;
- ptr++;
- continue;
- }
- if(a==')')
- {
- while ((st[ptr]!= '(') )
- {
- posfix[ind2]=st[ptr];
- ind2++;
- ptr --;
- }
- ptr--;
- }
- }
- posfix[ind2]='\0';
-}
-#endif
/* smyrnaPath:
* Construct pathname for smyrna data file.
RelativePath=".\draw.c"
>
</File>
+ <File
+ RelativePath=".\drawxdot.c"
+ >
+ </File>
<File
RelativePath=".\filter.c"
>
#ifndef NO_WIN_HEADER
#include "windows.h"
#endif
-//#include "gltexfont.h"
+#include "xdot.h"
//#define SMYRNA_GLADE "C:/Projects/graphviz2/share/gui/smyrna.glade"
#define SMYRNA_ATTRS "c:/graphviz-ms/graphviz2/share/gui/attrs.txt"
#endif
} viewport_camera;
+
typedef struct {
Agnode_t *Node;
/*original coordinates */
RGBColor Color;
int update_required;
element_data data;
+
} topview_edge;
typedef struct _graph_data {
Agrec_t h;
float init_node_size; //raster size of node
float init_zoom;
float fitin_zoom;
+ xdot_set* xdot_list;/*xdot attached to whole graph*/
+
} topview;
#include "hier.h"
#include "arith.h"
#include "topfisheyeview.h"
+#include "beacon.h"
#ifdef WIN32
#include "regex_win32.h"
#else
/*clear nodes */
free (t->Nodes);
free (t->Edges);
-// free(t);
+ free_xdotset(t->xdot_list);
+
}
static void init_element_data(element_data* d)
{
}
+static xdot* parseXdotwithattr(void *p, char *attr)
+{
+ xdot *xDot;
+ if ((xDot = parseXDotF(agget(p, attr), OpFns, sizeof(sdot_op))))
+ return xDot;
+ else
+ return NULL;
+}
+
+static void parseXdotwithattrs(void *e, xdot_set* s)
+{
+ xdot *xd,*xd2;
+ int ind;
+// xd=parseXdotwithattr(e, "_draw_");
+ xd=parseXDotF("e 54 102 27 18 c 9 -#000000ff c 9 -#000020ff ", OpFns, sizeof(sdot_op));
+ xd2=parseXdotwithattr(e, "_draw_");
+ if (xd2)
+ {
+ add_to_xdot_set(s,xd);
+ for (ind=0;ind < xd->cnt ;ind++)
+ {
+ xdot_op *op2,*op3;
+ op2=&xd->ops[ind];
+ op3=&xd2->ops[ind];
+ }
+ }
+ add_to_xdot_set(s,parseXdotwithattr(e, "_ldraw_"));
+ add_to_xdot_set(s,parseXdotwithattr(e, "_hdraw_"));
+ add_to_xdot_set(s,parseXdotwithattr(e, "_tdraw_"));
+ add_to_xdot_set(s,parseXdotwithattr(e, "_hldraw_"));
+ add_to_xdot_set(s,parseXdotwithattr(e, "_tldraw_"));
+}
+void settvxdot(Agraph_t* g,topview* t)
+{
+ /*look for xdot attributes and parse them if there is any*/
+
+ topview_node* np;
+ topview_edge* ep;
+ int ind;
+ for (ind=0;ind < t->Nodecount ; ind ++)
+ {
+ np=&t->Nodes[ind];
+ parseXdotwithattrs(np->Node, t->xdot_list);
+ }
+ for (ind=0;ind < t->Edgecount ; ind ++)
+ {
+ ep=&t->Edges[ind];
+ parseXdotwithattrs(ep->Edge, t->xdot_list);
+ }
+}
+
void update_topview(Agraph_t * g, topview * t,int init)
{
vsize = 0.05*sqrt((view->bdxRight - view->bdxLeft)*(view->bdyTop - view->bdyBottom));
t->init_node_size = vsize*2/GetOGLDistance(2)*percent/100.0/sqrt(t->Nodecount);
t->init_zoom = view->zoom;
+ free_xdotset(view->Topview->xdot_list);
+ t->xdot_list=init_xdot_set();
}
settvposinfo(g,t);
settvcolorinfo(g,t);
set_boundaries(t);
set_update_required(t);
+ settvxdot(view->g[view->activeGraph],view->Topview);
+ print_xdot_set(view->Topview->xdot_list);
btnToolZoomFit_clicked(NULL,NULL);
}
drawtopviewedges(g);
drawtopviewedgelabels(g);
enddrawcycle(g);
-
-
+ draw_xdot_set(view->Topview->xdot_list);
draw_node_hint_boxes();
if ((view->Selection.Active > 0) && (!view->SignalBlock)) {
view->Selection.Active = 0;
float ddx = 0;
float ddy = 0;
char* buf;
- char bf[256];
if (((v->distorted_x / view->zoom * -1 > view->clipX1)
&& (v->distorted_x / view->zoom * -1 < view->clipX2)
&& (v->distorted_y / view->zoom * -1 > view->clipY1)
}
}
}
-
-
}
-
-
view->Selection.Anti = 0;
view->Topview = GNEW(topview);
view->Topview->fs = 0;
+ view->Topview->xdot_list=NULL;
/* init topfish parameters */
view->Topview->parms.level.num_fine_nodes = 10;
* AT&T Research, Florham Park NJ *
**********************************************************/
#ifndef GLCOMPTEXT_H
-#define GLTEXFONTH_H
+#define GLCOMPTEXT_H
#include <stdlib.h>
#include <string.h>
{
if ((winZ[idx] > comp) && (winZ[idx] < 1))
comp = winZ[idx];
- printf ("%f\n",winZ[idx]);
}
gluUnProject(winX,winY, comp,modelview, projection, viewport, &posX,
&posY, &posZ);
x->cnt = 0;
x->sz = sz;
- while ((s = parseOp (&op, s, fns))) {
- if (x->cnt == bufsz) {
- bufsz += XDBSIZE;
- ops = (char*)grealloc (ops, bufsz*sz);
- }
- *(xdot_op*)(ops + (x->cnt*sz)) = op;
- x->cnt++;
+ while ((s = parseOp (&op, s, fns)))
+ {
+ if (x->cnt == bufsz)
+ {
+ bufsz += XDBSIZE;
+ ops = (char*)grealloc (ops, bufsz*sz);
+ }
+ *(xdot_op*)(ops + (x->cnt*sz)) = op;
+ x->cnt++;
}
if (x->cnt)
- x->ops = (xdot_op*)grealloc (ops, x->cnt*sz);
- else {
- free (x);
- x = 0;
+ x->ops = (xdot_op*)grealloc (ops, x->cnt*sz);
+ else
+ {
+ free (x);
+ x = 0;
}
return x;
}
free (base);
free (x);
}
+static void fix_capacity(xdot_set* s)
+{
+ if (s->cnt == s->capacity)
+ s->capacity=s->capacity + INITIAL_XDOT_CAPACITY;
+ s->obj=realloc(s->obj,(sizeof(void*))* s->capacity);
+ s->xdots=realloc (s->xdots,sizeof(xdot*)* s->capacity);
+}
+void add_to_xdot_set(xdot_set* s,xdot *x)
+{
+ int ind=0;
+ if (!x)
+ return ;
+ fix_capacity(s);
+ s->xdots[s->cnt]=x;
+ for (ind=0;ind < s->xdots[s->cnt]->cnt;ind++)
+ {
+ xdot_op* op,*op2,*op3;
+ op=&(s->xdots[s->cnt]->ops[ind]);
+ op2=&(x->ops[ind]);
+ op3=NULL;
+
+ }
+ s->cnt ++;
+
+}
+void free_xdotset(xdot_set* s)
+{
+ int idx;
+ if (!s)
+ return ;
+
+ for (idx=0;idx < s->cnt ; idx ++)
+ {
+ if (s->obj[idx])
+ free(s->obj[idx]);
+ if (s->xdots[idx])
+ freeXDot(s->xdots[idx]);
+ }
+ free (s);
+}
+
+xdot_set* init_xdot_set()
+{
+ xdot_set* rv;
+ rv=malloc(sizeof(xdot_set));
+ rv->cnt=0;
+ rv->capacity=INITIAL_XDOT_CAPACITY;
+ rv->obj=malloc (sizeof(void*)* INITIAL_XDOT_CAPACITY);
+ rv->xdots=malloc (sizeof(xdot*)* INITIAL_XDOT_CAPACITY);
+ rv->obj=NULL;
+ rv->xdots=NULL;
+
+ return rv;
+}
+void print_xdot_set(xdot_set* s)
+{
+ int ind=0;
+ printf("------------------------------------------\n");
+ printf ("# of xdots in set:%d\n",s->cnt);
+
+ for (ind=0;ind < s->cnt ; ind ++)
+ {
+ printf ("xdot id: %d count: %d",ind,s->xdots[ind]->cnt);
+
+ }
+}
+
+void draw_xdot_set(xdot_set* s)
+{
+ int ind=0;
+ int ind2=0;
+ for (ind=0;ind < s->cnt ; ind ++)
+ {
+ for (ind2=0;ind2 < s->xdots[ind]->cnt ; ind2 ++)
+ {
+ xdot_op* op;
+ op=&s->xdots[ind]->ops[ind2];
+ if(op->drawfunc)
+ op->drawfunc(op,0);
+ }
+ }
+}
+
+
+
+
+
+
+
#if 0
static void
#include <windows.h>
#endif
#include "cgraph.h"
+#define INITIAL_XDOT_CAPACITY 512
typedef enum {
xd_left, xd_center, xd_right
int sz;
xdot_op* ops;
} xdot;
+/*xdot collection*/
+typedef struct _xdot_set
+{
+ int cnt; /*number of xdots*/
+ int capacity;
+ void** obj; /*a pointer to the original object (node edge graph) can be stored here*/
+ xdot** xdots; /*xdot collection*/
+}xdot_set;
/* ops are indexed by xop_kind */
extern xdot* parseXDotF (char*, drawfunc_t ops[], int sz);
extern char* sprintXDot (xdot*);
extern void fprintXDot (FILE*, xdot*);
extern void freeXDot (xdot*);
+extern void free_xdotset(xdot_set* s);
+extern xdot_set* init_xdot_set();
+extern void add_to_xdot_set(xdot_set* s,xdot *x);
+extern void print_xdot_set(xdot_set* s);
+
+
#endif