]> granicus.if.org Git - graphviz/commitdiff
new smyrna implementation , mm2gv fix,
authorarif <devnull@localhost>
Mon, 15 Feb 2010 17:16:10 +0000 (17:16 +0000)
committerarif <devnull@localhost>
Mon, 15 Feb 2010 17:16:10 +0000 (17:16 +0000)
25 files changed:
cmd/smyrna/draw.c
cmd/smyrna/glexpose.c
cmd/smyrna/gltemplate.c
cmd/smyrna/gui/appmouse.c
cmd/smyrna/gui/beacon.c
cmd/smyrna/gui/frmobjectui.c
cmd/smyrna/gui/menucallbacks.c
cmd/smyrna/gui/topviewsettings.c
cmd/smyrna/gvprpipe.c
cmd/smyrna/polytess.c
cmd/smyrna/selection.c
cmd/smyrna/selection.h
cmd/smyrna/smyrna.vcproj
cmd/smyrna/smyrna.vcproj.RESEARCH.arif.user
cmd/smyrna/smyrna_utils.c
cmd/smyrna/smyrna_utils.h
cmd/smyrna/smyrnadefs.h
cmd/smyrna/tvnodes.c
cmd/smyrna/viewport.c
cmd/tools/mm2gv.c
cmd/tools/mm2gv.vcproj
lib/glcomp/glutils.c
lib/glcomp/glutils.h
lib/gvc.def
lib/gvc/gvc.h

index 06b7910f1613d68457faf6fc334d0fe45be9510d..32c1b9d707a4bd5b2fb0424d43aa499e601f2668 100755 (executable)
@@ -444,9 +444,7 @@ void EmbedText(sdot_op* o, int param)
 
        }
        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,
@@ -455,9 +453,9 @@ void EmbedText(sdot_op* o, int param)
                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)
@@ -504,7 +502,7 @@ void draw_magnifier(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,
@@ -796,7 +794,7 @@ void drawCircle(float x, float y, float radius, float zdepth)
     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),
index dca3792d5c628b4a972fbdb94f764ea8c5accf68..f0f657a6ba5977e2d81da57606b72c9d94b7279c 100644 (file)
@@ -262,7 +262,8 @@ int glexpose_drawgraph(ViewInfo * view)
 //              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);
        }
index c024aec7c21c1109e92a03cac4e54bb62dab0ee2..b24f81009f2ebcaa73c9b4ffc9f3b5ca25feb2a8 100755 (executable)
@@ -337,7 +337,6 @@ static gboolean key_release_event(GtkWidget * widget, GdkEventKey * event, gpoin
  //   printf ("key is released:%d\n",event->keyval);
     view->keymap.down=0;
     view->keymap.keyVal=0;
-    originate_distorded_coordinates(view->Topview);
         return FALSE;
 
 
index cfcf6f8462b7cd2e115702fad9c7b4812846e475..3f5a736d2bfb5e8965c3106025bd12a82dfe1a17 100644 (file)
@@ -22,6 +22,8 @@
 #include "beacon.h"
 #include "hotkeymap.h"
 #include "selection.h"
+#include "selectionfuncs.h"
+#include "topviewfuncs.h"
 
 
     static float prevX=0;
@@ -53,11 +55,14 @@ static void apply_actions(ViewInfo* v,int x,int y)
     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) 
     {
@@ -127,8 +132,6 @@ static void appmouse_up(ViewInfo* v,int x,int y)
        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;
index 69a2db40cb2b68f139c12f7baf0d0bce731e976a..688c74fcd0f0cc72fb903a7c8476d1418207f0d0 100644 (file)
@@ -109,7 +109,7 @@ void pick_node_from_coords(float x, float y, float z)
     }
 
     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;
index 7daacd7344ce75d3eaf817806189281f771391ab..a2fa985c6f981a61af8c8fd084f04f0acec0b98f 100644 (file)
@@ -808,7 +808,7 @@ void showAttrsWidget(topview* t)
     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);
 
 
index 4ec2799452767181976ec238655551bfd8553aa7..d6366090b463088e578b23373b6f8fddb83fd17f 100755 (executable)
@@ -188,7 +188,9 @@ void mHideConsoleSlot(GtkWidget * widget, gpointer user_data)
 //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)
@@ -226,29 +228,6 @@ void mGraphPropertiesSlot(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"))
-               );
-    }
 
 }
 
