}
y=o->op.u.text.y;
- if (o->font)
- glCompDrawText3D(o->font,x,y,view->Topview->global_z,o->op.u.text.width,font_op->op.u.font.size);
- else
+ if (!o->font)
{
o->font=new_font(
view->widgets,
pangotext,
font_op->op.u.font.name,font_op->op.u.font.size,0);
//new_font(glCompSet * s, char *text, glCompColor * c, glCompFontType type, char *fontdesc, int fs)*/
-
-
}
+ glCompDrawText3D(o->font,x,y,view->Topview->global_z,o->op.u.text.width,font_op->op.u.font.size);
+
}
void draw_selection_box(ViewInfo * view)
view->mg.x = mg_x;
view->mg.y = mg_y;
glLineWidth(4);
- local_zoom(view->Topview);
+// local_zoom(view->Topview);
//drawing the magnifier borders
glBegin(GL_LINE_STRIP);
glColor4f((GLfloat) 0.3, (GLfloat) 0.1, (GLfloat) 0.8,
if (radius < 0.3)
radius = (float) 0.4;
glBegin(GL_POLYGON);
- for (i = 0; i < 360; i = i + 10) {
+ for (i = 0; i < 360; i = i + 36) {
float degInRad = (float) (i * DEG2RAD);
glVertex3f((GLfloat) (x + cos(degInRad) * radius),
(GLfloat) (y + sin(degInRad) * radius),
// if (GD_TopView(view->g[view->activeGraph]))
// {
if (!view->Topview->fisheyeParams.active)
- drawTopViewGraph(view->g[view->activeGraph]); //view->Topview style dots and straight lines
+// drawTopViewGraph(view->g[view->activeGraph]); //view->Topview style dots and straight lines
+ renderSmGraph(view->g[view->activeGraph],view->Topview);
else {
drawtopologicalfisheye(view->Topview);
}
// printf ("key is released:%d\n",event->keyval);
view->keymap.down=0;
view->keymap.keyVal=0;
- originate_distorded_coordinates(view->Topview);
return FALSE;
#include "beacon.h"
#include "hotkeymap.h"
#include "selection.h"
+#include "selectionfuncs.h"
+#include "topviewfuncs.h"
static float prevX=0;
if(a==MM_RECTANGULAR_SELECT)
{
if (!view->mouse.down)
- rectangle_select(v);
+// rectangle_select(v);
+ pick_objects_rect(view->g[view->activeGraph]) ;
}
- if (a==MM_SINGLE_SELECT)
- pick_node_from_coords(view->mouse.GLfinalPos.x,view->mouse.GLfinalPos.y,view->mouse.GLfinalPos.z);
+ 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);
+ }
if (a==MM_FISHEYE_PICK)
{
if (v->mouse.t==glMouseRightButton)
appmouse_right_click(v,x,y);
}
- if ((a== MM_FISHEYE_MAGNIFIER) || (a == MM_MAGNIFIER)) //fisheye mag mouse release, stop distortion
- originate_distorded_coordinates(v->Topview);
apply_actions(v,x,y);
view->mouse.dragX = 0;
view->mouse.dragY = 0;
}
for (ind = 0; ((seledges)&&(ind < view->Topview->Edgecount)); ind++) {
- point3f p1, p2, p3;
+ glCompPoint p1, p2, p3;
e = &view->Topview->Edges[ind];
if (!e->data.Visible)
continue;
gtk_widget_show(glade_xml_get_widget(xml, "dlgSettings"));
gtk_notebook_set_current_page (
(GtkNotebook*)glade_xml_get_widget(xml, "notebook3"),ATTR_NOTEBOOK_IDX);
- set_header_text();
+// set_header_text();
filter_attributes("",view->Topview);
//Graph
void mNodeListSlot(GtkWidget * widget, gpointer user_data)
{
- execute_tv_nodes();
+ gtk_widget_show(glade_xml_get_widget(xml, "ListForm"));
+
+// execute_tv_nodes();
}
void mNewNodeSlot(GtkWidget * widget, gpointer user_data)
void mNodeFindSlot(GtkWidget * widget, gpointer user_data)
{
- if (view->activeGraph != -1) {
-
- gtk_dialog_set_response_sensitive((GtkDialog *)
- glade_xml_get_widget(xml,
- "findDialog"),
- 1, 1);
- gtk_dialog_set_response_sensitive((GtkDialog *)
- glade_xml_get_widget(xml,
- "findDialog"),
- 2, 1);
-
-
- respond = gtk_dialog_run((GtkDialog *)
- glade_xml_get_widget(xml, "findDialog"));
-
- gtk_widget_hide(glade_xml_get_widget(xml, "findDialog"));
- if (respond == 1)
- select_with_regex((gchar *)
- gtk_entry_get_text((GtkEntry *)
- glade_xml_get_widget(xml,
- "findText"))
- );
- }
}
{
update_graph_from_settings(view->g[view->activeGraph]);
set_viewport_settings_from_template(view, view->g[view->activeGraph]);
- update_topview(view->g[view->activeGraph], view->Topview, 0);
+// update_topview(view->g[view->activeGraph], view->Topview, 0);
/* settvcolorinfo(view->g[view->activeGraph],view->Topview);
init_node_size(view->g[view->activeGraph])*/
+ updateSmGraph(view->g[view->activeGraph],view->Topview);
}
void on_dlgSettings_close (GtkWidget * widget, gpointer user_data)
{
float value;
attribute=attribute +9;
-
value = (float)
gtk_combo_box_get_active((GtkComboBox *)
glade_xml_get_widget(xml, widget_name));
sprintf(buf, "%f", value);
agattr(g, AGRAPH, attribute, buf);
+ printf ("%s %f \n",attribute,value);
return 1;
{
set_refresh(view,argv[1]);
update_graph_from_settings(srcGraph);
- update_topview(srcGraph, view->Topview, 0);
+// update_topview(srcGraph, view->Topview, 0);
}
return rv;
}
// Create a new tessellation object
GLUtesselator* tobj = gluNewTess();
// Set callback functions
- gluTessCallback(tobj, GLU_TESS_VERTEX, &vertexCallback);
+ gluTessCallback(tobj, GLU_TESS_VERTEX, (void*)&vertexCallback);
gluTessCallback(tobj, GLU_TESS_BEGIN, &glBegin);
gluTessCallback(tobj, GLU_TESS_END, &glEnd);
- gluTessCallback(tobj, GLU_TESS_COMBINE,&combineCallback);
+ gluTessCallback(tobj, GLU_TESS_COMBINE,(void*)&combineCallback);
return tobj;
}
return 0;
return -1;
}
-int is_point_in_rectangle(float X, float Y, float RX, float RY, float RW,
- float RH)
-{
- if ((X >= RX) && (X <= (RX + RW)) && (Y >= RY) && (Y <= (RY + RH)))
- return 1;
- else
- return 0;
-
-
-}
-#ifdef UNUSED
-static int line_intersects(float *x, float *y, float *X, float *Y)
-{
- //x,y are arrayf of float for two lines parameters theyt hold 4 points with x and y
- //limitx and limity are float arrays with two points, thse points are the end points of the second line
- //X,Y are the variables to put intersection point coordinates in
- pointf pA, pB, pC, pD, pX;
- pA.x = x[0];
- pA.y = y[0];
- pB.x = x[1];
- pB.y = y[1];
- pC.x = x[2];
- pC.y = y[2];
- pD.x = x[3];
- pD.y = y[3];
-
- if (seg_intersect(pA, pB, pC, pD, &pX)) {
- *X = (float) pX.x;
- *Y = (float) pX.y;
- if ((pX.x >= x[2] - 0.01) && (pX.x < x[3] + 0.01) &&
- (pX.y >= y[2] - 0.01) && (pX.x < y[3] + 0.01)) {
- return 1;
-
- }
- return 0;
-
- } else
- return 0;
-
-}
-
-#endif
int point_within_ellips_with_coords(float ex, float ey, float ea, float eb,
float px, float py)
{
extern int point_within_ellips_with_coords(float ex, float ey,
float ea, float eb,
float px, float py);
- extern int is_point_in_rectangle(float X, float Y, float RX, float RY,
- float RW, float RH);
extern int SelectBeziers(sdot_op * op);
extern int SelectEllipse(sdot_op * op);
RelativePath=".\selection.h"
>
</File>
+ <File
+ RelativePath=".\selectionfuncs.h"
+ >
+ </File>
<File
RelativePath=".\smyrnadefs.h"
>
RelativePath=".\selection.c"
>
</File>
+ <File
+ RelativePath=".\selectionfuncs.c"
+ >
+ </File>
<File
RelativePath=".\smyrna_utils.c"
>
RelativePath=".\topfisheyeview.c"
>
</File>
- <File
- RelativePath=".\topview.c"
- >
- </File>
<File
RelativePath=".\topviewdata.c"
>
<DebugSettings
Command="$(TargetPath)"
WorkingDirectory="C:\graphviz-ms\bin"
- CommandArguments="C:\u.dot.xdot"
+ CommandArguments="c:/4elt.dot"
Attach="false"
DebuggerType="3"
Remote="1"
c->B=B;
c->A=A;
}
+glCompPoint getPointFromStr(char* str)
+{
+
+ glCompPoint p;
+ char* a;
+ static char bf[512];
+ strcpy(bf,str);
+ p.x=0;
+ p.y=0;
+ p.z=0;
+ a=strtok(bf,",");
+ if(a)
+ p.x=atof(a);
+ a=strtok(NULL,",");
+ if(a)
+ p.y=atof(a);
+ a=strtok(NULL,",");
+ if(a)
+ p.z=atof(a);
+ return p;
+}
+
#if 0
static float interpol(float minv, float maxv, float minc, float maxc, float x)
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);
+extern glCompPoint getPointFromStr(char* str);
#endif
typedef struct {
- GtkButton **gtkhostbtn;
- int gtkhostbtncount;
- GtkColorButton **gtkhostcolor;
- int hostactive[MAX_BTN_CNT]; //temporary static, convert to dynamic,realloc
- char **hostregex;
+
+ int a;
} topviewdata;
+ typedef struct
+ {
+ int node_id;
+ int edge_id;
+ int selnode_id;
+ int seledge_id;
+ int nodelabel_id;
+ int edgelabel_id;
+ }topviewcache;
typedef struct xdot_set xdot_set;
typedef enum { GEpixels, GEinches, GEmm } GEunit;
float offsetz;
} graph_data;
+
+
+ typedef struct{
+ Agrec_t h;
+ glCompPoint A;
+ float size;
+ int selected;
+ int visible;
+ int printLabel;
+ }nodeRec;
+ typedef struct{
+ Agrec_t h;
+ glCompPoint posTail;
+ glCompPoint posHead;
+ int selected;
+ int visible;
+ int printLabel;
+ }edgeRec;
+
+
typedef struct {
topview_node *Nodes;
topview_edge *Edges;
float global_z;
attr_list* attributes;/*attribute list*/
attr_list* filtered_attr_list;
+
+ topviewcache cache;
int xdotId;
+
} topview;
/*lately added */
int drawnodes;
int drawedges;
- int drawlabels;
int drawnodelabels;
int drawedgelabels;
static char buf[255];
int MP_Flag = 0;
-#ifdef UNUSED
-static
-void clear_tv_filter(tv_filter * TV_Filter)
-{
- TV_Filter->highlighted = -1;
- TV_Filter->visible = -1;
- TV_Filter->min_data1 = NULL;
- TV_Filter->max_data1 = NULL;
- TV_Filter->min_data2 = NULL;
- TV_Filter->max_data2 = NULL;
-
- TV_Nodes.filtered = 0;
-
-}
-
-static
-tv_filter *create_tv_filter(void)
-{
- tv_filter *f;
- f = NEW(tv_filter);
- clear_tv_filter(f);
- return f;
-}
-#endif
-
static
void init_tv_nodes(tv_nodes * TV_Nodes)
{
return 1;
}
-#ifdef UNUSED
-static
-int reverse_selection(void)
-{
- int i = 0;
- for (i; i < view->Topview->Nodecount; i++) {
- if (OD_Selected(view->Topview->Nodes[i].Node))
- deselect_node(view->g[view->activeGraph],
- view->Topview->Nodes[i].Node);
- else
- select_node(view->g[view->activeGraph],
- view->Topview->Nodes[i].Node);
- }
- for (i = 0; i < view->Topview->Edgecount; i++) {
- if (OD_Selected(view->Topview->Edges[i].Edge))
- deselect_edge(view->g[view->activeGraph],
- view->Topview->Edges[i].Edge);
- else
- select_edge(view->g[view->activeGraph],
- view->Topview->Edges[i].Edge);
- }
-}
-#endif
static
int validate_node(tv_node * TV_Node)
#include "md5.h"
#include "arcball.h"
#include "hotkeymap.h"
+#include "topviewfuncs.h"
{
/*free topview if there is one */
if (view->activeGraph >= 0)
- cleartopview(view->Topview);
+ {
+ freeSmGraph(view->g[view->activeGraph],view->Topview);
+ }
if (view->graphCount)
agclose(view->g[view->activeGraph]);
// init_viewport(view);
("defaultfisheyemagnifierdistort", view, g));
view->drawnodes = atoi(get_attribute_value("drawnodes", view, g));
view->drawedges = atoi(get_attribute_value("drawedges", view, g));
- view->drawlabels = atoi(get_attribute_value("drawlabels", view, g));
+ view->drawnodelabels=atoi(get_attribute_value("labelshownodes", view, g));
+ view->drawedgelabels=atoi(get_attribute_value("labelshowedges", view, g));
+
view->FontSizeConst = 0; //this will be calculated later in topview.c while calculating optimum font size
view->glutfont =
load_settings_from_graph(graph);
update_graph_from_settings(graph);
set_viewport_settings_from_template(view, graph);
- if (doClear)
- cleartopview(view->Topview);
+ view->Topview=initSmGraph(graph);
- update_topview(graph, view->Topview, 1);
+// update_topview(graph, view->Topview, 1);
fill_key(view->orig_key, get_md5_key(graph));
expose_event(view->drawing_area, NULL, NULL);
}
{
Agraph_t *g = 0;
SparseMatrix A = NULL;
- int dim;
+ int dim=0;
parms_t pv;
/* ======================= set parameters ==================== */
/>
<Tool
Name="VCLinkerTool"
- AdditionalDependencies="libpng.lib gtk-win32-2.0.lib asprintf.lib atk-1.0.lib bz2.lib cairo.lib charset.lib croco-0.6.lib expat.lib expatw.lib glade-2.0.lib fontconfig.lib freetype.lib gdk_pixbuf-2.0.lib gdkglext-win32-1.0.lib gdk-win32-2.0.lib glib-2.0.lib pathplan.lib gmodule-2.0.lib gobject-2.0.lib gsf-1.lib gsf-win32-1.lib gthread-2.0.lib gtkglext-win32-1.0.lib iconv.lib intl.lib jpeg.lib libexpat.lib libexpatw.lib pango-1.0.lib pangocairo-1.0.lib pangoft2-1.0.lib pangowin32-1.0.lib popt.lib rsvg-2.lib tiff.lib xml2.lib libgdkglext-win32-1.0.dll.a libgtkglext-win32-1.0.dll.a glu32.lib opengl32.lib ltdl.lib hs_regex.lib zdll.lib cdt.lib gvc.lib circogen.lib neatogen.lib fdpgen.lib patchwork.lib sparse.lib twopigen.lib cgraph.lib ingraphs.lib $(NOINHERIT)"
+ AdditionalDependencies="pathplan.lib xml2.lib cdt.lib sparse.lib cgraph.lib ingraphs.lib gvc.lib $(NOINHERIT)"
OutputFile="c:/graphviz-ms/bin/$(ProjectName).exe"
LinkIncremental="2"
AdditionalLibraryDirectories="C:\graphviz-ms\bin;C:\gtk\lib"
-static point3f add(point3f p, point3f q)
+static glCompPoint add(glCompPoint p, glCompPoint q)
{
p.x += q.x;
p.y += q.y;
return p;
}
-static point3f sub(point3f p, point3f q)
+static glCompPoint sub(glCompPoint p, glCompPoint q)
{
p.x -= q.x;
p.y -= q.y;
return p;
}
-static double dot(point3f p, point3f q)
+static double dot(glCompPoint p, glCompPoint q)
{
return (p.x * q.x + p.y * q.y + p.z * q.z);
}
-static double len(point3f p)
+static double len(glCompPoint p)
{
return sqrt(dot(p, p));
}
-static point3f scale(double d, point3f p)
+static glCompPoint scale(double d, glCompPoint p)
{
p.x *= (float) d;
p.y *= (float) d;
return p;
}
-static point3f blend(point3f p, point3f q, float m)
+static glCompPoint blend(glCompPoint p, glCompPoint q, float m)
{
- point3f r;
+ glCompPoint r;
r.x = p.x + m * (q.x - p.x);
r.y = p.y + m * (q.y - p.y);
return r;
}
-static point3f normalize(point3f p)
+static glCompPoint normalize(glCompPoint p)
{
double d = len(p);
return scale(1 / d, p);
}
-static double dist(point3f p, point3f q)
+static double dist(glCompPoint p, glCompPoint q)
{
return (len(sub(p, q)));
}
-static point3f intersect(line l, plane J)
+static glCompPoint intersect(line l, plane J)
{
double t = -(J.d + dot(l.u, J.N)) / dot(l.v, J.N);
return (add(l.u, scale(t, l.v)));
* Given a line l determined by two points a and b, and a 3rd point p,
* return the distance between the point and the line
*/
-double point_to_line_dist(point3f p, point3f a, point3f b)
+double point_to_line_dist(glCompPoint p, glCompPoint a, glCompPoint b)
{
line l;
plane J;
- point3f q;
+ glCompPoint q;
l.u = a;
l.v = normalize(sub(b, a));
* If the perpendicular from p to the line a-b is outside of the segment,
* return the distance to the closer of a or b.
*/
-double point_to_lineseg_dist(point3f p, point3f a, point3f b)
+double point_to_lineseg_dist(glCompPoint p, glCompPoint a, glCompPoint b)
{
float U;
- point3f q;
- point3f ba = sub(b, a);
- point3f pa = sub(p, a);
+ glCompPoint q;
+ glCompPoint ba = sub(b, a);
+ glCompPoint pa = sub(p, a);
U = (float) (dot(pa, ba) / dot(ba, ba));
*/
-void make_plane(point3f a, point3f b, point3f c, plane * P)
+void make_plane(glCompPoint a, glCompPoint b, glCompPoint c, plane * P)
{
P->N.x = a.y * (b.z - c.z) + b.y * (c.z - a.z) + c.y * (a.z - b.z); //+
P->N.y = a.z * (b.x - c.x) + b.z * (c.x - a.x) + c.z * (a.x - b.x); //+
#define G_PI 3.1415926535897932384626433832795028841971693993751
#define DEG2RAD G_PI/180
-int rot_spherex(plane J, float tet, point3f P, point3f * P2)
+int rot_spherex(plane J, float tet, glCompPoint P, glCompPoint * P2)
{
if (tet > 0) {
tet = 5;
{
return ((sideOf(a,b,c) != sideOf(a,b,d)) && (sideOf(c,d,a) != sideOf(c,d,b)));
}
+GLfloat distBetweenPts(glCompPoint A,glCompPoint B,float R)
+{
+ GLfloat rv=0;
+ 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);
+ rv=sqrt(rv);
+ if (rv <=R)
+ return 0;
+ return rv;
+}
+
+int is_point_in_rectangle(float X, float Y, float RX, float RY, float RW,float RH)
+{
+ if ((X >= RX) && (X <= (RX + RW)) && (Y >= RY) && (Y <= (RY + RH)))
+ return 1;
+ else
+ return 0;
+}
+
#ifdef DEBUG
void main(void)
{
- point3f LineStart, LineEnd, Point;
+ glCompPoint LineStart, LineEnd, Point;
float Distance;
#endif
typedef struct {
- float x, y, z;
- } point3f;
- typedef struct {
- point3f u, v;
+ glCompPoint u, v;
} line;
typedef struct {
- point3f N; /* normal */
+ glCompPoint N; /* normal */
double d; /* offset */
} plane;
GLfloat * Z);
void to3D(int x, int y, GLfloat * X, GLfloat * Y, GLfloat * Z);
void linear_interplotate(float, float, float, float, float, float *);
- double point_to_line_dist(point3f p, point3f u, point3f v);
- double point_to_lineseg_dist(point3f p, point3f a, point3f b);
- int rot_spherex(plane J, float tet, point3f P, point3f * P2);
- void make_plane(point3f a, point3f b, point3f c, plane * P);
+ double point_to_line_dist(glCompPoint p, glCompPoint u, glCompPoint v);
+ double point_to_lineseg_dist(glCompPoint p, glCompPoint a, glCompPoint b);
+ int rot_spherex(plane J, float tet, glCompPoint P, glCompPoint * P2);
+ void make_plane(glCompPoint a, glCompPoint b, glCompPoint c, plane * P);
void replacestr(char *source, char **target);
extern void glCompCalcWidget(glCompCommon * parent,
glCompCommon * child, glCompCommon * ref);
void glCompSelectionBox(glCompSet * s);
extern int lines_intersect (glCompPoint* a, glCompPoint* b, glCompPoint* c, glCompPoint* d);
+ extern GLfloat distBetweenPts(glCompPoint A,glCompPoint B,float R);
+ extern int is_point_in_rectangle(float X, float Y, float RX, float RY, float RW,float RH);
#ifdef __cplusplus
}
gvFinalize
gv_postprocess
gvRenderContext
+gvflush
\ No newline at end of file
/* Parse an html string */
#ifndef WITH_CGRAPH
extern char *agstrdup_html(char *s);
-#endif
extern int aghtmlstr(char *s);
+#endif
/* Render layout in a specified format to an open FILE */
extern int gvRender(GVC_t *gvc, graph_t *g, const char *format, FILE *out);