#include "colorprocs.h"
#include "glutils.h"
#include "math.h"
-#include "selection.h"
+
#include "xdot.h"
#include "viewport.h"
#include "topfisheyeview.h"
font_op=o;
}
+/*for now we only support png files in 2d space, no image rotation*/
void InsertImage(sdot_op * o, int param)
{
+
+
+ float w,h,x,y;
+ if(!o->obj)
+ return;
+ w=atof(agget(o->obj,"width"))*72;
+ h=atof(agget(o->obj,"height"))*72;
+
+ if(!o->iData.data)
+ o->iData.data = load_png(o->op.u.image.name, &o->iData.w, &o->iData.h);
+ x=o->op.u.image.pos.x;
+ y=o->op.u.image.pos.y;
+ x=x+(o->iData.w-w)/2.0;
+ y=y+(o->iData.h-h)/2.0;
+ // glRasterPos3f(x,y,5);
+ glRasterPos3f(20,20,0);
+ if(o->iData.data)
+ glDrawPixels(o->iData.w,o->iData.h,GL_RGBA,GL_UNSIGNED_BYTE,o->iData.data);
}
void EmbedText(sdot_op* o, int param)
{
glTranslatef(-x, -y, -z);
}
+void draw_selpoly(glCompPoly* selPoly)
+{
+ int i=0;
+/* glColor4f(view->gridColor.R, view->gridColor.G, view->gridColor.B,
+ view->gridColor.A);*/
+ glDisable(GL_DEPTH_TEST);
+ glColor4f(1,0,0,1);
+ glBegin(GL_LINE_STRIP);
+ for (i;i < selPoly->cnt ; i++)
+ {
+ glVertex3f(selPoly->pts[i].x,selPoly->pts[i].y,selPoly->pts[i].z);
+ }
+ glEnd();
+ glEnable(GL_DEPTH_TEST);
+
+}
+
#ifdef UNUSED
void draw_xdot_set(xdot_set * s)
{
#include "colorprocs.h"
#include "glutils.h"
#include "math.h"
-#include "selection.h"
+
#include "xdot.h"
#include "viewport.h"
#include "topfisheyeview.h"
-void drawGraph(Agraph_t * g)
-{
- Agnode_t *v;
- Agedge_t *e;
- Agraph_t *s;
- int param = 0;
- for (s = agfstsubg(g); s; s = agnxtsubg(s)) {
-/* OD_SelFlag(s) = 0;
- if (OD_Selected(s) == 1)
- param = 1;
- else*/
- param = 0;
- drawXdotwithattrs(s, param);
- }
-
- for (v = agfstnode(g); v; v = agnxtnode(g, v)) {
-/* if (OD_Selected(v) == 1)
- param = 1;
- else*/
- param = 0;
-// OD_SelFlag(v) = 0;
- drawXdotwithattr(v, "_draw_", param); //draw primitives
- drawXdotwithattr(v, "_ldraw_", param); //label drawing
- for (e = agfstout(g, v); e; e = agnxtout(g, e)) {
-/* OD_SelFlag(e) = 0;
- if (OD_Selected(e) == 1)
- param = 1;
- else*/
- param = 0;
- drawXdotwithattrs(e, param);
- }
- }
- if ((view->Selection.Active > 0) && (!view->SignalBlock)) {
- view->Selection.Active = 0;
- drawGraph(g);
- view->SignalBlock = 1;
- glexpose();
- view->SignalBlock = 0;
- }
-
-}
-
/*
this function is used to cache fonts in view->fontset
// drawRotatingTools();
// draw_cube();
drawRotatingAxis();
+ draw_selpoly(&view->Topview->selPoly);
// draw_stuff();
// test_color_pallete();
// drawtestpoly();
#include "glutils.h"
#include "glexpose.h"
#include "glmotion.h"
-#include "selection.h"
+
#include "glcompset.h"
#include "viewportcamera.h"
#include "gui/menucallbacks.h"
#include "glmotion.h"
#include "beacon.h"
#include "hotkeymap.h"
-#include "selection.h"
+
#include "selectionfuncs.h"
#include "topviewfuncs.h"
glmotion_pan(v);
}
if (a==MM_MOVE)
- move_TVnodes();
+ {
+// move_TVnodes();
+ ;
+ }
if(a==MM_RECTANGULAR_SELECT)
{
pick_objects_rect(view->g[view->activeGraph]) ;
}
+ if(a==MM_POLYGON_SELECT)
+ {
+ add_selpoly(view->g[view->activeGraph],&view->Topview->selPoly,view->mouse.GLfinalPos);
+ }
+
+
if (a==MM_SINGLE_SELECT)
{
pick_object_xyz(view->g[view->activeGraph],view->Topview,view->mouse.GLfinalPos.x,view->mouse.GLfinalPos.y,view->mouse.GLfinalPos.z);
prevX=0;
prevY=0;
- view->Selection.X = view->mouse.GLpos.x;
- view->Selection.Y = view->mouse.GLpos.y;
+/* view->Selection.X = view->mouse.GLpos.x;
+ view->Selection.Y = view->mouse.GLpos.y;*/
}
static void appmouse_up(ViewInfo* v,int x,int y)
{
#include "topfisheyeview.h"
#include "toolboxcallbacks.h"
#include "viewportcamera.h"
-#include "selection.h"
+
#include "frmobjectui.h"
}
-void graph_properties_init(int newgraph) //initialize little open graph dialog
-{
- //newgraph 0 : open graph mode
- //newgraph 1 : new graph mode
-
-
- gint result = 0;
- xml = glade_xml_new(smyrnaGlade, NULL, NULL);
- gladewidget = glade_xml_get_widget(xml, "entryGraphFileName");
-
- //signals
- //OK
- gladewidget = glade_xml_get_widget(xml, "btnOK");
-
-
- g_signal_connect((gpointer) gladewidget, "clicked",
- G_CALLBACK(dlgOpenGraph_OK_Clicked), &newgraph);
-
-
-
- if (newgraph) {
- gladewidget = glade_xml_get_widget(xml, "entryGraphName");
- gtk_entry_set_text((GtkEntry *) gladewidget, "Untitled");
- gladewidget = glade_xml_get_widget(xml, "entryGraphFileName");
- gtk_entry_set_text((GtkEntry *) gladewidget, "Untitled.dot");
- } else {
- gladewidget = glade_xml_get_widget(xml, "entryGraphName");
- gtk_entry_set_text((GtkEntry *) gladewidget, "");
- gladewidget = glade_xml_get_widget(xml, "entryGraphFileName");
- gtk_entry_set_text((GtkEntry *) gladewidget, "");
- }
- gladewidget = glade_xml_get_widget(xml, "dlgOpenGraph");
- result = gtk_dialog_run(GTK_DIALOG(gladewidget));
-}
GtkComboBox *get_SelectGraph(void)
{
#include "viewport.h"
#include "topview.h"
#include "tvnodes.h"
-#include "selection.h"
+
#include "gvprpipe.h"
#include "topviewsettings.h"
#include "gltemplate.h"
-//select
-void mSelectAllSlot(GtkWidget * widget, gpointer user_data)
-{
- select_all(view->g[view->activeGraph]);
-}
-
-
-void mUnselectAllSlot(GtkWidget * widget, gpointer user_data)
-{
- deselect_all(view->g[view->activeGraph]);
-}
-
-void mSelectAllNodesSlot(GtkWidget * widget, gpointer user_data)
-{
- select_all_nodes(view->g[view->activeGraph]);
-}
-
-void mSelectAllEdgesSlot(GtkWidget * widget, gpointer user_data)
-{
- select_all_edges(view->g[view->activeGraph]);
-}
-
-void mSelectAllClustersSlot(GtkWidget * widget, gpointer user_data)
-{
- //select_all_graphs(view->g[view->activeGraph]);
-}
-
-
-void mUnselectAllNodesSlot(GtkWidget * widget, gpointer user_data)
-{
- deselect_all_nodes(view->g[view->activeGraph]);
-}
-
-void mUnselectAllEdgesSlot(GtkWidget * widget, gpointer user_data)
-{
- deselect_all_edges(view->g[view->activeGraph]);
-}
-
-
-void mUnselectAllClustersSlot(GtkWidget * widget, gpointer user_data)
-{
-// deselect_all_graphs(view->g[view->activeGraph]);
-}
-
-
-//help
void mAbout(GtkWidget * widget, gpointer user_data)
{
}
#include "toolboxcallbacks.h"
#include "viewport.h"
-#include "selection.h"
+
#include "gltemplate.h"
#include "glutils.h"
#include "glmotion.h"
-void btnToolSingleSelect_clicked(GtkWidget * widget, gpointer user_data)
-{
- deselect_all(view->g[view->activeGraph]);
- //gtk_toggle_tool_button_set_active ((GtkToggleToolButton*)widget,1);
-}
-
-void btnToolRectSelect_clicked(GtkWidget * widget, gpointer user_data)
-{
-
- deselect_all(view->g[view->activeGraph]);
-}
-
-void btnToolRectXSelect_clicked(GtkWidget * widget, gpointer user_data)
-{
- deselect_all(view->g[view->activeGraph]);
- view->Selection.Anti = 0;
-}
-
-void btnToolAntiRectSelect_clicked(GtkWidget * widget, gpointer user_data)
-{
- view->Selection.Anti = 1;
-
-}
-
-void btnToolAntiRectXSelect_clicked(GtkWidget * widget, gpointer user_data)
-{
- view->Selection.Anti = 1;
-
-}
-
-
-void btnToolPan_clicked(GtkWidget * widget, gpointer user_data)
-{
-
-
-}
-
-void btnToolZoom_clicked(GtkWidget * widget, gpointer user_data)
-{
-}
-
-void btnToolZoomIn_clicked(GtkWidget * widget, gpointer user_data)
-{
- glmotion_zoom_inc(1);
-}
void btnToolZoomOut_clicked(GtkWidget * widget, gpointer user_data)
{
return MM_RECTANGULAR_SELECT;
if (strcmp(s,"MM_RECTANGULAR_X_SELECT")==0)
return MM_RECTANGULAR_X_SELECT;
+
+ if (strcmp(s,"MM_POLYGON_SELECT")==0)
+ return MM_POLYGON_SELECT;
+
if (strcmp(s,"MM_MOVE")==0)
return MM_MOVE;
if (strcmp(s,"MM_MOVE")==0)
-/* $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 *
-**********************************************************/
#include "polytess.h"
#include "xdot.h"
-
+tessPoly TP;
#if 0
GLdouble star[5][3] = { 0.6f, -0.1f, 0.0f,
1.35f, 1.4f, 0.0f,
#endif
-void combineCallback(GLdouble coords[3], GLdouble *vertex_data[4],GLfloat weight[4], GLdouble **dataOut)
+#ifndef WIN32
+#define CALLBACK
+#endif
+void CALLBACK combineCallback(GLdouble coords[3], GLdouble *vertex_data[4],GLfloat weight[4], GLdouble **dataOut)
{
GLdouble *vertex;
int i;
*dataOut = vertex;
}
-void vertexCallback(GLvoid *vertex)
+void CALLBACK vertexCallback(GLvoid *vertex)
{
GLdouble *ptr;
ptr = (GLdouble *) vertex;
// Create a new tessellation object
GLUtesselator* tobj = gluNewTess();
// Set callback functions
- gluTessCallback(tobj, GLU_TESS_VERTEX, (void*)&vertexCallback);
+ gluTessCallback(tobj, GLU_TESS_VERTEX, &vertexCallback);
gluTessCallback(tobj, GLU_TESS_BEGIN, &glBegin);
gluTessCallback(tobj, GLU_TESS_END, &glEnd);
- gluTessCallback(tobj, GLU_TESS_COMBINE,(void*)&combineCallback);
+ gluTessCallback(tobj, GLU_TESS_COMBINE,&combineCallback);
return tobj;
}
{
GLdouble** d;
int x=0;
- /* int y=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; */
+ 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;
+ d[x][2]=p->op.u.polygon.pts[x].z+view->Topview->global_z;
}
for (x = 0; x < p->op.u.polygon.cnt; x++) //loop through the vertices
{
return(1);
}
-#if 0
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; */
+ int y=0;
if (!d)
{
d=(GLdouble**) malloc(sizeof(GLdouble)* cnt);
for (x=0;x < cnt; x++)
{
- /* GLdouble temp; */
+ GLdouble temp;
d[x]=(GLdouble*)(malloc(sizeof(GLdouble)*3));
d[x][0]=obj_data[x][0];
d[x][1]=obj_data[x][1];
return(1);
}
-#endif
+
+
+
+
+
static int Begin_Polygon(GLUtesselator *tobj)
{
}
int drawTessPolygon(sdot_op* p)
{
- static tessPoly TP;
if (!TP.tobj)
{
TP.tobj=Init();
/ (pow((bx - ax), 2) + pow((by - ay), 2))
);
}
+
+int point_in_polygon(int npol, float *xp, float *yp, float x, float y)
+{
+ int i, j, c = 0;
+ for (i = 0, j = npol-1; i < npol; j = i++) {
+ if ((((yp[i] <= y) && (y < yp[j])) ||
+ ((yp[j] <= y) && (y < yp[i]))) &&
+ (x < (xp[j] - xp[i]) * (y - yp[i]) / (yp[j] - yp[i]) + xp[i]))
+ c = !c;
+ }
+ return c;
+ }
+
{
agxset(obj,sel_attr,"0");
((nodeRec*)(aggetrec(obj,"nodeRec",0)))->selected=0;
- ((edgeRec*)(aggetrec(obj,"nodeRec",0)))->printLabel=0;
+ ((nodeRec*)(aggetrec(obj,"nodeRec",0)))->printLabel=0;
}
cacheSelectedEdges(g,t);
((edgeRec*)(aggetrec(a,"edgeRec",0)))->printLabel=1;
}
-
-
}
void pick_objects_rect(Agraph_t* g)
{
}
+
+void deselect_all(Agraph_t* g)
+{
+ static Agnode_t *v;
+ static Agedge_t *e;
+ static Agsym_t* nsel_attr=(Agsym_t*)0;
+ static Agsym_t* esel_attr=(Agsym_t*)0;
+ if(!nsel_attr)
+ nsel_attr=agattr(g, AGNODE,"selected","0");
+ if(!esel_attr)
+ esel_attr=agattr(g, AGEDGE,"selected","0");
+ for (v = agfstnode(g); v; v = agnxtnode(g, v))
+ {
+ agxset(v,nsel_attr,"0");
+ ((nodeRec*)(aggetrec(v,"nodeRec",0)))->selected=0;
+ ((edgeRec*)(aggetrec(v,"nodeRec",0)))->printLabel=0;
+
+ for (e = agfstout(g, v); e; e = agnxtout(g, e))
+ {
+ agxset(e,esel_attr,"0");
+ ((edgeRec*)(aggetrec(e,"edgeRec",0)))->selected=0;
+ ((edgeRec*)(aggetrec(e,"edgeRec",0)))->printLabel=0;
+ }
+ }
+ cacheSelectedNodes(g,view->Topview);
+ cacheSelectedEdges(g,view->Topview);
+
+}
+void clear_selpoly(glCompPoly* sp)
+{
+ sp->pts=realloc(sp->pts,0);
+ sp->cnt=0;
+}
+static int close_poly(glCompPoly* selPoly,glCompPoint pt)
+{
+ int i=0;
+ float EPS=GetOGLDistance(3);
+ if (selPoly->cnt < 2)
+ return 0;
+ if(
+ ( (selPoly->pts[0].x-pt.x) < EPS) &&
+ ( (selPoly->pts[0].y-pt.y) < EPS))
+ return 1;
+ return 0;
+}
+
+
+static void select_polygon (Agraph_t* g,glCompPoly* selPoly)
+{
+ static Agnode_t *v;
+ static glCompPoint posN;
+
+ for (v = agfstnode(g); v; v = agnxtnode(g, v))
+ {
+ posN=((nodeRec*)(aggetrec(v,"nodeRec",0)))->A;
+ if(point_in_polygon(selPoly,posN))
+ select_node(g,v,0);
+ }
+ cacheSelectedNodes(g,view->Topview);
+}
+
+
+void add_selpoly(Agraph_t* g,glCompPoly* selPoly,glCompPoint pt)
+{
+ if(!close_poly(selPoly,pt))
+ {
+ selPoly->cnt ++;
+ selPoly->pts=realloc(selPoly->pts,sizeof(glCompPoint)*selPoly->cnt);
+ selPoly->pts[selPoly->cnt-1].x=pt.x;
+ selPoly->pts[selPoly->cnt-1].y=pt.y;
+ selPoly->pts[selPoly->cnt-1].z=0;
+ }
+ else
+ {
+ select_polygon (g,selPoly);
+ clear_selpoly(selPoly);
+ }
+}
+
#ifdef __cplusplus
extern "C" {
#endif
-extern void pick_objects_rect(Agraph_t* g) ;
+extern void pick_objects_rect(Agraph_t* g) ;
+extern void deselect_all(Agraph_t* g);
+extern void add_selpoly(Agraph_t* g,glCompPoly* selPoly,glCompPoint pt);
#ifdef __cplusplus
} /* end extern "C" */
#endif
RelativePath=".\arcball.c"
>
</File>
- <File
- RelativePath=".\gui\beacon.c"
- >
- </File>
<File
RelativePath=".\btree.c"
>
</File>
- <File
- RelativePath=".\gui\callbacks.c"
- >
- </File>
<File
RelativePath=".\gui\datalistcallbacks.c"
>
RelativePath=".\polytess.c"
>
</File>
- <File
- RelativePath=".\selection.c"
- >
- </File>
<File
RelativePath=".\selectionfuncs.c"
>
<DebugSettings
Command="$(TargetPath)"
WorkingDirectory="C:\graphviz-ms\bin"
- CommandArguments=""
+ CommandArguments="c:\4elt.dot"
Attach="false"
DebuggerType="3"
Remote="1"
}
}
#endif
+
+int point_within_ellips_with_coords(float ex, float ey, float ea, float eb,
+ float px, float py)
+{
+
+ float dx, dy;
+ float a;
+ dx = px - ex;
+ dy = py - ey;
+ a = (dx * dx) / (ea * ea) + (dy * dy) / (eb * eb);
+ return (a <= 1);
+}
+int point_within_sphere_with_coords(float x0, float y0, float z0, float r,
+ float x, float y, float z)
+{
+ float rr =
+ (x - x0) * (x - x0) + (y - y0) * (y - y0) + (z - z0) * (z - z0);
+ rr = (float) pow(rr, 0.5);
+ if (rr <= r)
+ return 1;
+ return 0;
+}
+float distance_to_line(float ax, float ay, float bx, float by, float cx,
+ float cy)
+{
+ //this function returns the distance between a line(a-b) segment and a point(c) in 2D plane
+ return (float)
+ sqrt(pow(((by - ay) * (cx - ax) + (bx - ax) * (cy - ay)), 2)
+ / (pow((bx - ax), 2) + pow((by - ay), 2))
+ );
+}
+
+int _point_in_polygon(int npol, float *xp, float *yp, float x, float y)
+{
+ int i, j, c = 0;
+ for (i = 0, j = npol-1; i < npol; j = i++) {
+ if ((((yp[i] <= y) && (y < yp[j])) ||
+ ((yp[j] <= y) && (y < yp[i]))) &&
+ (x < (xp[j] - xp[i]) * (y - yp[i]) / (yp[j] - yp[i]) + xp[i]))
+ c = !c;
+ }
+ return c;
+ }
+
+
+int point_in_polygon(glCompPoly* selPoly,glCompPoint p)
+{
+ int npol=selPoly->cnt;
+
+ int i, j, c = 0;
+ for (i = 0, j = npol-1; i < npol; j = i++)
+ {
+ if ((((selPoly->pts[i].y <= p.y) && (p.y < selPoly->pts[j].y)) ||
+ ((selPoly->pts[j].y <= p.y) && (p.y < selPoly->pts[i].y))) &&
+ (p.x < (selPoly->pts[j].x - selPoly->pts[i].x) * (p.y - selPoly->pts[i].y) / (selPoly->pts[j].y - selPoly->pts[i].y) + selPoly->pts[i].x))
+ c = !c;
+ }
+ return c;
+ }
+
+
extern void setColor(glCompColor* c,GLfloat R,GLfloat G,GLfloat B,GLfloat A);
extern void getcolorfromschema(colorschemaset * sc, float l, float maxl,glCompColor * c);
extern glCompPoint getPointFromStr(char* str);
-
+extern float distance_to_line(float ax, float ay, float bx, float by, float cx,float cy);
+extern int point_in_polygon(glCompPoly* selPoly,glCompPoint p);
#endif
#define MM_MAGNIFIER 20
#define MM_FISHEYE_MAGNIFIER 21
#define MM_FISHEYE_PICK 22 /*fisheye select foci point*/
+#define MM_POLYGON_SELECT 30
MOUSE_ROTATE_Z } mouse_rotate_axis;
+ typedef struct
+ {
+ unsigned char *data;
+ int w;
+ int h;
+ }image_data;
typedef struct
{
xdot_op op;
int size;
int layer;
int listId;/*opengl list id*/
-
+ image_data iData;
} sdot_op;
topviewcache cache;
int xdotId;
+ glCompPoly selPoly;
+
} topview;
} attribute;
- typedef struct _selection {
+/* typedef struct _selection {
int Active; //0 there is no selection need to be applied
char Type; //0 single selection , 1 rectangle , 2 rectangleX
int PickingType; //0 normal, union,2 subtract 3 intersection
//before the node/edge loop this value is nulled
topview_edge *single_selected_edge; //pointer to selected/picked edge
- } selection;
+ } selection;*/
typedef struct _magnifier {
float x, y;
float kts; //zoom X
glCompMouse mouse;
/*selection object,refer to smyrnadefs.h for more info */
- selection Selection;
+// selection Selection;
/*rectangular magnifier object */
magnifier mg;
#include "viewport.h"
#include "viewportcamera.h"
#include "draw.h"
-#include "selection.h"
+
#include "assert.h"
#include "hier.h"
#include "topfisheyeview.h"
objType=AGTYPE(obj);
if(objType==AGEDGE)
- Alpha=getAttrFloat(g,obj,"defaultedgealpha",1);
+ Alpha=getAttrFloat(g,agraphof(obj),"defaultedgealpha",1);
if(objType==AGNODE)
- Alpha=getAttrFloat(g,obj,"defaultnodealpha",1);
+ Alpha=getAttrFloat(g,agraphof(obj),"defaultnodealpha",1);
if(!getAttrBool(g,obj,"visible",1))
return 0;
- if(getAttrBool(g,obj,"selected",0))
- {
- setColor(c,view->selectedEdgeColor.R, view->selectedEdgeColor.G,view->selectedEdgeColor.B, view->selectedEdgeColor.A);
- return return_value;
- }
/*get edge's color attribute */
bf=getAttrStr(g,obj,"color",NULL);
if((bf)&&(strlen(bf)>0))
c->B=cl.u.RGBA[2];
c->A=cl.u.RGBA[3];
}
+ c->A=c->A*Alpha;
}
return return_value;
if(!((nodeRec*)(aggetrec(v,"nodeRec",0)))->selected);
continue;
x=parseXdotwithattrs(v);
- draw_xdot(x,0);
+ draw_xdot(x,-1);
if(x)
freeXDot (x);
}
{
if(!((nodeRec*)(aggetrec(v,"nodeRec",0)))->selected)
continue;
- glColor4f(1,0,0,1);
+ glColor4f(view->selectedEdgeColor.R, view->selectedNodeColor.G,view->selectedNodeColor.B, view->selectedNodeColor.A);
pos=((nodeRec*)(aggetrec(v,"nodeRec",0)))->A;
nodeSize=((nodeRec*)(aggetrec(v,"nodeRec",0)))->size;
static int defaultNodeShape=0;
static GLfloat nodeSize=0;
static glCompColor c;
- static xdot * x;
+ xdot * x;
- if(!defaultNodeShape)
- defaultNodeShape=getAttrBool(g,g,"defaultnodeshape",0);
+ defaultNodeShape=getAttrBool(g,g,"defaultnodeshape",0);
if(!pos_attr)
pos_attr=agattr(g, AGNODE,"pos",0);
if(!size_attr)
if(!selected_attr)
selected_attr=agattr(g, AGNODE,"selected",0);
- if(defaultNodeShape==0)
- glBegin(GL_POINTS);
for (v = agfstnode(g); v; v = agnxtnode(g, v))
{
if(!object_color(v,&c))
continue;
x=parseXdotwithattrs(v);
- draw_xdot(x,0);
+ draw_xdot(x,-0.1);
if(x)
+ if(defaultNodeShape==0)
+ glBegin(GL_POINTS);
+
+
+
+
+
+
+
for (v = agfstnode(g); v; v = agnxtnode(g, v))
{
if(l_int(v, selected_attr,0))
{
((nodeRec*)(aggetrec(v,"nodeRec",0)))->selected=1;
- continue;
}
glColor4f(c.R,c.G,c.B,c.A);
pos=getPointFromStr(agxget(v, pos_attr));
}
else
((edgeRec*)(aggetrec(e,"edgeRec",0)))->visible=1;
-
- if(((edgeRec*)(aggetrec(e,"edgeRec",0)))->selected)
- continue;
-
x=parseXdotwithattrs(e);
draw_xdot(x,0);
static xdot *parseXdotwithattrs(void *e)
{
- xdot* xDot=NULL;
- xDot=parseXDotFOn (agget(e,"_draw_" ), OpFns,sizeof(sdot_op), xDot);
- xDot=parseXDotFOn (agget(e,"_ldraw_" ), OpFns,sizeof(sdot_op), xDot);
- xDot=parseXDotFOn (agget(e,"_hdraw_" ), OpFns,sizeof(sdot_op), xDot);
- xDot=parseXDotFOn (agget(e,"_tdraw_" ), OpFns,sizeof(sdot_op), xDot);
- xDot=parseXDotFOn (agget(e,"_hldraw_" ), OpFns,sizeof(sdot_op), xDot);
- xDot=parseXDotFOn (agget(e,"_tldraw_" ), OpFns,sizeof(sdot_op), xDot);
- return xDot;
+ int cnt=0;
+ xdot* xDot=NULL;
+ xDot=parseXDotFOn (agget(e,"_draw_" ), OpFns,sizeof(sdot_op), xDot);
+ xDot=parseXDotFOn (agget(e,"_ldraw_" ), OpFns,sizeof(sdot_op), xDot);
+ xDot=parseXDotFOn (agget(e,"_hdraw_" ), OpFns,sizeof(sdot_op), xDot);
+ xDot=parseXDotFOn (agget(e,"_tdraw_" ), OpFns,sizeof(sdot_op), xDot);
+ xDot=parseXDotFOn (agget(e,"_hldraw_" ), OpFns,sizeof(sdot_op), xDot);
+ xDot=parseXDotFOn (agget(e,"_tldraw_" ), OpFns,sizeof(sdot_op), xDot);
+ if(xDot)
+ {
+ for (cnt=0;cnt < xDot->cnt ; cnt++)
+ {
+ ((sdot_op*)(xDot->ops))[cnt].obj=e;
+ }
+ }
+ return xDot;
}
t->picked_edge_count = 0;
t->picked_edges = '\0';
t->global_z=0;
-
-
+ t->selPoly.cnt=0;
+ t->selPoly.pts=NULL;
if(!t)
return ;
#include "tvnodes.h"
#include "btree.h"
#include "viewport.h"
-#include "selection.h"
+
#include "memory.h"
tv_nodes TV_Nodes;
int update_TV_data_from_gui(void)
{
- int i;
+/* int i;
int index = 0;
char *data_attr1;
char *data_attr2;
(char *) gtk_entry_get_text(TV_Nodes.TV_Node[i].Data2));
}
- }
+ }*/
return 1;
int tv_select_all(void)
{
- tv_node tvn;
+/* tv_node tvn;
int i;
for (i = 0; i < view->Topview->Nodecount; i++) {
tvn.index = i;
}
}
apply_filter_from_gui();
- return 1;
+ return 1;*/
}
int tv_unselect_all()
{
-
+/*
tv_node tvn;
int i;
for (i = 0; i < view->Topview->Nodecount; i++) {
}
}
apply_filter_from_gui();
- return 1;
+ return 1;*/
}
view->mouse.down = 0;
view->activeGraph = -1;
view->SignalBlock = 0;
- view->Selection.Active = 0;
- view->Selection.SelectionColor.R = 0.5;
- view->Selection.SelectionColor.G = (float) 0.2;
- view->Selection.SelectionColor.B = 1;
- view->Selection.SelectionColor.A = 1;
- view->Selection.Anti = 0;
view->Topview = GNEW(topview);
view->Topview->fisheyeParams.fs = 0;
view->Topview->xDot=NULL;
g_print("There is no position info in %s\n", filename);
return 0;
}
- free(view->Topview->Graphdata.GraphFileName);
+// free(view->Topview->Graphdata.GraphFileName);
view->Topview->Graphdata.GraphFileName = strdup(filename);
return g;
}
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""C:\gtk\lib\glib-2.0\include";"C:\gtk\include\glib-2.0";"C:\gtk\include\pango-1.0\";C:\gtk\include\cairo;C:\gtk\include\freetype2;C:\gtk\include;"$(SolutionDir)/libltdl";"$(SolutionDir)/lib/neatogen";"$(SolutionDir)/lib/agutil";"$(SolutionDir)/windows/lib/cdt";"$(SolutionDir)/";"$(SolutionDir)/lib/graph";"$(SolutionDir)/lib/vpsc";"$(SolutionDir)/lib/vmalloc";"$(SolutionDir)/lib/twopigen";"$(SolutionDir)/lib/sparse";"$(SolutionDir)/lib/sfio";"$(SolutionDir)/lib/sfpdpgen";"$(SolutionDir)/lib/rbtree";"$(SolutionDir)/lib/pathplan";"$(SolutionDir)/lib/patchwork";"$(SolutionDir)/lib/pack";"$(SolutionDir)/lib/ortho";"$(SolutionDir)/lib/inkpot";"$(SolutionDir)/lib/ingraphs";"$(SolutionDir)/lib/gd";"$(SolutionDir)/lib/filter";"$(SolutionDir)/lib/fdpgen";"$(SolutionDir)/lib/expr";"$(SolutionDir)/lib/dotgen";"$(SolutionDir)/lib/circogen";"$(SolutionDir)/lib/ast";"$(SolutionDir)/lib/agraph";"$(SolutionDir)/lib/common";"$(SolutionDir)/lib/gvc";"$(SolutionDir)/lib/cdt";"$(SolutionDir)/lib/cgraph""
- PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;CDT_EXPORTS;WIN32_DLL"
+ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;CDT_EXPORTS;WIN32_DLL;_BLD_cdt ;__EXPORT__"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""C:\gtk\lib\glib-2.0\include";"C:\gtk\include\glib-2.0";"C:\gtk\include\pango-1.0\";C:\gtk\include\cairo;C:\gtk\include\freetype2;C:\gtk\include;"$(SolutionDir)/libltdl";"$(SolutionDir)/lib/neatogen";"$(SolutionDir)/lib/agutil";"$(SolutionDir)/windows/lib/cdt";"$(SolutionDir)/";"$(SolutionDir)/lib/graph";"$(SolutionDir)/lib/vpsc";"$(SolutionDir)/lib/vmalloc";"$(SolutionDir)/lib/twopigen";"$(SolutionDir)/lib/sparse";"$(SolutionDir)/lib/sfio";"$(SolutionDir)/lib/sfpdpgen";"$(SolutionDir)/lib/rbtree";"$(SolutionDir)/lib/pathplan";"$(SolutionDir)/lib/patchwork";"$(SolutionDir)/lib/pack";"$(SolutionDir)/lib/ortho";"$(SolutionDir)/lib/inkpot";"$(SolutionDir)/lib/ingraphs";"$(SolutionDir)/lib/gd";"$(SolutionDir)/lib/filter";"$(SolutionDir)/lib/fdpgen";"$(SolutionDir)/lib/expr";"$(SolutionDir)/lib/dotgen";"$(SolutionDir)/lib/circogen";"$(SolutionDir)/lib/ast";"$(SolutionDir)/lib/agraph";"$(SolutionDir)/lib/common";"$(SolutionDir)/lib/gvc";"$(SolutionDir)/lib/cdt";"$(SolutionDir)/lib/cgraph""
- PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;CDT_EXPORTS;WIN32_DLL"
+ PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;CDT_EXPORTS;WIN32_DLL;_BLD_cdt;__EXPORT__"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="0"
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""C:\gtk\lib\glib-2.0\include";"C:\gtk\include\glib-2.0";"C:\gtk\include\pango-1.0\";C:\gtk\include\cairo;C:\gtk\include\freetype2;C:\gtk\include;"$(SolutionDir)/libltdl";"$(SolutionDir)/lib/neatogen";"$(SolutionDir)/lib/agutil";"$(SolutionDir)/windows/lib/cdt";"$(SolutionDir)/";"$(SolutionDir)/lib/graph";"$(SolutionDir)/lib/vpsc";"$(SolutionDir)/lib/vmalloc";"$(SolutionDir)/lib/twopigen";"$(SolutionDir)/lib/sparse";"$(SolutionDir)/lib/sfio";"$(SolutionDir)/lib/sfpdpgen";"$(SolutionDir)/lib/rbtree";"$(SolutionDir)/lib/pathplan";"$(SolutionDir)/lib/patchwork";"$(SolutionDir)/lib/pack";"$(SolutionDir)/lib/ortho";"$(SolutionDir)/lib/inkpot";"$(SolutionDir)/lib/ingraphs";"$(SolutionDir)/lib/gd";"$(SolutionDir)/lib/filter";"$(SolutionDir)/lib/fdpgen";"$(SolutionDir)/lib/expr";"$(SolutionDir)/lib/dotgen";"$(SolutionDir)/lib/circogen";"$(SolutionDir)/lib/ast";"$(SolutionDir)/lib/agraph";"$(SolutionDir)/lib/common";"$(SolutionDir)/lib/gvc";"$(SolutionDir)/lib/cdt";"$(SolutionDir)/lib/cgraph""
- PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;CGRAPH_EXPORTS;WIN32_DLL;HAVE_CONFIG_H;YY_NO_UNISTD_H"
+ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;CGRAPH_EXPORTS;WIN32_DLL;HAVE_CONFIG_H;YY_NO_UNISTD_H;_DLL_BLD;_dll_import"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
typedef struct _glCompPointI {
int x, y;
} glCompPointI;
-
+ typedef struct {
+ int cnt;
+ glCompPoint* pts;
+ }glCompPoly;
typedef struct {
GLfloat R;
GLfloat B;
GLfloat A; //Alpha
int tag;
+ int test;
} glCompColor;
glCompFont *new_font(glCompSet * s, char *text, glCompColor * c,glCompFontType type, char *fontdesc, int fs,int is2D)
{
- glCompFont *font = NEW(glCompFont);
+ glCompFont *font = (glCompFont*) malloc(sizeof(glCompFont));
font->reference = 0;
font->color.R = c->R;
font->color.G = c->G;
-#ifdef DEBUG
-void main(void)
-{
- glCompPoint LineStart, LineEnd, Point;
- float Distance;
-
-
- LineStart.x = 50.0f;
- LineStart.y = 80.0f;
- LineStart.z = 300.0f;
- LineEnd.x = 50.0f;
- LineEnd.y = -800.0f;
- LineEnd.z = 1000.0f;
- Point.x = 20.0f;
- Point.y = 1000.0f;
- Point.z = 400.0f;
-
- if (DistancePointLine(&Point, &LineStart, &LineEnd, &Distance))
- printf("closest point falls within line segment, distance = %f\n",
- Distance);
- else
- printf("closest point does not fall within line segment\n");
-
-
- LineStart.x = 0.0f;
- LineStart.y = 0.0f;
- LineStart.z = 50.0f;
- LineEnd.x = 0.0f;
- LineEnd.y = 0.0f;
- LineEnd.z = -50.0f;
- Point.x = 10.0f;
- Point.y = 50.0f;
- Point.z = 10.0f;
-
- if (DistancePointLine(&Point, &LineStart, &LineEnd, &Distance))
- printf("closest point falls within line segment, distance = %f\n",
- Distance);
- else
- printf("closest point does not fall within line segment\n");
-}
-#endif
gvFinalize
gv_postprocess
gvRenderContext
-gvflush
\ No newline at end of file
+gvflush
+gvrender_ptf
\ No newline at end of file
#MM_ROTATE
#MM_SINGLE_SELECT
#MM_RECTANGULAR_SELECT
+#MM_POLYGON_SELECT
#MM_MOVE
#MM_FISHEYE_MAGNIFIER
#keys:These are pre defined keys in the code , more keys can be added by using their GTK key event correspondants, 0 means no key
MM_RECTANGULAR_SELECT,0,ALL,RIGHT,1
MM_MOVE,B_LCTRL,2D,LEFT,1
MM_FISHEYE_MAGNIFIER,B_LSHIFT,2D,LEFT,1
-MM_FISHEYE_PICK,0,FISHEYE,RIGHT,0
\ No newline at end of file
+MM_FISHEYE_PICK,0,FISHEYE,RIGHT,0
+MM_POLYGON_SELECT,B_LCTRL,NO_FISHEYE,RIGHT,0