index c28799f52054a956a354bf26a0b6e3301dd25f4f..8c971aa22856185c97adf39fecadbf0c0972c204 100644 (file)
@@ -41,9 +41,10 @@ void on_settingsApplyBtn_clicked(GtkWidget * widget, gpointer user_data)
 {
     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)
 {
@@ -263,13 +264,13 @@ static int get_combobox_widget_to_attribute(char *attribute,
     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;
 
 
index c55ef0e75afe086c6bfad659ecf1bea21392d7ec..7b5540d4cf5f77634631819abda828703a336ea5 100644 (file)
@@ -123,7 +123,7 @@ int run_gvpr(Agraph_t * srcGraph, int argc, char *argv[])
     { 
        set_refresh(view,argv[1]);
         update_graph_from_settings(srcGraph);
-       update_topview(srcGraph, view->Topview, 0);
+//     update_topview(srcGraph, view->Topview, 0);
     }
     return rv;
 }
index eb522d5059b851672e85690d34ccdb252335e2bd..a966a52fb4238ebdad42d1ef4ab810349a0547e5 100644 (file)
@@ -126,10 +126,10 @@ static GLUtesselator* Init()
     // 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;
 }
 
index 99c03c33bb65ad9456c399dc9b50d09368cb9a63..6e6a640ff39c767279edf5ec0e97477b9d04a278 100755 (executable)
@@ -564,16 +564,6 @@ int lineintersects(float X1, float X2, float Y1, float Y2)
        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;
-
-
-}
 
 
 
@@ -757,38 +747,6 @@ int linesegmentsintersects(float X1, float X2, float Y1, float Y2)
 
 
 
-#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)
 {
index ebc399397ab511e6c7c79eb329aad4e6d00c413d..74d01caef5c7dc0909c23a5e02ef26f2accd6fb4 100644 (file)
@@ -31,8 +31,6 @@ extern "C" {
     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);
index b98cd27ecc42241a1da826b9fe3cb75cf7b01344..137a294b16cf0f809f220247c619f90642f37f1c 100644 (file)
                                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"
                                >
index c1742dcfa3e6cd30aac1baead67396029713a653..c13d860737fa39533587a0b47adc083a1ccbd651 100644 (file)
@@ -11,7 +11,7 @@
                        <DebugSettings
                                Command="$(TargetPath)"
                                WorkingDirectory="C:\graphviz-ms\bin"
-                               CommandArguments="C:\u.dot.xdot"
+                               CommandArguments="c:/4elt.dot"
                                Attach="false"
                                DebuggerType="3"
                                Remote="1"
index 709ed196f93c25c71e2f5c05f363fc110449535b..ca0555e1b9935fc2d5105f9d46296cafa08659ad 100644 (file)
@@ -137,6 +137,28 @@ void setColor(glCompColor* c,GLfloat R,GLfloat G,GLfloat B,GLfloat A)
     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)
index 500c78bf5cf9f8de039bc3b4de60e9bbd9d15a15..e5e3e23e8501869d04deda9f853884f78a27ef1c 100644 (file)
@@ -27,5 +27,6 @@ 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);
+extern glCompPoint getPointFromStr(char* str);
 
 #endif
index 0f23b300a3061632f978ae670e58fdaccdeb6fff..e54c8769c20323826a0c408f136b420f059a9ef4 100644 (file)
@@ -227,12 +227,18 @@ typedef struct
 
 
     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;
@@ -385,6 +391,26 @@ typedef struct
        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;
@@ -421,8 +447,11 @@ typedef struct
        float global_z;
        attr_list* attributes;/*attribute list*/
        attr_list* filtered_attr_list;
+
+       topviewcache cache;
        int xdotId;
 
+
     } topview;
 
 
@@ -624,7 +653,6 @@ typedef struct
        /*lately added */
        int drawnodes;
        int drawedges;
-       int drawlabels;
        int drawnodelabels;
        int drawedgelabels;
 
