58 float left = FLT_MAX,
right = -FLT_MAX,
top = -FLT_MAX, bottom = FLT_MAX;
67 bottom = fminf(bottom, pos.
y);
84 for (
size_t i = 0; i < x->
cnt; i++, op++)
108 float rv = (
A.x -
B.x) * (
A.x -
B.x) + (
A.y -
B.y) * (
A.y -
B.y) + (
A.z -
B.z) * (
A.z -
B.z);
142 int return_value = 1;
154 assert(objType ==
AGNODE);
169 c->
A = cl.
u.
RGBA[3]*Alpha;
189 free(previous_color_scheme);
201 double alpha, R, ITERANGLE;
202 double X1, Y1, X2, Y2;
206 if ((deg / 2) * 2 != deg)
207 ITERANGLE = (deg) * 15.00 * -1;
209 ITERANGLE = (deg) * 15.00;
210 ITERANGLE =
DEG2RAD * ITERANGLE;
212 alpha = atan((posH->
y - posT->
y) / (posH->
x - posT->
x));
213 if (posT->
x > posH->
x)
214 ITERANGLE = 180 *
DEG2RAD - ITERANGLE;
215 X1 = R * cos(
alpha - ITERANGLE) + posT->
x;
216 Y1 = R * sin(
alpha - ITERANGLE) + posT->
y;
219 glVertex3f(posT->
x, posT->
y, posT->
z);
220 glVertex3f(X1, Y1, posT->
z);
221 glVertex3f(X1, Y1, posT->
z);
222 glVertex3f(X2, Y2, posH->
z);
223 glVertex3f(X2, Y2, posH->
z);
224 glVertex3f(posH->
x, posH->
y, posH->
z);
226 glVertex3f(posT->
x, posT->
y, posT->
z);
227 glVertex3f(posH->
x, posH->
y, posH->
z);
243 if ((*
s ==
'\0') || !strcmp (
s,
"name"))
259 int defaultNodeShape;
264 defaultNodeShape=
getAttrBool(g,g,
"defaultnodeshape",0);
265 if(defaultNodeShape==0)
286 if (defaultNodeShape == 0)
287 glVertex3f(pos.
x, pos.
y, pos.
z + 0.001f);
288 else if (defaultNodeShape == 1)
291 if(defaultNodeShape==0)
300 glColor4f(c.
R, c.
G,c.
B, c.
A);
315 int defaultNodeShape;
321 defaultNodeShape=
getAttrInt(g,g,
"defaultnodeshape",0);
339 if(defaultNodeShape==0)
355 if(
l_int(v, selected_attr,0))
359 glColor4f(c.
R,c.
G,c.
B,c.
A);
361 nodeSize =
l_float(v, size_attr, 0);
369 if(defaultNodeShape==0)
372 if (defaultNodeShape == 0)
373 glVertex3f(pos.
x,pos.
y,pos.
z);
374 else if (defaultNodeShape == 1)
378 if(defaultNodeShape==0)
460 pt->
x = strtod (p, &endp);
469 pt->
y = strtod (p, &endp);
475 if ((*p ==
' ') || (*p ==
'\0'))
return p;
476 else if (*p ==
',') p++;
479 pt->
z = strtod (p, &endp);
561 int v, have_s, have_e;
563 static const size_t sz =
sizeof(
sdot_op);
565 if (*pos ==
'\0')
return NULL;
568 if (pos == 0)
return NULL;
584 pts[
cnt-1] = pts[
cnt-2] = e;
646 glColor4f(c.
R,c.
G,c.
B,c.
A);
659 glColor4f(c.
R,c.
G,c.
B,c.
A);
702 glColor4f(c.
R,c.
G,c.
B,c.
A);
722 if(!data_attr || !l_color_attr)
735 glColor4f(c.
R,c.
G,c.
B,c.
A);
736 float x = posH.
x + (posT.
x - posH.
x) / 2;
737 float y = posH.
y + (posT.
y - posH.
y) / 2;
738 float z = posH.
z + (posT.
z - posH.
z) / 2;
817 float totalELength=0;
837 totalELength += eLength;
884 glEnable(GL_POINT_SMOOTH);
885 glEnable(GL_DEPTH_TEST);
Memory allocation wrappers that exit on failure.
static void * gv_calloc(size_t nmemb, size_t size)
static void * gv_alloc(size_t size)
abstract graph C library, Cgraph API
COLORPROCS_API char * setColorScheme(const char *s)
void colorxlate(char *str, agxbuf *buf)
bool mapbool(const char *p)
void drawCircle(float x, float y, float radius, float zdepth)
attr_list * load_attr_list(Agraph_t *g)
void glprintfglut(void *font, float xpos, float ypos, float zpos, char *bf)
static int cnt(Dict_t *d, Dtlink_t **set)
char * agget(void *obj, char *name)
char * agxget(void *obj, Agsym_t *sym)
Agedge_t * agfstout(Agraph_t *g, Agnode_t *n)
Agedge_t * agnxtout(Agraph_t *g, Agedge_t *e)
Agnode_t * agnxtnode(Agraph_t *g, Agnode_t *n)
Agnode_t * agfstnode(Agraph_t *g)
Agraph_t * agraphof(void *obj)
char * agnameof(void *)
returns a string descriptor for the object.
#define AGTYPE(obj)
returns AGRAPH, AGNODE, or AGEDGE depending on the type of the object
void aginit(Agraph_t *g, int kind, const char *rec_name, int rec_size, int move_to_front)
attach new records to objects of specified kind
replacements for ctype.h functions
static bool gv_isspace(int c)
textitem scanner parser str
static Agedge_t * top(edge_stack_t *sp)
float getAttrFloat(Agraph_t *g, void *obj, char *attr_name, float def)
int getAttrInt(Agraph_t *g, void *obj, char *attr_name, int def)
int getAttrBool(Agraph_t *g, void *obj, char *attr_name, int def)
glCompPoint getPointFromStr(const char *str)
char * getAttrStr(Agraph_t *g, void *obj, char *attr_name, char *def)
int l_int(void *obj, Agsym_t *attr, int def)
float l_float(void *obj, Agsym_t *attr, float def)
void getcolorfromschema(const colorschemaset sc, float l, float maxl, glCompColor *c)
#define GG_labelattribute(g)
#define GG_nodelabelcolor(g)
#define GN_labelattribute(g)
#define GG_edgelabelcolor(g)
#define GE_labelattribute(g)
glCompColor selectedNodeColor
struct topview::@55 fisheyeParams
static char * skipNWS(char *p)
static int storePoints(char *pos, xdot_point *ps)
void cacheSelectedEdges(Agraph_t *g, topview *t)
static void edge_seg(Agraph_t *g, Agedge_t *e, glCompColor c)
static char * readPoint(char *p, xdot_point *pt)
static float getEdgeLength(Agedge_t *edge)
static void renderSelectedNodes(Agraph_t *g)
static void draw_edge(glCompPoint *posT, glCompPoint *posH, float length, int deg)
static glCompPoint getEdgeHead(Agedge_t *edge)
static xdot * parseXdotwithattrs(void *e)
static void edge_xdot(Agraph_t *g, Agedge_t *e, glCompColor c)
void updateSmGraph(Agraph_t *g, topview *t)
static char * countPoints(char *pos, int *have_sp, xdot_point *sp, int *have_ep, xdot_point *ep, size_t *cntp)
static void cacheNodeLabels(Agraph_t *g, topview *t)
static void cacheEdgeLabels(Agraph_t *g, topview *t)
static void draw_xdot(xdot *x, double base_z)
void(* edgefn)(Agraph_t *, Agedge_t *, glCompColor)
static xdot * makeXDotSpline(char *pos)
static void edge_spline(Agraph_t *g, Agedge_t *e, glCompColor c)
static void renderNodes(Agraph_t *g)
static char * labelOf(Agraph_t *g, Agnode_t *v)
static void renderEdges(Agraph_t *g)
static void renderEdgeLabels(Agraph_t *g)
void renderSmGraph(topview *t)
static void cacheEdges(Agraph_t *g, topview *t)
static void glCompColorxlate(glCompColor *c, const char *str)
static void set_boundaries(Agraph_t *g)
static void renderSelectedEdges(Agraph_t *g)
static int visible(Agsym_t *attr, void *obj)
static void cacheNodes(Agraph_t *g, topview *t)
static char * skipWS(char *p)
static void renderEdgesFn(Agraph_t *g, edgefn ef, int skipSelected)
void initSmGraph(Agraph_t *g, topview *rv)
static void renderNodeLabels(Agraph_t *g)
static glCompPoint getEdgeTail(Agedge_t *edge)
void cacheSelectedNodes(Agraph_t *g, topview *t)
static int object_color(void *obj, glCompColor *c)
graphs, nodes and edges info: Agraphinfo_t, Agnodeinfo_t and Agedgeinfo_t
xdot * parseXDotFOn(char *s, drawfunc_t fns[], size_t sz, xdot *x)
parsing and deparsing of xdot operations