Revision: 51699
          http://brlcad.svn.sourceforge.net/brlcad/?rev=51699&view=rev
Author:   cprecup
Date:     2012-07-29 00:39:09 +0000 (Sun, 29 Jul 2012)
Log Message:
-----------
Added the graph_structure command that, so far, can be used to traverse the 
database and define its corresponding graph.

Modified Paths:
--------------
    brlcad/trunk/include/ged.h
    brlcad/trunk/src/libged/dag.cpp
    brlcad/trunk/src/libtclcad/tclcad_obj.c
    brlcad/trunk/src/mged/setup.c

Modified: brlcad/trunk/include/ged.h
===================================================================
--- brlcad/trunk/include/ged.h  2012-07-28 17:42:19 UTC (rev 51698)
+++ brlcad/trunk/include/ged.h  2012-07-29 00:39:09 UTC (rev 51699)
@@ -1909,6 +1909,10 @@
  */
 GED_EXPORT extern int ged_voxelize(struct ged *gedp, int argc, const char 
*argv[]);
 
+/**
+ * Query or manipulate properties of a graph.
+ */
+GED_EXPORT extern int ged_graph_structure(struct ged *gedp, int argc, const 
char *argv[]);
 
 GED_EXPORT extern ged_polygon *ged_clip_polygon(GedClipType op, ged_polygon 
*subj, ged_polygon *clip, fastf_t sf, matp_t model2view, matp_t view2model);
 GED_EXPORT extern ged_polygon *ged_clip_polygons(GedClipType op, ged_polygons 
*subj, ged_polygons *clip, fastf_t sf, matp_t model2view, matp_t view2model);

Modified: brlcad/trunk/src/libged/dag.cpp
===================================================================
--- brlcad/trunk/src/libged/dag.cpp     2012-07-28 17:42:19 UTC (rev 51698)
+++ brlcad/trunk/src/libged/dag.cpp     2012-07-29 00:39:09 UTC (rev 51699)
@@ -418,8 +418,9 @@
 
     bu_log("Added %d objects.\n", dag->object_nr);
 
-    ged_close(gedp);
+    //ged_close(gedp);
 
+
     /* Free memory. */
     bu_vls_free(&dp_name_vls);
     free_hash_values(objects);
@@ -429,6 +430,54 @@
 }
 
 
+/**
+ * This routine calls the add_objects() method for a given database if the 
"view"
+ * subcommand is used.
+ */
+int
+ged_graph_structure(struct ged *gedp, int argc, const char *argv[])
+{
+    struct _ged_dag_data *dag;
+    size_t len;
+    const char *cmd = argv[0];
+    const char *sub;
+    static const char *usage = "view\n";
+
+    GED_CHECK_DATABASE_OPEN(gedp, GED_ERROR);
+    GED_CHECK_READ_ONLY(gedp, GED_ERROR);
+    GED_CHECK_ARGC_GT_0(gedp, argc, GED_ERROR);
+
+    /* initialize result */
+        bu_vls_trunc(gedp->ged_result_str, 0);
+
+    /* must be wanting help */
+    if (argc < 2) {
+            bu_vls_printf(gedp->ged_result_str, "Usage: %s %s", cmd, usage);
+            return GED_ERROR;
+    }
+if(argc >= 2) {
+    /* determine subcommand */
+    sub = argv[1];
+    len = strlen(sub);
+
+    if(bu_strncmp(sub, "view", len) == 0) {
+        dag = (struct _ged_dag_data *) bu_malloc(sizeof(_ged_dag_data), "DAG 
structure");
+        dag->router = new Avoid::Router(Avoid::PolyLineRouting);
+        add_objects(gedp, dag);
+
+        dag->router->outputInstanceToSVG("dag2");
+        dag->router->outputDiagramSVG("dag3");
+
+        bu_free(dag, "free DAG");
+    } else {
+        bu_vls_printf(gedp->ged_result_str, "%s: %s is not a known 
subcommand!", cmd, sub);
+        return GED_ERROR;
+    }
+}
+    return GED_OK;
+}
+
+
 #define PARALLEL BRLCAD_PARALLEL
 #undef BRLCAD_PARALLEL
 

Modified: brlcad/trunk/src/libtclcad/tclcad_obj.c
===================================================================
--- brlcad/trunk/src/libtclcad/tclcad_obj.c     2012-07-28 17:42:19 UTC (rev 
51698)
+++ brlcad/trunk/src/libtclcad/tclcad_obj.c     2012-07-29 00:39:09 UTC (rev 
51699)
@@ -918,6 +918,9 @@
     {"get_type",       (char *)0, TO_UNLIMITED, to_pass_through_func, 
ged_get_type},
     {"glob",   (char *)0, TO_UNLIMITED, to_pass_through_func, ged_glob},
     {"gqa",    (char *)0, TO_UNLIMITED, to_pass_through_func, ged_gqa},
+#ifdef HAVE_ADAPTAGRAMS
+    {"graph",  (char *)0, TO_UNLIMITED, to_pass_through_func, 
ged_graph_structure},
+#endif
     {"grid",   "args", 6, to_view_func, ged_grid},
     {"handle_expose",  "vname count", TO_UNLIMITED, to_handle_expose, 
GED_FUNC_PTR_NULL},
     {"hide",   (char *)0, TO_UNLIMITED, to_pass_through_func, ged_hide},

Modified: brlcad/trunk/src/mged/setup.c
===================================================================
--- brlcad/trunk/src/mged/setup.c       2012-07-28 17:42:19 UTC (rev 51698)
+++ brlcad/trunk/src/mged/setup.c       2012-07-29 00:39:09 UTC (rev 51699)
@@ -170,6 +170,9 @@
     {"get_sed", f_get_sedit, GED_FUNC_PTR_NULL},
     {"get_sed_menus", f_get_sedit_menus, GED_FUNC_PTR_NULL},
     {"get_solid_keypoint", f_get_solid_keypoint, GED_FUNC_PTR_NULL},
+#ifdef HAVE_ADAPTAGRAMS
+    {"graph_structure", cmd_ged_plain_wrapper, ged_graph_structure},
+#endif
     {"gqa", cmd_ged_gqa, ged_gqa},
     {"grid2model_lu", cmd_ged_plain_wrapper, ged_grid2model_lu},
     {"grid2view_lu", cmd_ged_plain_wrapper, ged_grid2view_lu},

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to