index 2e9ec4f1a2113c497501c58576475dc95b028535..ffbe4ebe2162944b37a7b2d1f3adf17da7b81722 100755 (executable)
@@ -25,31 +25,6 @@ tv_nodes TV_Nodes;
 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)
 {
@@ -102,29 +77,6 @@ set_filter(tv_filter * TV_Filter, char *MinData1, char *MaxData1,
     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)
index 9b586c3405747b0f65c85a63933b3e081039b2b3..322a3e60ef90063cc09340b01512d34af1c00169 100755 (executable)
@@ -35,6 +35,7 @@
 #include "md5.h"
 #include "arcball.h"
 #include "hotkeymap.h"
+#include "topviewfuncs.h"
 
 
 
@@ -79,7 +80,9 @@ void clear_viewport(ViewInfo * view)
 {
     /*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);
@@ -286,7 +289,9 @@ void set_viewport_settings_from_template(ViewInfo * view, Agraph_t * g)
             ("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 =
@@ -643,10 +648,9 @@ void refreshViewport(int doClear)
     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);
 }
index 0b1f637928154861379f47bd5c18ca29ac17133f..478d5fd1abe10fc5bae4f13867d00c47c0113fac 100644 (file)
@@ -469,7 +469,7 @@ int main(int argc, char *argv[])
 {
     Agraph_t *g = 0;
     SparseMatrix A = NULL;
-    int dim;
+    int dim=0;
     parms_t pv;
 
     /* ======================= set parameters ==================== */
index 5ee50e1b1b346be8c38aa765106857a3811faccf..24197c6cca958e8170a8a11cef75091c3d4f9058 100644 (file)
@@ -60,7 +60,7 @@
                        />
                        <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"
index 7c84bbe055e607835b74d7a8d01e294dff8a581e..ff1abd31fa30108bafffda2cb4693b78fcb88897 100644 (file)
@@ -279,7 +279,7 @@ int glreversecamera(ViewInfo * view)
 
 
 
-static point3f add(point3f p, point3f q)
+static glCompPoint add(glCompPoint p, glCompPoint q)
 {
     p.x += q.x;
     p.y += q.y;
@@ -287,7 +287,7 @@ static point3f add(point3f p, point3f q)
     return p;
 }
 
-static point3f sub(point3f p, point3f q)
+static glCompPoint sub(glCompPoint p, glCompPoint q)
 {
     p.x -= q.x;
     p.y -= q.y;
@@ -295,17 +295,17 @@ static point3f sub(point3f p, point3f q)
     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;
@@ -313,9 +313,9 @@ static point3f scale(double d, point3f p)
     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);
@@ -323,19 +323,19 @@ static point3f blend(point3f p, point3f q, float m)
     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)));
@@ -345,11 +345,11 @@ static point3f intersect(line l, plane J)
  * 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));
@@ -369,12 +369,12 @@ double point_to_line_dist(point3f p, point3f a, point3f b)
  * 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));
 
@@ -394,7 +394,7 @@ double point_to_lineseg_dist(point3f p, point3f a, point3f b)
 */
 
 
-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);        //+
@@ -418,7 +418,7 @@ void replacestr(char *source, char **target)
 
 #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;
@@ -705,6 +705,24 @@ int lines_intersect (glCompPoint* a, glCompPoint* b, glCompPoint* c, glCompPoint
 {
   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;
+}
+
 
 
 
@@ -713,7 +731,7 @@ int lines_intersect (glCompPoint* a, glCompPoint* b, glCompPoint* c, glCompPoint
 #ifdef DEBUG
 void main(void)
 {
-    point3f LineStart, LineEnd, Point;
+    glCompPoint LineStart, LineEnd, Point;
     float Distance;
 
 
index 8c93d36036b1316c736e534bdcced8abbf8c167d..685e4714a460f0b7b8dc02db0f8bb942c723fa2d 100644 (file)
@@ -29,13 +29,10 @@ extern "C" {
 #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;
 
@@ -47,10 +44,10 @@ extern "C" {
                            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);
@@ -64,6 +61,8 @@ extern "C" {
 
     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
 }
index a8ec99b326327321a12b60be7d783a3668f01235..627aeee8dc80a6f4092483d11cca7e5b189890eb 100644 (file)
@@ -335,3 +335,4 @@ xdotBB
 gvFinalize
 gv_postprocess
 gvRenderContext
+gvflush
\ No newline at end of file
index bd14e650714d151cf78ab4ce14cd122e44a1f228..47becbb1925c33a14d2694d559971d6650cdb884 100644 (file)
@@ -72,8 +72,8 @@ extern void attach_attrs(graph_t *g);
 /* 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);